Open BeanieBarrow opened 1 year ago
Optional notifications are for sure a good enhancement :) There should be both the option for a random time within a time window or just a fixed certain time of the day. I would be glad to have you on board to look into this :) I currently don't have the time.
I think there are following tasks:
Great! Can you provide build instructions in the README? I'll try to cook something up in the next few weeks (time is an issue for me too :D ).
It can be built with gradle (build.gradle). I recommend to use Android Studio. Everything should be set up and work fine out of the box.
I started working on the project. First, I want to implement the fix-time notification.
The app now has access to a daily_reminder
notification channel with IMPORTANCE_DEFAULT
.
Editing Settings.kt
, I want to add a checkbox that once checked, allows the user to specify a time at which they want to get notified. How can I get and set the values in the settings' persistent datastore?
The current code for the notification settings is as follows:
@Composable
fun NotificationSettings(viewModel: DiaryViewModel) {
val notificationsEnabled = remember { mutableStateOf(false) }
Checkbox(
checked = notificationsEnabled.value,
onCheckedChange = { isChecked ->
notificationsEnabled.value = isChecked
val dataStoreKey = stringPreferencesKey("notifications_enabled")
val dataStoreValue = isChecked.toString()
// My attempt to set the value, but it's unaccessible from viewModel.
viewModel.setSettingsValue(dataStoreKey, dataStoreValue)
}
)
}
Very nice! You can access the settings via the viewModel
. Call viewModel.onEvent
to pass your self defined event. In onEvent
you can call the use case setSettingsValue
. You can align with this code from the SetImageBaseLocation
event:
viewModelScope.launch {
diaryUseCases.setSettingsValue(
stringPreferencesKey(imageBaseLocationKey),
event.newBaseLocation.toString()
)
}
Also have a look at the DiarySettingsRepository and the DiarySettingsImplementation.
Don't hesitate to ask further questions. I am happy to support you!
One further remark (because I myself learned Android programming with this app):
Have a look at this video, which helped me a lot to build this app: https://www.youtube.com/watch?v=8YPXv7xKh2w
Any updates on this? I'd also love this feature.
Sadly, no. I haven't had much time to implement this feature. I'll try during the summer, but I can't promise anything.
I think that this app could easily be a better offline version of BeReal that focuses on journaling and memories instead of the social aspect of sharing moments.
I was thinking about an option in the settings where you can specify in which time window you'd like the app to send a notification to take a photo then and there. Of course, you can ignore or delete the notification with no repercussion.
For example, you specify in the settings that you'd want to receive this kind of notification every day and set a time window from 10 AM to 10 PM, and the app sends a reminder at 11:35 AM one day, 3:45 PM on the next day and so on.
If needed, I can look into the source code and see if I can help (I don't have any experience with Android apps but this could be a great exercise).