Skip to content

Commit c808eae

Browse files
committed
Merge branch 'master' into mainnet
2 parents 937d00e + a990d68 commit c808eae

File tree

7 files changed

+7463
-7472
lines changed

7 files changed

+7463
-7472
lines changed

phoenix-android/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ android {
2626
applicationId = "fr.acinq.phoenix.mainnet"
2727
minSdk = 26
2828
targetSdk = 34
29-
versionCode = 99
30-
versionName = "2.5.0"
29+
versionCode = 100
30+
versionName = gitCommitHash()
3131
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3232
}
3333

phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/AppView.kt

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ import fr.acinq.phoenix.android.utils.extensions.findActivitySafe
115115
import fr.acinq.phoenix.android.utils.logger
116116
import fr.acinq.phoenix.data.BitcoinUnit
117117
import fr.acinq.phoenix.data.FiatCurrency
118-
import io.ktor.http.decodeURLPart
119118
import io.ktor.http.encodeURLParameter
120119
import kotlinx.coroutines.flow.filterNotNull
121120
import kotlinx.coroutines.flow.first
@@ -192,26 +191,19 @@ fun AppView(
192191
navArgument("next") { type = NavType.StringType; nullable = true }
193192
),
194193
) {
195-
@Suppress("DEPRECATION")
196-
val intent = try {
197-
it.arguments?.getParcelable<Intent>(NavController.KEY_DEEP_LINK_INTENT)
198-
} catch (e: Exception) {
199-
null
200-
}
201-
val nextScreenLink = try {
202-
intent?.data?.getQueryParameter("next")?.decodeURLPart()
203-
} catch (e: Exception) {
204-
null
205-
}
194+
val nextScreenLink = it.arguments?.getString("next")
206195
StartupView(
207196
appVM = appVM,
208197
onShowIntro = { navController.navigate(Screen.Intro.route) },
209198
onKeyAbsent = { navController.navigate(Screen.InitWallet.route) },
210199
onBusinessStarted = {
211200
val next = nextScreenLink?.takeUnless { it.isBlank() }?.let { Uri.parse(it) }
212-
if (next == null || !navController.graph.hasDeepLink(next)) {
201+
if (next == null) {
213202
log.debug("redirecting from startup to home")
214203
navController.popToHome()
204+
} else if (!navController.graph.hasDeepLink(next)) {
205+
log.debug("redirecting from startup to home, ignoring invalid next=$nextScreenLink")
206+
navController.popToHome()
215207
} else {
216208
log.debug("redirecting from startup to {}", next)
217209
navController.navigate(next, navOptions = navOptions {
@@ -263,7 +255,7 @@ fun AppView(
263255
)
264256
}
265257
composable(
266-
route = "${Screen.Send}?input={input}&openScanner={openScanner}",
258+
route = "${Screen.Send.route}?input={input}&openScanner={openScanner}",
267259
arguments = listOf(
268260
navArgument("input") { type = NavType.StringType ; nullable = true },
269261
navArgument("openScanner") { type = NavType.BoolType ; defaultValue = false }
@@ -604,8 +596,6 @@ private fun RequireStarted(
604596
nextUri: String? = null,
605597
children: @Composable () -> Unit
606598
) {
607-
children()
608-
609599
val navController = navController
610600
val currentRoute = navController.currentDestination?.route
611601
if (serviceState != null && serviceState is NodeServiceState.Off && currentRoute != Screen.Startup.route) {
@@ -616,6 +606,8 @@ private fun RequireStarted(
616606
popUpTo(navController.graph.id) { inclusive = true }
617607
}
618608
}
609+
} else {
610+
children()
619611
}
620612
}
621613

phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/components/scanner/ScannerView.kt

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import androidx.compose.material.MaterialTheme
4242
import androidx.compose.runtime.Composable
4343
import androidx.compose.runtime.LaunchedEffect
4444
import androidx.compose.runtime.getValue
45-
import androidx.compose.runtime.mutableIntStateOf
4645
import androidx.compose.runtime.mutableStateOf
4746
import androidx.compose.runtime.remember
4847
import androidx.compose.runtime.setValue
@@ -65,9 +64,7 @@ import fr.acinq.phoenix.android.components.Card
6564
import fr.acinq.phoenix.android.components.FilledButton
6665
import fr.acinq.phoenix.android.components.TextWithIcon
6766
import fr.acinq.phoenix.android.utils.images.ZxingQrCodeAnalyzer
68-
import kotlinx.coroutines.delay
6967
import java.util.concurrent.Executors
70-
import kotlin.time.Duration.Companion.seconds
7168

7269

7370
@SuppressLint("ClickableViewAccessibility")
@@ -84,15 +81,25 @@ fun BoxScope.ScannerView(
8481
val cameraController = remember { LifecycleCameraController(context) }
8582
var scannedText by remember { mutableStateOf<String?>(null) }
8683

87-
// let us execute the callback for an already scanned text with a throttle
88-
var scanResetTick by remember { mutableIntStateOf(0) }
89-
LaunchedEffect(Unit) {
90-
while(true) {
91-
delay(2.seconds)
92-
scanResetTick++
84+
var currentCallbackAttempt by remember { mutableStateOf<String?>(null) }
85+
86+
LaunchedEffect(isPaused) {
87+
if (!isPaused) {
88+
scannedText = null
89+
currentCallbackAttempt = null
9390
}
9491
}
9592

93+
LaunchedEffect(scannedText) {
94+
if (!isPaused) currentCallbackAttempt = scannedText
95+
}
96+
97+
LaunchedEffect(currentCallbackAttempt) {
98+
if (isPaused) return@LaunchedEffect
99+
val currentAttempt = currentCallbackAttempt ?: return@LaunchedEffect
100+
onScannedText(currentAttempt)
101+
}
102+
96103
AndroidView(
97104
modifier = Modifier.fillMaxSize(),
98105
factory = { context ->
@@ -114,11 +121,12 @@ fun BoxScope.ScannerView(
114121
}
115122
)
116123

117-
Column(modifier = Modifier
118-
.align(Alignment.BottomCenter)
119-
.background(Brush.verticalGradient(colorStops = arrayOf(0.1f to Color.Transparent, 1f to Color(0x44000000))))
120-
.padding(24.dp)
121-
.systemGestureExclusion()
124+
Column(
125+
modifier = Modifier
126+
.align(Alignment.BottomCenter)
127+
.background(Brush.verticalGradient(colorStops = arrayOf(0.1f to Color.Transparent, 1f to Color(0x44000000))))
128+
.padding(24.dp)
129+
.systemGestureExclusion()
122130
) {
123131
Spacer(Modifier.height(36.dp))
124132
TextWithIcon(
@@ -142,12 +150,6 @@ fun BoxScope.ScannerView(
142150
}
143151

144152
CameraPermissionsView()
145-
146-
LaunchedEffect(scannedText, scanResetTick) {
147-
scannedText?.let {
148-
if (!isPaused) onScannedText(it)
149-
}
150-
}
151153
}
152154

153155
@OptIn(ExperimentalPermissionsApi::class)

phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/payments/send/PrepareSendView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fun SendView(
153153
LnurlWithdrawView(withdraw = data.lnurlWithdraw, onBackClick = onBackClick, onFeeManagementClick = { navController.navigate(Screen.LiquidityPolicy.route) }, onWithdrawDone = { navController.popToHome() })
154154
}
155155
is SendManager.ParseResult.Lnurl.Auth -> {
156-
LnurlAuthView(auth = data.auth, onBackClick = { navController.popBackStack() }, onChangeAuthSchemeSettingClick = { navController.navigate("${Screen.PaymentSettings.route}?showAuthSchemeDialog=true") },
156+
LnurlAuthView(auth = data.auth, onBackClick = onBackClick, onChangeAuthSchemeSettingClick = { navController.navigate("${Screen.PaymentSettings.route}?showAuthSchemeDialog=true") },
157157
onAuthDone = { navController.popToHome() },)
158158
}
159159
}

phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/settings/TorConfigView.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,9 @@ fun TorConfigView(
9898

9999
if (isTorEnabled == true) {
100100
Card(internalPadding = PaddingValues(16.dp)) {
101-
val context = LocalContext.current
102101
Text(text = stringResource(id = R.string.tor_settings_instructions_title), style = MaterialTheme.typography.body2)
103102
Spacer(Modifier.height(8.dp))
104103
Text(text = stringResource(id = R.string.tor_dialog_enable_details_1))
105-
Spacer(Modifier.height(16.dp))
106-
BorderButton(text = stringResource(id = R.string.tor_settings_instructions_help_button), icon = R.drawable.ic_external_link, onClick = { openLink(context, "https://phoenix.acinq.co/faq#how-to-use-tor-on-phoenix") })
107104
}
108105
}
109106
}

phoenix-android/src/main/res/values/strings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,6 @@
688688
<string name="tor_settings_title">Tor</string>
689689
<string name="tor_settings_switch_label">Enable Tor</string>
690690
<string name="tor_settings_instructions_title">How it works</string>
691-
<string name="tor_settings_instructions_help_button">Learn more</string>
692691

693692
<!-- home: connectivity dialog -->
694693

0 commit comments

Comments
 (0)