fix some lints

This commit is contained in:
greenart7c3
2024-06-12 10:24:36 -03:00
parent 98c9186cac
commit 62d3cd7f34
9 changed files with 13 additions and 18 deletions
@@ -20,6 +20,7 @@
*/
package com.greenart7c3.nostrsigner.relays
import com.fasterxml.jackson.databind.JsonNode
import com.vitorpamplona.quartz.events.Event
class JsonFilter(
@@ -37,26 +38,26 @@ class JsonFilter(
val filter =
factory.objectNode().apply {
ids?.run {
put(
set<JsonNode>(
"ids",
factory.arrayNode(ids.size).apply { ids.forEach { add(it) } },
)
}
authors?.run {
put(
set<JsonNode>(
"authors",
factory.arrayNode(authors.size).apply { authors.forEach { add(it) } },
)
}
kinds?.run {
put(
set<JsonNode>(
"kinds",
factory.arrayNode(kinds.size).apply { kinds.forEach { add(it) } },
)
}
tags?.run {
entries.forEach { kv ->
put(
set<JsonNode>(
"#${kv.key}",
factory.arrayNode(kv.value.size).apply { kv.value.forEach { add(it) } },
)
@@ -74,7 +75,7 @@ class JsonFilter(
entries.forEach { sincePairs ->
jsonObjectSince.put(sincePairs.key, "${sincePairs.value}")
}
put("since", jsonObjectSince)
set<JsonNode>("since", jsonObjectSince)
}
}
}
@@ -47,7 +47,7 @@ data class Subscription(
return factory.objectNode().apply {
put("id", id)
typedFilters?.also { filters ->
put(
set<JsonNode>(
"typedFilters",
factory.arrayNode(filters.size).apply {
filters.forEach { filter -> add(filter.toJsonObject()) }
@@ -48,7 +48,6 @@ import com.vitorpamplona.quartz.events.GiftWrapEvent
import com.vitorpamplona.quartz.events.SealedGossipEvent
class EventNotificationConsumer(private val applicationContext: Context) {
private val groupKey = "com.greenart7c3.nostrsigner.DM_NOTIFICATION"
fun consume(event: Event) {
if (!notificationManager().areNotificationsEnabled()) return
@@ -251,7 +250,6 @@ class EventNotificationConsumer(private val applicationContext: Context) {
"Bunker",
"nostrsigner:",
"BunkerID",
groupKey,
applicationContext,
bunkerRequest,
)
@@ -285,7 +283,6 @@ class EventNotificationConsumer(private val applicationContext: Context) {
"Bunker",
"nostrsigner:",
"BunkerID",
groupKey,
applicationContext,
bunkerRequest,
)
@@ -66,7 +66,6 @@ object NotificationUtils {
messageTitle: String,
uri: String,
channelId: String,
notificationGroupKey: String,
applicationContext: Context,
bunkerRequest: BunkerRequest,
) {
@@ -77,7 +76,6 @@ object NotificationUtils {
picture = null,
uri = uri,
channelId,
notificationGroupKey,
applicationContext = applicationContext,
bunkerRequest,
)
@@ -90,7 +88,6 @@ object NotificationUtils {
picture: BitmapDrawable?,
uri: String,
channelId: String,
notificationGroupKey: String,
applicationContext: Context,
bunkerRequest: BunkerRequest,
) {
@@ -22,7 +22,7 @@ import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
@Immutable
open class ToastMsg()
open class ToastMsg
@Immutable
class StringToastMsg(val title: String, val msg: String) : ToastMsg()
@@ -161,9 +161,9 @@ fun ConnectOrbotDialog(
@Composable
fun UseOrbotButton(
modifier: Modifier = Modifier,
onPost: () -> Unit = {},
isActive: Boolean,
modifier: Modifier = Modifier,
) {
Button(
modifier = modifier,
@@ -69,13 +69,13 @@ fun TextSpinner(
options,
onSelect,
modifier,
) { currentOption, modifier ->
) { currentOption, mainModifier ->
OutlinedTextField(
value = currentOption,
onValueChange = {},
readOnly = true,
label = { label?.let { Text(it) } },
modifier = modifier,
modifier = mainModifier,
)
}
}
@@ -26,7 +26,7 @@ import kotlinx.coroutines.Dispatchers
object PushNotificationUtils {
var hasInit: Boolean = false
suspend fun init(accounts: List<AccountInfo>) =
suspend fun init(@Suppress("UNUSED_PARAMETER") accounts: List<AccountInfo>) =
with(Dispatchers.IO) {
return@with
}
@@ -31,7 +31,7 @@ class Notifications : FirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) {
scope.launch(Dispatchers.IO) {
val (value, elapsed) =
val (_, elapsed) =
measureTimedValue { parseMessage(remoteMessage.data)?.let { receiveIfNew(it) } }
Log.d("Time", "Notification processed in $elapsed")
}