Skip to content

Commit

Permalink
Merge branch 'master' into mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
dpad85 committed Dec 3, 2024
2 parents c9a03c2 + 128aee7 commit 27d2543
Show file tree
Hide file tree
Showing 37 changed files with 343 additions and 386 deletions.
4 changes: 2 additions & 2 deletions phoenix-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
applicationId = "fr.acinq.phoenix.mainnet"
minSdk = 26
targetSdk = 34
versionCode = 97
versionName = "2.4.4"
versionCode = 98
versionName = gitCommitHash()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
resourceConfigurations.addAll(listOf("en", "fr", "de", "es", "b+es+419", "cs", "pt-rBR", "sk", "vi", "sw"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ class MainActivity : AppCompatActivity() {
lifecycleScope.launch {
val doDataMigration = LegacyPrefsDatastore.getDataMigrationExpected(applicationContext).filterNotNull().first()
if (doDataMigration) {
delay(7_000)
delay(3_000)
LegacyMigrationHelper.migrateLegacyPayments(applicationContext)
delay(5_000)
delay(1_000)
LegacyPrefsDatastore.saveDataMigrationExpected(applicationContext, false)
tryReconnect()
}
}

Expand All @@ -96,8 +97,11 @@ class MainActivity : AppCompatActivity() {
application.business.filterNotNull().map { it.peerManager.getPeer().eventsFlow }.flattenMerge().collect {
if (it is PhoenixAndroidLegacyInfoEvent) {
if (it.info.hasChannels) {
log.info("legacy channels have been found")
LegacyPrefsDatastore.saveStartLegacyApp(applicationContext, LegacyAppStatus.Required.Expected)
val legacyState = LegacyPrefsDatastore.getLegacyAppStatus(applicationContext).filterNotNull().first()
log.info("legacy channels have been found, in legacy_state=$legacyState")
if (legacyState is LegacyAppStatus.Required || legacyState is LegacyAppStatus.Unknown) {
LegacyPrefsDatastore.saveStartLegacyApp(applicationContext, LegacyAppStatus.Required.Expected)
}
} else {
log.info("no legacy channels were found")
LegacyPrefsDatastore.savePrefsMigrationExpected(applicationContext, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@ private fun DisclaimerView(
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Card(internalPadding = PaddingValues(16.dp)) {
Text(stringResource(R.string.restore_disclaimer_message))
Text(stringResource(R.string.restore_disclaimer_message_1_title), style = MaterialTheme.typography.h5)
Spacer(modifier = Modifier.height(6.dp))
Text(stringResource(R.string.restore_disclaimer_message_1_body))
Spacer(modifier = Modifier.height(16.dp))
Text(stringResource(R.string.restore_disclaimer_message_2_title), style = MaterialTheme.typography.h5)
Spacer(modifier = Modifier.height(6.dp))
Text(stringResource(R.string.restore_disclaimer_message_2_body))
}
Checkbox(
text = stringResource(R.string.utils_ack),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,23 +193,11 @@ fun LightningInvoiceView(
TorWarning()
HSeparator(width = 50.dp)
Spacer(modifier = Modifier.height(24.dp))
Box {
FilledButton(
text = stringResource(id = R.string.receive_toggle_offer_button),
icon = R.drawable.ic_qrcode,
onClick = { showOfferDialog = true },
)
Text(
text = stringResource(id = R.string.receive_toggle_offer_new_overlay),
modifier = Modifier
.rotate(-38f)
.offset((-9).dp, (-4).dp)
.background(red500)
.padding(horizontal = 4.dp, vertical = 2.dp),
color = MaterialTheme.colors.onPrimary,
fontSize = 12.sp
)
}
FilledButton(
text = stringResource(id = R.string.receive_toggle_offer_button),
icon = R.drawable.ic_qrcode,
onClick = { showOfferDialog = true },
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ fun SendView(
SendToOfferView(offer = data.offer, onBackClick = onBackClick, onPaymentSent = { navController.popToHome() })
}
is SendManager.ParseResult.Uri -> {
SendSpliceOutView(requestedAmount = data.uri.amount, address = data.uri.address, onBackClick = onBackClick, onSpliceOutSuccess = {navController.popToHome() })
SendSpliceOutView(requestedAmount = data.uri.amount, address = data.uri.address, onBackClick = onBackClick, onSpliceOutSuccess = { navController.popToHome() })
}
is SendManager.ParseResult.Lnurl.Pay -> {
LnurlPayView(payIntent = data.paymentIntent, onBackClick, onPaymentSent = { navController.popToHome() })
}
is SendManager.ParseResult.Lnurl.Withdraw -> {
LnurlWithdrawView(withdraw = data.lnurlWithdraw, onBackClick = onBackClick, onFeeManagementClick = { navController.navigate(Screen.LiquidityPolicy.route) }, onWithdrawDone = { navController.popToHome()})
LnurlWithdrawView(withdraw = data.lnurlWithdraw, onBackClick = onBackClick, onFeeManagementClick = { navController.navigate(Screen.LiquidityPolicy.route) }, onWithdrawDone = { navController.popToHome() })
}
is SendManager.ParseResult.Lnurl.Auth -> {
LnurlAuthView(auth = data.auth, onBackClick = { navController.popBackStack() }, onChangeAuthSchemeSettingClick = { navController.navigate("${Screen.PaymentSettings.route}?showAuthSchemeDialog=true") },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ class LnurlPayViewModel(private val sendManager: SendManager) : ViewModel() {
val invoice = result.value
state.value = LnurlPayViewState.PayingInvoice(invoice)
sendManager.lnurlPay_payInvoice(payIntent, amount, comment, invoice, fees)
onPaymentSent()
viewModelScope.launch(Dispatchers.Main) {
onPaymentSent()
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,10 @@ private fun ImportantNotification(
safeLet(actionText, onActionClick) { text, onClick ->
Button(
text = text, textStyle = MaterialTheme.typography.body2.copy(fontSize = 16.sp),
icon = R.drawable.ic_chevron_right,
modifier = Modifier.offset(x = (-16).dp),
padding = PaddingValues(horizontal = 16.dp, vertical = 12.dp),
space = 4.dp,
onClick = onClick,
)
} ?: Spacer(modifier = Modifier.height(12.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package fr.acinq.phoenix.android.settings

import android.widget.Toast
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
Expand All @@ -26,8 +27,10 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
Expand Down Expand Up @@ -60,7 +63,7 @@ fun SettingsView(
val nc = navController
val context = LocalContext.current
val scope = rememberCoroutineScope()
var debugClickCount by remember { mutableStateOf(0) }
var debugClickCount by remember { mutableIntStateOf(0) }
val notices = noticesViewModel.notices
val notifications = business.notificationsManager.notifications.collectAsState()

Expand All @@ -78,6 +81,23 @@ fun SettingsView(
)
}

if (debugClickCount > 10) {
LaunchedEffect(key1 = Unit) {
Toast.makeText(context, "Debug mode enabled", Toast.LENGTH_SHORT).show()
}
// -- debug
CardHeader(text = "DEBUG")
Card {
MenuButton(
text = "Switch to legacy app (DEBUG)",
icon = R.drawable.ic_settings,
onClick = {
scope.launch { LegacyPrefsDatastore.saveStartLegacyApp(context, LegacyAppStatus.Required.Expected) }
},
)
}
}

// -- general
CardHeader(text = stringResource(id = R.string.settings_general_title))
Card {
Expand Down Expand Up @@ -125,23 +145,6 @@ fun SettingsView(
)
}

if (debugClickCount > 10) {
// -- debug
CardHeader(text = "DEBUG")
Card {
Button(
text = "Switch to legacy app (DEBUG)",
icon = R.drawable.ic_user,
onClick = {
scope.launch {
LegacyPrefsDatastore.saveStartLegacyApp(context, LegacyAppStatus.Required.Expected)
}
},
modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Start
)
}
}

Spacer(Modifier.height(32.dp))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class StartupViewModel : ViewModel() {
is KeyStoreException, is GeneralSecurityException -> StartupDecryptionState.DecryptionError.KeystoreFailure(e)
else -> StartupDecryptionState.DecryptionError.Other(e)
}

}) {
when (encryptedSeed) {
is EncryptedSeed.V2.NoAuth -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@
<string name="initwallet_create">Crear una billetera nueva</string>
<string name="initwallet_restore">Restaurar mi billetera</string>

<string name="restore_disclaimer_message">Phoenix solo puede restaurar los fondos fuera de la cadena que hayan sido gestionados por esta aplicación.\n\nSi importas una semilla que NO haya sido creada por Phoenix, no se restaurará ningún fondo.\n\nAsegúrate además de no estar usando otra billetera Phoenix con la misma semilla.</string>
<string name="restore_disclaimer_message_1_title">Phoenix sólo está en Lightning</string>
<string name="restore_disclaimer_message_1_body">Phoenix sólo mostrará los fondos que ya han sido gestionados por Phoenix. Los fondos adjuntos a una semilla generada por otra aplicación no aparecerán aquí (esto incluye los fondos on-chain).</string>
<string name="restore_disclaimer_message_2_title">Utilizar la misma semilla en paralelo</string>
<string name="restore_disclaimer_message_2_body">No utilices la misma semilla al mismo tiempo en diferentes dispositivos. Esto puede causar conflictos entre las dos instancias de Phoenix, y resultar en el cierre de los canales Lightning.</string>
<string name="utils_ack">Entiendo.</string>

<string name="restore_instructions">La semilla de la billetera es una lista de 12 palabras en inglés. Escribe cada palabra de esta lista en la siguiente casilla.</string>
Expand Down
5 changes: 4 additions & 1 deletion phoenix-android/src/main/res/values-cs/important_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@
<string name="initwallet_create">Vytvoření nové peněženky</string>
<string name="initwallet_restore">Obnovit moji peněženku</string>

<string name="restore_disclaimer_message">Phoenix může obnovit pouze Off-Chain prostředky, které byly spravovány touto aplikací.\n\nImportem Seedu, který NEBYL vytvořen aplikací Phoenix, se neobnoví žádné prostředky.\n\nUjistěte se také, že již není spuštěna jiná aplikace Phoenix se stejným Seedem.</string>
<string name="restore_disclaimer_message_1_title">Phoenix je pouze na Lightning</string>
<string name="restore_disclaimer_message_1_body">Phoenix zobrazí pouze fondy, které již byly spravovány Phoenixem. Prostředky připojené k seedu vygenerovanému jinou aplikací se zde nezobrazí (to se týká i prostředků na řetězci).</string>
<string name="restore_disclaimer_message_2_title">Souběžné použití stejného klíče</string>
<string name="restore_disclaimer_message_2_body">Nepoužívejte stejný seed současně na různých zařízeních. Může to způsobit konflikty mezi oběma instancemi Phoenixu a vést k uzavření kanálů Lightning.</string>
<string name="utils_ack">Rozumím.</string>

<string name="restore_instructions">Seed vaší peněženky je seznam 12 anglických slov. Každé slovo z tohoto seznamu napište do níže uvedeného pole.</string>
Expand Down
1 change: 0 additions & 1 deletion phoenix-android/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
<string name="receive_lightning_share_subject">Lightningová faktura</string>
<string name="receive_lightning_share_title">Sdílet tuto Lightningovou fakturu s…</string>
<string name="receive_lnurl_button">Skenovat</string>
<string name="receive_toggle_offer_new_overlay">NOVINKA!</string>

<string name="receive_offer_share_title">Statická Lightning faktura</string>
<string name="receive_offer_share_subject">Sdílet tuto statickou Lightning fakturu s…</string>
Expand Down
5 changes: 4 additions & 1 deletion phoenix-android/src/main/res/values-de/important_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@
<string name="initwallet_create">Neue Wallet erstellen</string>
<string name="initwallet_restore">Meine Wallet wiederherstellen</string>

<string name="restore_disclaimer_message">Phoenix kann nur off-chain-Guthaben wiederherstellen, das von dieser App verwaltet wurde.\n\nEin Seed, der nicht von Phoenix generiert wurde, kann nicht importiert werden.\n\nStellen Sie außerdem sicher, dass Sie nicht bereits eine andere Phoenix-Wallet mit demselben Seed betreiben.</string>
<string name="restore_disclaimer_message_1_title">Phoenix ist nur auf Lightning</string>
<string name="restore_disclaimer_message_1_body">Phoenix wird nur Guthaben anzeigen, die bereits von Phoenix verwaltet wurden. Guthaben, die mit einem Seed verbunden sind, das von einer anderen Anwendung erzeugt wurde, werden nicht angezeigt (das gilt auch für On-Chain-Guthaben).</string>
<string name="restore_disclaimer_message_2_title">Parallele Verwendung desselben Seed</string>
<string name="restore_disclaimer_message_2_body">Verwenden Sie nicht denselben Seed gleichzeitig auf verschiedenen Geräten. Dies kann zu Konflikten zwischen den beiden Phoenix-Instanzen führen und dazu, dass die Lightning-Kanäle geschlossen werden.</string>
<string name="utils_ack">Ich verstehe.</string>

<string name="restore_instructions">Der Seed für deine Wallet ist eine Liste mit 12 englischen Wörtern. Schreiben Sie jedes Wort dieser Liste in die folgende Box.</string>
Expand Down
5 changes: 4 additions & 1 deletion phoenix-android/src/main/res/values-es/important_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@
<string name="initwallet_create">Crear una nueva cartera</string>
<string name="initwallet_restore">Restaurar mi cartera</string>

<string name="restore_disclaimer_message">Phoenix sólo puede restaurar los fondos fuera de la cadena que fueron gestionados por esta aplicación.\n\nImportar una semilla que no fue creada por Phoenix no restaurará ningún fondo.\n\nPor favor, asegúrese también de que no está ejecutando otra cartera Phoenix con la misma semilla.</string>
<string name="restore_disclaimer_message_1_title">Phoenix sólo está en Lightning</string>
<string name="restore_disclaimer_message_1_body">Phoenix sólo mostrará los fondos que ya han sido gestionados por Phoenix. Los fondos adjuntos a una semilla generada por otra aplicación no aparecerán aquí (esto incluye los fondos on-chain).</string>
<string name="restore_disclaimer_message_2_title">Utilizar la misma semilla en paralelo</string>
<string name="restore_disclaimer_message_2_body">No utilices la misma semilla al mismo tiempo en diferentes dispositivos. Esto puede causar conflictos entre las dos instancias de Phoenix, y resultar en el cierre de los canales Lightning.</string>
<string name="utils_ack">Entiendo.</string>

<string name="restore_instructions">La semilla de tu cartera es una lista de 12 palabras en inglés. Escribe cada palabra de esta lista en la casilla de abajo.</string>
Expand Down
5 changes: 4 additions & 1 deletion phoenix-android/src/main/res/values-fr/important_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@
<string name="initwallet_create">Créer un nouveau wallet</string>
<string name="initwallet_restore">Restaurer mon wallet</string>

<string name="restore_disclaimer_message">Phoenix ne restaure que les fonds off-chain qu\'il avait déjà gérés.\n\nImporter une seed qui n\'a pas été créée par Phoenix ne restaurera aucun fonds.\n\nVeuillez également vous assurer que cette seed n\'est pas déjà utilisée sur un autre wallet Phoenix.</string>
<string name="restore_disclaimer_message_1_title">Phoenix est uniquement sur Lightning</string>
<string name="restore_disclaimer_message_1_body">Phoenix ne pourra afficher que les fonds qui ont déjà gérés par Phoenix. Les fonds attachés à une clé générée par une autre application n\'apparaîtront pas ici (ceci inclut les fonds on-chain).</string>
<string name="restore_disclaimer_message_2_title">Utilisation de la même clé en parallèle</string>
<string name="restore_disclaimer_message_2_body">N\'utilisez pas la même clé simultanément sur différents appareils. Ceci peut causer des conflits entre les deux instances de Phoenix, et entraîner la fermeture des canaux Lightning.</string>
<string name="utils_ack">Je comprends.</string>

<string name="restore_instructions">La clé (ou seed) de votre wallet est une liste de 12 mots en anglais. Entrez chaque mot de cette liste dans la zone de saisie ci-dessous.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@
<string name="initwallet_create">Criar nova carteira</string>
<string name="initwallet_restore">Restaurar minha carteira</string>

<string name="restore_disclaimer_message">O Phoenix só pode restaurar fundos fora da cadeia que foram gerenciados por este aplicativo.\n\nA importação de uma semente que NÃO foi criada pelo Phoenix não restaurará nenhum fundo.\n\nVerifique também se você já não está executando outra carteira Phoenix com a mesma semente.</string>
<string name="restore_disclaimer_message_1_title">O Phoenix está apenas no Lightning</string>
<string name="restore_disclaimer_message_1_body">O Phoenix exibirá apenas fundos que já tenham sido gerenciados pelo Phoenix. Os fundos vinculados a uma semente gerada por outro aplicativo não aparecerão aqui (isso inclui fundos na cadeia).</string>
<string name="restore_disclaimer_message_2_title">Uso da mesma semente em paralelo</string>
<string name="restore_disclaimer_message_2_body">Não use a mesma semente simultaneamente em dispositivos diferentes. Isso pode causar conflitos entre as duas instâncias do Phoenix e resultar no fechamento de canais Lightning.</string>
<string name="utils_ack">Eu entendo.</string>

<string name="restore_instructions">A semente de sua carteira é uma lista de 12 palavras em inglês. Digite cada palavra dessa lista na caixa abaixo.</string>
Expand Down
Loading

0 comments on commit 27d2543

Please sign in to comment.