Skip to content

Commit cd799ce

Browse files
committed
chore: cleanup
1 parent 1d98732 commit cd799ce

4 files changed

Lines changed: 32 additions & 6 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ Set up local env:
6060

6161
Run `just list` to see available commands. The common ones are `just init`, `just compile`, `just run`, `just build`, `just release`, `just test`, `just lint`, and `just translations pull`. `just run` prefers a physical device and falls back to an emulator.
6262

63+
### Trezor Bridge In Android Studio
64+
65+
When testing the Trezor Bridge emulator from bitkit-docker through Android Studio, add these gitignored local values to `local.properties`:
66+
67+
```properties
68+
TREZOR_BRIDGE=true
69+
TREZOR_BRIDGE_URL=http://10.0.2.2:21325
70+
```
71+
72+
CLI builds can still pass the same values as environment variables.
73+
6374
### Lint
6475

6576
This project uses detekt with default ktlint and compose-rules for android code linting.

app/build.gradle.kts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@ val keystoreProperties by lazy {
4141
keystoreProperties
4242
}
4343

44+
val localProperties by lazy {
45+
Properties().apply {
46+
val localPropertiesFile = rootProject.file("local.properties")
47+
if (localPropertiesFile.exists()) {
48+
localPropertiesFile.inputStream().use { load(it) }
49+
}
50+
}
51+
}
52+
53+
fun localProp(key: String): String? {
54+
return System.getenv(key)
55+
?: providers.gradleProperty(key).orNull
56+
?: localProperties.getProperty(key)
57+
}
58+
4459
// Android resource qualifier format for androidResources.localeFilters
4560
val androidLocales = listOf(
4661
"en", "ar", "b+es+419", "ca", "cs", "de", "el", "es", "es-rES", "fr", "it", "nl", "pl", "pt", "pt-rBR", "ru"
@@ -51,8 +66,8 @@ val bcp47Locales = listOf(
5166
)
5267
val e2eBackendEnv = System.getenv("E2E_BACKEND") ?: "local"
5368
val e2eHomegateUrlEnv = System.getenv("E2E_HOMEGATE_URL") ?: "http://127.0.0.1:6288"
54-
val trezorBridgeEnv = System.getenv("TREZOR_BRIDGE")?.toBoolean()?.toString() ?: "false"
55-
val trezorBridgeUrlEnv = System.getenv("TREZOR_BRIDGE_URL") ?: "http://10.0.2.2:21325"
69+
val trezorBridgeEnv = localProp("TREZOR_BRIDGE")?.toBoolean()?.toString() ?: "false"
70+
val trezorBridgeUrlEnv = localProp("TREZOR_BRIDGE_URL") ?: "http://10.0.2.2:21325"
5671
val requestedNdkVersion = System.getenv("NDK_VERSION")?.takeIf { it.isNotBlank() }
5772
val androidTestAnnotationPackage = "to.bitkit.test.annotations"
5873
val androidTestTaskPrefix = "connectedDevDebug"

app/src/main/java/to/bitkit/ui/settings/general/HardwareWalletsSettingsScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private fun EmptyState(modifier: Modifier = Modifier) {
161161
VerticalSpacer(8.dp)
162162
BodyM(
163163
text = stringResource(R.string.settings__hardware_wallets__empty_text),
164-
color = Colors.White64,
164+
color = Colors.White80,
165165
)
166166
}
167167
}

app/src/test/java/to/bitkit/ui/screens/wallets/HwWalletViewModelTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.Context
44
import kotlinx.collections.immutable.ImmutableList
55
import kotlinx.collections.immutable.persistentListOf
66
import kotlinx.collections.immutable.toImmutableList
7+
import kotlinx.coroutines.ExperimentalCoroutinesApi
78
import kotlinx.coroutines.flow.MutableStateFlow
89
import kotlinx.coroutines.launch
910
import kotlinx.coroutines.test.advanceUntilIdle
@@ -23,6 +24,7 @@ import to.bitkit.utils.AppError
2324
import kotlin.test.assertEquals
2425
import kotlin.test.assertNull
2526

27+
@OptIn(ExperimentalCoroutinesApi::class)
2628
class HwWalletViewModelTest : BaseUnitTest() {
2729

2830
private val context: Context = mock()
@@ -49,14 +51,12 @@ class HwWalletViewModelTest : BaseUnitTest() {
4951
)
5052

5153
private lateinit var wallets: MutableStateFlow<ImmutableList<HwWallet>>
52-
private lateinit var walletsLoaded: MutableStateFlow<Boolean>
5354

5455
@Before
5556
fun setUp() {
5657
wallets = MutableStateFlow(listOf(wallet).toImmutableList())
57-
walletsLoaded = MutableStateFlow(true)
5858
whenever(hwWalletRepo.wallets).thenReturn(wallets)
59-
whenever(hwWalletRepo.walletsLoaded).thenReturn(walletsLoaded)
59+
whenever(hwWalletRepo.walletsLoaded).thenReturn(MutableStateFlow(true))
6060
whenever(context.getString(R.string.common__error)).thenReturn("Error")
6161
whenever(context.getString(R.string.hardware__remove_error)).thenReturn("Could not remove")
6262
}

0 commit comments

Comments
 (0)