Some another fixes for Android. Never ask us about that.

This commit is contained in:
M 2021-01-28 19:58:17 +02:00
parent 0774ce18ca
commit 5631961e47
7 changed files with 57 additions and 25 deletions

View file

@ -3,7 +3,8 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:label="Cake Wallet"
android:allowBackup="false"
@ -17,15 +18,6 @@
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait">
<!-- <meta-data-->
<!-- android:name="io.flutter.embedding.android.NormalTheme"-->
<!-- android:resource="@style/NormalTheme"-->
<!-- />-->
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"

View file

@ -5,7 +5,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:3.5.4'
}
}

View file

@ -9,7 +9,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:3.5.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

View file

@ -696,7 +696,7 @@ extern "C"
void on_startup()
{
Monero::Utils::onStartup();
Monero::WalletManagerFactory::setLogLevel(4);
Monero::WalletManagerFactory::setLogLevel(0);
}
void rescan_blockchain()

View file

@ -1,3 +1,4 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
@ -91,17 +92,46 @@ class BackupPage extends BasePage {
context: context,
builder: (dialogContext) {
return AlertWithTwoActions(
alertTitle: S.of(context).export_backup,
alertContent: S.of(context).save_backup_password,
rightButtonText: S.of(context).seed_alert_yes,
leftButtonText: S.of(context).seed_alert_back,
actionRightButton: () async {
Navigator.of(dialogContext).pop();
final backup = await backupViewModelBase.exportBackup();
await Share.file(
S.of(context).backup_file, backup.name, backup.content, 'text');
},
actionLeftButton: () => Navigator.of(dialogContext).pop());
alertTitle: S.of(context).export_backup,
alertContent: S.of(context).save_backup_password,
rightButtonText: S.of(context).seed_alert_yes,
leftButtonText: S.of(context).seed_alert_back,
actionRightButton: () async {
Navigator.of(dialogContext).pop();
final backup = await backupViewModelBase.exportBackup();
await backupViewModelBase.saveToDownload(
backup.name, backup.content);
if (Platform.isAndroid) {
onExportAndroid(context, backup);
} else {
await Share.file(S.of(context).backup_file, backup.name,
backup.content, 'application/*');
}
},
actionLeftButton: () => Navigator.of(dialogContext).pop());
});
}
void onExportAndroid(BuildContext context, BackupExportFile backup) {
showPopUp<void>(
context: context,
builder: (dialogContext) {
return AlertWithTwoActions(
alertTitle: S.of(context).export_backup,
alertContent: 'Please select destination for the backup file.',
rightButtonText: 'Save to Downloads',
leftButtonText: 'Share',
actionRightButton: () async {
Navigator.of(dialogContext).pop();
await backupViewModelBase.saveToDownload(
backup.name, backup.content);
},
actionLeftButton: () {
Navigator.of(dialogContext).pop();
Share.file(S.of(context).backup_file, backup.name,
backup.content, 'application/*');
});
});
}
}

View file

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:cake_wallet/core/backup_service.dart';
import 'package:cake_wallet/core/execution_state.dart';
import 'package:cake_wallet/entities/secret_store_key.dart';
@ -66,4 +68,12 @@ abstract class BackupViewModelBase with Store {
@action
void showMasterPassword() => isBackupPasswordVisible = true;
@action
Future<void> saveToDownload(String name, List<int> content) async {
const downloadDirPath = '/storage/emulated/0/Download'; // For Android
final filePath = '$downloadDirPath/${name}';
final file = File(filePath);
await file.writeAsBytes(content);
}
}

View file

@ -11,7 +11,7 @@ description: Cake Wallet.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 4.1.0+34
version: 4.1.0+37
environment:
sdk: ">=2.7.0 <3.0.0"