Skip to content

Commit

Permalink
feat: major features including event signUp
Browse files Browse the repository at this point in the history
  • Loading branch information
DarthBenro008 committed Jul 8, 2021
1 parent dfa4066 commit 6cdf857
Show file tree
Hide file tree
Showing 42 changed files with 686 additions and 34 deletions.
8 changes: 7 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Enchante">
<activity android:name=".ui.onboarding.OnboardingActivity"></activity>
<activity android:name=".ui.ar.CloudARActivity"></activity>
<activity android:name=".ui.onboarding.OnboardingActivity" />
<activity android:name=".ui.nearby.NearbyPaymentActivity" />
<activity android:name=".ui.TestActivity" />
<activity android:name=".ui.ar.ArPaymentActivity" />
Expand All @@ -45,6 +46,11 @@
android:name="com.google.android.nearby.messages.API_KEY"
android:value="@string/NEARBY_KEY" />

<meta-data
android:name="com.google.android.ar.API_KEY"
android:value="@string/NEARBY_KEY" />


<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
Expand Down
20 changes: 16 additions & 4 deletions app/src/main/java/com/benrostudios/enchante/SplashActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ import androidx.appcompat.app.AppCompatActivity
import com.benrostudios.enchante.ui.auth.AuthActivity
import com.benrostudios.enchante.ui.home.HomeActivity
import com.benrostudios.enchante.ui.onboarding.OnboardingActivity
import com.benrostudios.enchante.utils.SharedPrefManager
import com.google.firebase.auth.FirebaseAuth
import org.koin.android.ext.android.inject

