mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 19:08:23 +00:00
Update dependencies and gradle wrapper, and apply linting fixes
- Update Gradle to 9.3.1 and AGP to 9.1.0. - Upgrade library versions: ktlint (14.1.0), mockk (1.14.9), and coroutinesTest (1.10.2). - Apply code style improvements including trailing commas, optimized imports, and removal of redundant blank lines across several UI components and services. - Refactor `SecureCryptoHelper.isStrongboxSupported()` for better readability.
This commit is contained in:
@@ -24,7 +24,6 @@ import com.greenart7c3.nostrsigner.models.AmberSettings
|
|||||||
import com.greenart7c3.nostrsigner.models.FeedbackType
|
import com.greenart7c3.nostrsigner.models.FeedbackType
|
||||||
import com.greenart7c3.nostrsigner.okhttp.HttpClientManager
|
import com.greenart7c3.nostrsigner.okhttp.HttpClientManager
|
||||||
import com.greenart7c3.nostrsigner.okhttp.OkHttpWebSocket
|
import com.greenart7c3.nostrsigner.okhttp.OkHttpWebSocket
|
||||||
import com.greenart7c3.nostrsigner.relays.AmberListenerSingleton
|
|
||||||
import com.greenart7c3.nostrsigner.relays.AmberRelayStats
|
import com.greenart7c3.nostrsigner.relays.AmberRelayStats
|
||||||
import com.greenart7c3.nostrsigner.relays.NostrClientLoggerListener
|
import com.greenart7c3.nostrsigner.relays.NostrClientLoggerListener
|
||||||
import com.greenart7c3.nostrsigner.service.ClearLogsWorker
|
import com.greenart7c3.nostrsigner.service.ClearLogsWorker
|
||||||
@@ -45,6 +44,12 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
|||||||
import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent
|
import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent
|
||||||
import com.vitorpamplona.quartz.nip34Git.repository.GitRepositoryEvent
|
import com.vitorpamplona.quartz.nip34Git.repository.GitRepositoryEvent
|
||||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||||
|
import java.lang.ref.WeakReference
|
||||||
|
import java.net.InetSocketAddress
|
||||||
|
import java.net.Socket
|
||||||
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
import kotlin.coroutines.cancellation.CancellationException
|
||||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@@ -53,12 +58,6 @@ import kotlinx.coroutines.cancel
|
|||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.lang.ref.WeakReference
|
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import java.net.Socket
|
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
import kotlin.coroutines.cancellation.CancellationException
|
|
||||||
|
|
||||||
class Amber :
|
class Amber :
|
||||||
Application(),
|
Application(),
|
||||||
@@ -120,6 +119,7 @@ class Amber :
|
|||||||
val isOnWifiDataState = mutableStateOf(false)
|
val isOnWifiDataState = mutableStateOf(false)
|
||||||
val isOnOfflineState = mutableStateOf(false)
|
val isOnOfflineState = mutableStateOf(false)
|
||||||
private val isStartingApp = MutableStateFlow(false)
|
private val isStartingApp = MutableStateFlow(false)
|
||||||
|
|
||||||
@Volatile var intentionalDisconnectTime = 0L
|
@Volatile var intentionalDisconnectTime = 0L
|
||||||
val isStartingAppState = isStartingApp
|
val isStartingAppState = isStartingApp
|
||||||
val notificationCache = LruCache<String, Long>(10)
|
val notificationCache = LruCache<String, Long>(10)
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ fun Context.hasStrongBox(): Boolean {
|
|||||||
Build.BOARD.lowercase().contains("mt") ||
|
Build.BOARD.lowercase().contains("mt") ||
|
||||||
(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && Build.SOC_MANUFACTURER.lowercase().contains("mediatek")) // usually mediatek contains broken strongbox support
|
(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && Build.SOC_MANUFACTURER.lowercase().contains("mediatek")) // usually mediatek contains broken strongbox support
|
||||||
|
|
||||||
return !isMediaTek && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P &&
|
return !isMediaTek &&
|
||||||
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.P &&
|
||||||
packageManager.hasSystemFeature(PackageManager.FEATURE_STRONGBOX_KEYSTORE)
|
packageManager.hasSystemFeature(PackageManager.FEATURE_STRONGBOX_KEYSTORE)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class SignerActivity : AppCompatActivity() {
|
|||||||
sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
|
sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
|
||||||
containerColor = MaterialTheme.colorScheme.background,
|
containerColor = MaterialTheme.colorScheme.background,
|
||||||
scrimColor = Color.Transparent,
|
scrimColor = Color.Transparent,
|
||||||
dragHandle = { BottomSheetDefaults.DragHandle() }
|
dragHandle = { BottomSheetDefaults.DragHandle() },
|
||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
@@ -157,7 +157,7 @@ class SignerActivity : AppCompatActivity() {
|
|||||||
mainViewModel = mainViewModel,
|
mainViewModel = mainViewModel,
|
||||||
bunkerRequests = bunkerRequests.value,
|
bunkerRequests = bunkerRequests.value,
|
||||||
navController = navController,
|
navController = navController,
|
||||||
isExternalRequest = true
|
isExternalRequest = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package com.greenart7c3.nostrsigner.relays
|
|||||||
|
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.util.Log
|
||||||
import com.greenart7c3.nostrsigner.Amber
|
import com.greenart7c3.nostrsigner.Amber
|
||||||
|
import com.greenart7c3.nostrsigner.BuildConfig
|
||||||
import com.greenart7c3.nostrsigner.BuildFlavorChecker
|
import com.greenart7c3.nostrsigner.BuildFlavorChecker
|
||||||
import com.greenart7c3.nostrsigner.LocalPreferences
|
import com.greenart7c3.nostrsigner.LocalPreferences
|
||||||
import com.greenart7c3.nostrsigner.database.LogEntity
|
import com.greenart7c3.nostrsigner.database.LogEntity
|
||||||
@@ -13,8 +15,6 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.single.IRelayClient
|
|||||||
import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.Message
|
import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.Message
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.OkMessage
|
import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.OkMessage
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.Command
|
import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.Command
|
||||||
import android.util.Log
|
|
||||||
import com.greenart7c3.nostrsigner.BuildConfig
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ class BootReceiver : BroadcastReceiver() {
|
|||||||
|
|
||||||
when (intent.action) {
|
when (intent.action) {
|
||||||
Intent.ACTION_MY_PACKAGE_REPLACED,
|
Intent.ACTION_MY_PACKAGE_REPLACED,
|
||||||
Intent.ACTION_BOOT_COMPLETED -> {
|
Intent.ACTION_BOOT_COMPLETED,
|
||||||
|
-> {
|
||||||
Log.d(Amber.TAG, "Received ${intent.action}")
|
Log.d(Amber.TAG, "Received ${intent.action}")
|
||||||
Amber.instance.applicationIOScope.launch {
|
Amber.instance.applicationIOScope.launch {
|
||||||
Amber.instance.isStartingAppState.first { !it }
|
Amber.instance.isStartingAppState.first { !it }
|
||||||
|
|||||||
@@ -968,7 +968,6 @@ fun LoginPage(
|
|||||||
isLoading = false
|
isLoading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -1053,7 +1052,6 @@ fun LoginPage(
|
|||||||
isLoading = false
|
isLoading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ fun MainScreen(
|
|||||||
Route.IncomingRequest.route
|
Route.IncomingRequest.route
|
||||||
} else {
|
} else {
|
||||||
route.value ?: if (intents.isEmpty() && bunkerRequests.isEmpty()) Route.Applications.route else Route.IncomingRequest.route
|
route.value ?: if (intents.isEmpty() && bunkerRequests.isEmpty()) Route.Applications.route else Route.IncomingRequest.route
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
LaunchedEffect(Unit, route.value, intents, bunkerRequests, isExternalRequest) {
|
LaunchedEffect(Unit, route.value, intents, bunkerRequests, isExternalRequest) {
|
||||||
@@ -792,7 +792,7 @@ fun MainScreen(
|
|||||||
.padding(top = verticalPadding * 1.5f),
|
.padding(top = verticalPadding * 1.5f),
|
||||||
onBack = {
|
onBack = {
|
||||||
navController.popBackStack()
|
navController.popBackStack()
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerRequestSign
|
|||||||
@Composable
|
@Composable
|
||||||
fun SeeDetailsScreen(
|
fun SeeDetailsScreen(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onBack: () -> Unit
|
onBack: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
Column(
|
Column(
|
||||||
@@ -54,7 +54,7 @@ fun SeeDetailsScreen(
|
|||||||
Column(
|
Column(
|
||||||
Modifier
|
Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.verticalScroll(rememberScrollState())
|
.verticalScroll(rememberScrollState()),
|
||||||
) {
|
) {
|
||||||
var rememberType by remember { mutableStateOf(MultiEventScreenIntents.intents.firstOrNull()?.rememberType?.value ?: MultiEventScreenIntents.bunkerRequests.first().rememberType.value) }
|
var rememberType by remember { mutableStateOf(MultiEventScreenIntents.intents.firstOrNull()?.rememberType?.value ?: MultiEventScreenIntents.bunkerRequests.first().rememberType.value) }
|
||||||
val type = if (MultiEventScreenIntents.intents.isNotEmpty()) {
|
val type = if (MultiEventScreenIntents.intents.isNotEmpty()) {
|
||||||
@@ -240,7 +240,7 @@ fun SeeDetailsScreen(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(vertical = 16.dp),
|
.padding(vertical = 16.dp),
|
||||||
text = stringResource(R.string.go_back),
|
text = stringResource(R.string.go_back),
|
||||||
onClick = onBack
|
onClick = onBack,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ import com.greenart7c3.nostrsigner.models.defaultAppRelays
|
|||||||
import com.greenart7c3.nostrsigner.relays.AmberListenerSingleton
|
import com.greenart7c3.nostrsigner.relays.AmberListenerSingleton
|
||||||
import com.greenart7c3.nostrsigner.service.TrustScoreService
|
import com.greenart7c3.nostrsigner.service.TrustScoreService
|
||||||
import com.greenart7c3.nostrsigner.ui.CenterCircularProgressIndicator
|
import com.greenart7c3.nostrsigner.ui.CenterCircularProgressIndicator
|
||||||
import com.greenart7c3.nostrsigner.ui.ToastManager
|
|
||||||
import com.greenart7c3.nostrsigner.ui.RelayCard
|
import com.greenart7c3.nostrsigner.ui.RelayCard
|
||||||
|
import com.greenart7c3.nostrsigner.ui.ToastManager
|
||||||
import com.greenart7c3.nostrsigner.ui.components.AmberButton
|
import com.greenart7c3.nostrsigner.ui.components.AmberButton
|
||||||
import com.greenart7c3.nostrsigner.ui.components.TrustScoreBadge
|
import com.greenart7c3.nostrsigner.ui.components.TrustScoreBadge
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ import com.greenart7c3.nostrsigner.service.toShortenHex
|
|||||||
import com.greenart7c3.nostrsigner.ui.navigation.Route
|
import com.greenart7c3.nostrsigner.ui.navigation.Route
|
||||||
import com.greenart7c3.nostrsigner.ui.navigation.routes
|
import com.greenart7c3.nostrsigner.ui.navigation.routes
|
||||||
import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerRequestConnect
|
import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerRequestConnect
|
||||||
|
import java.util.Base64
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.util.Base64
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
-1
@@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.ButtonDefaults
|
import androidx.compose.material3.ButtonDefaults
|
||||||
import androidx.compose.material3.HorizontalDivider
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
|||||||
@@ -37,16 +37,16 @@ fun SigningAs(account: Account, modifier: Modifier = Modifier) {
|
|||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(vertical = 8.dp),
|
.padding(vertical = 8.dp),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.signing_as),
|
text = stringResource(R.string.signing_as),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
)
|
)
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(top = 4.dp),
|
modifier = Modifier.padding(top = 4.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
val profileUrl by account.picture.collectAsStateWithLifecycle()
|
val profileUrl by account.picture.collectAsStateWithLifecycle()
|
||||||
if (profileUrl.isNotBlank() && !BuildFlavorChecker.isOfflineFlavor()) {
|
if (profileUrl.isNotBlank() && !BuildFlavorChecker.isOfflineFlavor()) {
|
||||||
@@ -68,7 +68,7 @@ fun SigningAs(account: Account, modifier: Modifier = Modifier) {
|
|||||||
CircleShape,
|
CircleShape,
|
||||||
)
|
)
|
||||||
.height(30.dp)
|
.height(30.dp)
|
||||||
.width(30.dp)
|
.width(30.dp),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -83,7 +83,7 @@ fun SigningAs(account: Account, modifier: Modifier = Modifier) {
|
|||||||
CircleShape,
|
CircleShape,
|
||||||
)
|
)
|
||||||
.height(30.dp)
|
.height(30.dp)
|
||||||
.width(30.dp)
|
.width(30.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ fun SigningAs(account: Account, modifier: Modifier = Modifier) {
|
|||||||
modifier = Modifier.padding(start = 8.dp),
|
modifier = Modifier.padding(start = 8.dp),
|
||||||
text = name.ifBlank { account.npub.toShortenHex() },
|
text = name.ifBlank { account.npub.toShortenHex() },
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
style = MaterialTheme.typography.bodyMedium
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ zxingAndroidEmbedded = "4.3.0"
|
|||||||
okhttp = "5.3.2"
|
okhttp = "5.3.2"
|
||||||
kotlin = "2.3.10"
|
kotlin = "2.3.10"
|
||||||
workRuntimeKtx = "2.11.1"
|
workRuntimeKtx = "2.11.1"
|
||||||
agp = "9.0.1"
|
agp = "9.1.0"
|
||||||
ktlint = "14.0.1"
|
ktlint = "14.1.0"
|
||||||
ksp = "2.3.5"
|
ksp = "2.3.5"
|
||||||
coil = "3.4.0"
|
coil = "3.4.0"
|
||||||
storage = "2.2.0"
|
storage = "2.2.0"
|
||||||
@@ -29,8 +29,8 @@ jna = "5.18.1"
|
|||||||
materialIconsExtended = "1.7.8"
|
materialIconsExtended = "1.7.8"
|
||||||
collections = "0.4.0"
|
collections = "0.4.0"
|
||||||
pagingCommon = "3.4.1"
|
pagingCommon = "3.4.1"
|
||||||
mockk = "1.13.12"
|
mockk = "1.14.9"
|
||||||
coroutinesTest = "1.10.1"
|
coroutinesTest = "1.10.2"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" }
|
datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" }
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionSha256Sum=72f44c9f8ebcb1af43838f45ee5c4aa9c5444898b3468ab3f4af7b6076c5bc3f
|
distributionSha256Sum=b266d5ff6b90eada6dc3b20cb090e3731302e553a27c5d3e4df1f0d76beaff06
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
Reference in New Issue
Block a user