mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-20 06:08:34 +02:00
Merge branch 'main' into CAKE-306-add-moonpay-option-for-btc-buying
# Conflicts: # lib/di.dart # lib/view_model/dashboard/dashboard_view_model.dart # res/values/strings_de.arb # res/values/strings_en.arb # res/values/strings_es.arb # res/values/strings_hi.arb # res/values/strings_hr.arb # res/values/strings_it.arb # res/values/strings_ja.arb # res/values/strings_ko.arb # res/values/strings_nl.arb # res/values/strings_pl.arb # res/values/strings_pt.arb # res/values/strings_ru.arb # res/values/strings_uk.arb # res/values/strings_zh.arb
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class BitcoinMnemonicIsIncorrectException implements Exception {
|
||||
@override
|
||||
String toString() =>
|
||||
'Bitcoin mnemonic has incorrect format. Mnemonic should contain 24 words separated by space.';
|
||||
'Bitcoin mnemonic has incorrect format. Mnemonic should contain 12 or 24 words separated by space.';
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ abstract class ElectrumTransactionHistoryBase
|
||||
|
||||
@override
|
||||
void addMany(Map<String, ElectrumTransactionInfo> transactions) =>
|
||||
this.transactions.addAll(transactions);
|
||||
transactions.forEach((_, tx) => _updateOrInsert(tx));
|
||||
|
||||
@override
|
||||
Future<void> save() async {
|
||||
|
||||
+6
-1
@@ -115,6 +115,7 @@ import 'package:cake_wallet/store/templates/exchange_template_store.dart';
|
||||
import 'package:cake_wallet/entities/template.dart';
|
||||
import 'package:cake_wallet/exchange/exchange_template.dart';
|
||||
import 'package:cake_wallet/.secrets.g.dart' as secrets;
|
||||
import 'package:cake_wallet/entities/push_notifications_service.dart';
|
||||
|
||||
final getIt = GetIt.instance;
|
||||
|
||||
@@ -244,6 +245,9 @@ Future setup(
|
||||
settingsStore: getIt.get<SettingsStore>(),
|
||||
fiatConvertationStore: getIt.get<FiatConversionStore>()));
|
||||
|
||||
|
||||
getIt.registerFactory(() => PushNotificationsService());
|
||||
|
||||
getIt.registerFactory(() => DashboardViewModel(
|
||||
balanceViewModel: getIt.get<BalanceViewModel>(),
|
||||
appStore: getIt.get<AppStore>(),
|
||||
@@ -251,7 +255,8 @@ Future setup(
|
||||
tradeFilterStore: getIt.get<TradeFilterStore>(),
|
||||
transactionFilterStore: getIt.get<TransactionFilterStore>(),
|
||||
settingsStore: settingsStore,
|
||||
ordersStore: getIt.get<OrdersStore>()));
|
||||
ordersStore: getIt.get<OrdersStore>(),
|
||||
pushNotificationsService: getIt.get<PushNotificationsService>()));
|
||||
|
||||
getIt.registerFactory<AuthService>(() => AuthService(
|
||||
secureStorage: getIt.get<FlutterSecureStorage>(),
|
||||
|
||||
@@ -7,7 +7,7 @@ class BiometricAuth {
|
||||
|
||||
Future<bool> isAuthenticated() async {
|
||||
try {
|
||||
return await _localAuth.authenticateWithBiometrics(
|
||||
return await _localAuth.authenticate(
|
||||
localizedReason: S.current.biometric_auth_reason,
|
||||
useErrorDialogs: true,
|
||||
stickyAuth: false);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import 'dart:io';
|
||||
import 'package:cake_wallet/main.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
|
||||
class PushNotificationsService {
|
||||
PushNotificationsService._();
|
||||
|
||||
factory PushNotificationsService() => _instance;
|
||||
|
||||
static final PushNotificationsService _instance = PushNotificationsService._();
|
||||
static Future<dynamic> _onBackgroundMessage(Map<String, dynamic> message) async {}
|
||||
final _firebaseMessaging = FirebaseMessaging();
|
||||
bool _initialized = false;
|
||||
|
||||
Future<void> init() async {
|
||||
if (_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
_firebaseMessaging.requestNotificationPermissions();
|
||||
_firebaseMessaging.configure(
|
||||
onMessage: (message) async {
|
||||
Map<dynamic, dynamic> alert = {};
|
||||
String msg = '';
|
||||
String title = '';
|
||||
|
||||
if (Platform.isIOS) {
|
||||
alert = message['aps']['alert'] as Map<dynamic, dynamic> ?? <dynamic, dynamic>{};
|
||||
msg = alert['body'] as String ?? '';
|
||||
title = alert['title'] as String ?? '';
|
||||
}
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
msg = message['notification']['body'] as String ?? '';
|
||||
title = message['notification']['title'] as String ?? '';
|
||||
}
|
||||
|
||||
await showBar<void>(navigatorKey.currentContext, msg, titleText: title, duration: null);
|
||||
},
|
||||
onBackgroundMessage: _onBackgroundMessage);
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ String walletTypeToDisplayName(WalletType type) {
|
||||
case WalletType.bitcoin:
|
||||
return 'Bitcoin (Electrum)';
|
||||
case WalletType.litecoin:
|
||||
return 'Litecoin';
|
||||
return 'Litecoin (Electrum)';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ class ExchangeTemplatePage extends BasePage {
|
||||
initialIsAddressEditable:
|
||||
exchangeViewModel.isReceiveAddressEnabled,
|
||||
isAmountEstimated: true,
|
||||
currencies: CryptoCurrency.all,
|
||||
currencies: exchangeViewModel.receiveCurrencies,
|
||||
onCurrencySelected: (currency) =>
|
||||
exchangeViewModel.changeReceiveCurrency(
|
||||
currency: currency),
|
||||
|
||||
@@ -45,6 +45,7 @@ class CurrencyPickerState extends State<CurrencyPicker> {
|
||||
color: Palette.darkBlueCraiola,
|
||||
);
|
||||
final int crossAxisCount = 3;
|
||||
final int maxNumberItemsInAlert = 12;
|
||||
final int itemsCount;
|
||||
final double backgroundHeight = 280;
|
||||
final double thumbHeight = 72;
|
||||
@@ -148,6 +149,7 @@ class CurrencyPickerState extends State<CurrencyPicker> {
|
||||
);
|
||||
})
|
||||
),
|
||||
if (itemsCount > maxNumberItemsInAlert)
|
||||
CakeScrollbar(
|
||||
backgroundHeight: backgroundHeight,
|
||||
thumbHeight: thumbHeight,
|
||||
|
||||
+12
-4
@@ -2,8 +2,11 @@ import 'package:flushbar/flushbar.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Future<T> showBar<T>(BuildContext context, String text,
|
||||
{bool isDark = false, Duration duration = const Duration(seconds: 1), bool isDismissible = true}) {
|
||||
Future<T> showBar<T>(BuildContext context, String messageText,
|
||||
{bool isDark = false,
|
||||
Duration duration = const Duration(seconds: 1),
|
||||
bool isDismissible = true,
|
||||
String titleText}) {
|
||||
final bar = Flushbar<T>(
|
||||
boxShadows: [
|
||||
BoxShadow(
|
||||
@@ -14,9 +17,14 @@ Future<T> showBar<T>(BuildContext context, String text,
|
||||
backgroundColor: isDark ? Colors.black : Colors.white,
|
||||
borderRadius: 35,
|
||||
margin: EdgeInsets.all(50),
|
||||
messageText: Text(text,
|
||||
titleText: titleText != null
|
||||
? Text(titleText,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: isDark ? Colors.white : Colors.black, fontWeight: FontWeight.bold, fontSize: 24.0))
|
||||
: null,
|
||||
messageText: Text(messageText,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: isDark ? Colors.white : Colors.black)),
|
||||
style: TextStyle(color: isDark ? Colors.white : Colors.black, fontSize: 16)),
|
||||
duration: duration,
|
||||
isDismissible: isDismissible,
|
||||
flushbarPosition: FlushbarPosition.TOP,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:cake_wallet/core/transaction_history.dart';
|
||||
import 'package:cake_wallet/entities/balance.dart';
|
||||
import 'package:cake_wallet/entities/push_notifications_service.dart';
|
||||
import 'package:cake_wallet/buy/order.dart';
|
||||
import 'package:cake_wallet/entities/transaction_history.dart';
|
||||
import 'package:cake_wallet/exchange/trade_state.dart';
|
||||
@@ -46,7 +47,9 @@ abstract class DashboardViewModelBase with Store {
|
||||
this.tradeFilterStore,
|
||||
this.transactionFilterStore,
|
||||
this.settingsStore,
|
||||
this.ordersStore}) {
|
||||
this.ordersStore,
|
||||
PushNotificationsService pushNotificationsService}) {
|
||||
_pushNotificationsService = pushNotificationsService;
|
||||
filterItems = {
|
||||
S.current.transactions: [
|
||||
FilterItem(
|
||||
@@ -133,6 +136,8 @@ abstract class DashboardViewModelBase with Store {
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
Future.delayed(Duration(seconds: 2), () => _pushNotificationsService.init());
|
||||
}
|
||||
|
||||
@observable
|
||||
@@ -220,18 +225,20 @@ abstract class DashboardViewModelBase with Store {
|
||||
|
||||
bool get isBuyEnabled => settingsStore.isBitcoinBuyEnabled;
|
||||
|
||||
PushNotificationsService _pushNotificationsService;
|
||||
|
||||
ReactionDisposer _onMoneroAccountChangeReaction;
|
||||
|
||||
ReactionDisposer _onMoneroBalanceChangeReaction;
|
||||
|
||||
@observable
|
||||
bool isOutdatedElectrumWallet;
|
||||
|
||||
Future<void> reconnect() async {
|
||||
final node = appStore.settingsStore.getCurrentNode(wallet.type);
|
||||
await wallet.connectToNode(node: node);
|
||||
}
|
||||
|
||||
@observable
|
||||
bool isOutdatedElectrumWallet;
|
||||
|
||||
@action
|
||||
void _onWalletChange(
|
||||
WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
|
||||
|
||||
@@ -24,6 +24,15 @@ abstract class SupportViewModelBase with Store {
|
||||
title: 'Email',
|
||||
linkTitle: 'support@cakewallet.com',
|
||||
link: 'mailto:support@cakewallet.com'),
|
||||
LinkListItem(
|
||||
title: 'Website',
|
||||
linkTitle: 'cakewallet.com',
|
||||
link: 'https://cakewallet.com'),
|
||||
LinkListItem(
|
||||
title: 'GitHub',
|
||||
icon: 'assets/images/github.png',
|
||||
linkTitle: S.current.apk_update,
|
||||
link: 'https://github.com/cake-tech/cake_wallet/releases'),
|
||||
LinkListItem(
|
||||
title: 'Telegram',
|
||||
icon: 'assets/images/Telegram.png',
|
||||
|
||||
Reference in New Issue
Block a user