From 9dd53ad3ab11ac6782dd171df20b233596d1cd6d Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 24 Jan 2023 17:00:29 +0300 Subject: [PATCH 1/6] Push notification fixes --- lib/app_state/app_state.dart | 2 +- lib/ui/login/login_screen.dart | 6 ++++++ lib/ui/login/verify_last_login_screen.dart | 12 ++++++++---- pubspec.yaml | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart index 731a45e..e1b095e 100644 --- a/lib/app_state/app_state.dart +++ b/lib/app_state/app_state.dart @@ -76,7 +76,7 @@ class AppState { bool get getIsDemoMarathon => _isDemoMarathon; - final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 3.9, mobileType: Platform.isAndroid ? "android" : "ios"); + final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 4.0, mobileType: Platform.isAndroid ? "android" : "ios"); void setPostParamsInitConfig() { isAuthenticated = false; diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 6253002..98b898c 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -95,6 +95,12 @@ class _LoginScreenState extends State { try { Utils.showLoading(context); await Firebase.initializeApp(); + await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions( + alert: true, + badge: true, + sound: true, + ); + await FirebaseMessaging.instance.requestPermission(); _firebaseMessaging = FirebaseMessaging.instance; firebaseToken = await _firebaseMessaging.getToken(); AppNotifications().initNotification(firebaseToken); diff --git a/lib/ui/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index cfa808a..30feb71 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -324,20 +324,22 @@ class _VerifyLastLoginScreenState extends State { Future performApiCall(String _title, String _icon, int _flag, int sendVerificationFlat, {bool isDirectLogin = false}) async { try { - if (isDirectLogin) + if (isDirectLogin) { setState(() { Utils.showLoading(context); }); - else + } else { Utils.showLoading(context); + } await LoginApiClient().checkMobileAppVersion(); await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!); - if (!isDirectLogin) + if (!isDirectLogin) { BasicMemberInformationModel? memberInformationModel = await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); + } if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, "", null); if (!isDirectLogin) Utils.hideLoading(context); - if (!isDirectLogin) + if (!isDirectLogin) { OtpDialog( context, sendVerificationFlat, @@ -353,6 +355,7 @@ class _VerifyLastLoginScreenState extends State { performApiCall(_title, _icon, _flag, sendVerificationFlat, isDirectLogin: isDirectLogin); }, ).displayDialog(context); + } } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); @@ -372,6 +375,7 @@ class _VerifyLastLoginScreenState extends State { mobileLoginInfoListModel!.deviceToken!, Platform.isAndroid ? "android" : "ios"); AppState().setMemberInformationListModel = genericResponseModel!.memberInformationList?.first; + AppState().setPrivilegeListModel = genericResponseModel!.privilegeList ?? []; if (genericResponseModel.errorMessage != null) { Utils.showToast(genericResponseModel.errorMessage ?? ""); // Navigator.pop(context); diff --git a/pubspec.yaml b/pubspec.yaml index 189128d..f8748e6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,7 +49,7 @@ dependencies: flutter_calendar_carousel: ^2.1.0 pie_chart: ^5.1.0 shared_preferences: ^2.0.12 - firebase_messaging: ^11.2.8 + firebase_messaging: ^13.0.4 shimmer: ^2.0.0 logger: ^1.1.0 flutter_countdown_timer: ^4.1.0 From 9a2a85f84836a988dd9a88bb81546fa7bf5e2737 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 24 Jan 2023 17:29:38 +0300 Subject: [PATCH 2/6] updates --- lib/ui/login/login_screen.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index fee8e09..40ce546 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -95,12 +95,12 @@ class _LoginScreenState extends State { try { Utils.showLoading(context); await Firebase.initializeApp(); - await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions( - alert: true, - badge: true, - sound: true, - ); - await FirebaseMessaging.instance.requestPermission(); + // await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions( + // alert: true, + // badge: true, + // sound: true, + // ); + // await FirebaseMessaging.instance.requestPermission(); _firebaseMessaging = FirebaseMessaging.instance; firebaseToken = await _firebaseMessaging.getToken(); AppNotifications().init(firebaseToken); From 0c7771dab9ecf32bd5e86c36222580fecc54d422 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 25 Jan 2023 12:03:45 +0300 Subject: [PATCH 3/6] updates --- lib/ui/login/login_screen.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 40ce546..69750fa 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -172,8 +172,8 @@ class _LoginScreenState extends State { isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; if (!kReleaseMode) { // username.text = "15444"; // Maha User - username.text = "15153"; // Tamer User - password.text = "Abcd@12345"; + // username.text = "15153"; // Tamer User + // password.text = "Abcd@12345"; // username.text = "206535"; // Hashim User // password.text = "Namira786"; From 992490812e58831fc46245b6b0cbd29d1ef78164 Mon Sep 17 00:00:00 2001 From: Amir Saleem Date: Wed, 25 Jan 2023 14:28:56 +0300 Subject: [PATCH 4/6] Notification IOS Fix --- ios/Runner/AppDelegate.swift | 10 +++++++++- pubspec.yaml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index c1c9fd9..528e5c0 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,6 +1,7 @@ import UIKit import Flutter import Firebase +import flutter_local_notifications @UIApplicationMain @@ -9,7 +10,14 @@ import Firebase _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - FirebaseApp.configure() + FirebaseApp.configure() + FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in + GeneratedPluginRegistrant.register(with: registry) + } + + if #available(iOS 10.0, *) { + UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate + } GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/pubspec.yaml b/pubspec.yaml index def761b..367db22 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -93,7 +93,7 @@ dependencies: flutter_webrtc: ^0.9.16 camera: ^0.10.0+4 flutter_local_notifications: any - firebase_analytics: any + #firebase_analytics: any #Chat Voice Message Recoding & Play audio_waveforms: ^0.1.5+1 From 0e329e8e2b4d7df08daeb680dfa6fa41ff2edc57 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 26 Jan 2023 10:50:21 +0300 Subject: [PATCH 5/6] ticket balance value display fixed & infant added in value. --- lib/generated/codegen_loader.g.dart | 6 ++++++ lib/generated/locale_keys.g.dart | 11 ++++++----- lib/provider/dashboard_provider_model.dart | 2 +- lib/ui/landing/widget/menus_widget.dart | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 1563767..f3497d3 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -533,6 +533,9 @@ class CodegenLoader extends AssetLoader{ "startingIn": "يبدأ في", "youAreOutOfContest": "أنت خارج المسابقة.", "winners": "الفائزين!!!", + "expireAfter": "تنتهي بعد", + "oneWeek": "أسبوع 1", + "twoWeek": "2 أسبوع", "noUpcoming": "لا يوجد قادم", "fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية", "noWinner": "حزين! لم يفز أحد اليوم.", @@ -1058,6 +1061,9 @@ static const Map en_US = { "startingIn": "Starting in", "youAreOutOfContest": "You are out of the contest.", "winners": "WINNERS!!!", + "expireAfter": "Expires After", + "oneWeek": "1 Week", + "twoWeek": "2 Week", "noUpcoming": "There is no upcoming", "fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified.", "noWinner": "Sad! No one won today.", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 184748a..4eb91c9 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1,6 +1,6 @@ // DO NOT EDIT. This is code generated via package:easy_localization/generate.dart -abstract class LocaleKeys { +abstract class LocaleKeys { static const mohemm = 'mohemm'; static const english = 'english'; static const arabic = 'arabic'; @@ -250,7 +250,7 @@ abstract class LocaleKeys { static const Payroll = 'Payroll'; static const civilIdentityNumber = 'civilIdentityNumber'; static const dateOfBirth = 'dateOfBirth'; - static const maritalStatus = 'maritalStatus '; + static const maritalStatus = 'maritalStatus '; static const fullName = 'fullName'; static const remove = 'remove'; static const submit = 'submit'; @@ -280,7 +280,7 @@ abstract class LocaleKeys { static const enterNewInfo = 'enterNewInfo'; static const endDate = 'endDate'; static const removeThisMember = 'removeThisMember'; - static const wantUpdateThisMember = 'wantUpdateThisMember '; + static const wantUpdateThisMember = 'wantUpdateThisMember '; static const addNewFamilyMember = 'addNewFamilyMember'; static const addRow = 'addRow'; static const pleaseSelect = 'pleaseSelect'; @@ -503,12 +503,13 @@ abstract class LocaleKeys { static const startingIn = 'startingIn'; static const youAreOutOfContest = 'youAreOutOfContest'; static const winners = 'winners'; - static const noUpcoming = 'noUpcoming'; - static const fakeLocation = 'fakeLocation'; static const expireAfter = 'expireAfter'; static const oneWeek = 'oneWeek'; static const twoWeek = 'twoWeek'; + static const noUpcoming = 'noUpcoming'; + static const fakeLocation = 'fakeLocation'; static const noWinner = 'noWinner'; static const myTeam = 'myTeam'; static const youCanPlayDemo = 'youCanPlayDemo'; + } diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index aa9a38f..5899699 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -190,7 +190,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy").format(date)); isLeaveTicketBalanceLoading = false; leaveBalanceAccrual = accrualList![0]; - ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0); + ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0) + (accrualList![3].accrualNetEntitlement ?? 0.0); notifyListeners(); } catch (ex) { isLeaveTicketBalanceLoading = false; diff --git a/lib/ui/landing/widget/menus_widget.dart b/lib/ui/landing/widget/menus_widget.dart index 3e24f63..64855ee 100644 --- a/lib/ui/landing/widget/menus_widget.dart +++ b/lib/ui/landing/widget/menus_widget.dart @@ -96,7 +96,7 @@ class MenusWidget extends StatelessWidget { Row( children: [ Expanded( - child: data.leaveBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), + child: data.leaveBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1), ), RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], @@ -123,7 +123,7 @@ class MenusWidget extends StatelessWidget { Row( children: [ Expanded( - child: data.ticketBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), + child: data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1), ), RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], From a59656184f9ef4fea945fab87a7fb7bf1adbd093 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 26 Jan 2023 11:03:05 +0300 Subject: [PATCH 6/6] session log out check change. --- lib/api/api_client.dart | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index 1a70428..8518cd7 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -87,13 +87,12 @@ class ApiClient { if (!kReleaseMode) { logger.i("res: " + response.body); } + var jsonData = jsonDecode(response.body); - if (jsonData["MessageStatus"] == 2) { - AppState().setIsAuthenticated = false; + if (jsonData["IsAuthenticated"] != null) { + AppState().setIsAuthenticated = jsonData["IsAuthenticated"]; } - - - if (jsonData["ErrorMessage"] == null && jsonData["MessageStatus"] == 1) { + if (jsonData["ErrorMessage"] == null) { return factoryConstructor(jsonData); } else { APIError? apiError;