class SplashActivity : AppCompatActivity() {

private val sharedPrefManager: SharedPrefManager by inject()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
requestWindowFeature(Window.FEATURE_NO_TITLE);
Expand All @@ -32,15 +36,23 @@ class SplashActivity : AppCompatActivity() {

Handler(Looper.getMainLooper()).postDelayed(
{
if (FirebaseAuth.getInstance().currentUser != null) {
startActivity(Intent(this, HomeActivity::class.java))
if (sharedPrefManager.firstOpen) {
startActivity(Intent(this, OnboardingActivity::class.java))
this.finish()
} else {
startActivity(Intent(this, AuthActivity::class.java))
this.finish()
if (FirebaseAuth.getInstance().currentUser != null) {
startActivity(Intent(this, HomeActivity::class.java))
this.finish()
} else {
startActivity(Intent(this, AuthActivity::class.java))
this.finish()
}
}

}, SPLASH_TIME_OUT
)


}

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.benrostudios.enchante.data.models.response.events

data class Assets(
val banner: String? = "",
val logo: String? = "",
val otherImages: List<String>? = listOf()
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.benrostudios.enchante.data.models.response.events

data class AssetsX(
val banner: String? = "",
val logo: String? = "",
val otherImages: List<String>? = listOf()
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.benrostudios.enchante.data.models.response.events

data class Coordinates(
val lat: String? = "",
val lon: String? = ""
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.benrostudios.enchante.data.models.response.events

data class CoordinatesX(
val lat: String? = "",
val lon: String? = ""
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.benrostudios.enchante.data.models.response.events

data class Duration(
val endTimeAndDate: String? = "",
val startTimeAndDate: String? = ""
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.benrostudios.enchante.data.models.response.events

data class DurationX(
val endTimeAndDate: String? = "",
val startTimeAndDate: String? = ""
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.benrostudios.enchante.data.models.response.events

data class EventId(
val __v: Int? = 0,
val _id: String? = "",
val assets: Assets? = Assets(),
val description: String? = "",
val duration: Duration? = Duration(),
val faq: List<Any>? = listOf(),
val location: Location? = Location(),
val name: String? = "",
val parentOrg: String? = "",
val passes: List<Passe>? = listOf(),
val schedule: String? = "",
val status: String? = "",
val tags: List<String>? = listOf()
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.benrostudios.enchante.data.models.response.events

data class EventIdX(
val __v: Int? = 0,
val _id: String? = "",
val assets: Assets = Assets(),
val description: String? = "",
val duration: Duration = Duration(),
val faq: List<Any>? = listOf(),
val location: Location = Location(),
val name: String? = "",
val parentOrg: String? = "",
val passes: List<PasseX>? = listOf(),
val schedule: String? = "",
val status: String? = "",
val tags: List<String>? = listOf()
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.benrostudios.enchante.data.models.response.events

data class FutureEvent(
val _id: String? = "",
val budget: String? = "",
val eventId: EventId? = EventId(),
val passType: String? = ""
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.benrostudios.enchante.data.models.response.events

data class Location(
val coordinates: Coordinates? = Coordinates(),
val humanformAddress: String? = "",
val mapsUrl: String? = ""
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.benrostudios.enchante.data.models.response.events

data class LocationX(
val coordinates: Coordinates = Coordinates(),
val humanformAddress: String? = "",
val mapsUrl: String? = ""
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.benrostudios.enchante.data.models.response.events

data class MyEventsResponse(
val futureEvents: List<FutureEvent>? = listOf(),
val pastEvents: List<PastEvent>? = listOf()
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.benrostudios.enchante.data.models.response.events

data class Passe(
val _id: String? = "",
val availableNumber: Int? = 0,
val description: String? = "",
val passName: String? = "",
val price: Int? = 0
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.benrostudios.enchante.data.models.response.events

data class PasseX(
val _id: String? = "",
val availableNumber: Int? = 0,
val description: String? = "",
val passName: String? = "",
val price: Int? = 0
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.benrostudios.enchante.data.models.response.events

data class PastEvent(
val _id: String? = "",
val eventId: EventId = EventId(),
val passType: String? = ""
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ interface ApiService {
@Query("lon") longitude: Double
): Response<GenericResponse>

@GET("v1/user/profile/get-my-events")
suspend fun getMyEvents(): Response<GenericResponse>


@POST("/v1/user/profile/registration")
suspend fun register(@Body registrationRequest: RegistrationRequest): Response<GenericResponse>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.benrostudios.enchante.data.network.reponse

import com.benrostudios.enchante.data.models.response.events.FutureEvent
import com.benrostudios.enchante.data.models.response.events.PastEvent
import com.benrostudios.enchante.data.models.response.home.EventsBasedOnYourInterest
import com.benrostudios.enchante.data.models.response.home.EventsInRange
import com.benrostudios.enchante.data.models.response.home.TipDetails
Expand All @@ -8,5 +10,7 @@ data class ResponseMetrics(
val jwtToken: String?,
val eventsBasedOnYourInterest: List<EventsBasedOnYourInterest>? = listOf(),
val eventsInRange: List<EventsInRange>? = listOf(),
val tip: TipDetails? = TipDetails()
val tip: TipDetails? = TipDetails(),
val futureEvents: List<FutureEvent>? = listOf(),
val pastEvents: List<PastEvent>? = listOf()
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ interface ApiRepo {
val homeResponse: LiveData<GenericResponse>
suspend fun register(registrationRequest: RegistrationRequest): LiveData<GenericResponse>
val registrationResponse: LiveData<GenericResponse>
suspend fun getMyEvents(): LiveData<GenericResponse>
val eventsResponse: LiveData<GenericResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ApiRepoImpl(private val apiService: ApiService) : BaseNetworkRepository(),

private val _homeResponse = MutableLiveData<GenericResponse>()
private val _registrationResponse = MutableLiveData<GenericResponse>()
private val _eventsResponse = MutableLiveData<GenericResponse>()

override suspend fun getHomeRoute(
latitude: Double,
Expand Down Expand Up @@ -47,4 +48,19 @@ class ApiRepoImpl(private val apiService: ApiService) : BaseNetworkRepository(),

override val registrationResponse: LiveData<GenericResponse>
get() = _registrationResponse

override suspend fun getMyEvents(): LiveData<GenericResponse> {
return withContext(Dispatchers.IO) {
_eventsResponse.postValue(
safeApiCall(
call = { apiService.getMyEvents() },
error = "Unable to register"
)!!
)
return@withContext _eventsResponse
}
}

override val eventsResponse: LiveData<GenericResponse>
get() = _eventsResponse
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ class WalletRepoImpl(context: Context, sharedPrefManager: SharedPrefManager) : W
accountManager.getUserAccounts(object : AccountsCallback {
override fun onResponse(p0: ArrayList<RPDAccount>?) {
if (p0.isNullOrEmpty()) {
d("WalletRepo", "nil balance")
val dummyRpd = RPDAccount()
dummyRpd.balance = 0.0
_walletBalanceResponse.postValue(dummyRpd)
}
p0?.forEach {
d("WalletRepo", "${it.balance}")
if (it.currency == "USD") {
d("WalletRepo", "${it.balance}")
_walletBalanceResponse.postValue(it)
Expand Down
Loading

0 comments on commit 6cdf857

Please sign in to comment.