Changes for buy page for bitcoin and litecoin. Added listeners for notifications from resume and launch.

wownero
M 3 years ago
parent 6268cf3788
commit 81b34a30e7

@ -366,7 +366,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 46;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
@ -510,7 +510,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 46;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
@ -546,7 +546,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 46;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";

@ -10,6 +10,25 @@ class PushNotificationsService {
static final PushNotificationsService _instance = PushNotificationsService._();
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();
bool _initialized = false;
@ -20,24 +39,9 @@ class PushNotificationsService {
_firebaseMessaging.requestNotificationPermissions();
_firebaseMessaging.configure(
onMessage: (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);
},
onMessage: (message) async => _showNotification(message),
onLaunch: (message) async => _showNotification(message),
onResume: (message) async => _showNotification(message),
onBackgroundMessage: _onBackgroundMessage);
_initialized = true;

@ -73,9 +73,7 @@ class PreOrderPage extends BasePage {
@override
Widget trailing(context) => TrailButton(
caption: S.of(context).clear,
onPressed: () {
buyViewModel.reset();
});
onPressed: () => buyViewModel.reset());
@override
Widget body(BuildContext context) {

@ -180,10 +180,7 @@ class DashboardPage extends BasePage {
final walletType = walletViewModel.type;
switch (walletType) {
case WalletType.bitcoin:
Navigator.of(context).pushNamed(Routes.preOrder);
break;
default:
case WalletType.monero:
await showPopUp<void>(
context: context,
builder: (BuildContext context) {
@ -194,6 +191,9 @@ class DashboardPage extends BasePage {
buttonAction: () => Navigator.of(context).pop());
});
break;
default:
Navigator.of(context).pushNamed(Routes.preOrder);
break;
}
}
}

@ -89,7 +89,11 @@ abstract class BuyViewModelBase with Store {
}
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;
try {

Loading…
Cancel
Save