Skip to content

Commit 5f6fc75

Browse files
committed
chore: extract remaining non-dev strings
1 parent 1fab9e6 commit 5f6fc75

7 files changed

Lines changed: 42 additions & 21 deletions

File tree

app/src/main/java/to/bitkit/ui/screens/recovery/RecoveryMnemonicViewModel.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package to.bitkit.ui.screens.recovery
22

3+
import android.content.Context
34
import androidx.lifecycle.ViewModel
45
import androidx.lifecycle.viewModelScope
56
import dagger.hilt.android.lifecycle.HiltViewModel
7+
import dagger.hilt.android.qualifiers.ApplicationContext
68
import kotlinx.coroutines.flow.MutableStateFlow
79
import kotlinx.coroutines.flow.StateFlow
810
import kotlinx.coroutines.flow.asStateFlow
911
import kotlinx.coroutines.flow.update
1012
import kotlinx.coroutines.launch
13+
import to.bitkit.R
1114
import to.bitkit.data.keychain.Keychain
1215
import to.bitkit.models.Toast
1316
import to.bitkit.ui.shared.toast.ToastEventBus
@@ -16,6 +19,7 @@ import javax.inject.Inject
1619

1720
@HiltViewModel
1821
class RecoveryMnemonicViewModel @Inject constructor(
22+
@ApplicationContext private val context: Context,
1923
private val keychain: Keychain,
2024
) : ViewModel() {
2125

@@ -40,8 +44,8 @@ class RecoveryMnemonicViewModel @Inject constructor(
4044
}
4145
ToastEventBus.send(
4246
type = Toast.ToastType.ERROR,
43-
title = "Failed to load mnemonic",
44-
description = "Failed to load mnemonic",
47+
title = context.getString(R.string.security__mnemonic_load_error),
48+
description = context.getString(R.string.security__mnemonic_load_error),
4549
)
4650
return@launch
4751
}

app/src/main/java/to/bitkit/ui/screens/recovery/RecoveryViewModel.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class RecoveryViewModel @Inject constructor(
7575
}
7676
ToastEventBus.send(
7777
type = Toast.ToastType.ERROR,
78-
title = "Error",
79-
description = "Failed to create log zip file",
78+
title = context.getString(R.string.common__error),
79+
description = context.getString(R.string.other__logs_export_error),
8080
)
8181
}
8282
)
@@ -100,8 +100,8 @@ class RecoveryViewModel @Inject constructor(
100100
viewModelScope.launch {
101101
ToastEventBus.send(
102102
type = Toast.ToastType.ERROR,
103-
title = "Error",
104-
description = "Failed to open support links",
103+
title = context.getString(R.string.common__error),
104+
description = context.getString(R.string.settings__support__link_error),
105105
)
106106
}
107107
}

app/src/main/java/to/bitkit/ui/screens/transfer/SpendingConfirmScreen.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.padding
1313
import androidx.compose.foundation.rememberScrollState
1414
import androidx.compose.foundation.verticalScroll
1515
import androidx.compose.runtime.Composable
16-
import androidx.compose.runtime.Stable
1716
import androidx.compose.runtime.getValue
1817
import androidx.compose.runtime.mutableStateOf
1918
import androidx.compose.runtime.remember
@@ -54,10 +53,10 @@ import to.bitkit.ui.components.PrimaryButton
5453
import to.bitkit.ui.components.SwipeToConfirm
5554
import to.bitkit.ui.components.VerticalSpacer
5655
import to.bitkit.ui.components.settings.SettingsSwitchRow
56+
import to.bitkit.ui.openNotificationSettings
5757
import to.bitkit.ui.scaffold.AppTopBar
5858
import to.bitkit.ui.scaffold.DrawerNavIcon
5959
import to.bitkit.ui.scaffold.ScreenColumn
60-
import to.bitkit.ui.openNotificationSettings
6160
import to.bitkit.ui.theme.AppSwitchDefaults
6261
import to.bitkit.ui.theme.AppThemeSurface
6362
import to.bitkit.ui.theme.Colors
@@ -202,7 +201,7 @@ private fun Content(
202201
}
203202

