diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index e5aaa7e0..fd2a469c 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -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 = ""; diff --git a/lib/entities/push_notifications_service.dart b/lib/entities/push_notifications_service.dart index 5fb68bae..bf5226af 100644 --- a/lib/entities/push_notifications_service.dart +++ b/lib/entities/push_notifications_service.dart @@ -10,6 +10,25 @@ class PushNotificationsService { static final PushNotificationsService _instance = PushNotificationsService._(); static Future _onBackgroundMessage(Map message) async {} + static Future _showNotification(Map message) async { + Map alert = {}; + String msg = ''; + String title = ''; + + if (Platform.isIOS) { + alert = message['aps']['alert'] as Map ?? {}; + 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(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 alert = {}; - String msg = ''; - String title = ''; - - if (Platform.isIOS) { - alert = message['aps']['alert'] as Map ?? {}; - 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(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; diff --git a/lib/src/screens/buy/pre_order_page.dart b/lib/src/screens/buy/pre_order_page.dart index 54eeebb6..7f18873a 100644 --- a/lib/src/screens/buy/pre_order_page.dart +++ b/lib/src/screens/buy/pre_order_page.dart @@ -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) { diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index 5e21b88e..9ec03ea1 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -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( 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; } } } diff --git a/lib/view_model/buy/buy_view_model.dart b/lib/view_model/buy/buy_view_model.dart index 95739edd..270d6213 100644 --- a/lib/view_model/buy/buy_view_model.dart +++ b/lib/view_model/buy/buy_view_model.dart @@ -89,7 +89,11 @@ abstract class BuyViewModelBase with Store { } Future _fetchBuyItems() async { - final List _providerList = [WyreBuyProvider(wallet: wallet)]; + final List _providerList = []; + + if (wallet.type == WalletType.bitcoin) { + _providerList.add(WyreBuyProvider(wallet: wallet)); + } var isMoonPayEnabled = false; try {