Skip to content

Commit

Permalink
worked on display reminder on notification screen
Browse files Browse the repository at this point in the history
  • Loading branch information
brandyodhiambo committed Jul 30, 2024
1 parent 215fe6b commit 89d78dc
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import com.brandyodhiambo.common.domain.model.ReminderMode
import com.brandyodhiambo.common.util.toInitials
import com.brandyodhiambo.designsystem.components.Loader
import com.brandyodhiambo.designsystem.components.NotificationSwitcher
import com.brandyodhiambo.settings.R
import com.ramcosta.composedestinations.annotation.Destination

interface NotificationNavigator {
Expand All @@ -66,9 +70,10 @@ interface NotificationNavigator {
@Destination
@Composable
fun NotificationScreen(
navigator: NotificationNavigator
navigator: NotificationNavigator,
settingsViewModel: SettingsViewModel = hiltViewModel()
) {
val reminder = listOf(
/*val reminder = listOf(
ReminderMode(
"Monday",
listOf("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"),
Expand All @@ -80,8 +85,9 @@ fun NotificationScreen(
isOn = true
),
)
)*/

val reminder = settingsViewModel.reminderModeFromDb.observeAsState().value
Scaffold(
containerColor = MaterialTheme.colorScheme.primary,
topBar = {
Expand Down Expand Up @@ -120,9 +126,9 @@ fun NotificationScreen(
item {
AddReminder(navigator = navigator)
}
if (reminder.isEmpty()) {
if (reminder == null) {
item {
// Loader(compositions = R.raw.clock)
Loader(compositions = com.brandyodhiambo.home.R.raw.drink)
}
} else {
items(reminder) { reminder ->
Expand Down Expand Up @@ -221,6 +227,7 @@ fun ReminderCardTime(reminder: ReminderMode) {
padding = 5.dp,
onToggle = {
reminder.isOn.not()
// update the reminder on database
}
)
}
Expand Down

0 comments on commit 89d78dc

Please sign in to comment.