P4 Stream P: NotificationPreferencesScreen expansion

Per-category toggle + master toggle + system-settings shortcut matching
iOS NotificationPreferencesView depth. DataStore-backed prefs, channel
importance rewritten to NONE when category disabled.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey T
2026-04-18 13:24:45 -05:00
parent 3700968d00
commit 65af40ed73
12 changed files with 1053 additions and 206 deletions
@@ -0,0 +1,41 @@
package com.tt.honeyDue.ui.screens
import android.content.Intent
import android.provider.Settings
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import com.tt.honeyDue.notifications.NotificationPreferencesStore
import com.tt.honeyDue.viewmodel.NotificationCategoriesController
import com.tt.honeyDue.viewmodel.NotificationCategoryKeys
@Composable
actual fun rememberNotificationCategoriesController(): NotificationCategoriesController? {
val context = LocalContext.current
return remember(context) {
val store = NotificationPreferencesStore(context.applicationContext)
NotificationCategoriesController(
loadAll = {
NotificationCategoryKeys.ALL.associateWith { id ->
store.isCategoryEnabled(id)
}
},
setCategory = { id, enabled -> store.setCategoryEnabled(id, enabled) },
setAll = { enabled -> store.setAllEnabled(enabled) },
)
}
}
@Composable
actual fun rememberOpenAppNotificationSettings(): (() -> Unit)? {
val context = LocalContext.current
return remember(context) {
{
val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply {
putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
context.startActivity(intent)
}
}
}