Fix db getting deleted on iOS (#2736)

* Fix db getting deleted on iOS

* Fix db getting deleted on iOS and add a patch for users who updated

* remove prints [skip ci]
This commit is contained in:
Omar Hatem
2025-12-15 04:49:51 +02:00
committed by GitHub
parent 1844405a43
commit aea855d023
11 changed files with 36 additions and 15 deletions
-2
View File
@@ -1,3 +1 @@
Fix QR scanning
UI enhancements
Bug fixes
-2
View File
@@ -1,3 +1 @@
Fix QR scanning
UI enhancements
Bug fixes
+9
View File
@@ -224,6 +224,15 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
snp?.derivationPath ?? electrum_path;
derivationInfo.derivationType ??=
snp?.derivationType ?? DerivationType.electrum;
if (derivationInfo.derivationType == DerivationType.unknown) {
if (snp?.derivationPath == electrum_path || snp?.derivationType == DerivationType.electrum) {
derivationInfo.derivationPath = electrum_path;
derivationInfo.derivationType = DerivationType.electrum;
} else {
derivationInfo.derivationPath = segwit_path;
derivationInfo.derivationType = DerivationType.bip39;
}
}
await derivationInfo.save();
Uint8List? seedBytes = null;
+1
View File
@@ -115,3 +115,4 @@ Map<DerivationType, List<DerivationInfo>> electrum_derivations = {
};
String electrum_path = electrum_derivations[DerivationType.electrum]!.first.derivationPath!;
String segwit_path = "m/84'/0'/0'";
+9
View File
@@ -283,6 +283,15 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
// set the default if not present:
derivationInfo.derivationPath ??= snp?.derivationPath ?? electrum_path;
derivationInfo.derivationType ??= snp?.derivationType ?? DerivationType.electrum;
if (derivationInfo.derivationType == DerivationType.unknown) {
if (snp?.derivationPath == electrum_path || snp?.derivationType == DerivationType.electrum) {
derivationInfo.derivationPath = electrum_path;
derivationInfo.derivationType = DerivationType.electrum;
} else {
derivationInfo.derivationPath = segwit_path;
derivationInfo.derivationType = DerivationType.bip39;
}
}
Uint8List? seedBytes = null;
final mnemonic = keysData.mnemonic;
+1 -1
View File
@@ -15,7 +15,7 @@ Future<void> initDb({String? pathOverride}) async {
final dbFileOld = File("${await getDatabasesPath()}/cake.db");
final dbFile = File("${(await getAppDir()).path}/cake.db");
if (dbFileOld.existsSync()) {
if (Platform.isAndroid && dbFileOld.existsSync() && dbFileOld.path != dbFile.path) {
final copied = dbFileOld.copySync(dbFile.path);
if (copied.existsSync()) {
dbFileOld.deleteSync();
+7
View File
@@ -436,6 +436,13 @@ abstract class NanoWalletBase
final derivationInfo = await walletInfo.getDerivationInfo();
derivationInfo.derivationType ??= derivationType;
if (derivationInfo.derivationType == DerivationType.unknown) {
if (data?['derivationType'] != null) {
derivationInfo.derivationType = derivationType;
} else {
derivationInfo.derivationType = DerivationType.bip39;
}
}
derivationInfo.save();
return NanoWallet(
@@ -360,7 +360,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
alertContent: S.of(context).wallet_name_exists,
buttonText: S.of(context).ok,
buttonAction: () {
if (Navigator.of(context).canPop()) {
if (mounted && Navigator.of(context).canPop()) {
Navigator.of(context).pop();
}
});
@@ -17,7 +17,6 @@ class WalletRestoreChooseDerivationPage extends BasePage {
);
final WalletRestoreChooseDerivationViewModel walletRestoreChooseDerivationViewModel;
DerivationType derivationType = DerivationType.unknown;
@override
Widget body(BuildContext context) {
+4 -4
View File
@@ -14,15 +14,15 @@ TYPES=($MONERO_COM $CAKEWALLET)
APP_ANDROID_TYPE=$1
MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="5.6.3"
MONERO_COM_BUILD_NUMBER=4148
MONERO_COM_VERSION="5.6.4"
MONERO_COM_BUILD_NUMBER=4149
MONERO_COM_BUNDLE_ID="com.monero.app"
MONERO_COM_PACKAGE="com.monero.app"
MONERO_COM_SCHEME="monero.com"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="5.6.3"
CAKEWALLET_BUILD_NUMBER=4294
CAKEWALLET_VERSION="5.6.4"
CAKEWALLET_BUILD_NUMBER=4295
CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
CAKEWALLET_SCHEME="cakewallet"
+4 -4
View File
@@ -12,13 +12,13 @@ TYPES=($MONERO_COM $CAKEWALLET)
APP_IOS_TYPE=$1
MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="5.6.3"
MONERO_COM_BUILD_NUMBER=151
MONERO_COM_VERSION="5.6.4"
MONERO_COM_BUILD_NUMBER=152
MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="5.6.3"
CAKEWALLET_BUILD_NUMBER=357
CAKEWALLET_VERSION="5.6.4"
CAKEWALLET_BUILD_NUMBER=359
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"