|  |  |  | @ -4,7 +4,7 @@ import 'package:firebase_core/firebase_core.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:firebase_messaging/firebase_messaging.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter/foundation.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter_local_notifications/flutter_local_notifications.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; | 
		
	
		
			
				|  |  |  |  | // import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:huawei_push/huawei_push.dart' as huawei_push; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/app_state/app_state.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/classes/utils.dart'; | 
		
	
	
		
			
				
					|  |  |  | @ -19,7 +19,7 @@ class AppNotifications { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   factory AppNotifications() => _instance; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   late HmsApiAvailability hmsApiAvailability; | 
		
	
		
			
				|  |  |  |  |   // late HmsApiAvailability hmsApiAvailability; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   String _huaweiToken = ''; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -40,9 +40,9 @@ class AppNotifications { | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void init(String? firebaseToken) async { | 
		
	
		
			
				|  |  |  |  |     if (Platform.isAndroid) { | 
		
	
		
			
				|  |  |  |  |       hmsApiAvailability = HmsApiAvailability(); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     // if (Platform.isAndroid) { | 
		
	
		
			
				|  |  |  |  |     //   hmsApiAvailability = HmsApiAvailability(); | 
		
	
		
			
				|  |  |  |  |     // } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     await requestPermissions(); | 
		
	
		
			
				|  |  |  |  |     AppState().setDeviceToken = firebaseToken; | 
		
	
	
		
			
				
					|  |  |  | @ -68,9 +68,10 @@ class AppNotifications { | 
		
	
		
			
				|  |  |  |  |     }); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     if (Platform.isAndroid) { | 
		
	
		
			
				|  |  |  |  |       await hmsApiAvailability.isHMSAvailable().then((value) async { | 
		
	
		
			
				|  |  |  |  |         if (value == 0) { | 
		
	
		
			
				|  |  |  |  |           huawei_push.Push.enableLogger(); | 
		
	
		
			
				|  |  |  |  |       // await hmsApiAvailability.isHMSAvailable().then((value) async { | 
		
	
		
			
				|  |  |  |  |       if (await Utils.isAppInstalledFromHuawei() && !(await Utils.isGoogleServicesAvailable()) ) { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         huawei_push.Push.enableLogger(); | 
		
	
		
			
				|  |  |  |  |           var result = await huawei_push.Push.setAutoInitEnabled(true); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |           huawei_push.Push.onNotificationOpenedApp.listen((message) { | 
		
	
	
		
			
				
					|  |  |  | @ -81,9 +82,9 @@ class AppNotifications { | 
		
	
		
			
				|  |  |  |  |             // newMessage(toFirebaseRemoteMessage(message)); | 
		
	
		
			
				|  |  |  |  |           }, onError: (e) => print(e.toString())); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       }).catchError((err) { | 
		
	
		
			
				|  |  |  |  |         print(err); | 
		
	
		
			
				|  |  |  |  |       }); | 
		
	
		
			
				|  |  |  |  |       // }).catchError((err) { | 
		
	
		
			
				|  |  |  |  |       //   print(err); | 
		
	
		
			
				|  |  |  |  |       // }); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | 
 |