Added push notifications, FCM.

M committed Jun 4, 2021 at 18:25 UTC ff6e4d58f700738e5e14fdcd3d00ff1f20d93de2
18 files changed +259 -16
.gitignore
+4 -1
@@ -97,4 +97,7 @@ android/app/.cxx/**
97 ios/Flutter/.last_build_id
98 /lib/generated/**
99 #**#
100 -/**/#**#
\ No newline at end of file
100 +/**/#**#
101 +
102 +**/google-services.json
103 +**/GoogleService-Info.plist
\ No newline at end of file
android/app/build.gradle
+6
@@ -24,6 +24,10 @@ if (flutterVersionName == null) {
24 apply plugin: 'com.android.application'
25 apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26
27 +if (file("./google-services.json").exists()) {
28 + apply plugin: 'com.google.gms.google-services'
29 +}
30 +
31 def keystoreProperties = new Properties()
32 def keystorePropertiesFile = rootProject.file('key.properties')
33 if (keystorePropertiesFile.exists()) {
@@ -83,4 +87,6 @@ dependencies {
87 testImplementation 'junit:junit:4.12'
88 androidTestImplementation 'androidx.test:runner:1.1.1'
89 androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
90 + implementation 'com.google.firebase:firebase-core:19.0.0'
91 + implementation 'com.google.firebase:firebase-messaging:19.0.0'
92 }
android/app/src/main/AndroidManifest.xml
+1 -1
@@ -7,6 +7,7 @@
7 <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
8
9 <application
10 + android:name=".Application"
11 android:label="Cake Wallet"
12 android:allowBackup="false"
13 android:fullBackupContent="false"
@@ -29,7 +30,6 @@
30 <category android:name="android.intent.category.LAUNCHER"/>
31 </intent-filter>
32 </activity>
32 -
33 <meta-data
34 android:name="flutterEmbedding"
35 android:value="2" />
android/app/src/main/java/com/cakewallet/cake_wallet/Application.java new
+21
@@ -0,0 +1,21 @@
1 +package com.cakewallet.cake_wallet;
2 +
3 +import io.flutter.app.FlutterApplication;
4 +import io.flutter.plugin.common.PluginRegistry;
5 +import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
6 +import io.flutter.plugins.GeneratedPluginRegistrant;
7 +import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
8 +import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin;
9 +
10 +public class Application extends FlutterApplication implements PluginRegistrantCallback {
11 + @Override
12 + public void onCreate() {
13 + super.onCreate();
14 + FlutterFirebaseMessagingService.setPluginRegistrant(this);
15 + }
16 +
17 + @Override
18 + public void registerWith(PluginRegistry registry) {
19 + FirebaseMessagingPlugin.registerWith(registry.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
20 + }
21 +}
\ No newline at end of file
android/build.gradle
+1
@@ -6,6 +6,7 @@ buildscript {
6
7 dependencies {
8 classpath 'com.android.tools.build:gradle:3.5.4'
9 + classpath 'com.google.gms:google-services:4.3.8'
10 }
11 }
12
ios/Podfile
+1
@@ -36,6 +36,7 @@ target 'Runner' do
36
37 # Cake Wallet (Legacy)
38 pod 'CryptoSwift'
39 + pod 'Firebase/Messaging', '6.33.0'
40 end
41
42 post_install do |installer|
ios/Podfile.lock
+98 -1
@@ -62,18 +62,84 @@ PODS:
62 - file_picker (0.0.1):
63 - DKImagePickerController/PhotoGallery
64 - Flutter
65 + - Firebase/CoreOnly (6.33.0):
66 + - FirebaseCore (= 6.10.3)
67 + - Firebase/Messaging (6.33.0):
68 + - Firebase/CoreOnly
69 + - FirebaseMessaging (~> 4.7.0)
70 + - firebase_core (0.5.3):
71 + - Firebase/CoreOnly (~> 6.33.0)
72 + - Flutter
73 + - firebase_messaging (7.0.3):
74 + - Firebase/CoreOnly (~> 6.33.0)
75 + - Firebase/Messaging (~> 6.33.0)
76 + - firebase_core
77 + - Flutter
78 + - FirebaseCore (6.10.3):
79 + - FirebaseCoreDiagnostics (~> 1.6)
80 + - GoogleUtilities/Environment (~> 6.7)
81 + - GoogleUtilities/Logger (~> 6.7)
82 + - FirebaseCoreDiagnostics (1.7.0):
83 + - GoogleDataTransport (~> 7.4)
84 + - GoogleUtilities/Environment (~> 6.7)
85 + - GoogleUtilities/Logger (~> 6.7)
86 + - nanopb (~> 1.30906.0)
87 + - FirebaseInstallations (1.7.0):
88 + - FirebaseCore (~> 6.10)
89 + - GoogleUtilities/Environment (~> 6.7)
90 + - GoogleUtilities/UserDefaults (~> 6.7)
91 + - PromisesObjC (~> 1.2)
92 + - FirebaseInstanceID (4.8.0):
93 + - FirebaseCore (~> 6.10)
94 + - FirebaseInstallations (~> 1.6)
95 + - GoogleUtilities/Environment (~> 6.7)
96 + - GoogleUtilities/UserDefaults (~> 6.7)
97 + - FirebaseMessaging (4.7.1):
98 + - FirebaseCore (~> 6.10)
99 + - FirebaseInstanceID (~> 4.7)
100 + - GoogleUtilities/AppDelegateSwizzler (~> 6.7)
101 + - GoogleUtilities/Environment (~> 6.7)
102 + - GoogleUtilities/Reachability (~> 6.7)
103 + - GoogleUtilities/UserDefaults (~> 6.7)
104 + - Protobuf (>= 3.9.2, ~> 3.9)
105 - Flutter (1.0.0)
106 - flutter_secure_storage (3.3.1):
107 - Flutter
108 + - GoogleDataTransport (7.5.1):
109 + - nanopb (~> 1.30906.0)
110 + - GoogleUtilities/AppDelegateSwizzler (6.7.2):
111 + - GoogleUtilities/Environment
112 + - GoogleUtilities/Logger
113 + - GoogleUtilities/Network
114 + - GoogleUtilities/Environment (6.7.2):
115 + - PromisesObjC (~> 1.2)
116 + - GoogleUtilities/Logger (6.7.2):
117 + - GoogleUtilities/Environment
118 + - GoogleUtilities/Network (6.7.2):
119 + - GoogleUtilities/Logger
120 + - "GoogleUtilities/NSData+zlib"
121 + - GoogleUtilities/Reachability
122 + - "GoogleUtilities/NSData+zlib (6.7.2)"
123 + - GoogleUtilities/Reachability (6.7.2):
124 + - GoogleUtilities/Logger
125 + - GoogleUtilities/UserDefaults (6.7.2):
126 + - GoogleUtilities/Logger
127 - local_auth (0.0.1):
128 - Flutter
129 - MTBBarcodeScanner (5.0.11)
130 + - nanopb (1.30906.0):
131 + - nanopb/decode (= 1.30906.0)
132 + - nanopb/encode (= 1.30906.0)
133 + - nanopb/decode (1.30906.0)
134 + - nanopb/encode (1.30906.0)
135 - package_info (0.0.1):
136 - Flutter
137 - path_provider (0.0.1):
138 - Flutter
139 - "permission_handler (5.1.0+2)":
140 - Flutter
141 + - PromisesObjC (1.2.12)
142 + - Protobuf (3.17.0)
143 - Reachability (3.2)
144 - SDWebImage (5.9.1):
145 - SDWebImage/Core (= 5.9.1)
@@ -97,6 +163,9 @@ DEPENDENCIES:
163 - devicelocale (from `.symlinks/plugins/devicelocale/ios`)
164 - esys_flutter_share (from `.symlinks/plugins/esys_flutter_share/ios`)
165 - file_picker (from `.symlinks/plugins/file_picker/ios`)
166 + - Firebase/Messaging (= 6.33.0)
167 + - firebase_core (from `.symlinks/plugins/firebase_core/ios`)
168 + - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
169 - Flutter (from `Flutter`)
170 - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
171 - local_auth (from `.symlinks/plugins/local_auth/ios`)
@@ -113,7 +182,18 @@ SPEC REPOS:
182 - CryptoSwift
183 - DKImagePickerController
184 - DKPhotoGallery
185 + - Firebase
186 + - FirebaseCore
187 + - FirebaseCoreDiagnostics
188 + - FirebaseInstallations
189 + - FirebaseInstanceID
190 + - FirebaseMessaging
191 + - GoogleDataTransport
192 + - GoogleUtilities
193 - MTBBarcodeScanner
194 + - nanopb
195 + - PromisesObjC
196 + - Protobuf
197 - Reachability
198 - SDWebImage
199 - SwiftProtobuf
@@ -132,6 +212,10 @@ EXTERNAL SOURCES:
212 :path: ".symlinks/plugins/esys_flutter_share/ios"
213 file_picker:
214 :path: ".symlinks/plugins/file_picker/ios"
215 + firebase_core:
216 + :path: ".symlinks/plugins/firebase_core/ios"
217 + firebase_messaging:
218 + :path: ".symlinks/plugins/firebase_messaging/ios"
219 Flutter:
220 :path: Flutter
221 flutter_secure_storage:
@@ -163,13 +247,26 @@ SPEC CHECKSUMS:
247 DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
248 esys_flutter_share: 403498dab005b36ce1f8d7aff377e81f0621b0b4
249 file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1
250 + Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5
251 + firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659
252 + firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75
253 + FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd
254 + FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1
255 + FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2
256 + FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1
257 + FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a
258 Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
259 flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
260 + GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833
261 + GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3
262 local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd
263 MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
264 + nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc
265 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
266 path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
267 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
268 + PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
269 + Protobuf: 7327d4444215b5f18e560a97f879ff5503c4581c
270 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
271 SDWebImage: a990c053fff71e388a10f3357edb0be17929c9c5
272 share: 0b2c3e82132f5888bccca3351c504d0003b3b410
@@ -179,6 +276,6 @@ SPEC CHECKSUMS:
276 url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
277 webview_flutter: 9f491a9b5a66f2573946a389b2677987b0ff8c0b
278
182 -PODFILE CHECKSUM: 5b5f101b119a1b6eb857c967d462832a9062dec4
279 +PODFILE CHECKSUM: f316539722a6f9dbb0d0f1065a27fa7ea38c6f88
280
281 COCOAPODS: 1.9.3
ios/Runner.xcodeproj/project.pbxproj
+7
@@ -7,6 +7,7 @@
7 objects = {
8
9 /* Begin PBXBuildFile section */
10 + 0C37B8B926678E9100C6E5A9 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0C37B8B826678E9100C6E5A9 /* GoogleService-Info.plist */; };
11 0C44A71A2518EF8000B570ED /* decrypt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C44A7192518EF8000B570ED /* decrypt.swift */; };
12 0C9D68C9264854B60011B691 /* secRandom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C9D68C8264854B60011B691 /* secRandom.swift */; };
13 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
@@ -19,6 +20,7 @@
20 /* End PBXBuildFile section */
21
22 /* Begin PBXFileReference section */
23 + 0C37B8B826678E9100C6E5A9 /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
24 0C400E0F25B21ABB0025E469 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
25 0C44A7192518EF8000B570ED /* decrypt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = decrypt.swift; sourceTree = "<group>"; };
26 0C9986A3251A932F00D566FD /* CryptoSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CryptoSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -96,6 +98,7 @@
98 97C146E51CF9000F007C117D = {
99 isa = PBXGroup;
100 children = (
101 + 0C37B8B826678E9100C6E5A9 /* GoogleService-Info.plist */,
102 0C44A7182518EF4A00B570ED /* CakeWallet */,
103 9740EEB11CF90186004384FC /* Flutter */,
104 97C146F01CF9000F007C117D /* Runner */,
@@ -191,6 +194,7 @@
194 isa = PBXResourcesBuildPhase;
195 buildActionMask = 2147483647;
196 files = (
197 + 0C37B8B926678E9100C6E5A9 /* GoogleService-Info.plist in Resources */,
198 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
199 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
200 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
@@ -365,6 +369,7 @@
369 CURRENT_PROJECT_VERSION = 41;
370 DEVELOPMENT_TEAM = 32J6BB6VUS;
371 ENABLE_BITCODE = NO;
372 + EXCLUDED_SOURCE_FILE_NAMES = "\"$(SRCROOT)/Runner/GoogleService-Info.plist\"";
373 FRAMEWORK_SEARCH_PATHS = (
374 "$(inherited)",
375 "$(PROJECT_DIR)/Flutter",
@@ -508,6 +513,7 @@
513 CURRENT_PROJECT_VERSION = 41;
514 DEVELOPMENT_TEAM = 32J6BB6VUS;
515 ENABLE_BITCODE = NO;
516 + EXCLUDED_SOURCE_FILE_NAMES = "\"$(SRCROOT)/Runner/GoogleService-Info.plist\"";
517 FRAMEWORK_SEARCH_PATHS = (
518 "$(inherited)",
519 "$(PROJECT_DIR)/Flutter",
@@ -543,6 +549,7 @@
549 CURRENT_PROJECT_VERSION = 41;
550 DEVELOPMENT_TEAM = 32J6BB6VUS;
551 ENABLE_BITCODE = NO;
552 + EXCLUDED_SOURCE_FILE_NAMES = "\"$(SRCROOT)/Runner/GoogleService-Info.plist\"";
553 FRAMEWORK_SEARCH_PATHS = (
554 "$(inherited)",
555 "$(PROJECT_DIR)/Flutter",
ios/Runner/AppDelegate.swift
+4
@@ -7,6 +7,10 @@ import Flutter
7 _ application: UIApplication,
8 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 ) -> Bool {
10 + if #available(iOS 10.0, *) {
11 + UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
12 + }
13 +
14 let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
15 let legacyMigrationChannel = FlutterMethodChannel(
16 name: "com.cakewallet.cakewallet/legacy_wallet_migration",
ios/Runner/Info.plist
+5
@@ -37,6 +37,11 @@
37 <string>Enable Face ID for fast and secure access to wallets and private keys</string>
38 <key>NSPhotoLibraryUsageDescription</key>
39 <string>We need access to documents folder for get acces to open/save backup file</string>
40 + <key>UIBackgroundModes</key>
41 + <array>
42 + <string>fetch</string>
43 + <string>remote-notification</string>
44 + </array>
45 <key>UILaunchStoryboardName</key>
46 <string>LaunchScreen</string>
47 <key>UIMainStoryboardFile</key>
ios/Runner/Runner.entitlements
+4 -1
@@ -1,5 +1,8 @@
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 <plist version="1.0">
4 -<dict/>
4 +<dict>
5 + <key>aps-environment</key>
6 + <string>development</string>
7 +</dict>
8 </plist>
lib/di.dart
+6 -1
@@ -113,6 +113,7 @@ import 'package:cake_wallet/store/templates/exchange_template_store.dart';
113 import 'package:cake_wallet/entities/template.dart';
114 import 'package:cake_wallet/exchange/exchange_template.dart';
115 import 'package:cake_wallet/.secrets.g.dart' as secrets;
116 +import 'package:cake_wallet/entities/push_notifications_service.dart';
117
118 final getIt = GetIt.instance;
119
@@ -232,6 +233,9 @@ Future setup(
233 settingsStore: getIt.get<SettingsStore>(),
234 fiatConvertationStore: getIt.get<FiatConversionStore>()));
235
236 +
237 + getIt.registerFactory(() => PushNotificationsService());
238 +
239 getIt.registerFactory(() => DashboardViewModel(
240 balanceViewModel: getIt.get<BalanceViewModel>(),
241 appStore: getIt.get<AppStore>(),
@@ -241,7 +245,8 @@ Future setup(
245 settingsStore: settingsStore,
246 ordersSource: _ordersSource,
247 ordersStore: getIt.get<OrdersStore>(),
244 - wyreViewModel: getIt.get<WyreViewModel>()));
248 + wyreViewModel: getIt.get<WyreViewModel>(),
249 + pushNotificationsService: getIt.get<PushNotificationsService>()));
250
251 getIt.registerFactory<AuthService>(() => AuthService(
252 secureStorage: getIt.get<FlutterSecureStorage>(),
lib/entities/push_notifications_service.dart new
+45
@@ -0,0 +1,45 @@
1 +import 'dart:io';
2 +import 'package:cake_wallet/main.dart';
3 +import 'package:cake_wallet/utils/show_bar.dart';
4 +import 'package:firebase_messaging/firebase_messaging.dart';
5 +
6 +class PushNotificationsService {
7 + PushNotificationsService._();
8 +
9 + factory PushNotificationsService() => _instance;
10 +
11 + static final PushNotificationsService _instance = PushNotificationsService._();
12 + static Future<dynamic> _onBackgroundMessage(Map<String, dynamic> message) async {}
13 + final _firebaseMessaging = FirebaseMessaging();
14 + bool _initialized = false;
15 +
16 + Future<void> init() async {
17 + if (_initialized) {
18 + return;
19 + }
20 +
21 + _firebaseMessaging.requestNotificationPermissions();
22 + _firebaseMessaging.configure(
23 + onMessage: (message) async {
24 + Map<dynamic, dynamic> alert = {};
25 + String msg = '';
26 + String title = '';
27 +
28 + if (Platform.isIOS) {
29 + alert = message['aps']['alert'] as Map<dynamic, dynamic> ?? <dynamic, dynamic>{};
30 + msg = alert['body'] as String ?? '';
31 + title = alert['title'] as String ?? '';
32 + }
33 +
34 + if (Platform.isAndroid) {
35 + msg = message['notification']['body'] as String ?? '';
36 + title = message['notification']['title'] as String ?? '';
37 + }
38 +
39 + await showBar<void>(navigatorKey.currentContext, msg, titleText: title, duration: null);
40 + },
41 + onBackgroundMessage: _onBackgroundMessage);
42 +
43 + _initialized = true;
44 + }
45 +}
\ No newline at end of file
lib/src/screens/dashboard/widgets/balance_page.dart
+1
@@ -1,5 +1,6 @@
1 import 'package:flutter/material.dart';
2 import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
3 +import 'package:flutter/scheduler.dart';
4 import 'package:flutter_mobx/flutter_mobx.dart';
5 import 'package:auto_size_text/auto_size_text.dart';
6
lib/utils/show_bar.dart
+12 -4
@@ -2,8 +2,11 @@ import 'package:flushbar/flushbar.dart';
2 import 'package:flutter/cupertino.dart';
3 import 'package:flutter/material.dart';
4
5 -Future<T> showBar<T>(BuildContext context, String text,
6 - {bool isDark = false, Duration duration = const Duration(seconds: 1), bool isDismissible = true}) {
5 +Future<T> showBar<T>(BuildContext context, String messageText,
6 + {bool isDark = false,
7 + Duration duration = const Duration(seconds: 1),
8 + bool isDismissible = true,
9 + String titleText}) {
10 final bar = Flushbar<T>(
11 boxShadows: [
12 BoxShadow(
@@ -14,9 +17,14 @@ Future<T> showBar<T>(BuildContext context, String text,
17 backgroundColor: isDark ? Colors.black : Colors.white,
18 borderRadius: 35,
19 margin: EdgeInsets.all(50),
17 - messageText: Text(text,
20 + titleText: titleText != null
21 + ? Text(titleText,
22 + textAlign: TextAlign.center,
23 + style: TextStyle(color: isDark ? Colors.white : Colors.black, fontWeight: FontWeight.bold, fontSize: 24.0))
24 + : null,
25 + messageText: Text(messageText,
26 textAlign: TextAlign.center,
19 - style: TextStyle(color: isDark ? Colors.white : Colors.black)),
27 + style: TextStyle(color: isDark ? Colors.white : Colors.black, fontSize: 16)),
28 duration: duration,
29 isDismissible: isDismissible,
30 flushbarPosition: FlushbarPosition.TOP,
lib/view_model/dashboard/dashboard_view_model.dart
+11 -4
@@ -1,6 +1,7 @@
1 import 'package:cake_wallet/core/transaction_history.dart';
2 import 'package:cake_wallet/entities/balance.dart';
3 import 'package:cake_wallet/entities/order.dart';
4 +import 'package:cake_wallet/entities/push_notifications_service.dart';
5 import 'package:cake_wallet/monero/account.dart';
6 import 'package:cake_wallet/monero/monero_balance.dart';
7 import 'package:cake_wallet/monero/monero_transaction_info.dart';
@@ -44,7 +45,9 @@ abstract class DashboardViewModelBase with Store {
45 this.settingsStore,
46 this.ordersSource,
47 this.ordersStore,
47 - this.wyreViewModel}) {
48 + this.wyreViewModel,
49 + PushNotificationsService pushNotificationsService}) {
50 + _pushNotificationsService = pushNotificationsService;
51 filterItems = {
52 S.current.transactions: [
53 FilterItem(
@@ -133,6 +136,8 @@ abstract class DashboardViewModelBase with Store {
136
137 return true;
138 });
139 +
140 + Future.delayed(Duration(seconds: 2), () => _pushNotificationsService.init());
141 }
142
143 @observable
@@ -227,18 +232,20 @@ abstract class DashboardViewModelBase with Store {
232
233 bool get isBuyEnabled => settingsStore.isBitcoinBuyEnabled;
234
235 + PushNotificationsService _pushNotificationsService;
236 +
237 ReactionDisposer _onMoneroAccountChangeReaction;
238
239 ReactionDisposer _onMoneroBalanceChangeReaction;
240
241 + @observable
242 + bool isOutdatedElectrumWallet;
243 +
244 Future<void> reconnect() async {
245 final node = appStore.settingsStore.getCurrentNode(wallet.type);
246 await wallet.connectToNode(node: node);
247 }
248
239 - @observable
240 - bool isOutdatedElectrumWallet;
241 -
249 @action
250 void _onWalletChange(
251 WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
pubspec.lock
+31 -3
@@ -70,7 +70,7 @@ packages:
70 path: "."
71 ref: cake
72 resolved-ref: "02fef082f20af13de00b4e64efb93a2c1e5e1cf2"
73 - url: "git@github.com:cake-tech/bech32.git"
73 + url: "https://github.com/cake-tech/bech32.git"
74 source: git
75 version: "0.2.0"
76 bip32:
@@ -92,8 +92,8 @@ packages:
92 description:
93 path: "."
94 ref: cake
95 - resolved-ref: b3ab2926c665f0e68b74a4a5f31059f7fcd817b7
96 - url: "git@github.com:cake-tech/bitcoin_flutter.git"
95 + resolved-ref: cbabfd87b6ce3cae6051a3e86ddb56e7a934e188
96 + url: "https://github.com/cake-tech/bitcoin_flutter.git"
97 source: git
98 version: "2.0.2"
99 boolean_selector:
@@ -362,6 +362,34 @@ packages:
362 url: "https://pub.dartlang.org"
363 source: hosted
364 version: "3.0.0-nullsafety.2"
365 + firebase_core:
366 + dependency: transitive
367 + description:
368 + name: firebase_core
369 + url: "https://pub.dartlang.org"
370 + source: hosted
371 + version: "0.5.3"
372 + firebase_core_platform_interface:
373 + dependency: transitive
374 + description:
375 + name: firebase_core_platform_interface
376 + url: "https://pub.dartlang.org"
377 + source: hosted
378 + version: "2.1.0"
379 + firebase_core_web:
380 + dependency: transitive
381 + description:
382 + name: firebase_core_web
383 + url: "https://pub.dartlang.org"
384 + source: hosted
385 + version: "0.2.1+1"
386 + firebase_messaging:
387 + dependency: "direct main"
388 + description:
389 + name: firebase_messaging
390 + url: "https://pub.dartlang.org"
391 + source: hosted
392 + version: "7.0.3"
393 fixnum:
394 dependency: transitive
395 description:
pubspec.yaml
+1
@@ -78,6 +78,7 @@ dependencies:
78 file_picker: ^3.0.0-nullsafety.2
79 unorm_dart: ^0.2.0
80 permission_handler: ^5.0.1+1
81 + firebase_messaging: ^7.0.3
82
83 dev_dependencies:
84 flutter_test: