Skip to content

Commit a90b862

Browse files
Implemented check-in pop up feature flag
1 parent 2df252f commit a90b862

11 files changed

Lines changed: 1433 additions & 36 deletions

File tree

app/.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/AndroidProjectSystem.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/caches/deviceStreaming.xml

Lines changed: 1318 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/gradle.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/migrations.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/misc.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/runConfigurations.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ android {
2121
applicationId "com.cornellappdev.uplift"
2222
minSdk 28
2323
targetSdk 35
24-
versionCode 12
25-
versionName "1.4-backend-fix"
24+
versionCode 16
25+
versionName "1.6-capacity-reminders"
2626

2727
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2828
vectorDrawables {
@@ -40,6 +40,7 @@ android {
4040
"GOOGLE_AUTH_CLIENT_ID", secretsProperties["GOOGLE_AUTH_CLIENT_ID"]
4141
)
4242
buildConfigField("boolean", "ONBOARDING_FLAG", "true")
43+
buildConfigField("boolean", "CHECK_IN_FLAG", "true")
4344
signingConfig signingConfigs.debug
4445
}
4546
release {
@@ -48,6 +49,7 @@ android {
4849
buildConfigField("String", "GOOGLE_AUTH_CLIENT_ID", secretsProperties["GOOGLE_AUTH_CLIENT_ID"])
4950
buildConfigField("String", "BACKEND_URL", secretsProperties['PROD_ENDPOINT'])
5051
buildConfigField("boolean", "ONBOARDING_FLAG", "false")
52+
buildConfigField("boolean", "CHECK_IN_FLAG", "false")
5153
}
5254
debug {
5355
buildConfigField("String", "BACKEND_URL", secretsProperties['DEV_ENDPOINT'])
@@ -57,6 +59,7 @@ android {
5759
)
5860
signingConfig signingConfigs.debug
5961
buildConfigField("boolean", "ONBOARDING_FLAG", "false")
62+
buildConfigField("boolean", "CHECK_IN_FLAG", "false")
6063
}
6164
}
6265
compileOptions {

app/src/main/java/com/cornellappdev/uplift/MainActivity.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import androidx.activity.compose.setContent
88
import androidx.activity.viewModels
99
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
1010
import com.cornellappdev.uplift.data.repositories.DatastoreRepository
11+
import com.cornellappdev.uplift.data.repositories.LocationRepository
1112
import com.cornellappdev.uplift.ui.MainNavigationWrapper
1213
import com.cornellappdev.uplift.ui.theme.UpliftTheme
1314
import com.cornellappdev.uplift.ui.viewmodels.profile.CheckInViewModel
15+
import com.cornellappdev.uplift.util.CHECK_IN_FLAG
1416
import com.cornellappdev.uplift.util.LockScreenOrientation
1517
import dagger.hilt.android.AndroidEntryPoint
1618
import javax.inject.Inject
@@ -41,11 +43,17 @@ class MainActivity : ComponentActivity() {
4143

4244
override fun onResume() {
4345
super.onResume()
44-
checkInViewModel.startLocationUpdates(this)
46+
LocationRepository.startLocationUpdates(this)
47+
if (CHECK_IN_FLAG == true){
48+
checkInViewModel.startLocationUpdates(this)
49+
}
4550
}
4651

4752
override fun onPause() {
4853
super.onPause()
49-
checkInViewModel.stopLocationUpdates()
54+
LocationRepository.stopLocationUpdates()
55+
if (CHECK_IN_FLAG == true){
56+
checkInViewModel.stopLocationUpdates()
57+
}
5058
}
5159
}

app/src/main/java/com/cornellappdev/uplift/ui/MainNavigationWrapper.kt

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ import com.cornellappdev.uplift.ui.screens.report.ReportSubmittedScreen
5555
import com.cornellappdev.uplift.ui.viewmodels.classes.ClassDetailViewModel
5656
import com.cornellappdev.uplift.ui.viewmodels.gyms.GymDetailViewModel
5757
import com.cornellappdev.uplift.ui.viewmodels.nav.RootNavigationViewModel
58+
import com.cornellappdev.uplift.ui.viewmodels.profile.CheckInUiState
5859
import com.cornellappdev.uplift.ui.viewmodels.profile.CheckInViewModel
5960
import com.cornellappdev.uplift.util.ONBOARDING_FLAG
6061
import com.cornellappdev.uplift.ui.viewmodels.profile.ConfettiViewModel
62+
import com.cornellappdev.uplift.util.CHECK_IN_FLAG
6163
import com.cornellappdev.uplift.util.PRIMARY_BLACK
6264
import com.cornellappdev.uplift.util.PRIMARY_YELLOW
6365
import com.cornellappdev.uplift.util.montserratFamily
@@ -81,16 +83,18 @@ fun MainNavigationWrapper(
8183

8284
) {
8385

84-
val confettiViewModel: ConfettiViewModel = hiltViewModel()
85-
val checkInViewModel: CheckInViewModel = hiltViewModel()
8686
val rootNavigationUiState = rootNavigationViewModel.collectUiStateValue()
8787
val startDestination = rootNavigationUiState.startDestination
8888

8989
val navController = rememberNavController()
9090
val systemUiController: SystemUiController = rememberSystemUiController()
9191

92-
val checkInUiState = checkInViewModel.collectUiStateValue()
93-
val confettiUiState = confettiViewModel.collectUiStateValue()
92+
val checkInViewModel: CheckInViewModel? =
93+
if (CHECK_IN_FLAG) hiltViewModel() else null
94+
val confettiViewModel: ConfettiViewModel? =
95+
if (CHECK_IN_FLAG) hiltViewModel() else null
96+
val checkInUiState = checkInViewModel?.collectUiStateValue() ?: CheckInUiState()
97+
val confettiUiState = confettiViewModel?.collectUiStateValue()
9498

9599
val yourShimmerTheme = defaultShimmerTheme.copy(
96100
shaderColors = listOf(
@@ -261,37 +265,41 @@ fun MainNavigationWrapper(
261265
}
262266

263267
Box(modifier = Modifier.fillMaxSize()){
264-
AnimatedVisibility(
265-
visible = checkInUiState.showPopUp && isMainScreen(),
266-
modifier = Modifier
267-
.align(Alignment.BottomCenter)
268-
.fillMaxWidth()
269-
.padding(
270-
start = 10.dp,
271-
end = 9.dp,
272-
bottom = it.calculateBottomPadding() + 13.dp
273-
)
274-
){
275-
Box(
276-
modifier = Modifier.onGloballyPositioned { coords ->
277-
confettiViewModel.setConfettiBounds(coords.boundsInRoot())
278-
}
268+
if(CHECK_IN_FLAG){
269+
AnimatedVisibility(
270+
visible = checkInUiState.showPopUp && isMainScreen(),
271+
modifier = Modifier
272+
.align(Alignment.BottomCenter)
273+
.fillMaxWidth()
274+
.padding(
275+
start = 10.dp,
276+
end = 9.dp,
277+
bottom = it.calculateBottomPadding() + 13.dp
278+
)
279279
){
280-
CheckInPopUp(
281-
gymName = checkInUiState.gymName,
282-
currentTimeText = checkInUiState.timeText,
283-
onDismiss = checkInViewModel::onDismiss,
284-
onCheckIn = checkInViewModel::onCheckIn,
285-
onClosePopUp = checkInViewModel::onClose,
286-
mode = checkInUiState.mode,
280+
Box(
281+
modifier = Modifier.onGloballyPositioned { coords ->
282+
confettiViewModel?.setConfettiBounds(coords.boundsInRoot())
283+
}
284+
){
285+
CheckInPopUp(
286+
gymName = checkInUiState.gymName,
287+
currentTimeText = checkInUiState.timeText,
288+
onDismiss = { checkInViewModel?.onDismiss() },
289+
onCheckIn = { checkInViewModel?.onCheckIn() },
290+
onClosePopUp = { checkInViewModel?.onClose() },
291+
mode = checkInUiState.mode,
292+
)
293+
}
294+
}
295+
if(confettiViewModel != null){
296+
ConfettiBurst(
297+
confettiViewModel = confettiViewModel,
298+
particleSpawningBounds = confettiUiState?.confettiBounds,
299+
modifier = Modifier
287300
)
288301
}
289302
}
290-
ConfettiBurst(
291-
confettiViewModel = confettiViewModel,
292-
particleSpawningBounds = confettiUiState.confettiBounds,
293-
modifier = Modifier
294-
)
295303
}
296304

297305
}

0 commit comments

Comments
 (0)