Skip to content

Commit

Permalink
fixes achievement worker
Browse files Browse the repository at this point in the history
  • Loading branch information
brandyodhiambo committed Aug 25, 2023
1 parent 30af7a2 commit 75f0356
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 66 deletions.
12 changes: 6 additions & 6 deletions app/src/main/java/com/brandyodhiambo/quench/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ class MainActivity : ComponentActivity() {
QuenchTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
color = MaterialTheme.colors.background,
) {
startAchievementOnetimeWorkRequest(applicationContext)
startDailyOnetimeWorkRequest(applicationContext)
startMonthlyOnetimeWorkRequest(applicationContext)
startWeeklyOnetimeWorkRequest(applicationContext)
startAchievementOnetimeWorkRequest(applicationContext)

val reminderTimeFromDb = viewModel.reminderTime.observeAsState()
val hours = reminderTimeFromDb.value?.hour ?: 0
val minutes = reminderTimeFromDb.value?.minute ?: 0
val scheduler = AlarmSchedularImpl(this)
val alarmItem = AlarmData(
time = LocalDateTime.now().withHour(hours).withMinute(minutes),
message = getString(R.string.it_s_time_to_drink_water)
message = getString(R.string.it_s_time_to_drink_water),
)
alarmItem.let(scheduler::schedule)
val navController = rememberAnimatedNavController()
Expand All @@ -87,9 +87,9 @@ class MainActivity : ComponentActivity() {
engine = navHostEngine,
dependenciesContainerBuilder = {
dependency(
currentNavigator()
currentNavigator(),
)
}
},
)
}
}
Expand All @@ -100,7 +100,7 @@ class MainActivity : ComponentActivity() {
fun DestinationScope<*>.currentNavigator(): FeatureNavigator {
return FeatureNavigator(
navController = navController,
navGraph = navBackStackEntry.destination.navGraph()
navGraph = navBackStackEntry.destination.navGraph(),
)
}

Expand Down
Loading

0 comments on commit 75f0356

Please sign in to comment.