mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-03 19:54:12 +00:00 
			
		
		
		
	Integrate Firebase
This commit is contained in:
		@@ -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();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user