lint android

This commit is contained in:
Hailey
2024-07-12 16:26:12 -07:00
parent 849b5ab139
commit 62aa42f073
4 changed files with 35 additions and 296 deletions
@@ -4,7 +4,9 @@ import android.content.Context
import com.google.firebase.messaging.RemoteMessage
import expo.modules.blueskyswissarmy.sharedprefs.Preferences
enum class NotificationType(val type: String) {
enum class NotificationType(
val type: String,
) {
Like("like"),
Repost("repost"),
Follow("follow"),
@@ -4,16 +4,17 @@ import expo.modules.blueskyswissarmy.sharedprefs.Preferences
import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition
val DEFAULTS = mapOf<String, Any>(
"playSoundChat" to true,
"playSoundFollow" to false,
"playSoundLike" to false,
"playSoundMention" to false,
"playSoundQuote" to false,
"playSoundReply" to false,
"playSoundRepost" to false,
"mutedThreads" to mapOf<String, List<String>>()
)
val DEFAULTS =
mapOf<String, Any>(
"playSoundChat" to true,
"playSoundFollow" to false,
"playSoundLike" to false,
"playSoundMention" to false,
"playSoundQuote" to false,
"playSoundReply" to false,
"playSoundRepost" to false,
"mutedThreads" to mapOf<String, List<String>>(),
)
class ExpoBackgroundNotificationHandlerModule : Module() {
companion object {
@@ -24,15 +25,15 @@ class ExpoBackgroundNotificationHandlerModule : Module() {
ModuleDefinition {
Name("ExpoBackgroundNotificationHandler")
OnCreate {
val context = appContext.reactContext ?: throw Error("Context is null")
DEFAULTS.forEach { (key, value) ->
if (Preferences(context).hasValue(key)) {
return@forEach
OnCreate {
val context = appContext.reactContext ?: throw Error("Context is null")
DEFAULTS.forEach { (key, value) ->
if (Preferences(context).hasValue(key)) {
return@forEach
}
Preferences(context)._setAnyValue(key, value)
}
Preferences(context)._setAnyValue(key, value)
}
}
OnActivityEntersForeground {
isForegrounded = true
@@ -42,22 +43,22 @@ class ExpoBackgroundNotificationHandlerModule : Module() {
isForegrounded = false
}
AsyncFunction("getPrefsAsync") {
val context = appContext.reactContext ?: throw Error("Context is null")
val keys = DEFAULTS.keys
return@AsyncFunction Preferences(context).getValues(keys)
}
AsyncFunction("getPrefsAsync") {
val context = appContext.reactContext ?: throw Error("Context is null")
val keys = DEFAULTS.keys
return@AsyncFunction Preferences(context).getValues(keys)
}
AsyncFunction("resetGenericCountAsync") {
// Not implemented
}
AsyncFunction("resetGenericCountAsync") {
// Not implemented
}
AsyncFunction("maybeIncrementMessagesCountAsync") {
// Not implemented
}
AsyncFunction("maybeIncrementMessagesCountAsync") {
// Not implemented
}
AsyncFunction("maybeDecrementMessagesCountAsync") {
// Not implemented
AsyncFunction("maybeDecrementMessagesCountAsync") {
// Not implemented
}
}
}
}