Skip to content

Commit

Permalink
Merge pull request #133 from MXCzkEVM/big_upgrade
Browse files Browse the repository at this point in the history
Big upgrade
  • Loading branch information
reasje authored Dec 17, 2024
2 parents 58128f2 + 33758b2 commit 3dfcc85
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
15 changes: 14 additions & 1 deletion lib/core/src/background_process/notifications_service.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:background_fetch/background_fetch.dart';
import 'package:moonchain_wallet/app/logger.dart';
import 'package:moonchain_wallet/core/core.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:mxc_logic/mxc_logic.dart';
Expand Down Expand Up @@ -48,20 +49,24 @@ class NotificationsService {
final lowBatteryEnabled = periodicalCallData.lowBatteryEnabled;

// Make sure user is logged in
print("isLoggedIn : $isLoggedIn, serviceEnabled : $serviceEnabled" );
if (isLoggedIn && MXCChains.isMXCChains(chainId) && serviceEnabled) {
await MoonchainWalletNotification()
.setupFlutterNotifications(shouldInitFirebase: false);

print('lowBalanceLimitEnabled: $lowBalanceLimitEnabled');
if (lowBalanceLimitEnabled) {
await backgroundFetchConfigUseCase.checkLowBalance(
account!, lowBalanceLimit);
}

print('expectedTransactionFeeEnabled: $expectedTransactionFeeEnabled');
if (expectedTransactionFeeEnabled) {
await backgroundFetchConfigUseCase
.checkTransactionFee(expectedTransactionFee);
}

print('expectedEpochOccurrenceEnabled: $expectedEpochOccurrenceEnabled');
if (expectedEpochOccurrenceEnabled) {
periodicalCallData =
await backgroundFetchConfigUseCase.checkEpochOccur(
Expand All @@ -71,30 +76,38 @@ class NotificationsService {
chainId);
}

print('activityReminderEnabled: $activityReminderEnabled');
if (activityReminderEnabled) {
await blueberryRingBackgroundNotificationsUseCase
.checkActivityReminder();
}

print('sleepInsightEnabled: $sleepInsightEnabled');
if (sleepInsightEnabled) {
await blueberryRingBackgroundNotificationsUseCase.checkSleepInsight();
}

print('heartAlertEnabled: $heartAlertEnabled');
if (heartAlertEnabled) {
await blueberryRingBackgroundNotificationsUseCase.checkHeartAlert();
}

print('lowBatteryEnabled: $lowBatteryEnabled');
if (lowBatteryEnabled) {
await blueberryRingBackgroundNotificationsUseCase.checkLowBattery();
}

print('periodicalCallData: ${periodicalCallData.toString()}');
backgroundFetchConfigUseCase.updateItem(periodicalCallData);
BackgroundFetch.finish(taskId);
} else {
print("Terminating background service because conditions doesn't meet" );
// terminate background fetch
BackgroundFetch.stop(taskId);
}
} catch (e) {
} catch (e, s) {
print("Background fetch ERROR : $e" );
print("Background fetch stacktrace : $s" );
BackgroundFetch.finish(taskId);
}
}
Expand Down
3 changes: 1 addition & 2 deletions lib/core/src/firebase/moonchain_wallet_firebase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class MoonchainWalletFireBase {
static int buildTap = 0;

static Future<FirebaseApp> initializeFirebase() async {
return await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform);
return await Firebase.initializeApp();
}

// Listening to the foreground messages
Expand Down
8 changes: 5 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.

version: 1.4.2
version: 1.4.3


environment:
Expand Down Expand Up @@ -51,7 +51,9 @@ dependencies:
eth_sig_util: ^0.0.9
f_logs: ^2.0.1
favicon: ^1.1.2
firebase_core: ^3.8.0
firebase_analytics: ^11.3.6
firebase_core: ^3.8.1
firebase_crashlytics: ^4.2.0
firebase_messaging: ^15.1.5
fl_chart: ^0.69.0
fl_shared_link:
Expand All @@ -66,7 +68,7 @@ dependencies:
flutter_i18n: ^0.35.1
flutter_inappwebview: ^6.1.5
flutter_local_notifications: ^18.0.1
flutter_mailer: ^2.0.2
flutter_mailer: ^2.1.2
flutter_svg: ^2.0.1
geolocator: ^10.1.0
google_sign_in: ^6.1.5
Expand Down

0 comments on commit 3dfcc85

Please sign in to comment.