Merge branch 'main' of https://github.com/cake-tech/cake_wallet into error-report-enhancements

This commit is contained in:
OmarHatem
2023-02-28 15:37:37 +02:00
15 changed files with 1439 additions and 56 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ class AnyPayPayment {
List<String> get outAddresses {
return instructions
.map((instuction) => instuction.outputs.map((out) => out.address))
.map((instruction) => instruction.outputs.map((out) => out.address))
.expand((e) => e)
.toList();
}
+4 -4
View File
@@ -22,13 +22,13 @@ class WalletLoadingService {
final wallet = await walletService.openWallet(name, password);
if (type == WalletType.monero) {
await upateMoneroWalletPassword(wallet);
await updateMoneroWalletPassword(wallet);
}
return wallet;
}
Future<void> upateMoneroWalletPassword(WalletBase wallet) async {
Future<void> updateMoneroWalletPassword(WalletBase wallet) async {
final key = PreferencesKey.moneroWalletUpdateV1Key(wallet.name);
var isPasswordUpdated = sharedPreferences.getBool(key) ?? false;
@@ -37,8 +37,8 @@ class WalletLoadingService {
}
final password = generateWalletPassword();
// Save new generated password with backup key for case
// if wallet will change password, but it will faild to updated in secure storage
// Save new generated password with backup key for case where
// wallet will change password, but it will fail to update in secure storage
final bakWalletName = '#__${wallet.name}_bak__#';
await keyService.saveWalletPassword(walletName: bakWalletName, password: password);
await wallet.changePassword(password);
+4
View File
@@ -23,6 +23,8 @@ class LanguageService {
'ar': 'العربية (Arabic)',
'tr': 'Türkçe (Turkish)',
'my': 'မြန်မာ (Burmese)',
'bg': 'Български (Bulgarian)',
'ur': 'اردو (Urdu)'
};
static const Map<String, String> localeCountryCode = {
@@ -45,6 +47,8 @@ class LanguageService {
'ar': 'sau',
'tr': 'tur',
'my': 'mmr',
'bg': 'bgr',
'ur': 'pak'
};
static final list = <String, String> {};
+5 -10
View File
@@ -1,10 +1,9 @@
import 'dart:io';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/utils/share_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:share_plus/share_plus.dart';
import 'package:cross_file/cross_file.dart';
import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart';
@@ -110,7 +109,7 @@ class BackupPage extends BasePage {
if (Platform.isAndroid) {
onExportAndroid(context, backup);
} else {
await share(backup);
await share(backup, context);
}
},
actionLeftButton: () => Navigator.of(dialogContext).pop());
@@ -140,18 +139,14 @@ class BackupPage extends BasePage {
},
actionLeftButton: () async {
Navigator.of(dialogContext).pop();
await share(backup);
await share(backup, context);
});
});
}
Future<void> share(BackupExportFile backup) async {
const mimeType = 'application/*';
Future<void> share(BackupExportFile backup, BuildContext context) async {
final path = await backupViewModelBase.saveBackupFileLocally(backup);
await Share.shareXFiles(<XFile>[XFile(
path,
name: backup.name,
mimeType: mimeType)]);
await ShareUtil.shareFile(filePath: path, fileName: backup.name, context: context);
await backupViewModelBase.removeBackupFileLocally(backup);
}
}
@@ -8,7 +8,6 @@ import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/menu_widget.dart';
@@ -229,7 +228,8 @@ class DashboardPage extends BasePage {
}
await Future<void>.delayed(Duration(seconds: 1));
await showPopUp<void>(
if (context.mounted) {
await showPopUp<void>(
context: context,
builder: (BuildContext context) {
return AlertWithOneAction(
@@ -239,6 +239,7 @@ class DashboardPage extends BasePage {
buttonText: S.of(context).understand,
buttonAction: () => Navigator.of(context).pop());
});
}
});
var needToPresentYat = false;
@@ -117,7 +117,8 @@ class AddressPage extends BasePage {
}
await Future<void>.delayed(Duration(seconds: 1));
await showPopUp<void>(
if (context.mounted) {
await showPopUp<void>(
context: context,
builder: (BuildContext context) {
return AlertWithTwoActions(
@@ -131,6 +132,7 @@ class AddressPage extends BasePage {
Navigator.of(context).pop();
});
});
}
});
return KeyboardActions(
+3 -1
View File
@@ -379,7 +379,8 @@ class SendPage extends BasePage {
if (state is ExecutedSuccessfullyState) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showPopUp<void>(
if (context.mounted) {
showPopUp<void>(
context: context,
builder: (BuildContext context) {
return ConfirmSendingAlert(
@@ -423,6 +424,7 @@ class SendPage extends BasePage {
},
actionLeftButton: () => Navigator.of(context).pop());
});
}
});
}
@@ -30,6 +30,8 @@ class SettingsLinkProviderCell extends StandardListRow {
color: Palette.blueCraiola));
static void _launchUrl(String url) async {
if (await canLaunch(url)) await launch(url, forceSafariVC: false);
try {
await launch(url, forceSafariVC: false);
} catch (e) {}
}
}
}
+28 -4
View File
@@ -1,13 +1,37 @@
import 'package:flutter/material.dart';
import 'package:share_plus/share_plus.dart';
import 'package:cross_file/cross_file.dart';
class ShareUtil {
static void share({required String text, required BuildContext context}) {
final box = context.findRenderObject() as RenderBox?;
static const _mimeType = 'application/*';
static void share({required String text, required BuildContext context}) {
Share.share(
text,
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
sharePositionOrigin: _sharePosition(context),
);
}
}
static Future<void> shareFile({
required String filePath,
required String fileName,
required BuildContext context,
}) async {
Share.shareXFiles(
<XFile>[
XFile(
filePath,
name: fileName,
mimeType: _mimeType,
)
],
sharePositionOrigin: _sharePosition(context),
);
}
static Rect? _sharePosition(BuildContext context) {
final box = context.findRenderObject() as RenderBox?;
return box!.localToGlobal(Offset.zero) & box.size;
}
}
+3 -2
View File
@@ -7,7 +7,6 @@ import 'package:flutter/material.dart';
import 'package:mobx/mobx.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
part 'support_view_model.g.dart';
@@ -19,7 +18,9 @@ abstract class SupportViewModelBase with Store {
RegularListItem(
title: S.current.faq,
handler: (BuildContext context) async {
if (await canLaunch(url)) await launch(url);
try {
await launch(url);
} catch (e) {}
},
),
LinkListItem(