Redesign: Permissions screen, battery optimization, location sheet (#415)

* update permissions screen design

* battery optimization screen

* remove init screen

* skip init screen on load

* skip on load only

* location sheet design wip

* denser location sheet

* location sheet layout fix
This commit is contained in:
callebtc
2025-09-14 04:22:56 +02:00
committed by GitHub
parent 861eaaeaef
commit 1a398b16ef
5 changed files with 659 additions and 482 deletions
@@ -0,0 +1,33 @@
package com.bitchat.android.onboarding
import android.content.Context
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
/**
* Preference manager for battery optimization skip choice
*/
object BatteryOptimizationPreferenceManager {
private const val PREFS_NAME = "bitchat_settings"
private const val KEY_BATTERY_SKIP = "battery_optimization_skipped"
private val _skipFlow = MutableStateFlow(false)
val skipFlow: StateFlow<Boolean> = _skipFlow
fun init(context: Context) {
val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
val skipped = prefs.getBoolean(KEY_BATTERY_SKIP, false)
_skipFlow.value = skipped
}
fun setSkipped(context: Context, skipped: Boolean) {
val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
prefs.edit().putBoolean(KEY_BATTERY_SKIP, skipped).apply()
_skipFlow.value = skipped
}
fun isSkipped(context: Context): Boolean {
val prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
return prefs.getBoolean(KEY_BATTERY_SKIP, false)
}
}