204203
SettingsSwitchRow(
205-
title = "Set up in background",
204+
title = stringResource(R.string.settings__bg__setup),
206205
isChecked = hasNotificationPermission,
207206
colors = AppSwitchDefaults.colorsPurple,
208207
onClick = onSwitchClick,

app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveConfirmScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ import to.bitkit.ui.components.Title
3636
import to.bitkit.ui.components.VerticalSpacer
3737
import to.bitkit.ui.components.settings.SettingsSwitchRow
3838
import to.bitkit.ui.currencyViewModel
39+
import to.bitkit.ui.openNotificationSettings
3940
import to.bitkit.ui.scaffold.SheetTopBar
4041
import to.bitkit.ui.shared.modifiers.sheetHeight
4142
import to.bitkit.ui.shared.util.gradientBackground
42-
import to.bitkit.ui.openNotificationSettings
4343
import to.bitkit.ui.theme.AppSwitchDefaults
4444
import to.bitkit.ui.theme.AppThemeSurface
4545
import to.bitkit.ui.theme.Colors
@@ -169,7 +169,7 @@ private fun Content(
169169
FillHeight()
170170

171171
SettingsSwitchRow(
172-
title = "Set up in background",
172+
title = stringResource(R.string.settings__bg__setup),
173173
isChecked = hasNotificationPermission,
174174
colors = AppSwitchDefaults.colorsPurple,
175175
onClick = onSystemSettingsClick,

app/src/main/java/to/bitkit/ui/screens/wallets/send/SendRecipientScreen.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fun SendRecipientScreen(
169169
app?.toast(
170170
type = Toast.ToastType.ERROR,
171171
title = context.getString(R.string.other__qr_error_header),
172-
description = "Failed to initialize camera: ${e.message}"
172+
description = context.getString(R.string.other__camera_init_error, e.message.orEmpty())
173173
)
174174
isCameraInitialized = false
175175
}
@@ -388,7 +388,7 @@ private fun CameraPreviewWithControls(
388388
}
389389

390390
BodyMSB(
391-
"Scan QR",
391+
stringResource(R.string.other__camera_scan_qr),
392392
color = Colors.White,
393393
modifier = Modifier
394394
.padding(top = 31.dp)
@@ -425,20 +425,24 @@ private fun PermissionDenied(
425425
.background(Colors.Black)
426426
.padding(32.dp)
427427
) {
428-
Display("SCAN\n<accent>QR CODE</accent>".withAccent(accentColor = Colors.Brand), color = Colors.White)
428+
Display(
429+
stringResource(R.string.other__camera_permission_title)
430+
.withAccent(accentColor = Colors.Brand),
431+
color = Colors.White
432+
)
429433

430434
VerticalSpacer(8.dp)
431435

432436
BodyM(
433-
"Allow camera access to scan bitcoin invoices and pay more quickly.",
437+
stringResource(R.string.other__camera_permission_description),
434438
color = Colors.White64,
435439
modifier = Modifier.fillMaxWidth()
436440
)
437441

438442
VerticalSpacer(32.dp)
439443

440444
PrimaryButton(
441-
text = "Enable camera",
445+
text = stringResource(R.string.other__camera_permission_button),
442446
icon = {
443447
Icon(painter = painterResource(R.drawable.ic_camera), contentDescription = null)
444448
},

app/src/main/java/to/bitkit/ui/screens/widgets/blocks/BlocksEditScreen.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fun BlocksEditContent(
114114

115115
// Block number toggle
116116
BlockEditOptionRow(
117-
label = "Block",
117+
label = stringResource(R.string.widgets__blocks__field__block),
118118
value = block.height,
119119
isEnabled = blocksPreferences.showBlock,
120120
onClick = onClickShowBlock,
@@ -123,7 +123,7 @@ fun BlocksEditContent(
123123

124124
// Time toggle
125125
BlockEditOptionRow(
126-
label = "Time",
126+
label = stringResource(R.string.widgets__blocks__field__time),
127127
value = block.time,
128128
isEnabled = blocksPreferences.showTime,
129129
onClick = onClickShowTime,
@@ -132,7 +132,7 @@ fun BlocksEditContent(
132132

133133
// Date toggle
134134
BlockEditOptionRow(
135-
label = "Date",
135+
label = stringResource(R.string.widgets__blocks__field__date),
136136
value = block.date,
137137
isEnabled = blocksPreferences.showDate,
138138
onClick = onClickShowDate,
@@ -141,7 +141,7 @@ fun BlocksEditContent(
141141

142142
// Transactions toggle
143143
BlockEditOptionRow(
144-
label = "Transactions",
144+
label = stringResource(R.string.widgets__blocks__field__transactions),
145145
value = block.transactionCount,
146146
isEnabled = blocksPreferences.showTransactions,
147147
onClick = onClickShowTransactions,
@@ -150,7 +150,7 @@ fun BlocksEditContent(
150150

151151
// Size toggle
152152
BlockEditOptionRow(
153-
label = "Size",
153+
label = stringResource(R.string.widgets__blocks__field__size),
154154
value = block.size,
155155
isEnabled = blocksPreferences.showSize,
156156
onClick = onClickShowSize,

app/src/main/res/values/strings.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,12 @@
363363
<string name="other__update_critical_button">Update Bitkit</string>
364364
<string name="other__camera_ask_title">Permission to use camera</string>
365365
<string name="other__camera_ask_msg">Bitkit needs permission to use your camera</string>
366+
<string name="other__camera_init_error">Failed to initialize camera: {message}</string>
366367
<string name="other__camera_no_text">&lt;bold&gt;It appears Bitkit does not have permission to access your camera.&lt;/bold&gt;\n\nTo utilize this feature in the future you will need to enable camera permissions for this app from your phone\'s settings.</string>
368+
<string name="other__camera_permission_button">Enable camera</string>
369+
<string name="other__camera_permission_description">Allow camera access to scan bitcoin invoices and pay more quickly.</string>
370+
<string name="other__camera_permission_title">SCAN\n&lt;accent&gt;QR CODE&lt;/accent&gt;</string>
371+
<string name="other__camera_scan_qr">Scan QR</string>
367372
<string name="other__clipboard_redirect_title">Clipboard Data Detected</string>
368373
<string name="other__clipboard_redirect_msg">Do you want to be redirected to the relevant screen?</string>
369374
<string name="other__coming_soon">Coming soon</string>
@@ -410,6 +415,7 @@
410415
<string name="other__lnurl_withdr_error_minmax">Incorrect LNURL withdraw params, min/max not set correctly.</string>
411416
<string name="other__lnurl_withdr_success_title">Withdraw Requested</string>
412417
<string name="other__lnurl_withdr_success_msg">Your withdraw was successfully requested. Waiting for payment.</string>
418+
<string name="other__logs_export_error">Failed to create log zip file</string>
413419
<string name="other__node_error_starting">Error starting: %1$s</string>
414420
<string name="other__node_initializing">Setting up wallet…</string>
415421
<string name="other__node_running">Running</string>
@@ -489,6 +495,7 @@
489495
<string name="security__mnemonic_multiple_header">Multiple Devices</string>
490496
<string name="security__mnemonic_multiple_text">Don\'t use your Bitkit recovery phrase on multiple phones simultaneously, as this can corrupt your data.</string>
491497
<string name="security__mnemonic_latest_backup">&lt;bold&gt;Latest data backup:&lt;/bold&gt; {time}</string>
498+
<string name="security__mnemonic_load_error">Failed to load mnemonic</string>
492499
<string name="security__pin_security_header">Increase Security</string>
493500
<string name="security__pin_security_title">&lt;accent&gt;Protect&lt;/accent&gt;\nyour bitcoin</string>
494501
<string name="security__pin_security_text">To increase wallet security, you can set up a PIN code and Face ID.</string>
@@ -634,6 +641,7 @@
634641
<string name="settings__bg__include_amount">Include amount in notifications</string>
635642
<string name="settings__bg__notifications_header">Notifications</string>
636643
<string name="settings__bg__privacy_header">Privacy</string>
644+
<string name="settings__bg__setup">Set up in background</string>
637645
<string name="settings__bg__switch_title">Get paid when Bitkit is closed</string>
638646
<string name="settings__cs__bnb_title">Branch and Bound</string>
639647
<string name="settings__cs__bnb_desc">Finds exact amount matches to minimize change</string>
@@ -681,6 +689,7 @@
681689
<string name="settings__support__report_text">Please describe the issue you are experiencing or ask a general question.</string>
682690
<string name="settings__support__label_address">Email address</string>
683691
<string name="settings__support__label_message">Issue or question</string>
692+
<string name="settings__support__link_error">Failed to open support links</string>
684693
<string name="settings__support__placeholder_address">satoshi@satoshi.com</string>
685694
<string name="settings__support__placeholder_message">Describe the issue or ask a question</string>
686695
<string name="settings__support__text_button">Send</string>
@@ -1186,6 +1195,11 @@
11861195
<string name="widgets__blocks__name">Bitcoin Blocks</string>
11871196
<string name="widgets__blocks__description">Examine various statistics on newly mined Bitcoin Blocks.</string>
11881197
<string name="widgets__blocks__error">Couldn\'t get blocks data</string>
1198+
<string name="widgets__blocks__field__block">Block</string>
1199+
<string name="widgets__blocks__field__date">Date</string>
1200+
<string name="widgets__blocks__field__size">Size</string>
1201+
<string name="widgets__blocks__field__time">Time</string>
1202+
<string name="widgets__blocks__field__transactions">Transactions</string>
11891203
<string name="widgets__facts__name">Bitcoin Facts</string>
11901204
<string name="widgets__facts__description">Discover fun facts about Bitcoin, every time you open your wallet.</string>
11911205
<string name="widgets__calculator__name">Bitcoin Calculator</string>

0 commit comments

Comments
 (0)