lint android
This commit is contained in:
+3
-1
@@ -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"),
|
||||
|
||||
+32
-31
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user