mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-18 03:48:52 +01:00
+1
@@ -98,6 +98,7 @@ class NotificationPrefsActivity : QkThemedActivity(), NotificationPrefsView {
|
||||
notifications.checkbox.isChecked = state.notificationsEnabled
|
||||
previews.summary = state.previewSummary
|
||||
previewModeDialog.adapter.selectedItem = state.previewId
|
||||
wake.checkbox.isChecked = state.wakeEnabled
|
||||
vibration.checkbox.isChecked = state.vibrationEnabled
|
||||
ringtone.summary = state.ringtoneName
|
||||
|
||||
|
||||
+1
@@ -27,6 +27,7 @@ data class NotificationPrefsState(
|
||||
val notificationsEnabled: Boolean = true,
|
||||
val previewSummary: String = "",
|
||||
val previewId: Int = Preferences.NOTIFICATION_PREVIEWS_ALL,
|
||||
val wakeEnabled: Boolean = false,
|
||||
val action1Summary: String = "",
|
||||
val action2Summary: String = "",
|
||||
val action3Summary: String = "",
|
||||
|
||||
+6
@@ -46,6 +46,7 @@ class NotificationPrefsViewModel @Inject constructor(
|
||||
|
||||
private val notifications = prefs.notifications(threadId)
|
||||
private val previews = prefs.notificationPreviews(threadId)
|
||||
private val wake = prefs.wakeScreen(threadId)
|
||||
private val vibration = prefs.vibration(threadId)
|
||||
private val ringtone = prefs.ringtone(threadId)
|
||||
|
||||
@@ -75,6 +76,9 @@ class NotificationPrefsViewModel @Inject constructor(
|
||||
disposables += prefs.notifAction3.asObservable()
|
||||
.subscribe { previewId -> newState { copy(action3Summary = actionLabels[previewId]) } }
|
||||
|
||||
disposables += wake.asObservable()
|
||||
.subscribe { enabled -> newState { copy(wakeEnabled = enabled) } }
|
||||
|
||||
disposables += vibration.asObservable()
|
||||
.subscribe { enabled -> newState { copy(vibrationEnabled = enabled) } }
|
||||
|
||||
@@ -107,6 +111,8 @@ class NotificationPrefsViewModel @Inject constructor(
|
||||
|
||||
R.id.previews -> view.showPreviewModeDialog()
|
||||
|
||||
R.id.wake -> wake.set(!wake.get())
|
||||
|
||||
R.id.vibration -> vibration.set(!vibration.get())
|
||||
|
||||
R.id.ringtone -> view.showRingtonePicker(ringtone.get().takeIf { it.isNotEmpty() }?.let(Uri::parse))
|
||||
|
||||
Reference in New Issue
Block a user