mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 10:58:23 +00:00
change linter rules
This commit is contained in:
+3
-1
@@ -12,7 +12,9 @@ ij_kotlin_name_count_to_use_star_import = 999
|
|||||||
ij_kotlin_name_count_to_use_star_import_for_members = 999
|
ij_kotlin_name_count_to_use_star_import_for_members = 999
|
||||||
max_line_length = off
|
max_line_length = off
|
||||||
ktlint_function_naming_ignore_when_annotated_with = Composable
|
ktlint_function_naming_ignore_when_annotated_with = Composable
|
||||||
ktlint_code_style = ktlint_official
|
ktlint_code_style = android_studio
|
||||||
|
ij_kotlin_allow_trailing_comma_on_call_site = true
|
||||||
|
ij_kotlin_allow_trailing_comma = true
|
||||||
|
|
||||||
[*.{yml,yaml}]
|
[*.{yml,yaml}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
@@ -17,11 +17,11 @@ import com.vitorpamplona.quartz.encoders.hexToByteArray
|
|||||||
import com.vitorpamplona.quartz.encoders.toHexKey
|
import com.vitorpamplona.quartz.encoders.toHexKey
|
||||||
import com.vitorpamplona.quartz.encoders.toNpub
|
import com.vitorpamplona.quartz.encoders.toNpub
|
||||||
import fr.acinq.secp256k1.jni.BuildConfig
|
import fr.acinq.secp256k1.jni.BuildConfig
|
||||||
|
import java.io.File
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
// Release mode (!BuildConfig.DEBUG) always uses encrypted preferences
|
// Release mode (!BuildConfig.DEBUG) always uses encrypted preferences
|
||||||
// To use plaintext SharedPreferences for debugging, set this to true
|
// To use plaintext SharedPreferences for debugging, set this to true
|
||||||
|
|||||||
@@ -61,15 +61,13 @@ data class BunkerRequest(
|
|||||||
return BunkerRequest(
|
return BunkerRequest(
|
||||||
id = jsonObject.get("id").asText().intern(),
|
id = jsonObject.get("id").asText().intern(),
|
||||||
method = jsonObject.get("method").asText().intern(),
|
method = jsonObject.get("method").asText().intern(),
|
||||||
params =
|
params = jsonObject.get("params").asIterable().toList().map {
|
||||||
jsonObject.get("params").asIterable().toList().map {
|
it.asText().intern()
|
||||||
it.asText().intern()
|
}.toTypedArray(),
|
||||||
}.toTypedArray(),
|
|
||||||
localKey = jsonObject.get("localKey")?.asText()?.intern() ?: "",
|
localKey = jsonObject.get("localKey")?.asText()?.intern() ?: "",
|
||||||
relays =
|
relays = jsonObject.get("relays")?.asIterable()?.toList()?.map {
|
||||||
jsonObject.get("relays")?.asIterable()?.toList()?.map {
|
it.asText().intern()
|
||||||
it.asText().intern()
|
} ?: listOf(),
|
||||||
} ?: listOf(),
|
|
||||||
secret = jsonObject.get("secret")?.asText()?.intern() ?: "",
|
secret = jsonObject.get("secret")?.asText()?.intern() ?: "",
|
||||||
currentAccount = jsonObject.get("currentAccount")?.asText()?.intern() ?: "",
|
currentAccount = jsonObject.get("currentAccount")?.asText()?.intern() ?: "",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ import android.util.Log
|
|||||||
import com.greenart7c3.nostrsigner.checkNotInMainThread
|
import com.greenart7c3.nostrsigner.checkNotInMainThread
|
||||||
import com.vitorpamplona.quartz.events.Event
|
import com.vitorpamplona.quartz.events.Event
|
||||||
import com.vitorpamplona.quartz.events.EventInterface
|
import com.vitorpamplona.quartz.events.EventInterface
|
||||||
|
import java.util.UUID
|
||||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.util.UUID
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Nostr Client manages multiple personae the user may switch between. Events are received and
|
* The Nostr Client manages multiple personae the user may switch between. Events are received and
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ import com.vitorpamplona.quartz.events.EventInterface
|
|||||||
import com.vitorpamplona.quartz.events.RelayAuthEvent
|
import com.vitorpamplona.quartz.events.RelayAuthEvent
|
||||||
import com.vitorpamplona.quartz.events.bytesUsedInMemory
|
import com.vitorpamplona.quartz.events.bytesUsedInMemory
|
||||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import okhttp3.WebSocket
|
import okhttp3.WebSocket
|
||||||
import okhttp3.WebSocketListener
|
import okhttp3.WebSocketListener
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
|
||||||
|
|
||||||
enum class FeedType {
|
enum class FeedType {
|
||||||
FOLLOWS,
|
FOLLOWS,
|
||||||
|
|||||||
@@ -152,19 +152,18 @@ object AmberUtils {
|
|||||||
database
|
database
|
||||||
.applicationDao()
|
.applicationDao()
|
||||||
.getByKey(key) ?: ApplicationWithPermissions(
|
.getByKey(key) ?: ApplicationWithPermissions(
|
||||||
application =
|
application = ApplicationEntity(
|
||||||
ApplicationEntity(
|
key,
|
||||||
key,
|
appName,
|
||||||
appName,
|
listOf(),
|
||||||
listOf(),
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
account.keyPair.pubKey.toHexKey(),
|
||||||
account.keyPair.pubKey.toHexKey(),
|
true,
|
||||||
true,
|
intentData.bunkerRequest?.secret ?: "",
|
||||||
intentData.bunkerRequest?.secret ?: "",
|
intentData.bunkerRequest?.secret != null,
|
||||||
intentData.bunkerRequest?.secret != null,
|
),
|
||||||
),
|
|
||||||
permissions = mutableListOf(),
|
permissions = mutableListOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
package com.greenart7c3.nostrsigner.service
|
package com.greenart7c3.nostrsigner.service
|
||||||
|
|
||||||
import androidx.compose.runtime.Stable
|
import androidx.compose.runtime.Stable
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import kotlinx.coroutines.CoroutineDispatcher
|
import kotlinx.coroutines.CoroutineDispatcher
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@@ -30,7 +31,6 @@ import kotlinx.coroutines.cancel
|
|||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
|
||||||
|
|
||||||
/** This class is designed to have a waiting time between two calls of invalidate */
|
/** This class is designed to have a waiting time between two calls of invalidate */
|
||||||
@Stable
|
@Stable
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ package com.greenart7c3.nostrsigner.service
|
|||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.greenart7c3.nostrsigner.BuildConfig
|
import com.greenart7c3.nostrsigner.BuildConfig
|
||||||
import okhttp3.Interceptor
|
|
||||||
import okhttp3.OkHttpClient
|
|
||||||
import okhttp3.Request
|
|
||||||
import okhttp3.Response
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.net.InetSocketAddress
|
import java.net.InetSocketAddress
|
||||||
import java.net.Proxy
|
import java.net.Proxy
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
import okhttp3.Interceptor
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Response
|
||||||
|
|
||||||
object HttpClientManager {
|
object HttpClientManager {
|
||||||
val DEFAULT_TIMEOUT_ON_WIFI: Duration = Duration.ofSeconds(10L)
|
val DEFAULT_TIMEOUT_ON_WIFI: Duration = Duration.ofSeconds(10L)
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ import com.vitorpamplona.quartz.encoders.toHexKey
|
|||||||
import com.vitorpamplona.quartz.encoders.toNpub
|
import com.vitorpamplona.quartz.encoders.toNpub
|
||||||
import com.vitorpamplona.quartz.events.Event
|
import com.vitorpamplona.quartz.events.Event
|
||||||
import fr.acinq.secp256k1.Hex
|
import fr.acinq.secp256k1.Hex
|
||||||
|
import java.net.URLDecoder
|
||||||
|
import java.util.UUID
|
||||||
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.net.URLDecoder
|
|
||||||
import java.util.UUID
|
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
|
||||||
|
|
||||||
data class BunkerMetadata(
|
data class BunkerMetadata(
|
||||||
val name: String,
|
val name: String,
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ import com.greenart7c3.nostrsigner.relays.Relay
|
|||||||
import com.greenart7c3.nostrsigner.relays.Subscription
|
import com.greenart7c3.nostrsigner.relays.Subscription
|
||||||
import com.vitorpamplona.quartz.events.Event
|
import com.vitorpamplona.quartz.events.Event
|
||||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||||
|
import java.util.UUID
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.SupervisorJob
|
import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.util.UUID
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
|
||||||
|
|
||||||
abstract class NostrDataSource(val debugName: String) {
|
abstract class NostrDataSource(val debugName: String) {
|
||||||
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
||||||
|
|||||||
@@ -59,13 +59,12 @@ object NotificationDataSource : NostrDataSource("AccountData") {
|
|||||||
|
|
||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.FOLLOWS),
|
types = setOf(FeedType.FOLLOWS),
|
||||||
filter =
|
filter = JsonFilter(
|
||||||
JsonFilter(
|
kinds = listOf(24133),
|
||||||
kinds = listOf(24133),
|
tags = mapOf("p" to pubKeys),
|
||||||
tags = mapOf("p" to pubKeys),
|
limit = 1,
|
||||||
limit = 1,
|
since = eoses,
|
||||||
since = eoses,
|
),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,10 +38,9 @@ open class AmberEvent(
|
|||||||
pubKey = jsonObject.get("pubkey")?.asString ?: "",
|
pubKey = jsonObject.get("pubkey")?.asString ?: "",
|
||||||
createdAt = jsonObject.get("created_at")?.asLong ?: TimeUtils.now(),
|
createdAt = jsonObject.get("created_at")?.asLong ?: TimeUtils.now(),
|
||||||
kind = jsonObject.get("kind").asInt,
|
kind = jsonObject.get("kind").asInt,
|
||||||
tags =
|
tags = jsonObject.get("tags")?.asJsonArray?.map {
|
||||||
jsonObject.get("tags")?.asJsonArray?.map {
|
it.asJsonArray.mapNotNull { s -> if (s.isJsonNull) null else s.asString }.toTypedArray()
|
||||||
it.asJsonArray.mapNotNull { s -> if (s.isJsonNull) null else s.asString }.toTypedArray()
|
}?.toTypedArray() ?: emptyArray(),
|
||||||
}?.toTypedArray() ?: emptyArray(),
|
|
||||||
content = jsonObject.get("content").asString,
|
content = jsonObject.get("content").asString,
|
||||||
sig = jsonObject.get("sig")?.asString ?: "",
|
sig = jsonObject.get("sig")?.asString ?: "",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -74,13 +74,13 @@ import com.greenart7c3.nostrsigner.ui.components.PostButton
|
|||||||
import com.greenart7c3.nostrsigner.ui.navigation.Route
|
import com.greenart7c3.nostrsigner.ui.navigation.Route
|
||||||
import com.vitorpamplona.quartz.encoders.toHexKey
|
import com.vitorpamplona.quartz.encoders.toHexKey
|
||||||
import com.vitorpamplona.quartz.encoders.toNpub
|
import com.vitorpamplona.quartz.encoders.toNpub
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
import java.time.format.FormatStyle
|
import java.time.format.FormatStyle
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
fun convertLongToDateTime(longValue: Long): String {
|
fun convertLongToDateTime(longValue: Long): String {
|
||||||
val dateTime =
|
val dateTime =
|
||||||
@@ -124,20 +124,18 @@ fun ActivityDialog(
|
|||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxSize(),
|
.fillMaxSize(),
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.background(MaterialTheme.colorScheme.background)
|
||||||
.background(MaterialTheme.colorScheme.background)
|
.fillMaxSize(),
|
||||||
.fillMaxSize(),
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(10.dp),
|
||||||
.padding(10.dp),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
@@ -273,21 +271,18 @@ fun EditPermission(
|
|||||||
properties = DialogProperties(usePlatformDefaultWidth = false),
|
properties = DialogProperties(usePlatformDefaultWidth = false),
|
||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxSize(),
|
||||||
.fillMaxSize(),
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.background(MaterialTheme.colorScheme.background)
|
||||||
.background(MaterialTheme.colorScheme.background)
|
.fillMaxSize(),
|
||||||
.fillMaxSize(),
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(10.dp),
|
||||||
.padding(10.dp),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
@@ -345,15 +340,13 @@ fun EditPermission(
|
|||||||
) {
|
) {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
enabled = !applicationData.isConnected,
|
enabled = !applicationData.isConnected,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth(0.9f)
|
||||||
.fillMaxWidth(0.9f)
|
.padding(horizontal = 16.dp),
|
||||||
.padding(horizontal = 16.dp),
|
|
||||||
value = textFieldRelay.text,
|
value = textFieldRelay.text,
|
||||||
keyboardOptions =
|
keyboardOptions = KeyboardOptions(
|
||||||
KeyboardOptions(
|
imeAction = ImeAction.Done,
|
||||||
imeAction = ImeAction.Done,
|
),
|
||||||
),
|
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
textFieldRelay = TextFieldValue(it)
|
textFieldRelay = TextFieldValue(it)
|
||||||
},
|
},
|
||||||
@@ -500,15 +493,14 @@ fun EditPermission(
|
|||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.padding(horizontal = 8.dp)
|
||||||
.padding(horizontal = 8.dp)
|
.clickable {
|
||||||
.clickable {
|
checked = !checked
|
||||||
checked = !checked
|
val relays = applicationData.relays.joinToString(separator = "&") { "relay=$it" }
|
||||||
val relays = applicationData.relays.joinToString(separator = "&") { "relay=$it" }
|
val localSecret = if (checked) "&secret=${applicationData.secret}" else ""
|
||||||
val localSecret = if (checked) "&secret=${applicationData.secret}" else ""
|
bunkerUri = "bunker://${account.keyPair.pubKey.toHexKey()}?$relays$localSecret"
|
||||||
bunkerUri = "bunker://${account.keyPair.pubKey.toHexKey()}?$relays$localSecret"
|
},
|
||||||
},
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
@@ -523,15 +515,13 @@ fun EditPermission(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(horizontal = 16.dp),
|
||||||
.padding(horizontal = 16.dp),
|
|
||||||
value = textFieldvalue.text,
|
value = textFieldvalue.text,
|
||||||
keyboardOptions =
|
keyboardOptions = KeyboardOptions(
|
||||||
KeyboardOptions(
|
imeAction = ImeAction.Done,
|
||||||
imeAction = ImeAction.Done,
|
),
|
||||||
),
|
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
textFieldvalue = TextFieldValue(it)
|
textFieldvalue = TextFieldValue(it)
|
||||||
},
|
},
|
||||||
@@ -590,36 +580,33 @@ fun EditPermission(
|
|||||||
localPermission.toString()
|
localPermission.toString()
|
||||||
}
|
}
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.padding(vertical = 15.dp, horizontal = 25.dp)
|
||||||
.padding(vertical = 15.dp, horizontal = 25.dp)
|
.fillMaxWidth(),
|
||||||
.fillMaxWidth(),
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
if (permission.acceptable) Icons.Default.Check else Icons.Default.Close,
|
if (permission.acceptable) Icons.Default.Check else Icons.Default.Close,
|
||||||
null,
|
null,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.size(22.dp)
|
||||||
.size(22.dp)
|
.padding(end = 4.dp)
|
||||||
.padding(end = 4.dp)
|
.clickable {
|
||||||
.clickable {
|
val localPermissions =
|
||||||
val localPermissions =
|
permissions.map {
|
||||||
permissions.map {
|
if (it.id == permission.id) {
|
||||||
if (it.id == permission.id) {
|
it.copy(acceptable = !permission.acceptable)
|
||||||
it.copy(acceptable = !permission.acceptable)
|
} else {
|
||||||
} else {
|
it.copy()
|
||||||
it.copy()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
permissions.clear()
|
}
|
||||||
permissions.addAll(localPermissions)
|
permissions.clear()
|
||||||
},
|
permissions.addAll(localPermissions)
|
||||||
|
},
|
||||||
tint = if (permission.acceptable) Color.Green else Color.Red,
|
tint = if (permission.acceptable) Color.Green else Color.Red,
|
||||||
)
|
)
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.weight(1f),
|
||||||
.weight(1f),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
@@ -630,12 +617,11 @@ fun EditPermission(
|
|||||||
Icon(
|
Icon(
|
||||||
Icons.Default.Delete,
|
Icons.Default.Delete,
|
||||||
null,
|
null,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.size(22.dp)
|
||||||
.size(22.dp)
|
.clickable {
|
||||||
.clickable {
|
permissions.remove(permission)
|
||||||
permissions.remove(permission)
|
},
|
||||||
},
|
|
||||||
tint = Color.Red,
|
tint = Color.Red,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,11 +84,10 @@ fun LoginPage(accountViewModel: AccountStateViewModel) {
|
|||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxSize()
|
||||||
.fillMaxSize()
|
.navigationBarsPadding()
|
||||||
.navigationBarsPadding()
|
.verticalScroll(rememberScrollState()),
|
||||||
.verticalScroll(rememberScrollState()),
|
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
) {
|
) {
|
||||||
// The first child is glued to the top.
|
// The first child is glued to the top.
|
||||||
@@ -97,10 +96,9 @@ fun LoginPage(accountViewModel: AccountStateViewModel) {
|
|||||||
|
|
||||||
// The second child, this column, is centered vertically.
|
// The second child, this column, is centered vertically.
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.padding(20.dp)
|
||||||
.padding(20.dp)
|
.fillMaxSize(),
|
||||||
.fillMaxSize(),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
) {
|
) {
|
||||||
Spacer(modifier = Modifier.height(40.dp))
|
Spacer(modifier = Modifier.height(40.dp))
|
||||||
@@ -128,28 +126,26 @@ fun LoginPage(accountViewModel: AccountStateViewModel) {
|
|||||||
LocalAutofillTree.current += autofillNodePassword
|
LocalAutofillTree.current += autofillNodePassword
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.onGloballyPositioned { coordinates ->
|
||||||
.onGloballyPositioned { coordinates ->
|
autofillNodeKey.boundingBox = coordinates.boundsInWindow()
|
||||||
autofillNodeKey.boundingBox = coordinates.boundsInWindow()
|
}
|
||||||
}
|
.onFocusChanged { focusState ->
|
||||||
.onFocusChanged { focusState ->
|
autofill?.run {
|
||||||
autofill?.run {
|
if (focusState.isFocused) {
|
||||||
if (focusState.isFocused) {
|
requestAutofillForNode(autofillNodeKey)
|
||||||
requestAutofillForNode(autofillNodeKey)
|
} else {
|
||||||
} else {
|
cancelAutofillForNode(autofillNodeKey)
|
||||||
cancelAutofillForNode(autofillNodeKey)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
},
|
||||||
value = key.value,
|
value = key.value,
|
||||||
onValueChange = { key.value = it },
|
onValueChange = { key.value = it },
|
||||||
keyboardOptions =
|
keyboardOptions = KeyboardOptions(
|
||||||
KeyboardOptions(
|
autoCorrect = false,
|
||||||
autoCorrect = false,
|
keyboardType = KeyboardType.Password,
|
||||||
keyboardType = KeyboardType.Password,
|
imeAction = ImeAction.Go,
|
||||||
imeAction = ImeAction.Go,
|
),
|
||||||
),
|
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.nsec),
|
text = stringResource(R.string.nsec),
|
||||||
@@ -160,12 +156,11 @@ fun LoginPage(accountViewModel: AccountStateViewModel) {
|
|||||||
IconButton(onClick = { showPassword = !showPassword }) {
|
IconButton(onClick = { showPassword = !showPassword }) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = if (showPassword) Icons.Outlined.VisibilityOff else Icons.Outlined.Visibility,
|
imageVector = if (showPassword) Icons.Outlined.VisibilityOff else Icons.Outlined.Visibility,
|
||||||
contentDescription =
|
contentDescription = if (showPassword) {
|
||||||
if (showPassword) {
|
stringResource(R.string.show_password)
|
||||||
stringResource(R.string.show_password)
|
} else {
|
||||||
} else {
|
stringResource(R.string.hide_password)
|
||||||
stringResource(R.string.hide_password)
|
},
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,8 +184,93 @@ fun LoginPage(accountViewModel: AccountStateViewModel) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
visualTransformation = if (showPassword) VisualTransformation.None else PasswordVisualTransformation(),
|
visualTransformation = if (showPassword) VisualTransformation.None else PasswordVisualTransformation(),
|
||||||
keyboardActions =
|
keyboardActions = KeyboardActions(
|
||||||
KeyboardActions(
|
onGo = {
|
||||||
|
if (key.value.text.isBlank()) {
|
||||||
|
errorMessage = context.getString(R.string.key_is_required)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needsPassword.value && password.value.text.isBlank()) {
|
||||||
|
errorMessage = context.getString(R.string.password_is_required)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key.value.text.isNotBlank() && !(needsPassword.value && password.value.text.isBlank())) {
|
||||||
|
try {
|
||||||
|
accountViewModel.startUI(
|
||||||
|
key.value.text,
|
||||||
|
password.value.text,
|
||||||
|
null,
|
||||||
|
useProxy = useProxy.value,
|
||||||
|
proxyPort = proxyPort.value.toInt(),
|
||||||
|
)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("Login", "Could not sign in", e)
|
||||||
|
errorMessage = context.getString(R.string.invalid_key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
if (errorMessage.isNotBlank()) {
|
||||||
|
Text(
|
||||||
|
text = errorMessage,
|
||||||
|
color = MaterialTheme.colorScheme.error,
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
|
|
||||||
|
if (needsPassword.value) {
|
||||||
|
OutlinedTextField(
|
||||||
|
modifier = Modifier
|
||||||
|
.onGloballyPositioned { coordinates ->
|
||||||
|
autofillNodePassword.boundingBox = coordinates.boundsInWindow()
|
||||||
|
}
|
||||||
|
.onFocusChanged { focusState ->
|
||||||
|
autofill?.run {
|
||||||
|
if (focusState.isFocused) {
|
||||||
|
requestAutofillForNode(autofillNodePassword)
|
||||||
|
} else {
|
||||||
|
cancelAutofillForNode(autofillNodePassword)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value = password.value,
|
||||||
|
onValueChange = {
|
||||||
|
password.value = it
|
||||||
|
if (errorMessage.isNotEmpty()) {
|
||||||
|
errorMessage = ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
keyboardOptions = KeyboardOptions(
|
||||||
|
autoCorrect = false,
|
||||||
|
keyboardType = KeyboardType.Password,
|
||||||
|
imeAction = ImeAction.Go,
|
||||||
|
),
|
||||||
|
placeholder = {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.ncryptsec_password),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
trailingIcon = {
|
||||||
|
Row {
|
||||||
|
IconButton(onClick = { showCharsPassword = !showCharsPassword }) {
|
||||||
|
Icon(
|
||||||
|
imageVector = if (showCharsPassword) Icons.Outlined.VisibilityOff else Icons.Outlined.Visibility,
|
||||||
|
contentDescription = if (showCharsPassword) {
|
||||||
|
stringResource(R.string.show_password)
|
||||||
|
} else {
|
||||||
|
stringResource(
|
||||||
|
R.string.hide_password,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
visualTransformation = if (showCharsPassword) VisualTransformation.None else PasswordVisualTransformation(),
|
||||||
|
keyboardActions = KeyboardActions(
|
||||||
onGo = {
|
onGo = {
|
||||||
if (key.value.text.isBlank()) {
|
if (key.value.text.isBlank()) {
|
||||||
errorMessage = context.getString(R.string.key_is_required)
|
errorMessage = context.getString(R.string.key_is_required)
|
||||||
@@ -216,98 +296,6 @@ fun LoginPage(accountViewModel: AccountStateViewModel) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
|
||||||
if (errorMessage.isNotBlank()) {
|
|
||||||
Text(
|
|
||||||
text = errorMessage,
|
|
||||||
color = MaterialTheme.colorScheme.error,
|
|
||||||
style = MaterialTheme.typography.bodySmall,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(20.dp))
|
|
||||||
|
|
||||||
if (needsPassword.value) {
|
|
||||||
OutlinedTextField(
|
|
||||||
modifier =
|
|
||||||
Modifier
|
|
||||||
.onGloballyPositioned { coordinates ->
|
|
||||||
autofillNodePassword.boundingBox = coordinates.boundsInWindow()
|
|
||||||
}
|
|
||||||
.onFocusChanged { focusState ->
|
|
||||||
autofill?.run {
|
|
||||||
if (focusState.isFocused) {
|
|
||||||
requestAutofillForNode(autofillNodePassword)
|
|
||||||
} else {
|
|
||||||
cancelAutofillForNode(autofillNodePassword)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
value = password.value,
|
|
||||||
onValueChange = {
|
|
||||||
password.value = it
|
|
||||||
if (errorMessage.isNotEmpty()) {
|
|
||||||
errorMessage = ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
keyboardOptions =
|
|
||||||
KeyboardOptions(
|
|
||||||
autoCorrect = false,
|
|
||||||
keyboardType = KeyboardType.Password,
|
|
||||||
imeAction = ImeAction.Go,
|
|
||||||
),
|
|
||||||
placeholder = {
|
|
||||||
Text(
|
|
||||||
text = stringResource(R.string.ncryptsec_password),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
trailingIcon = {
|
|
||||||
Row {
|
|
||||||
IconButton(onClick = { showCharsPassword = !showCharsPassword }) {
|
|
||||||
Icon(
|
|
||||||
imageVector =
|
|
||||||
if (showCharsPassword) Icons.Outlined.VisibilityOff else Icons.Outlined.Visibility,
|
|
||||||
contentDescription =
|
|
||||||
if (showCharsPassword) {
|
|
||||||
stringResource(R.string.show_password)
|
|
||||||
} else {
|
|
||||||
stringResource(
|
|
||||||
R.string.hide_password,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visualTransformation =
|
|
||||||
if (showCharsPassword) VisualTransformation.None else PasswordVisualTransformation(),
|
|
||||||
keyboardActions =
|
|
||||||
KeyboardActions(
|
|
||||||
onGo = {
|
|
||||||
if (key.value.text.isBlank()) {
|
|
||||||
errorMessage = context.getString(R.string.key_is_required)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needsPassword.value && password.value.text.isBlank()) {
|
|
||||||
errorMessage = context.getString(R.string.password_is_required)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key.value.text.isNotBlank() && !(needsPassword.value && password.value.text.isBlank())) {
|
|
||||||
try {
|
|
||||||
accountViewModel.startUI(
|
|
||||||
key.value.text,
|
|
||||||
password.value.text,
|
|
||||||
null,
|
|
||||||
useProxy = useProxy.value,
|
|
||||||
proxyPort = proxyPort.value.toInt(),
|
|
||||||
)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e("Login", "Could not sign in", e)
|
|
||||||
errorMessage = context.getString(R.string.invalid_key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,10 +369,9 @@ fun LoginPage(accountViewModel: AccountStateViewModel) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
shape = RoundedCornerShape(Size35dp),
|
shape = RoundedCornerShape(Size35dp),
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.height(50.dp),
|
||||||
.height(50.dp),
|
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.login))
|
Text(text = stringResource(R.string.login))
|
||||||
}
|
}
|
||||||
@@ -393,10 +380,9 @@ fun LoginPage(accountViewModel: AccountStateViewModel) {
|
|||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
TextButton(
|
TextButton(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.padding(30.dp)
|
||||||
.padding(30.dp)
|
.fillMaxWidth(),
|
||||||
.fillMaxWidth(),
|
|
||||||
onClick = {
|
onClick = {
|
||||||
accountViewModel.newKey(useProxy.value, proxyPort.value.toInt())
|
accountViewModel.newKey(useProxy.value, proxyPort.value.toInt())
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -107,14 +107,14 @@ import com.greenart7c3.nostrsigner.ui.navigation.Route
|
|||||||
import com.greenart7c3.nostrsigner.ui.theme.ButtonBorder
|
import com.greenart7c3.nostrsigner.ui.theme.ButtonBorder
|
||||||
import com.vitorpamplona.quartz.encoders.toHexKey
|
import com.vitorpamplona.quartz.encoders.toHexKey
|
||||||
import com.vitorpamplona.quartz.encoders.toNpub
|
import com.vitorpamplona.quartz.encoders.toNpub
|
||||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.util.Base64
|
import java.util.Base64
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
import java.util.zip.GZIPOutputStream
|
import java.util.zip.GZIPOutputStream
|
||||||
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@OptIn(DelicateCoroutinesApi::class)
|
@OptIn(DelicateCoroutinesApi::class)
|
||||||
fun sendResult(
|
fun sendResult(
|
||||||
@@ -179,19 +179,18 @@ fun sendResult(
|
|||||||
|
|
||||||
val application =
|
val application =
|
||||||
savedApplication ?: ApplicationWithPermissions(
|
savedApplication ?: ApplicationWithPermissions(
|
||||||
application =
|
application = ApplicationEntity(
|
||||||
ApplicationEntity(
|
key,
|
||||||
key,
|
appName ?: localAppName ?: "",
|
||||||
appName ?: localAppName ?: "",
|
relays,
|
||||||
relays,
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
account.keyPair.pubKey.toHexKey(),
|
||||||
account.keyPair.pubKey.toHexKey(),
|
true,
|
||||||
true,
|
intentData.bunkerRequest?.secret ?: "",
|
||||||
intentData.bunkerRequest?.secret ?: "",
|
intentData.bunkerRequest?.secret != null,
|
||||||
intentData.bunkerRequest?.secret != null,
|
),
|
||||||
),
|
|
||||||
permissions = mutableListOf(),
|
permissions = mutableListOf(),
|
||||||
)
|
)
|
||||||
application.application.isConnected = true
|
application.application.isConnected = true
|
||||||
@@ -436,11 +435,10 @@ fun PermissionsFloatingActionButton(
|
|||||||
|
|
||||||
val rotation by animateFloatAsState(
|
val rotation by animateFloatAsState(
|
||||||
targetValue = if (expanded) 0f else 180f,
|
targetValue = if (expanded) 0f else 180f,
|
||||||
animationSpec =
|
animationSpec = tween(
|
||||||
tween(
|
durationMillis = 150,
|
||||||
durationMillis = 150,
|
easing = LinearEasing,
|
||||||
easing = LinearEasing,
|
),
|
||||||
),
|
|
||||||
label = "rotation",
|
label = "rotation",
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -732,10 +730,9 @@ fun MainScreen(
|
|||||||
Route.Permissions.route,
|
Route.Permissions.route,
|
||||||
content = {
|
content = {
|
||||||
PermissionsScreen(
|
PermissionsScreen(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxSize()
|
||||||
.fillMaxSize()
|
.padding(padding),
|
||||||
.padding(padding),
|
|
||||||
account = account,
|
account = account,
|
||||||
accountStateViewModel = accountStateViewModel,
|
accountStateViewModel = accountStateViewModel,
|
||||||
navController = navController,
|
navController = navController,
|
||||||
@@ -763,9 +760,9 @@ fun MainScreen(
|
|||||||
content = {
|
content = {
|
||||||
EditPermission(
|
EditPermission(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(padding),
|
.padding(padding),
|
||||||
account = account,
|
account = account,
|
||||||
accountStateViewModel = accountStateViewModel,
|
accountStateViewModel = accountStateViewModel,
|
||||||
selectedPackage = it.arguments?.getString("packageName")!!,
|
selectedPackage = it.arguments?.getString("packageName")!!,
|
||||||
|
|||||||
@@ -40,11 +40,10 @@ fun QrCodeDrawer(
|
|||||||
val foregroundColor = Color.Black
|
val foregroundColor = Color.Black
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier =
|
modifier = modifier
|
||||||
modifier
|
.defaultMinSize(48.dp, 48.dp)
|
||||||
.defaultMinSize(48.dp, 48.dp)
|
.aspectRatio(1f)
|
||||||
.aspectRatio(1f)
|
.background(Color.White),
|
||||||
.background(Color.White),
|
|
||||||
) {
|
) {
|
||||||
Canvas(modifier = Modifier.fillMaxSize()) {
|
Canvas(modifier = Modifier.fillMaxSize()) {
|
||||||
// Calculate the height and width of each column/row
|
// Calculate the height and width of each column/row
|
||||||
@@ -55,22 +54,20 @@ fun QrCodeDrawer(
|
|||||||
// of the number of rows/columns to the width and height
|
// of the number of rows/columns to the width and height
|
||||||
drawQrCodeFinders(
|
drawQrCodeFinders(
|
||||||
sideLength = size.width,
|
sideLength = size.width,
|
||||||
finderPatternSize =
|
finderPatternSize = Size(
|
||||||
Size(
|
width = columnWidth * FINDER_PATTERN_ROW_COUNT,
|
||||||
width = columnWidth * FINDER_PATTERN_ROW_COUNT,
|
height = rowHeight * FINDER_PATTERN_ROW_COUNT,
|
||||||
height = rowHeight * FINDER_PATTERN_ROW_COUNT,
|
),
|
||||||
),
|
|
||||||
color = foregroundColor,
|
color = foregroundColor,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Draw data bits (encoded data part)
|
// Draw data bits (encoded data part)
|
||||||
drawAllQrCodeDataBits(
|
drawAllQrCodeDataBits(
|
||||||
bytes = qrCode.matrix,
|
bytes = qrCode.matrix,
|
||||||
size =
|
size = Size(
|
||||||
Size(
|
width = columnWidth,
|
||||||
width = columnWidth,
|
height = rowHeight,
|
||||||
height = rowHeight,
|
),
|
||||||
),
|
|
||||||
color = foregroundColor,
|
color = foregroundColor,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -108,33 +105,29 @@ fun DrawScope.drawAllQrCodeDataBits(
|
|||||||
// data bits between top left finder pattern and top right finder pattern.
|
// data bits between top left finder pattern and top right finder pattern.
|
||||||
Pair(
|
Pair(
|
||||||
first = Coordinate(first = FINDER_PATTERN_ROW_COUNT, second = 0),
|
first = Coordinate(first = FINDER_PATTERN_ROW_COUNT, second = 0),
|
||||||
second =
|
second = Coordinate(
|
||||||
Coordinate(
|
first = (bytes.width - FINDER_PATTERN_ROW_COUNT),
|
||||||
first = (bytes.width - FINDER_PATTERN_ROW_COUNT),
|
second = FINDER_PATTERN_ROW_COUNT,
|
||||||
second = FINDER_PATTERN_ROW_COUNT,
|
),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
// data bits below top left finder pattern and above bottom left finder pattern.
|
// data bits below top left finder pattern and above bottom left finder pattern.
|
||||||
Pair(
|
Pair(
|
||||||
first = Coordinate(first = 0, second = FINDER_PATTERN_ROW_COUNT),
|
first = Coordinate(first = 0, second = FINDER_PATTERN_ROW_COUNT),
|
||||||
second =
|
second = Coordinate(
|
||||||
Coordinate(
|
first = bytes.width,
|
||||||
first = bytes.width,
|
second = bytes.height - FINDER_PATTERN_ROW_COUNT,
|
||||||
second = bytes.height - FINDER_PATTERN_ROW_COUNT,
|
),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
// data bits to the right of the bottom left finder pattern.
|
// data bits to the right of the bottom left finder pattern.
|
||||||
Pair(
|
Pair(
|
||||||
first =
|
first = Coordinate(
|
||||||
Coordinate(
|
first = FINDER_PATTERN_ROW_COUNT,
|
||||||
first = FINDER_PATTERN_ROW_COUNT,
|
second = (bytes.height - FINDER_PATTERN_ROW_COUNT),
|
||||||
second = (bytes.height - FINDER_PATTERN_ROW_COUNT),
|
),
|
||||||
),
|
second = Coordinate(
|
||||||
second =
|
first = bytes.width,
|
||||||
Coordinate(
|
second = bytes.height,
|
||||||
first = bytes.width,
|
),
|
||||||
second = bytes.height,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
).forEach { section ->
|
).forEach { section ->
|
||||||
for (y in section.first.second until section.second.second) {
|
for (y in section.first.second until section.second.second) {
|
||||||
@@ -142,20 +135,19 @@ fun DrawScope.drawAllQrCodeDataBits(
|
|||||||
if (bytes[x, y] == 1.toByte()) {
|
if (bytes[x, y] == 1.toByte()) {
|
||||||
drawPath(
|
drawPath(
|
||||||
color = color,
|
color = color,
|
||||||
path =
|
path = newPath {
|
||||||
newPath {
|
addRect(
|
||||||
addRect(
|
rect =
|
||||||
rect =
|
Rect(
|
||||||
Rect(
|
offset =
|
||||||
offset =
|
Offset(
|
||||||
Offset(
|
x = QR_MARGIN_PX + x * size.width,
|
||||||
x = QR_MARGIN_PX + x * size.width,
|
y = QR_MARGIN_PX + y * size.height,
|
||||||
y = QR_MARGIN_PX + y * size.height,
|
),
|
||||||
),
|
size = size,
|
||||||
size = size,
|
),
|
||||||
),
|
)
|
||||||
)
|
},
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,56 +202,55 @@ private fun DrawScope.drawQrCodeFinder(
|
|||||||
) {
|
) {
|
||||||
drawPath(
|
drawPath(
|
||||||
color = color,
|
color = color,
|
||||||
path =
|
path = newPath {
|
||||||
newPath {
|
// Draw the outer rectangle for the finder pattern.
|
||||||
// Draw the outer rectangle for the finder pattern.
|
addRoundRect(
|
||||||
addRoundRect(
|
roundRect =
|
||||||
roundRect =
|
RoundRect(
|
||||||
RoundRect(
|
rect =
|
||||||
rect =
|
Rect(
|
||||||
Rect(
|
offset = topLeft,
|
||||||
offset = topLeft,
|
size = finderPatternSize,
|
||||||
size = finderPatternSize,
|
),
|
||||||
),
|
cornerRadius = cornerRadius,
|
||||||
cornerRadius = cornerRadius,
|
),
|
||||||
),
|
)
|
||||||
)
|
|
||||||
|
|
||||||
// Draw background for the finder pattern interior (this keeps the arc ratio consistent).
|
// Draw background for the finder pattern interior (this keeps the arc ratio consistent).
|
||||||
val innerBackgroundOffset =
|
val innerBackgroundOffset =
|
||||||
Offset(
|
Offset(
|
||||||
x = finderPatternSize.width * INTERIOR_BACKGROUND_EXTERIOR_OFFSET_RATIO,
|
x = finderPatternSize.width * INTERIOR_BACKGROUND_EXTERIOR_OFFSET_RATIO,
|
||||||
y = finderPatternSize.height * INTERIOR_BACKGROUND_EXTERIOR_OFFSET_RATIO,
|
y = finderPatternSize.height * INTERIOR_BACKGROUND_EXTERIOR_OFFSET_RATIO,
|
||||||
)
|
|
||||||
addRoundRect(
|
|
||||||
roundRect =
|
|
||||||
RoundRect(
|
|
||||||
rect =
|
|
||||||
Rect(
|
|
||||||
offset = topLeft + innerBackgroundOffset,
|
|
||||||
size = finderPatternSize * INTERIOR_BACKGROUND_EXTERIOR_SHAPE_RATIO,
|
|
||||||
),
|
|
||||||
cornerRadius = cornerRadius * INTERIOR_BACKGROUND_EXTERIOR_SHAPE_CORNER_RADIUS,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
addRoundRect(
|
||||||
|
roundRect =
|
||||||
|
RoundRect(
|
||||||
|
rect =
|
||||||
|
Rect(
|
||||||
|
offset = topLeft + innerBackgroundOffset,
|
||||||
|
size = finderPatternSize * INTERIOR_BACKGROUND_EXTERIOR_SHAPE_RATIO,
|
||||||
|
),
|
||||||
|
cornerRadius = cornerRadius * INTERIOR_BACKGROUND_EXTERIOR_SHAPE_CORNER_RADIUS,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
// Draw the inner rectangle for the finder pattern.
|
// Draw the inner rectangle for the finder pattern.
|
||||||
val innerRectOffset =
|
val innerRectOffset =
|
||||||
Offset(
|
Offset(
|
||||||
x = finderPatternSize.width * INTERIOR_EXTERIOR_OFFSET_RATIO,
|
x = finderPatternSize.width * INTERIOR_EXTERIOR_OFFSET_RATIO,
|
||||||
y = finderPatternSize.height * INTERIOR_EXTERIOR_OFFSET_RATIO,
|
y = finderPatternSize.height * INTERIOR_EXTERIOR_OFFSET_RATIO,
|
||||||
)
|
|
||||||
addRoundRect(
|
|
||||||
roundRect =
|
|
||||||
RoundRect(
|
|
||||||
rect =
|
|
||||||
Rect(
|
|
||||||
offset = topLeft + innerRectOffset,
|
|
||||||
size = finderPatternSize * INTERIOR_EXTERIOR_SHAPE_RATIO,
|
|
||||||
),
|
|
||||||
cornerRadius = cornerRadius * INTERIOR_EXTERIOR_SHAPE_CORNER_RADIUS,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
},
|
addRoundRect(
|
||||||
|
roundRect =
|
||||||
|
RoundRect(
|
||||||
|
rect =
|
||||||
|
Rect(
|
||||||
|
offset = topLeft + innerRectOffset,
|
||||||
|
size = finderPatternSize * INTERIOR_EXTERIOR_SHAPE_RATIO,
|
||||||
|
),
|
||||||
|
cornerRadius = cornerRadius * INTERIOR_EXTERIOR_SHAPE_CORNER_RADIUS,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ import com.greenart7c3.nostrsigner.ui.components.PostButton
|
|||||||
import com.greenart7c3.nostrsigner.ui.components.TextSpinner
|
import com.greenart7c3.nostrsigner.ui.components.TextSpinner
|
||||||
import com.greenart7c3.nostrsigner.ui.components.TitleExplainer
|
import com.greenart7c3.nostrsigner.ui.components.TitleExplainer
|
||||||
import com.vitorpamplona.quartz.encoders.toNpub
|
import com.vitorpamplona.quartz.encoders.toNpub
|
||||||
|
import java.io.IOException
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
import kotlinx.collections.immutable.ImmutableMap
|
import kotlinx.collections.immutable.ImmutableMap
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
@@ -79,7 +80,6 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.xmlpull.v1.XmlPullParser
|
import org.xmlpull.v1.XmlPullParser
|
||||||
import org.xmlpull.v1.XmlPullParserException
|
import org.xmlpull.v1.XmlPullParserException
|
||||||
import java.io.IOException
|
|
||||||
|
|
||||||
fun Context.getLocaleListFromXml(): LocaleListCompat {
|
fun Context.getLocaleListFromXml(): LocaleListCompat {
|
||||||
val tagsList = mutableListOf<CharSequence>()
|
val tagsList = mutableListOf<CharSequence>()
|
||||||
@@ -377,12 +377,11 @@ fun SettingsScreen(
|
|||||||
.padding(16.dp),
|
.padding(16.dp),
|
||||||
) {
|
) {
|
||||||
IconRow(
|
IconRow(
|
||||||
title =
|
title = if (checked) {
|
||||||
if (checked) {
|
stringResource(R.string.disconnect_from_your_orbot_setup)
|
||||||
stringResource(R.string.disconnect_from_your_orbot_setup)
|
} else {
|
||||||
} else {
|
stringResource(R.string.connect_via_tor_short)
|
||||||
stringResource(R.string.connect_via_tor_short)
|
},
|
||||||
},
|
|
||||||
icon = R.drawable.ic_tor,
|
icon = R.drawable.ic_tor,
|
||||||
tint = MaterialTheme.colorScheme.onBackground,
|
tint = MaterialTheme.colorScheme.onBackground,
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
@@ -408,16 +407,14 @@ fun SettingsScreen(
|
|||||||
fullText = "v${BuildConfig.VERSION_NAME}\n\n${context.getString(
|
fullText = "v${BuildConfig.VERSION_NAME}\n\n${context.getString(
|
||||||
R.string.support_development,
|
R.string.support_development,
|
||||||
)}\n\n${context.getString(R.string.source_code)}",
|
)}\n\n${context.getString(R.string.source_code)}",
|
||||||
hyperLinks =
|
hyperLinks = mutableMapOf(
|
||||||
mutableMapOf(
|
stringResource(R.string.source_code) to stringResource(R.string.amber_github_uri),
|
||||||
stringResource(R.string.source_code) to stringResource(R.string.amber_github_uri),
|
stringResource(R.string.support_development) to stringResource(R.string.support_development_uri),
|
||||||
stringResource(R.string.support_development) to stringResource(R.string.support_development_uri),
|
),
|
||||||
),
|
textStyle = TextStyle(
|
||||||
textStyle =
|
textAlign = TextAlign.Center,
|
||||||
TextStyle(
|
color = MaterialTheme.colorScheme.inverseSurface,
|
||||||
textAlign = TextAlign.Center,
|
),
|
||||||
color = MaterialTheme.colorScheme.inverseSurface,
|
|
||||||
),
|
|
||||||
linkTextColor = MaterialTheme.colorScheme.primary,
|
linkTextColor = MaterialTheme.colorScheme.primary,
|
||||||
linkTextDecoration = TextDecoration.Underline,
|
linkTextDecoration = TextDecoration.Underline,
|
||||||
fontSize = 18.sp,
|
fontSize = 18.sp,
|
||||||
@@ -512,10 +509,9 @@ fun SettingsRow(
|
|||||||
placeholder = selectedItems[selectedIndex].title,
|
placeholder = selectedItems[selectedIndex].title,
|
||||||
options = selectedItems,
|
options = selectedItems,
|
||||||
onSelect = onSelect,
|
onSelect = onSelect,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.windowInsetsPadding(WindowInsets(0.dp, 0.dp, 0.dp, 0.dp))
|
||||||
.windowInsetsPadding(WindowInsets(0.dp, 0.dp, 0.dp, 0.dp))
|
.weight(1f),
|
||||||
.weight(1f),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,20 +93,20 @@ fun AccountBackupDialog(
|
|||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxSize(),
|
.fillMaxSize(),
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.background(MaterialTheme.colorScheme.background)
|
.background(MaterialTheme.colorScheme.background)
|
||||||
.fillMaxSize(),
|
.fillMaxSize(),
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(10.dp),
|
.padding(10.dp),
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
@@ -115,9 +115,9 @@ fun AccountBackupDialog(
|
|||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.padding(horizontal = 30.dp)
|
.padding(horizontal = 30.dp)
|
||||||
.verticalScroll(rememberScrollState()),
|
.verticalScroll(rememberScrollState()),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
) {
|
) {
|
||||||
val content = stringResource(R.string.account_backup_tips_md)
|
val content = stringResource(R.string.account_backup_tips_md)
|
||||||
@@ -168,20 +168,19 @@ fun AccountBackupDialog(
|
|||||||
LocalAutofillTree.current += autofillNode
|
LocalAutofillTree.current += autofillNode
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.onGloballyPositioned { coordinates ->
|
||||||
.onGloballyPositioned { coordinates ->
|
autofillNode.boundingBox = coordinates.boundsInWindow()
|
||||||
autofillNode.boundingBox = coordinates.boundsInWindow()
|
}
|
||||||
}
|
.onFocusChanged { focusState ->
|
||||||
.onFocusChanged { focusState ->
|
autofill?.run {
|
||||||
autofill?.run {
|
if (focusState.isFocused) {
|
||||||
if (focusState.isFocused) {
|
requestAutofillForNode(autofillNode)
|
||||||
requestAutofillForNode(autofillNode)
|
} else {
|
||||||
} else {
|
cancelAutofillForNode(autofillNode)
|
||||||
cancelAutofillForNode(autofillNode)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
},
|
||||||
value = password.value,
|
value = password.value,
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
password.value = it
|
password.value = it
|
||||||
@@ -189,12 +188,11 @@ fun AccountBackupDialog(
|
|||||||
errorMessage = ""
|
errorMessage = ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
keyboardOptions =
|
keyboardOptions = KeyboardOptions(
|
||||||
KeyboardOptions(
|
autoCorrect = false,
|
||||||
autoCorrect = false,
|
keyboardType = KeyboardType.Password,
|
||||||
keyboardType = KeyboardType.Password,
|
imeAction = ImeAction.Go,
|
||||||
imeAction = ImeAction.Go,
|
),
|
||||||
),
|
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.ncryptsec_password),
|
text = stringResource(R.string.ncryptsec_password),
|
||||||
@@ -204,22 +202,19 @@ fun AccountBackupDialog(
|
|||||||
Row {
|
Row {
|
||||||
IconButton(onClick = { showCharsPassword = !showCharsPassword }) {
|
IconButton(onClick = { showCharsPassword = !showCharsPassword }) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector =
|
imageVector = if (showCharsPassword) Icons.Outlined.VisibilityOff else Icons.Outlined.Visibility,
|
||||||
if (showCharsPassword) Icons.Outlined.VisibilityOff else Icons.Outlined.Visibility,
|
contentDescription = if (showCharsPassword) {
|
||||||
contentDescription =
|
stringResource(R.string.show_password)
|
||||||
if (showCharsPassword) {
|
} else {
|
||||||
stringResource(R.string.show_password)
|
stringResource(
|
||||||
} else {
|
R.string.hide_password,
|
||||||
stringResource(
|
)
|
||||||
R.string.hide_password,
|
},
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
visualTransformation =
|
visualTransformation = if (showCharsPassword) VisualTransformation.None else PasswordVisualTransformation(),
|
||||||
if (showCharsPassword) VisualTransformation.None else PasswordVisualTransformation(),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (errorMessage.isNotBlank()) {
|
if (errorMessage.isNotBlank()) {
|
||||||
@@ -311,16 +306,14 @@ fun QrCodeDialog(
|
|||||||
) {
|
) {
|
||||||
Surface(modifier = Modifier.fillMaxSize()) {
|
Surface(modifier = Modifier.fillMaxSize()) {
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.background(MaterialTheme.colorScheme.background)
|
||||||
.background(MaterialTheme.colorScheme.background)
|
.fillMaxSize(),
|
||||||
.fillMaxSize(),
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(10.dp),
|
||||||
.padding(10.dp),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
@@ -328,19 +321,17 @@ fun QrCodeDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxSize()
|
||||||
.fillMaxSize()
|
.padding(horizontal = 30.dp),
|
||||||
.padding(horizontal = 30.dp),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(horizontal = Size35dp),
|
||||||
.padding(horizontal = Size35dp),
|
|
||||||
) {
|
) {
|
||||||
QrCodeDrawer(content)
|
QrCodeDrawer(content)
|
||||||
}
|
}
|
||||||
@@ -452,18 +443,16 @@ private fun EncryptNSecCopyButton(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
shape = ButtonBorder,
|
shape = ButtonBorder,
|
||||||
colors =
|
colors = ButtonDefaults.buttonColors(
|
||||||
ButtonDefaults.buttonColors(
|
containerColor = MaterialTheme.colorScheme.primary,
|
||||||
containerColor = MaterialTheme.colorScheme.primary,
|
),
|
||||||
),
|
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp),
|
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp),
|
||||||
enabled = password.value.text.isNotBlank(),
|
enabled = password.value.text.isNotBlank(),
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
tint = MaterialTheme.colorScheme.onPrimary,
|
tint = MaterialTheme.colorScheme.onPrimary,
|
||||||
imageVector = Icons.Default.Key,
|
imageVector = Icons.Default.Key,
|
||||||
contentDescription =
|
contentDescription = stringResource(R.string.copies_the_nsec_id_your_password_to_the_clipboard_for_backup),
|
||||||
stringResource(R.string.copies_the_nsec_id_your_password_to_the_clipboard_for_backup),
|
|
||||||
modifier = Modifier.padding(end = 5.dp),
|
modifier = Modifier.padding(end = 5.dp),
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
@@ -521,18 +510,16 @@ private fun EncryptNSecQRButton(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
shape = ButtonBorder,
|
shape = ButtonBorder,
|
||||||
colors =
|
colors = ButtonDefaults.buttonColors(
|
||||||
ButtonDefaults.buttonColors(
|
containerColor = MaterialTheme.colorScheme.primary,
|
||||||
containerColor = MaterialTheme.colorScheme.primary,
|
),
|
||||||
),
|
|
||||||
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp),
|
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp),
|
||||||
enabled = password.value.text.isNotBlank(),
|
enabled = password.value.text.isNotBlank(),
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
tint = MaterialTheme.colorScheme.onPrimary,
|
tint = MaterialTheme.colorScheme.onPrimary,
|
||||||
imageVector = Icons.Default.QrCode,
|
imageVector = Icons.Default.QrCode,
|
||||||
contentDescription =
|
contentDescription = stringResource(R.string.shows_qr_code_with_you_private_key),
|
||||||
stringResource(R.string.shows_qr_code_with_you_private_key),
|
|
||||||
modifier = Modifier.padding(end = 5.dp),
|
modifier = Modifier.padding(end = 5.dp),
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@@ -76,10 +76,9 @@ fun AccountsBottomSheet(
|
|||||||
|
|
||||||
Column(modifier = Modifier.verticalScroll(scrollState)) {
|
Column(modifier = Modifier.verticalScroll(scrollState)) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(16.dp),
|
||||||
.padding(16.dp),
|
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
@@ -88,13 +87,12 @@ fun AccountsBottomSheet(
|
|||||||
accounts.forEach { acc ->
|
accounts.forEach { acc ->
|
||||||
val name = LocalPreferences.getAccountName(acc.npub)
|
val name = LocalPreferences.getAccountName(acc.npub)
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.clickable {
|
||||||
.clickable {
|
accountStateViewModel.switchUser(acc.npub, null)
|
||||||
accountStateViewModel.switchUser(acc.npub, null)
|
}
|
||||||
}
|
.padding(16.dp, 16.dp),
|
||||||
.padding(16.dp, 16.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
@@ -146,10 +144,9 @@ fun AccountsBottomSheet(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(16.dp),
|
||||||
.padding(16.dp),
|
|
||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
@@ -202,17 +199,15 @@ fun EditAccountDialog(
|
|||||||
) {
|
) {
|
||||||
Surface {
|
Surface {
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.background(MaterialTheme.colorScheme.background)
|
||||||
.background(MaterialTheme.colorScheme.background)
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(8.dp),
|
||||||
.padding(8.dp),
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(10.dp),
|
||||||
.padding(10.dp),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
@@ -230,9 +225,8 @@ fun EditAccountDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.padding(horizontal = 30.dp),
|
||||||
.padding(horizontal = 30.dp),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
) {
|
) {
|
||||||
|
|||||||
+25
-29
@@ -47,16 +47,14 @@ fun AdjustPermissionsDialog(
|
|||||||
) {
|
) {
|
||||||
Surface(modifier = Modifier.fillMaxSize()) {
|
Surface(modifier = Modifier.fillMaxSize()) {
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.background(MaterialTheme.colorScheme.background)
|
||||||
.background(MaterialTheme.colorScheme.background)
|
.fillMaxSize(),
|
||||||
.fillMaxSize(),
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(10.dp),
|
||||||
.padding(10.dp),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
@@ -75,16 +73,15 @@ fun AdjustPermissionsDialog(
|
|||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.padding(horizontal = 8.dp)
|
||||||
.padding(horizontal = 8.dp)
|
.clickable {
|
||||||
.clickable {
|
selectAll = !selectAll
|
||||||
selectAll = !selectAll
|
dialogPermissions =
|
||||||
dialogPermissions =
|
dialogPermissions.map { item ->
|
||||||
dialogPermissions.map { item ->
|
item.copy(checked = selectAll)
|
||||||
item.copy(checked = selectAll)
|
}
|
||||||
}
|
},
|
||||||
},
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
@@ -110,18 +107,17 @@ fun AdjustPermissionsDialog(
|
|||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.clickable {
|
||||||
.clickable {
|
dialogPermissions =
|
||||||
dialogPermissions =
|
dialogPermissions.mapIndexed { j, item ->
|
||||||
dialogPermissions.mapIndexed { j, item ->
|
if (it == j) {
|
||||||
if (it == j) {
|
item.copy(checked = !item.checked)
|
||||||
item.copy(checked = !item.checked)
|
} else {
|
||||||
} else {
|
item
|
||||||
item
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
|
|||||||
@@ -107,14 +107,13 @@ fun ConnectOrbotDialog(
|
|||||||
) {
|
) {
|
||||||
val myMarkDownStyle =
|
val myMarkDownStyle =
|
||||||
RichTextDefaults.copy(
|
RichTextDefaults.copy(
|
||||||
stringStyle =
|
stringStyle = RichTextDefaults.stringStyle?.copy(
|
||||||
RichTextDefaults.stringStyle?.copy(
|
linkStyle =
|
||||||
linkStyle =
|
SpanStyle(
|
||||||
SpanStyle(
|
textDecoration = TextDecoration.Underline,
|
||||||
textDecoration = TextDecoration.Underline,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
@@ -142,11 +141,10 @@ fun ConnectOrbotDialog(
|
|||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = portNumber.value,
|
value = portNumber.value,
|
||||||
onValueChange = { portNumber.value = it },
|
onValueChange = { portNumber.value = it },
|
||||||
keyboardOptions =
|
keyboardOptions = KeyboardOptions.Default.copy(
|
||||||
KeyboardOptions.Default.copy(
|
capitalization = KeyboardCapitalization.None,
|
||||||
capitalization = KeyboardCapitalization.None,
|
keyboardType = KeyboardType.Number,
|
||||||
keyboardType = KeyboardType.Number,
|
),
|
||||||
),
|
|
||||||
label = { Text(text = stringResource(R.string.orbot_socks_port)) },
|
label = { Text(text = stringResource(R.string.orbot_socks_port)) },
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(
|
Text(
|
||||||
@@ -175,10 +173,9 @@ fun UseOrbotButton(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
shape = ButtonBorder,
|
shape = ButtonBorder,
|
||||||
colors =
|
colors = ButtonDefaults.buttonColors(
|
||||||
ButtonDefaults.buttonColors(
|
containerColor = if (isActive) MaterialTheme.colorScheme.primary else Color.Gray,
|
||||||
containerColor = if (isActive) MaterialTheme.colorScheme.primary else Color.Gray,
|
),
|
||||||
),
|
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.use_orbot), color = Color.White)
|
Text(text = stringResource(R.string.use_orbot), color = Color.White)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,9 @@ fun LogoutDialog(
|
|||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
Text(
|
Text(
|
||||||
text =
|
text = stringResource(
|
||||||
stringResource(
|
R.string.logging_out_deletes_all_your_local_information_make_sure_to_have_your_private_keys_backed_up_to_avoid_losing_your_account_do_you_want_to_continue,
|
||||||
R.string.logging_out_deletes_all_your_local_information_make_sure_to_have_your_private_keys_backed_up_to_avoid_losing_your_account_do_you_want_to_continue,
|
),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onDismissRequest = {
|
onDismissRequest = {
|
||||||
|
|||||||
@@ -31,10 +31,9 @@ fun AcceptRejectButtons(
|
|||||||
Button(
|
Button(
|
||||||
shape = ButtonBorder,
|
shape = ButtonBorder,
|
||||||
onClick = onReject,
|
onClick = onReject,
|
||||||
colors =
|
colors = ButtonDefaults.buttonColors(
|
||||||
ButtonDefaults.buttonColors(
|
containerColor = Color(0xFF5A5554),
|
||||||
containerColor = Color(0xFF5A5554),
|
),
|
||||||
),
|
|
||||||
) {
|
) {
|
||||||
Text(stringResource(R.string.reject))
|
Text(stringResource(R.string.reject))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,9 +77,8 @@ fun EncryptDecryptData(
|
|||||||
Spacer(Modifier.size(4.dp))
|
Spacer(Modifier.size(4.dp))
|
||||||
if (!type.toString().contains("DECRYPT")) {
|
if (!type.toString().contains("DECRYPT")) {
|
||||||
Card(
|
Card(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth(),
|
||||||
.fillMaxWidth(),
|
|
||||||
) {
|
) {
|
||||||
Column(Modifier.padding(6.dp)) {
|
Column(Modifier.padding(6.dp)) {
|
||||||
Text(
|
Text(
|
||||||
@@ -91,10 +90,9 @@ fun EncryptDecryptData(
|
|||||||
content,
|
content,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(top = 8.dp),
|
||||||
.padding(top = 8.dp),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,9 +66,8 @@ fun EventData(
|
|||||||
val content = if (event.kind == 22242) AmberEvent.relay(event) else event.content
|
val content = if (event.kind == 22242) AmberEvent.relay(event) else event.content
|
||||||
if (content.isNotBlank()) {
|
if (content.isNotBlank()) {
|
||||||
Card(
|
Card(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth(),
|
||||||
.fillMaxWidth(),
|
|
||||||
) {
|
) {
|
||||||
Column(Modifier.padding(16.dp)) {
|
Column(Modifier.padding(16.dp)) {
|
||||||
Text(
|
Text(
|
||||||
@@ -79,10 +78,9 @@ fun EventData(
|
|||||||
content,
|
content,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(top = 8.dp),
|
||||||
.padding(top = 8.dp),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,13 +30,12 @@ fun HyperlinkText(
|
|||||||
val startIndex = fullText.indexOf(key)
|
val startIndex = fullText.indexOf(key)
|
||||||
val endIndex = startIndex + key.length
|
val endIndex = startIndex + key.length
|
||||||
addStyle(
|
addStyle(
|
||||||
style =
|
style = SpanStyle(
|
||||||
SpanStyle(
|
color = linkTextColor,
|
||||||
color = linkTextColor,
|
fontSize = fontSize,
|
||||||
fontSize = fontSize,
|
fontWeight = linkTextFontWeight,
|
||||||
fontWeight = linkTextFontWeight,
|
textDecoration = linkTextDecoration,
|
||||||
textDecoration = linkTextDecoration,
|
),
|
||||||
),
|
|
||||||
start = startIndex,
|
start = startIndex,
|
||||||
end = endIndex,
|
end = endIndex,
|
||||||
)
|
)
|
||||||
@@ -48,10 +47,9 @@ fun HyperlinkText(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
addStyle(
|
addStyle(
|
||||||
style =
|
style = SpanStyle(
|
||||||
SpanStyle(
|
fontSize = fontSize,
|
||||||
fontSize = fontSize,
|
),
|
||||||
),
|
|
||||||
start = 0,
|
start = 0,
|
||||||
end = fullText.length,
|
end = fullText.length,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -28,19 +28,17 @@ fun IconRow(
|
|||||||
onLongClick: (() -> Unit)? = null,
|
onLongClick: (() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.combinedClickable(
|
||||||
.combinedClickable(
|
onClick = onClick,
|
||||||
onClick = onClick,
|
onLongClick = onLongClick,
|
||||||
onLongClick = onLongClick,
|
),
|
||||||
),
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(vertical = 15.dp, horizontal = 25.dp),
|
||||||
.padding(vertical = 15.dp, horizontal = 25.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
@@ -70,19 +68,17 @@ fun IconRow(
|
|||||||
onLongClick: (() -> Unit)? = null,
|
onLongClick: (() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.combinedClickable(
|
||||||
.combinedClickable(
|
onClick = onClick,
|
||||||
onClick = onClick,
|
onLongClick = onLongClick,
|
||||||
onLongClick = onLongClick,
|
),
|
||||||
),
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(vertical = 15.dp, horizontal = 25.dp),
|
||||||
.padding(vertical = 15.dp, horizontal = 25.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
|
|||||||
@@ -141,9 +141,8 @@ fun LoginWithPubKey(
|
|||||||
onClick = {
|
onClick = {
|
||||||
showAdjustDialog = true
|
showAdjustDialog = true
|
||||||
},
|
},
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.padding(8.dp),
|
||||||
.padding(8.dp),
|
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(R.string.adjust))
|
Text(text = stringResource(R.string.adjust))
|
||||||
}
|
}
|
||||||
@@ -151,10 +150,9 @@ fun LoginWithPubKey(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button(
|
Button(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth(0.8f)
|
||||||
.fillMaxWidth(0.8f)
|
.padding(8.dp),
|
||||||
.padding(8.dp),
|
|
||||||
shape = ButtonBorder,
|
shape = ButtonBorder,
|
||||||
onClick = {
|
onClick = {
|
||||||
onAccept(localPermissions)
|
onAccept(localPermissions)
|
||||||
@@ -165,14 +163,13 @@ fun LoginWithPubKey(
|
|||||||
Spacer(modifier = Modifier.width(8.dp))
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
Button(
|
Button(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.padding(8.dp),
|
.padding(8.dp),
|
||||||
shape = ButtonBorder,
|
shape = ButtonBorder,
|
||||||
onClick = onReject,
|
onClick = onReject,
|
||||||
colors =
|
colors = ButtonDefaults.buttonColors(
|
||||||
ButtonDefaults.buttonColors(
|
containerColor = Color(0xFF5A5554),
|
||||||
containerColor = Color(0xFF5A5554),
|
),
|
||||||
),
|
|
||||||
) {
|
) {
|
||||||
Text(stringResource(R.string.reject))
|
Text(stringResource(R.string.reject))
|
||||||
}
|
}
|
||||||
|
|||||||
+41
-47
@@ -83,12 +83,11 @@ fun SelectAllButton(
|
|||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.padding(horizontal = 8.dp)
|
||||||
.padding(horizontal = 8.dp)
|
.clickable {
|
||||||
.clickable {
|
onSelected()
|
||||||
onSelected()
|
},
|
||||||
},
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
@@ -188,19 +187,18 @@ fun MultiEventHomeScreen(
|
|||||||
database
|
database
|
||||||
.applicationDao()
|
.applicationDao()
|
||||||
.getByKey(key) ?: ApplicationWithPermissions(
|
.getByKey(key) ?: ApplicationWithPermissions(
|
||||||
application =
|
application = ApplicationEntity(
|
||||||
ApplicationEntity(
|
key,
|
||||||
key,
|
applicationEntity?.application?.name?.ifBlank { applicationEntity.application.key.toShortenHex() } ?: "",
|
||||||
applicationEntity?.application?.name?.ifBlank { applicationEntity.application.key.toShortenHex() } ?: "",
|
listOf(),
|
||||||
listOf(),
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
localAccount.keyPair.pubKey.toHexKey(),
|
||||||
localAccount.keyPair.pubKey.toHexKey(),
|
true,
|
||||||
true,
|
intentData.bunkerRequest?.secret ?: "",
|
||||||
intentData.bunkerRequest?.secret ?: "",
|
intentData.bunkerRequest?.secret != null,
|
||||||
intentData.bunkerRequest?.secret != null,
|
),
|
||||||
),
|
|
||||||
permissions = mutableListOf(),
|
permissions = mutableListOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -260,19 +258,18 @@ fun MultiEventHomeScreen(
|
|||||||
database
|
database
|
||||||
.applicationDao()
|
.applicationDao()
|
||||||
.getByKey(key) ?: ApplicationWithPermissions(
|
.getByKey(key) ?: ApplicationWithPermissions(
|
||||||
application =
|
application = ApplicationEntity(
|
||||||
ApplicationEntity(
|
key,
|
||||||
key,
|
applicationEntity?.application?.name?.ifBlank { applicationEntity.application.key.toShortenHex() } ?: "",
|
||||||
applicationEntity?.application?.name?.ifBlank { applicationEntity.application.key.toShortenHex() } ?: "",
|
listOf(),
|
||||||
listOf(),
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
localAccount.keyPair.pubKey.toHexKey(),
|
||||||
localAccount.keyPair.pubKey.toHexKey(),
|
true,
|
||||||
true,
|
intentData.bunkerRequest?.secret ?: "",
|
||||||
intentData.bunkerRequest?.secret ?: "",
|
intentData.bunkerRequest?.secret != null,
|
||||||
intentData.bunkerRequest?.secret != null,
|
),
|
||||||
),
|
|
||||||
permissions = mutableListOf(),
|
permissions = mutableListOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -408,10 +405,9 @@ fun ListItem(
|
|||||||
|
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(4.dp),
|
||||||
.padding(4.dp),
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Default.run {
|
Icons.Default.run {
|
||||||
@@ -436,13 +432,12 @@ fun ListItem(
|
|||||||
}
|
}
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
text =
|
text = buildAnnotatedString {
|
||||||
buildAnnotatedString {
|
withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) {
|
||||||
withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) {
|
append(appName)
|
||||||
append(appName)
|
}
|
||||||
}
|
append(" $text")
|
||||||
append(" $text")
|
},
|
||||||
},
|
|
||||||
fontSize = 18.sp,
|
fontSize = 18.sp,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -476,10 +471,9 @@ fun ListItem(
|
|||||||
content,
|
content,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.fillMaxWidth()
|
||||||
.fillMaxWidth()
|
.padding(top = 8.dp),
|
||||||
.padding(top = 8.dp),
|
|
||||||
)
|
)
|
||||||
RememberMyChoice(
|
RememberMyChoice(
|
||||||
shouldRunOnAccept = false,
|
shouldRunOnAccept = false,
|
||||||
|
|||||||
@@ -41,9 +41,8 @@ fun RawJson(
|
|||||||
}
|
}
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
modifier =
|
modifier = modifier
|
||||||
modifier
|
.fillMaxWidth(),
|
||||||
.fillMaxWidth(),
|
|
||||||
value = TextFieldValue(currentContent),
|
value = TextFieldValue(currentContent),
|
||||||
onValueChange = { },
|
onValueChange = { },
|
||||||
readOnly = true,
|
readOnly = true,
|
||||||
|
|||||||
@@ -29,11 +29,10 @@ fun RememberMyChoice(
|
|||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.clickable {
|
||||||
.clickable {
|
onChanged()
|
||||||
onChanged()
|
},
|
||||||
},
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
|
|||||||
+36
-39
@@ -142,19 +142,18 @@ fun SingleEventHomeScreen(
|
|||||||
val relays = intentData.bunkerRequest?.relays ?: listOf()
|
val relays = intentData.bunkerRequest?.relays ?: listOf()
|
||||||
val application =
|
val application =
|
||||||
savedApplication ?: ApplicationWithPermissions(
|
savedApplication ?: ApplicationWithPermissions(
|
||||||
application =
|
application = ApplicationEntity(
|
||||||
ApplicationEntity(
|
key,
|
||||||
key,
|
appName,
|
||||||
appName,
|
relays,
|
||||||
relays,
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
account.keyPair.pubKey.toHexKey(),
|
||||||
account.keyPair.pubKey.toHexKey(),
|
true,
|
||||||
true,
|
intentData.bunkerRequest?.secret ?: "",
|
||||||
intentData.bunkerRequest?.secret ?: "",
|
intentData.bunkerRequest?.secret != null,
|
||||||
intentData.bunkerRequest?.secret != null,
|
),
|
||||||
),
|
|
||||||
permissions = mutableListOf(),
|
permissions = mutableListOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -264,19 +263,18 @@ fun SingleEventHomeScreen(
|
|||||||
val relays = intentData.bunkerRequest?.relays ?: listOf()
|
val relays = intentData.bunkerRequest?.relays ?: listOf()
|
||||||
val application =
|
val application =
|
||||||
savedApplication ?: ApplicationWithPermissions(
|
savedApplication ?: ApplicationWithPermissions(
|
||||||
application =
|
application = ApplicationEntity(
|
||||||
ApplicationEntity(
|
key,
|
||||||
key,
|
appName,
|
||||||
appName,
|
relays,
|
||||||
relays,
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
account.keyPair.pubKey.toHexKey(),
|
||||||
account.keyPair.pubKey.toHexKey(),
|
true,
|
||||||
true,
|
intentData.bunkerRequest?.secret ?: "",
|
||||||
intentData.bunkerRequest?.secret ?: "",
|
intentData.bunkerRequest?.secret != null,
|
||||||
intentData.bunkerRequest?.secret != null,
|
),
|
||||||
),
|
|
||||||
permissions = mutableListOf(),
|
permissions = mutableListOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -417,19 +415,18 @@ fun SingleEventHomeScreen(
|
|||||||
val relays = intentData.bunkerRequest?.relays ?: listOf()
|
val relays = intentData.bunkerRequest?.relays ?: listOf()
|
||||||
val application =
|
val application =
|
||||||
savedApplication ?: ApplicationWithPermissions(
|
savedApplication ?: ApplicationWithPermissions(
|
||||||
application =
|
application = ApplicationEntity(
|
||||||
ApplicationEntity(
|
key,
|
||||||
key,
|
appName,
|
||||||
appName,
|
relays,
|
||||||
relays,
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
account.keyPair.pubKey.toHexKey(),
|
||||||
account.keyPair.pubKey.toHexKey(),
|
true,
|
||||||
true,
|
intentData.bunkerRequest?.secret ?: "",
|
||||||
intentData.bunkerRequest?.secret ?: "",
|
intentData.bunkerRequest?.secret != null,
|
||||||
intentData.bunkerRequest?.secret != null,
|
),
|
||||||
),
|
|
||||||
permissions = mutableListOf(),
|
permissions = mutableListOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -102,14 +102,13 @@ fun TextSpinner(
|
|||||||
remember { Modifier.fillMaxWidth().focusRequester(focusRequester) },
|
remember { Modifier.fillMaxWidth().focusRequester(focusRequester) },
|
||||||
)
|
)
|
||||||
Box(
|
Box(
|
||||||
modifier =
|
modifier = Modifier.matchParentSize().clickable(
|
||||||
Modifier.matchParentSize().clickable(
|
interactionSource = interactionSource,
|
||||||
interactionSource = interactionSource,
|
indication = null,
|
||||||
indication = null,
|
) {
|
||||||
) {
|
optionsShowing = true
|
||||||
optionsShowing = true
|
focusRequester.requestFocus()
|
||||||
focusRequester.requestFocus()
|
},
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,9 @@ import androidx.compose.ui.unit.sp
|
|||||||
// Set of Material typography styles to start with
|
// Set of Material typography styles to start with
|
||||||
val Typography =
|
val Typography =
|
||||||
Typography(
|
Typography(
|
||||||
bodyLarge =
|
bodyLarge = TextStyle(
|
||||||
TextStyle(
|
fontFamily = FontFamily.Default,
|
||||||
fontFamily = FontFamily.Default,
|
fontWeight = FontWeight.Normal,
|
||||||
fontWeight = FontWeight.Normal,
|
fontSize = 16.sp,
|
||||||
fontSize = 16.sp,
|
),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ import com.greenart7c3.nostrsigner.LocalPreferences
|
|||||||
import com.greenart7c3.nostrsigner.service.NotificationUtils.getOrCreateDMChannel
|
import com.greenart7c3.nostrsigner.service.NotificationUtils.getOrCreateDMChannel
|
||||||
import com.vitorpamplona.quartz.events.Event
|
import com.vitorpamplona.quartz.events.Event
|
||||||
import com.vitorpamplona.quartz.events.GiftWrapEvent
|
import com.vitorpamplona.quartz.events.GiftWrapEvent
|
||||||
|
import kotlin.time.measureTimedValue
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.SupervisorJob
|
import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.cancel
|
import kotlinx.coroutines.cancel
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlin.time.measureTimedValue
|
|
||||||
|
|
||||||
class Notifications : FirebaseMessagingService() {
|
class Notifications : FirebaseMessagingService() {
|
||||||
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
||||||
|
|||||||
Reference in New Issue
Block a user