Skip to content

Commit 8c50f77

Browse files
authored
Merge branch 'master' into claude/issue-655-20260122-1114
2 parents aa59103 + 520b60c commit 8c50f77

File tree

32 files changed

+7340
-5480
lines changed

32 files changed

+7340
-5480
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches: [ "master" ]
66
pull_request:
7+
types: [ opened, synchronize, reopened, ready_for_review ]
78

89
workflow_dispatch:
910

.github/workflows/e2e.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ on:
88
required: false
99
default: "default-feature-branch"
1010
pull_request:
11+
paths:
12+
- 'app/**'
13+
- 'gradle/**'
14+
- '*.gradle.kts'
15+
- 'gradle.properties'
16+
- '.github/workflows/e2e.yml'
1117

1218
env:
1319
TERM: xterm-256color

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,34 @@ To pull the latest translations from Transifex:
9090
- Follow the installation instructions: [Transifex CLI Installation](https://developers.transifex.com/docs/cli)
9191

9292
2. **Authenticate with Transifex** (if not already configured):
93-
- Create a `.transifexrc` file in your home directory (`~/.transifexrc`) with your API token:
94-
```ini
95-
[https://www.transifex.com]
96-
rest_hostname = https://rest.api.transifex.com
97-
token = YOUR_API_TOKEN_HERE
93+
- Set the `TX_TOKEN` environment variable with your API token:
94+
```sh
95+
export TX_TOKEN="YOUR_API_TOKEN_HERE"
9896
```
99-
- You can get your API token from your [Transifex account settings](https://www.transifex.com/user/settings/api/)
100-
- The CLI will prompt you for an API token if one is not configured
97+
- You can get your API token from [Transifex account settings](https://www.transifex.com/user/settings/api/)
98+
- Add it to `~/.zshrc` or other shell rc file to persist across sessions
10199

102100
3. **Pull translations**:
103101
```sh
104102
./scripts/pull-translations.sh
105103
```
106104

105+
### Pushing Source Strings
106+
107+
When you add or modify translation keys in the EN source file, push them to Transifex:
108+
109+
```sh
110+
tx push --source
111+
```
112+
113+
### Translation Workflow
114+
115+
1. **Add/modify strings** in `app/src/main/res/values/strings.xml`
116+
2. **Push to Transifex:** `tx push --source`
117+
3. **Translators** work on translations in Transifex
118+
4. **Pull translations:** `./scripts/pull-translations.sh`
119+
5. **Commit** the updated translation files
120+
107121
## Build
108122

109123
### Bitcoin Networks

app/src/main/java/to/bitkit/ext/FileSystem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import to.bitkit.utils.AppError
44
import java.io.File
55
import kotlin.io.path.exists
66

7-
fun File.ensureDir() = this.also {
7+
fun File.ensureDir(): File = this.also {
88
if (toPath().exists()) return this
99

1010
val path = if (extension.isEmpty()) this else parentFile

app/src/main/java/to/bitkit/fcm/WakeNodeWorker.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import androidx.work.WorkerParameters
77
import androidx.work.workDataOf
88
import dagger.assisted.Assisted
99
import dagger.assisted.AssistedInject
10+
import kotlinx.coroutines.CancellationException
1011
import kotlinx.coroutines.CompletableDeferred
1112
import kotlinx.coroutines.delay
1213
import kotlinx.coroutines.flow.first
@@ -109,6 +110,11 @@ class WakeNodeWorker @AssistedInject constructor(
109110
.fold(
110111
onSuccess = { Result.success() },
111112
onFailure = { e ->
113+
if (e is CancellationException) {
114+
Logger.debug("Work cancelled", context = TAG)
115+
return@fold Result.failure(workDataOf("Reason" to "Cancelled"))
116+
}
117+
112118
val reason = e.message ?: appContext.getString(R.string.common__error_body)
113119

114120
bestAttemptContent = NotificationDetails(

app/src/main/java/to/bitkit/repositories/LightningRepo.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import com.synonym.bitkitcore.PreActivityMetadata
88
import com.synonym.bitkitcore.Scanner
99
import com.synonym.bitkitcore.createChannelRequestUrl
1010
import com.synonym.bitkitcore.createWithdrawCallbackUrl
11-
import com.synonym.bitkitcore.decode
1211
import com.synonym.bitkitcore.lnurlAuth
1312
import kotlinx.coroutines.CoroutineDispatcher
1413
import kotlinx.coroutines.CoroutineScope
@@ -552,7 +551,7 @@ class LightningRepo @Inject constructor(
552551
return runCatching {
553552
// TODO use bitkit-core getLnurlInvoice if it works with callbackUrl
554553
val bolt11 = lnurlService.fetchLnurlInvoice(callbackUrl, amountSats, comment).getOrThrow().pr
555-
val decoded = (decode(bolt11) as Scanner.Lightning).invoice
554+
val decoded = (coreService.decode(bolt11) as Scanner.Lightning).invoice
556555
return@runCatching decoded
557556
}.onFailure {
558557
Logger.error(

app/src/main/java/to/bitkit/repositories/WalletRepo.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package to.bitkit.repositories
33
import com.synonym.bitkitcore.AddressType
44
import com.synonym.bitkitcore.PreActivityMetadata
55
import com.synonym.bitkitcore.Scanner
6-
import com.synonym.bitkitcore.decode
76
import kotlinx.coroutines.CoroutineDispatcher
87
import kotlinx.coroutines.CoroutineScope
98
import kotlinx.coroutines.Job
@@ -137,7 +136,7 @@ class WalletRepo @Inject constructor(
137136
) {
138137
val onChainAddress = getOnchainAddress()
139138
val paymentHash = runCatching {
140-
when (val decoded = decode(bip21Url)) {
139+
when (val decoded = coreService.decode(bip21Url)) {
141140
is Scanner.Lightning -> decoded.invoice.paymentHash.toHex()
142141
is Scanner.OnChain -> decoded.extractLightningHash()
143142
else -> null
@@ -418,7 +417,7 @@ class WalletRepo @Inject constructor(
418417
if (bolt11.isEmpty()) return@withContext null
419418

420419
runCatching {
421-
when (val decoded = decode(bolt11)) {
420+
when (val decoded = coreService.decode(bolt11)) {
422421
is Scanner.Lightning -> decoded.invoice.paymentHash.toHex()
423422
else -> null
424423
}
@@ -544,7 +543,7 @@ class WalletRepo @Inject constructor(
544543
private suspend fun Scanner.OnChain.extractLightningHash(): String? {
545544
val lightningInvoice: String = this.invoice.params?.get("lightning") ?: return null
546545

547-
return when (val decoded = decode(lightningInvoice)) {
546+
return when (val decoded = coreService.decode(lightningInvoice)) {
548547
is Scanner.Lightning -> decoded.invoice.paymentHash.toHex()
549548
else -> null
550549
}

app/src/main/java/to/bitkit/services/CoreService.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import com.synonym.bitkitcore.OnchainActivity
2020
import com.synonym.bitkitcore.PaymentState
2121
import com.synonym.bitkitcore.PaymentType
2222
import com.synonym.bitkitcore.PreActivityMetadata
23+
import com.synonym.bitkitcore.Scanner
2324
import com.synonym.bitkitcore.SortDirection
2425
import com.synonym.bitkitcore.WordCount
2526
import com.synonym.bitkitcore.addTags
@@ -185,6 +186,12 @@ class CoreService @Inject constructor(
185186
com.synonym.bitkitcore.isAddressUsed(address = address)
186187
}
187188

189+
@Suppress("ForbiddenComment")
190+
suspend fun decode(input: String): Scanner = ServiceQueue.CORE.background {
191+
// TODO: Remove lowercase workaround when https://github.com/synonymdev/bitkit-core/issues/66 is fixed
192+
com.synonym.bitkitcore.decode(input.lowercase())
193+
}
194+
188195
companion object {
189196
private const val TAG = "CoreService"
190197
}

app/src/main/java/to/bitkit/ui/components/DrawerMenu.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import androidx.compose.ui.res.painterResource
3434
import androidx.compose.ui.res.stringResource
3535
import androidx.compose.ui.text.TextStyle
3636
import androidx.compose.ui.text.font.FontWeight
37+
import androidx.compose.ui.text.style.TextOverflow
3738
import androidx.compose.ui.tooling.preview.Preview
3839
import androidx.compose.ui.unit.dp
3940
import androidx.compose.ui.unit.sp
@@ -291,6 +292,8 @@ private fun DrawerItem(
291292
fontFamily = InterFontFamily,
292293
color = Colors.White,
293294
),
295+
maxLines = 1,
296+
overflow = TextOverflow.Ellipsis,
294297
modifier = Modifier.weight(1f)
295298
)
296299
}

app/src/main/java/to/bitkit/ui/components/TextInput.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import androidx.compose.foundation.text.KeyboardActions
88
import androidx.compose.foundation.text.KeyboardOptions
99
import androidx.compose.material3.Text
1010
import androidx.compose.material3.TextField
11+
import androidx.compose.material3.TextFieldColors
1112
import androidx.compose.runtime.Composable
1213
import androidx.compose.runtime.LaunchedEffect
1314
import androidx.compose.runtime.getValue
@@ -46,6 +47,7 @@ fun TextInput(
4647
supportingText: @Composable (() -> Unit)? = null,
4748
visualTransformation: VisualTransformation = VisualTransformation.None,
4849
textStyle: TextStyle = AppTextStyles.BodySSB,
50+
colors: TextFieldColors = AppTextFieldDefaults.semiTransparent,
4951
) {
5052
var textFieldValue by remember { mutableStateOf(TextFieldValue(value)) }
5153

@@ -75,7 +77,7 @@ fun TextInput(
7577
maxLines = maxLines,
7678
minLines = minLines,
7779
singleLine = singleLine,
78-
colors = AppTextFieldDefaults.semiTransparent,
80+
colors = colors,
7981
shape = AppShapes.small,
8082
keyboardOptions = keyboardOptions,
8183
keyboardActions = keyboardActions,

0 commit comments

Comments
 (0)