diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 8d8e7c2..0eb7f4f 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -27,7 +27,6 @@ import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/member_login_list_model.dart'; import 'package:mohem_flutter_app/models/privilege_list_model.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; -import 'package:mohem_flutter_app/widgets/button/hmg_connectivity_button.dart'; import 'package:mohem_flutter_app/widgets/input_widget.dart'; // import 'package:safe_device/safe_device.dart'; @@ -98,6 +97,7 @@ class _LoginScreenState extends State { Future checkFirebaseToken() async { try { + await checkPrefs(); Utils.showLoading(context); if (Platform.isAndroid) { try { @@ -120,6 +120,9 @@ class _LoginScreenState extends State { await Firebase.initializeApp(); _firebaseMessaging = FirebaseMessaging.instance; firebaseToken = await _firebaseMessaging.getToken(); + String? firebaseAPNSToken = await _firebaseMessaging.getAPNSToken(); + print("Firebase Token: $firebaseToken"); + print("Firebase APNS Token: $firebaseAPNSToken"); AppNotifications().init(firebaseToken); checkLoginInfo(); await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true); @@ -132,17 +135,21 @@ class _LoginScreenState extends State { } void checkLoginInfo() async { - loginInfo = await LoginApiClient().getMobileLoginInfoNEW(AppState().getIsHuawei ? AppState().getHuaweiPushToken : firebaseToken ?? "", Platform.isAndroid ? "android" : "ios"); - if (loginInfo == null) { - await checkPrefs(); - _autoLogin = false; - Utils.hideLoading(context); - return; - } else { - loginInfo!.deviceToken = firebaseToken; - await checkPrefs(); + try { + loginInfo = await LoginApiClient().getMobileLoginInfoNEW(AppState().getIsHuawei ? AppState().getHuaweiPushToken : firebaseToken ?? "", Platform.isAndroid ? "android" : "ios"); + if (loginInfo == null) { + await checkPrefs(); + _autoLogin = false; + Utils.hideLoading(context); + return; + } else { + loginInfo!.deviceToken = firebaseToken; + await checkPrefs(); + Utils.hideLoading(context); + performLogin(); + } + } catch (ex) { Utils.hideLoading(context); - performLogin(); } } diff --git a/lib/ui/work_list/item_history_screen.dart b/lib/ui/work_list/item_history_screen.dart index c53a68e..e88dcba 100644 --- a/lib/ui/work_list/item_history_screen.dart +++ b/lib/ui/work_list/item_history_screen.dart @@ -179,37 +179,6 @@ class _ItemHistoryScreenState extends State { ), ), if (tabIndex == 0) _screenParams!.getPRInformationList!.pRHeader![0].dESCRIPTION!.toText14().paddingOnly(top: 20, right: 21, left: 21), - // if (tabIndex == 0) - // ListView.separated( - // padding: const EdgeInsets.all(21), - // shrinkWrap: true, - // physics: const NeverScrollableScrollPhysics(), - // itemBuilder: (cxt, index) => Column( - // children: [ - // ItemDetailGrid( - // ItemDetailViewCol("Cost Center", _screenParams!.getPRInformationList!.pRLines![index].cOSTCENTER ?? ""), - // ItemDetailViewCol("Code", _screenParams!.getPRInformationList!.pRLines![index].iTEMCODE ?? ""), - // ), - // ItemDetailGrid( - // ItemDetailViewCol("Unit", _screenParams!.getPRInformationList!.pRLines![index].uOM ?? ""), - // ItemDetailViewCol("Price (SAR)", _screenParams!.getPRInformationList!.pRLines![index].uNITPRICE.toString() ?? ""), - // ), - // ItemDetailGrid( - // ItemDetailViewCol("Amount (SAR)", _screenParams!.getPRInformationList!.pRLines![index].lINEAMOUNT.toString() ?? ""), - // ItemDetailViewCol("Quantity", _screenParams!.getPRInformationList!.pRLines![index].qUANTITY.toString() ?? ""), - // ), - // ItemDetailGrid( - // ItemDetailViewCol("AMU (Last 3 months)", _screenParams!.getPRInformationList!.pRLines![index].iTEMAMU.toString() ?? ""), - // ItemDetailViewCol("PR Number", _screenParams!.getPRInformationList!.pRHeader![0].pRNUMBER!.toString() ?? ""), - // isItLast: true, - // ), - // ], - // ).objectContainerView(), - // separatorBuilder: (cxt, index) => 12.height, - // itemCount: _screenParams!.getPRInformationList!.pRLines!.length), - // if (tabIndex == 1) getPRActionsHistory(), //"ACTIONS".toText14().paddingOnly(top: 20, right: 21, left: 21), - // if (tabIndex == 2) getPRAttachments(), - SizedBox( height: MediaQuery.of(context).size.height, child: PageView( @@ -226,7 +195,6 @@ class _ItemHistoryScreenState extends State { }); }, children: [ - // if (tabIndex == 0) ListView.separated( padding: const EdgeInsets.all(21), shrinkWrap: true, @@ -254,9 +222,7 @@ class _ItemHistoryScreenState extends State { ).objectContainerView(), separatorBuilder: (cxt, index) => 12.height, itemCount: _screenParams!.getPRInformationList!.pRLines!.length), - // if (tabIndex == 1) getPRActionsHistory(), //"ACTIONS".toText14().paddingOnly(top: 20, right: 21, left: 21), - // if (tabIndex == 2) getPRAttachments(), ], ),