|
|
|
@ -151,16 +151,16 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
|
|
|
|
|
_firebaseMessaging.getToken().then((String token) async {
|
|
|
|
|
sharedPref.setString(PUSH_TOKEN, token);
|
|
|
|
|
if (token != null && await sharedPref.getObject(USER_PROFILE) == null) {
|
|
|
|
|
DEVICE_TOKEN = token;
|
|
|
|
|
checkUserStatus(token);
|
|
|
|
|
} else {
|
|
|
|
|
getNotificationCount(token);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
requestPermissions();
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
Future.delayed(Duration.zero, () async {
|
|
|
|
|
if (token != null && await sharedPref.getObject(USER_PROFILE) == null) {
|
|
|
|
|
DEVICE_TOKEN = token;
|
|
|
|
|
checkUserStatus(token);
|
|
|
|
|
} else if (await sharedPref.getObject(USER_PROFILE) != null) {
|
|
|
|
|
getNotificationCount(token);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
//
|
|
|
|
|
// //_firebase Background message handler
|
|
|
|
@ -516,12 +516,12 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
// themeNotifier.setTheme(defaultTheme);
|
|
|
|
|
}
|
|
|
|
|
void checkUserStatus(token) async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
//GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
authService
|
|
|
|
|
.selectDeviceImei(token)
|
|
|
|
|
.then((SelectDeviceIMEIRES value) => setUserValues(value))
|
|
|
|
|
.catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
//GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -543,6 +543,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
|
|
|
|
|
void setUserValues(value) async {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
requestPermissions();
|
|
|
|
|
sharedPref.setObject(IMEI_USER_DATA, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|