mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
Changes for buy page for bitcoin and litecoin. Added listeners for notifications from resume and launch.
This commit is contained in:
parent
6268cf3788
commit
81b34a30e7
5 changed files with 35 additions and 29 deletions
|
@ -366,7 +366,7 @@
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 45;
|
CURRENT_PROJECT_VERSION = 46;
|
||||||
DEVELOPMENT_TEAM = 32J6BB6VUS;
|
DEVELOPMENT_TEAM = 32J6BB6VUS;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
EXCLUDED_SOURCE_FILE_NAMES = "";
|
EXCLUDED_SOURCE_FILE_NAMES = "";
|
||||||
|
@ -510,7 +510,7 @@
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 45;
|
CURRENT_PROJECT_VERSION = 46;
|
||||||
DEVELOPMENT_TEAM = 32J6BB6VUS;
|
DEVELOPMENT_TEAM = 32J6BB6VUS;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
EXCLUDED_SOURCE_FILE_NAMES = "";
|
EXCLUDED_SOURCE_FILE_NAMES = "";
|
||||||
|
@ -546,7 +546,7 @@
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 45;
|
CURRENT_PROJECT_VERSION = 46;
|
||||||
DEVELOPMENT_TEAM = 32J6BB6VUS;
|
DEVELOPMENT_TEAM = 32J6BB6VUS;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
EXCLUDED_SOURCE_FILE_NAMES = "";
|
EXCLUDED_SOURCE_FILE_NAMES = "";
|
||||||
|
|
|
@ -10,6 +10,25 @@ class PushNotificationsService {
|
||||||
|
|
||||||
static final PushNotificationsService _instance = PushNotificationsService._();
|
static final PushNotificationsService _instance = PushNotificationsService._();
|
||||||
static Future<dynamic> _onBackgroundMessage(Map<String, dynamic> message) async {}
|
static Future<dynamic> _onBackgroundMessage(Map<String, dynamic> message) async {}
|
||||||
|
static Future<void> _showNotification(Map<String, dynamic> message) async {
|
||||||
|
Map<dynamic, dynamic> alert = <dynamic, dynamic>{};
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
final _firebaseMessaging = FirebaseMessaging();
|
final _firebaseMessaging = FirebaseMessaging();
|
||||||
bool _initialized = false;
|
bool _initialized = false;
|
||||||
|
|
||||||
|
@ -20,24 +39,9 @@ class PushNotificationsService {
|
||||||
|
|
||||||
_firebaseMessaging.requestNotificationPermissions();
|
_firebaseMessaging.requestNotificationPermissions();
|
||||||
_firebaseMessaging.configure(
|
_firebaseMessaging.configure(
|
||||||
onMessage: (message) async {
|
onMessage: (message) async => _showNotification(message),
|
||||||
Map<dynamic, dynamic> alert = <dynamic, dynamic>{};
|
onLaunch: (message) async => _showNotification(message),
|
||||||
String msg = '';
|
onResume: (message) async => _showNotification(message),
|
||||||
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);
|
onBackgroundMessage: _onBackgroundMessage);
|
||||||
|
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
|
|
|
@ -73,9 +73,7 @@ class PreOrderPage extends BasePage {
|
||||||
@override
|
@override
|
||||||
Widget trailing(context) => TrailButton(
|
Widget trailing(context) => TrailButton(
|
||||||
caption: S.of(context).clear,
|
caption: S.of(context).clear,
|
||||||
onPressed: () {
|
onPressed: () => buyViewModel.reset());
|
||||||
buyViewModel.reset();
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) {
|
Widget body(BuildContext context) {
|
||||||
|
|
|
@ -180,10 +180,7 @@ class DashboardPage extends BasePage {
|
||||||
final walletType = walletViewModel.type;
|
final walletType = walletViewModel.type;
|
||||||
|
|
||||||
switch (walletType) {
|
switch (walletType) {
|
||||||
case WalletType.bitcoin:
|
case WalletType.monero:
|
||||||
Navigator.of(context).pushNamed(Routes.preOrder);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
await showPopUp<void>(
|
await showPopUp<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
@ -194,6 +191,9 @@ class DashboardPage extends BasePage {
|
||||||
buttonAction: () => Navigator.of(context).pop());
|
buttonAction: () => Navigator.of(context).pop());
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
Navigator.of(context).pushNamed(Routes.preOrder);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,11 @@ abstract class BuyViewModelBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _fetchBuyItems() async {
|
Future<void> _fetchBuyItems() async {
|
||||||
final List<BuyProvider> _providerList = [WyreBuyProvider(wallet: wallet)];
|
final List<BuyProvider> _providerList = [];
|
||||||
|
|
||||||
|
if (wallet.type == WalletType.bitcoin) {
|
||||||
|
_providerList.add(WyreBuyProvider(wallet: wallet));
|
||||||
|
}
|
||||||
|
|
||||||
var isMoonPayEnabled = false;
|
var isMoonPayEnabled = false;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue