mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-08-22 07:06:05 +00:00
* persistence step 1 * fix build * messages in the background work, notifications not yet * app state store * DM icon shows up * notification launches when app is closed! * keep ui updated * lifecycle fixes * extensive logging, maybe revert later * send nickname in announcement * quit in notification * setting in about sheet * fix quit bitchat * lifecycle fixes * power mode based on background state * stats for both direciotns * fix graph persistence * better counting * count per device * only compute when debug sheet is open? untested * fix read receipts * fix read receipts fully * fix unread badge if messages have been read in focus * foreground promotion fix * fix app kill in notification * adjust to new tor * nice * about sheet design
33 lines
1018 B
Kotlin
33 lines
1018 B
Kotlin
package com.bitchat.android.service
|
|
|
|
import android.content.Context
|
|
import android.content.SharedPreferences
|
|
|
|
object MeshServicePreferences {
|
|
private const val PREFS_NAME = "bitchat_mesh_service_prefs"
|
|
private const val KEY_AUTO_START = "auto_start_on_boot"
|
|
private const val KEY_BACKGROUND_ENABLED = "background_enabled"
|
|
|
|
private lateinit var prefs: SharedPreferences
|
|
|
|
fun init(context: Context) {
|
|
prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
|
}
|
|
|
|
fun isAutoStartEnabled(default: Boolean = true): Boolean {
|
|
return prefs.getBoolean(KEY_AUTO_START, default)
|
|
}
|
|
|
|
fun setAutoStartEnabled(enabled: Boolean) {
|
|
prefs.edit().putBoolean(KEY_AUTO_START, enabled).apply()
|
|
}
|
|
|
|
fun isBackgroundEnabled(default: Boolean = true): Boolean {
|
|
return prefs.getBoolean(KEY_BACKGROUND_ENABLED, default)
|
|
}
|
|
|
|
fun setBackgroundEnabled(enabled: Boolean) {
|
|
prefs.edit().putBoolean(KEY_BACKGROUND_ENABLED, enabled).apply()
|
|
}
|
|
}
|