1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 16:25:17 +00:00

Integrate Firebase

This commit is contained in:
2021-04-15 13:34:49 +02:00
parent 0c75575a70
commit f0f2f06ec2
9 changed files with 196 additions and 5 deletions

View File

@ -1,3 +1,4 @@
import 'package:comunic/helpers/firebase_messaging_helper.dart';
import 'package:comunic/helpers/independent_push_notifications_helper.dart';
import 'package:comunic/helpers/push_notifications_helper.dart';
import 'package:comunic/helpers/server_config_helper.dart';
@ -111,13 +112,15 @@ class _PushNotificationsConfigurationRouteState
Future<void> _submit() async {
try {
String firebaseToken = "";
switch (currStatus) {
case PushNotificationsStatus.DISABLED:
break;
case PushNotificationsStatus.FIREBASE:
// TODO: Handle this case.
throw new Exception("Firebase not supported yet!");
await FirebaseMessagingHelper.preConfigure();
firebaseToken = await FirebaseMessagingHelper.getToken();
break;
case PushNotificationsStatus.INDEPENDENT:
@ -130,7 +133,8 @@ class _PushNotificationsConfigurationRouteState
}
await PushNotificationsHelper.clearLocalStatus();
await PushNotificationsHelper.setNewStatus(currStatus);
await PushNotificationsHelper.setNewStatus(currStatus,
firebaseToken: firebaseToken);
await PushNotificationsHelper.refreshLocalStatus();
Navigator.of(context).pop();