From 82afd0ae61dc61a1c2d438ac573d42a30dc82aee Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Mon, 24 Oct 2022 11:02:43 +0300 Subject: [PATCH 01/10] Chat Fixes --- lib/api/chat/chat_provider_model.dart | 11 +++++++++++ .../bottom_sheets/search_employee_bottom_sheet.dart | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/api/chat/chat_provider_model.dart b/lib/api/chat/chat_provider_model.dart index ea6ea13..708096b 100644 --- a/lib/api/chat/chat_provider_model.dart +++ b/lib/api/chat/chat_provider_model.dart @@ -224,6 +224,17 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { if (chatMessage == null || chatMessage.isEmpty) { return; } + + var contain = searchedChats!.where((ChatUser element) => element.id == targetUserId); + if (contain.isEmpty) { + searchedChats!.add( + ChatUser( + id: targetUserId, + userName: targetUserName, + ), + ); + } + String chatData = '{"contant":"$chatMessage","contantNo":"8a129295-36d7-7185-5d34-cc4eec7bcba4","chatEventId":1,"fileTypeId":null,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"userChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":$targetUserId,"targetUserStatus":1}],"conversationId":"715f8b13-96ee-cd36-cb07-5a982a219982"}'; await hubConnection.invoke("AddChatUserAsync", args: [json.decode(chatData)]); diff --git a/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart b/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart index face11b..e7db4e2 100644 --- a/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart +++ b/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart @@ -230,7 +230,7 @@ class _SearchEmployeeBottomSheetState extends State { }, ); }, - separatorBuilder: (cxt, index) => Container( + separatorBuilder: (BuildContext cxt, int index) => Container( height: 1, color: MyColors.borderE3Color, ), From 912ac8070712117d810236ed0b09ba3d7f92a0ba Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Mon, 24 Oct 2022 11:29:28 +0300 Subject: [PATCH 02/10] Chat Fixes --- assets/langs/ar-SA.json | 3 ++- assets/langs/en-US.json | 3 ++- lib/generated/locale_keys.g.dart | 1 + lib/ui/chat/chat_detailed_screen.dart | 4 +++- lib/ui/chat/chat_home.dart | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index f5d9495..e6628b8 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -467,5 +467,6 @@ "fromUserName": "من", "sentDate": "تاريخ الإرسال", "itemTypeDisplayName": "اسم العرض", - "none": "بدون" + "none": "بدون", + "typeheretoreply": "اكتب هنا للرد" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 640afdb..3527ed4 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -467,5 +467,6 @@ "fromUserName": "From User Name", "sentDate": "Sent Date", "itemTypeDisplayName": "Item Type Display Name", - "none": "None" + "none": "None", + "typeheretoreply": "Type here to reply" } \ No newline at end of file diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index d2fae58..b351236 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -454,5 +454,6 @@ abstract class LocaleKeys { static const sentDate = 'sentDate'; static const itemTypeDisplayName = 'itemTypeDisplayName'; static const none = 'none'; + static const typeheretoreply = 'typeheretoreply'; } diff --git a/lib/ui/chat/chat_detailed_screen.dart b/lib/ui/chat/chat_detailed_screen.dart index b647a38..654b026 100644 --- a/lib/ui/chat/chat_detailed_screen.dart +++ b/lib/ui/chat/chat_detailed_screen.dart @@ -1,11 +1,13 @@ import 'dart:async'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:mohem_flutter_app/api/chat/chat_provider_model.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/ui/chat/chat_bubble.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; @@ -56,7 +58,7 @@ class ChatDetailScreen extends StatelessWidget { child: TextField( controller: m.message, decoration: InputDecoration( - hintText: 'Type here to reply', + hintText: LocaleKeys.typeheretoreply.tr(), hintStyle: const TextStyle(color: MyColors.grey98Color), border: InputBorder.none, focusedBorder: InputBorder.none, diff --git a/lib/ui/chat/chat_home.dart b/lib/ui/chat/chat_home.dart index ef984a3..5d6d065 100644 --- a/lib/ui/chat/chat_home.dart +++ b/lib/ui/chat/chat_home.dart @@ -45,7 +45,7 @@ class _ChatHomeScreenState extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, - appBar: AppBarWidget(context, title: "My Chats", showHomeButton: false), + appBar: AppBarWidget(context, title: LocaleKeys.mychats.tr(), showHomeButton: false), body: Consumer(builder: (BuildContext context, ChatProviderModel m, Widget? child) { return m.isLoading ? ChatHomeShimmer() From 40b9cb95767e4096d19c1a735f1cd050791175c1 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Mon, 31 Oct 2022 08:45:03 +0300 Subject: [PATCH 03/10] Chat Fixes --- lib/ui/chat/chat_detailed_screen.dart | 100 +++++++++++++++----------- 1 file changed, 59 insertions(+), 41 deletions(-) diff --git a/lib/ui/chat/chat_detailed_screen.dart b/lib/ui/chat/chat_detailed_screen.dart index 654b026..1a9cf7d 100644 --- a/lib/ui/chat/chat_detailed_screen.dart +++ b/lib/ui/chat/chat_detailed_screen.dart @@ -1,5 +1,4 @@ import 'dart:async'; - import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -21,7 +20,10 @@ class ChatDetailScreen extends StatelessWidget { @override Widget build(BuildContext context) { - userDetails = ModalRoute.of(context)!.settings.arguments; + userDetails = ModalRoute + .of(context)! + .settings + .arguments; data = Provider.of(context, listen: false); data.getSingleUserChatHistory(senderUID: AppState().chatDetails!.response!.id.toString(), receiverUID: userDetails["targetUser"].id, pagination: "0"); Timer(const Duration(seconds: 1), () => data.scrollDown()); @@ -33,56 +35,72 @@ class ChatDetailScreen extends StatelessWidget { return (m.isLoading ? ChatHomeShimmer() : Column( - children: [ - Expanded( - child: ListView.builder( - controller: m.scrollController, - shrinkWrap: true, - itemCount: m.userChatHistory.length, - padding: const EdgeInsets.symmetric(vertical: 10), - itemBuilder: (BuildContext context, int i) { - return ChatBubble( - text: m.userChatHistory[i].contant.toString(), - isSeen: m.userChatHistory[i].isSeen == true ? true : false, - isCurrentUser: m.userChatHistory[i].currentUserId == 42062 ? true : false, - isDelivered: m.userChatHistory[i].currentUserId == 42062 && m.userChatHistory[i].isDelivered == true ? true : false, - dateTime: m.userChatHistory[i].createdDate.toString(), - ); - }, - ), - ), - Card( - margin: EdgeInsets.zero, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 10), - child: TextField( - controller: m.message, - decoration: InputDecoration( - hintText: LocaleKeys.typeheretoreply.tr(), - hintStyle: const TextStyle(color: MyColors.grey98Color), - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - errorBorder: InputBorder.none, - disabledBorder: InputBorder.none, - contentPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15), - suffixIcon: IconButton( + children: [ + Expanded( + child: ListView.builder( + controller: m.scrollController, + shrinkWrap: true, + itemCount: m.userChatHistory.length, + padding: const EdgeInsets.symmetric(vertical: 10), + itemBuilder: (BuildContext context, int i) { + return ChatBubble( + text: m.userChatHistory[i].contant.toString(), + isSeen: m.userChatHistory[i].isSeen == true ? true : false, + isCurrentUser: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id ? true : false, + isDelivered: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id && m.userChatHistory[i].isDelivered == true ? true : false, + dateTime: m.userChatHistory[i].createdDate.toString(), + ); + }, + ), + ), + Card( + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 10), + child: TextField( + controller: m.message, + decoration: InputDecoration( + hintText: LocaleKeys.typeheretoreply.tr(), + hintStyle: const TextStyle(color: MyColors.grey98Color), + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + errorBorder: InputBorder.none, + disabledBorder: InputBorder.none, + contentPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15), + suffixIcon: SizedBox( + width: 100, + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + IconButton( + icon: const Icon( + Icons.attach_file_rounded, + size: 27, + color: MyColors.lightGreenColor, + ), + onPressed: () {}, + ), + IconButton( icon: SvgPicture.asset( "assets/icons/chat/chat_send_icon.svg", height: 26, width: 35, ), onPressed: () { - // m.logger.d(userDetails); - m.sendChatMessage(m.message.text, userDetails["targetUser"].id, userDetails["targetUser"].userName); + m.sendChatMessage(m.message.text, userDetails["targetUser"].id, userDetails["targetUser"].userName); }, ), - ), + ], ), ), ), - ], - )); + ), + ), + ), + ], + )); }, ), ); From c0ee98b06ec80eee36bfbe24a63df01d0087e654 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Tue, 1 Nov 2022 09:16:55 +0300 Subject: [PATCH 04/10] Merge branch 'master' into development_aamir # Conflicts: # assets/langs/ar-SA.json # assets/langs/en-US.json # lib/generated/locale_keys.g.dart --- assets/langs/ar-SA.json | 4 +--- assets/langs/en-US.json | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 88f0b75..bfcaa1c 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -492,8 +492,6 @@ "winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.", "fingersCrossed": "تشابك الاصابع!!!", "congrats": "مبروك !!!", - "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح." - - "none": "بدون", + "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح.", "typeheretoreply": "اكتب هنا للرد" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 0c7434a..7e9b42a 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -492,7 +492,6 @@ "winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.", "fingersCrossed": "Fingers Crossed!!!", "congrats": "Congratulations!!!", - "allQuestionsCorrect": "You have answered all questions correct" - "none": "None", + "allQuestionsCorrect": "You have answered all questions correct", "typeheretoreply": "Type here to reply" } \ No newline at end of file From 7408e242457f04d76853c4d1436f40115f1aac33 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Tue, 1 Nov 2022 11:35:18 +0300 Subject: [PATCH 05/10] Chat Delivered&Seen Event Added. --- lib/api/chat/chat_provider_model.dart | 42 ++++++++++++++++++++------- lib/classes/consts.dart | 4 +-- lib/ui/chat/chat_detailed_screen.dart | 1 + lib/ui/chat/chat_home.dart | 2 +- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/lib/api/chat/chat_provider_model.dart b/lib/api/chat/chat_provider_model.dart index d5abd79..bcb748c 100644 --- a/lib/api/chat/chat_provider_model.dart +++ b/lib/api/chat/chat_provider_model.dart @@ -91,18 +91,18 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { .build(); hubConnection.onclose( ({Exception? error}) { - logger.d(error); + // logger.d(error); }, ); hubConnection.onreconnecting( ({Exception? error}) { - logger.d(error); - logger.d("Reconnecting"); + // logger.d(error); + // logger.d("Reconnecting"); }, ); hubConnection.onreconnected( ({String? connectionId}) { - logger.d("Reconnected"); + // logger.d("Reconnected"); }, ); if (hubConnection.state != HubConnectionState.Connected) { @@ -110,23 +110,39 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { hubConnection.on("OnUpdateUserStatusAsync", changeStatus); hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); - // hubConnection.on("OnUserTypingAsync", onUserTyping); + hubConnection.on("OnUserTypingAsync", onUserTyping); // hubConnection.on("OnUserCountAsync", userCountAsync); // hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow); // hubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered); + hubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus); } else { hubConnection.on("OnUpdateUserStatusAsync", changeStatus); hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); - // hubConnection.on("OnUserTypingAsync", onUserTyping); + hubConnection.on("OnUserTypingAsync", onUserTyping); // hubConnection.on("OnUserCountAsync", userCountAsync); // hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow); // hubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered); + hubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus); } isLoading = false; notifyListeners(); } + void updateUserChatStatus(List? args) { + dynamic items = args!.toList(); + for (dynamic cItem in items[0]) { + for (SingleUserChatModel chat in userChatHistory) { + if (chat.userChatHistoryId.toString() == cItem["userChatHistoryId"].toString()) { + logger.d(jsonEncode(chat)); + chat.isSeen = cItem["isSeen"]; + chat.isDelivered = cItem["isDelivered"]; + notifyListeners(); + } + } + } + } + void userCountAsync(List? args) { List items = args!.toList(); print("---------------------------------User Count Async -------------------------------------"); @@ -166,7 +182,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { void changeStatus(List? args) { // print("================= Status Online // Offline ===================="); List items = args!.toList(); - logger.d(items); + // logger.d(items); for (ChatUser user in searchedChats!) { if (user.id == items.first["id"]) { user.userStatus = items.first["userStatus"]; @@ -192,9 +208,14 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { Future onMsgReceived(List? parameters) async { List data = []; + List temp = []; for (dynamic msg in parameters!) { data = getSingleUserChatModel(jsonEncode(msg)); - logger.d(msg); + temp = getSingleUserChatModel(jsonEncode(msg)); + data.first.targetUserId = temp.first.currentUserId; + data.first.targetUserName = temp.first.currentUserName; + data.first.currentUserId = temp.first.targetUserId; + data.first.currentUserName = temp.first.targetUserName; } userChatHistory.add(data.first); notifyListeners(); @@ -207,11 +228,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { for (ChatUser user in searchedChats!) { if (user.id == parameters![1] && parameters[0] == true) { user.isTyping = parameters[0] as bool?; - } else { + Future.delayed( - const Duration(milliseconds: 500), + const Duration(seconds: 2), () { user.isTyping = false; + notifyListeners(); }, ); } diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index e82c30a..3fd992f 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,7 +1,7 @@ class ApiConsts { //static String baseUrl = "http://10.200.204.20:2801/"; // Local server - static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server - // static String baseUrl = "https://hmgwebservices.com"; // Live server + //static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server + static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; diff --git a/lib/ui/chat/chat_detailed_screen.dart b/lib/ui/chat/chat_detailed_screen.dart index 1a9cf7d..5f2fa97 100644 --- a/lib/ui/chat/chat_detailed_screen.dart +++ b/lib/ui/chat/chat_detailed_screen.dart @@ -43,6 +43,7 @@ class ChatDetailScreen extends StatelessWidget { itemCount: m.userChatHistory.length, padding: const EdgeInsets.symmetric(vertical: 10), itemBuilder: (BuildContext context, int i) { + i == 0 ? m.logger.d(m.userChatHistory.length) : ""; return ChatBubble( text: m.userChatHistory[i].contant.toString(), isSeen: m.userChatHistory[i].isSeen == true ? true : false, diff --git a/lib/ui/chat/chat_home.dart b/lib/ui/chat/chat_home.dart index 5d6d065..b8696ae 100644 --- a/lib/ui/chat/chat_home.dart +++ b/lib/ui/chat/chat_home.dart @@ -110,7 +110,7 @@ class _ChatHomeScreenState extends State { ], ), title: (m.searchedChats![index].userName ?? "").toText14(color: MyColors.darkTextColor), - subtitle: (m.searchedChats![index].isTyping == true ? "Something is Typing" : "Last message text").toText11(color: MyColors.normalTextColor), + subtitle: (m.searchedChats![index].isTyping == true ? "Typing ..." : "").toText11(color: MyColors.normalTextColor), trailing: ("Today").toText10(color: MyColors.lightTextColor), minVerticalPadding: 0, onTap: () { From 96e1be782353ddce3c0bf35017fcee294e1d39d1 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Tue, 1 Nov 2022 11:50:51 +0300 Subject: [PATCH 06/10] Chat Delivered&Seen Event Added. --- lib/classes/consts.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 3fd992f..e82c30a 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,7 +1,7 @@ class ApiConsts { //static String baseUrl = "http://10.200.204.20:2801/"; // Local server - //static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server - static String baseUrl = "https://hmgwebservices.com"; // Live server + static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server + // static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; From f0d2c78f8348affc00853be23f60977922f5a852 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Tue, 1 Nov 2022 14:51:51 +0300 Subject: [PATCH 07/10] Chat Delivered&Seen Event Added. --- lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart b/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart index e7db4e2..1904a48 100644 --- a/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart +++ b/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart @@ -217,7 +217,7 @@ class _SearchEmployeeBottomSheetState extends State { ], ), title: (chatUsersList![index].userName ?? "").toText14(color: MyColors.darkTextColor), - subtitle: (chatUsersList![index].isTyping == true ? "Something is Typing" : "Last message text").toText11(color: MyColors.normalTextColor), + // subtitle: (chatUsersList![index].isTyping == true ? "Something is Typing" : "Last message text").toText11(color: MyColors.normalTextColor), trailing: ("Today").toText10(color: MyColors.lightTextColor), minVerticalPadding: 0, onTap: () { From 77a56759dc3c4f6f1b484f1ecc442f78603d2637 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Tue, 1 Nov 2022 15:03:38 +0300 Subject: [PATCH 08/10] Chat Delivered&Seen Event Added. --- lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart b/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart index 1904a48..16942c5 100644 --- a/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart +++ b/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart @@ -218,7 +218,7 @@ class _SearchEmployeeBottomSheetState extends State { ), title: (chatUsersList![index].userName ?? "").toText14(color: MyColors.darkTextColor), // subtitle: (chatUsersList![index].isTyping == true ? "Something is Typing" : "Last message text").toText11(color: MyColors.normalTextColor), - trailing: ("Today").toText10(color: MyColors.lightTextColor), + // trailing: ("Today").toText10(color: MyColors.lightTextColor), minVerticalPadding: 0, onTap: () { Navigator.pop(context); From f06238a93fdac1feee2c21d1a967136e405e973e Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Wed, 2 Nov 2022 11:22:27 +0300 Subject: [PATCH 09/10] OTP dialog new design --- assets/icons/ic_alarm.png | Bin 0 -> 875 bytes assets/langs/ar-SA.json | 6 +- assets/langs/en-US.json | 6 +- lib/classes/colors.dart | 1 + lib/dialogs/otp_dialog.dart | 117 +++++++++------ lib/generated/codegen_loader.g.dart | 12 +- lib/generated/locale_keys.g.dart | 4 + lib/ui/login/forgot_password_screen.dart | 5 +- lib/ui/login/verify_last_login_screen.dart | 158 ++++++--------------- lib/ui/login/verify_login_screen.dart | 16 +-- 10 files changed, 153 insertions(+), 172 deletions(-) create mode 100644 assets/icons/ic_alarm.png diff --git a/assets/icons/ic_alarm.png b/assets/icons/ic_alarm.png new file mode 100644 index 0000000000000000000000000000000000000000..5bc71e7f23b3ba503f7432b873fc044249d98564 GIT binary patch literal 875 zcmV-x1C;!UP)nd8+uPmmo0$XWffoW{ zX5RO^+57fp7b1~JBoc}IuXF@lyB8R!{rw&&hqL0BeZV823M|%C1s(!>0{Zg8NnoC( z;Qwk4I1$X9WA+0TnuoXg0}KZ8=!|aQHLb&2O#!QeICaE%(ucRY5X7ki)&t+kUVtCK z#sGfRxkdKyR<{HARb>b1zWAD{3hegoT9FCzhqrp--L(=&kcYQA>e;)PZr~Mq1$YPa zcugSWEPCOs&UsBBU@b6L7ukPNEb1W<~lIn=F<5}HE+%tS1@b!0r;pm-j zp+mOP16Sb>C>yN+_kjDzj?NoN{n=s{vbNVqhwJ7aR-XHL&9fS(l?_feSfix8#wo4v zy}*pJxiZT?p#tzzd5vjcjYa{kD;u*K#oP>a0#_ZaA^x4m4{)eM4H?vAxV0I81W4R09%7TO?4RxJRRq~R?GfoE+HDy^Q@ zJhvq4>+=1WmZI__!vST?>GEu7BauiX5{X3GpTAzciiy*UBJThI002ovPDHLkV1h_x Bj9dT! literal 0 HcmV?d00001 diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index dcd03b5..27eccc8 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -493,6 +493,10 @@ "winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.", "fingersCrossed": "تشابك الاصابع!!!", "congrats": "مبروك !!!", - "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح." + "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح.", + "otp": "OTP", + "verification": "تَحَقّق", + "resend": "إعادة إرسال", + "codeExpire": "انتهت صلاحية رمز التحقق" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 503302b..64a7fed 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -493,5 +493,9 @@ "winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.", "fingersCrossed": "Fingers Crossed!!!", "congrats": "Congratulations!!!", - "allQuestionsCorrect": "You have answered all questions correct" + "allQuestionsCorrect": "You have answered all questions correct", + "otp": "OTP", + "verification": "Verification", + "resend": "Resend", + "codeExpire": "The verification code has been expired" } \ No newline at end of file diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index e670bbc..ad91de7 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -29,6 +29,7 @@ class MyColors { static const Color darkWhiteColor = Color(0xffE0E0E0); static const Color redColor = Color(0xffD02127); static const Color pinkColor = Color(0xffEBA9A9); + static const Color pinkDarkColor = Color(0xffe3797d); static const Color yellowColor = Color(0xffF4E31C); static const Color orange = Color(0xFFCC9B14); static const Color yellowFavColor = Color(0xffEAC321); diff --git a/lib/dialogs/otp_dialog.dart b/lib/dialogs/otp_dialog.dart index 23c7c67..3952e70 100644 --- a/lib/dialogs/otp_dialog.dart +++ b/lib/dialogs/otp_dialog.dart @@ -7,7 +7,9 @@ import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/otp_widget.dart'; +import 'package:sizer/sizer.dart'; class OtpDialog { final int type; @@ -15,6 +17,7 @@ class OtpDialog { final Function(String) onSuccess; final Function onFailure; final BuildContext context; + final Function onResendCode; int remainingTime = 120; @@ -24,13 +27,7 @@ class OtpDialog { static bool? _loading; - OtpDialog( - this.context, - this.type, - this.mobileNo, - this.onSuccess, - this.onFailure, - ); + OtpDialog(this.context, this.type, this.mobileNo, this.onSuccess, this.onFailure, {required this.onResendCode}); GlobalKey? verifyAccountForm = GlobalKey(); @@ -69,7 +66,7 @@ class OtpDialog { // projectProvider = Provider.of(context); return Dialog( backgroundColor: Colors.white, - shape: const RoundedRectangleBorder(), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), insetPadding: const EdgeInsets.only(left: 21, right: 21), child: StatefulBuilder(builder: (context, setState) { if (displayTime == '') { @@ -77,37 +74,26 @@ class OtpDialog { } return Container( - padding: EdgeInsets.only(left: 21, right: 18, top: 39, bottom: 59), + padding: EdgeInsets.all(21), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SvgPicture.asset( - type == 1 - ? "assets/images/login/verify_sms.svg" - : type == 2 - ? "assets/images/login/verify_whatsapp.svg" - : type == 3 - ? "assets/images/login/verify_face.svg" - : 'assets/images/login/verify_thumb.svg', - height: 50, - width: 50, - ), - IconButton( - padding: EdgeInsets.zero, - icon: const Icon(Icons.close), - constraints: const BoxConstraints(), - onPressed: () { - stopTimer = true; - onFailure(); - }) - ], + SvgPicture.asset( + type == 1 + ? "assets/images/login/verify_sms.svg" + : type == 2 + ? "assets/images/login/verify_whatsapp.svg" + : type == 3 + ? "assets/images/login/verify_face.svg" + : 'assets/images/login/verify_thumb.svg', + height: 50, + width: 50, ), - 22.height, + 12.height, + LocaleKeys.otp.tr().toText14(), + LocaleKeys.verification.tr().toText24(isBold: true), + 6.height, (LocaleKeys.pleaseEnterTheVerificationCodeSentTo.tr() + ' xxxxxxxx' + mobileNo.toString().substring(mobileNo.toString().length - 3)).toText16(), 18.height, Directionality( @@ -132,18 +118,55 @@ class OtpDialog { ), ), ), - 30.height, - RichText( - text: TextSpan( - text: LocaleKeys.theVerificationCodeWillExpireIn.tr() + '\n', - style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48), - children: [ - TextSpan( - text: displayTime, - style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.textMixColor, letterSpacing: -0.48), + 10.height, + stopTimer + ? Row( + children: [ + Expanded( + child: LocaleKeys.codeExpire.tr().toText16( + color: MyColors.redColor, + ), + ), + 12.width, + Image.asset( + "assets/icons/ic_alarm.png", + width: 20, + height: 20, + color: MyColors.redColor, + ), + ], + ) + : RichText( + text: TextSpan( + text: LocaleKeys.theVerificationCodeWillExpireIn.tr() + '\n', + style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48), + children: [ + TextSpan( + text: displayTime, + style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.textMixColor, letterSpacing: -0.48), + ), + ], + ), ), - ], - ), + 18.height, + DefaultButton( + stopTimer ? LocaleKeys.resend.tr() : LocaleKeys.cancel.tr(), + () async { + if (stopTimer) { + hideSMSBox(context); + onResendCode(); + } else { + stopTimer = true; + // onFailure(); + hideSMSBox(context); + } + }, + colors: stopTimer + ? null + : [ + MyColors.pinkDarkColor, + MyColors.pinkDarkColor, + ], ), ], ), @@ -208,7 +231,9 @@ class OtpDialog { if (remainingTime > 0) { startTimer(setState); } else { - Navigator.pop(context); + setState(() { + stopTimer = true; + }); } }); } diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 6b702f8..66e4f97 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -509,7 +509,11 @@ class CodegenLoader extends AssetLoader{ "winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.", "fingersCrossed": "تشابك الاصابع!!!", "congrats": "مبروك !!!", - "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح." + "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح.", + "otp": "OTP", + "verification": "تَحَقّق", + "resend": "إعادة إرسال", + "codeExpire": "انتهت صلاحية رمز التحقق" }; static const Map en_US = { "mohemm": "Mohemm", @@ -1006,7 +1010,11 @@ static const Map en_US = { "winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.", "fingersCrossed": "Fingers Crossed!!!", "congrats": "Congratulations!!!", - "allQuestionsCorrect": "You have answered all questions correct" + "allQuestionsCorrect": "You have answered all questions correct", + "otp": "OTP", + "verification": "Verification", + "resend": "Resend", + "codeExpire": "The verification code has been expired" }; static const Map> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 0da7047..835157b 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -480,5 +480,9 @@ abstract class LocaleKeys { static const fingersCrossed = 'fingersCrossed'; static const congrats = 'congrats'; static const allQuestionsCorrect = 'allQuestionsCorrect'; + static const otp = 'otp'; + static const verification = 'verification'; + static const resend = 'resend'; + static const codeExpire = 'codeExpire'; } diff --git a/lib/ui/login/forgot_password_screen.dart b/lib/ui/login/forgot_password_screen.dart index f058d43..6c1868e 100644 --- a/lib/ui/login/forgot_password_screen.dart +++ b/lib/ui/login/forgot_password_screen.dart @@ -65,11 +65,14 @@ class _ForgotPasswordScreenState extends State { () => { Navigator.pop(context), }, + onResendCode: () { + performForgotPassword(); + }, ).displayDialog(context); } catch (ex) { print(ex); Utils.hideLoading(context); - Utils.handleException(ex, context, null); + Utils.handleException(ex, context, null); } } diff --git a/lib/ui/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index 4d653ed..6e51e51 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -57,30 +57,21 @@ class _VerifyLastLoginScreenState extends State { @override Widget build(BuildContext context) { - mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments - as GetMobileLoginInfoListModel; - String empName = AppState().isArabic(context) - ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr! - : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!; + mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments as GetMobileLoginInfoListModel; + String empName = AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr! : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!; return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, automaticallyImplyLeading: false, title: (mobileLoginInfoListModel?.businessCardPrivilege ?? false) - ? LocaleKeys.viewBusinessCard - .tr() - .toText12(color: MyColors.textMixColor, isUnderLine: true) - .onPress(() { + ? LocaleKeys.viewBusinessCard.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() { showMDialog(context, child: BusinessCardDialog()); }) : null, actions: [ Center( - child: LocaleKeys.employeeDigitalID - .tr() - .toText12(color: MyColors.textMixColor, isUnderLine: true) - .onPress(() { + child: LocaleKeys.employeeDigitalID.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() { showMDialog(context, child: EmployeeDigitialIdDialog()); })), 21.width @@ -99,12 +90,9 @@ class _VerifyLastLoginScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ LocaleKeys.welcomeBack.tr().toText12(), - mobileLoginInfoListModel!.employeeName! - .toText24(isBold: true), + mobileLoginInfoListModel!.employeeName!.toText24(isBold: true), 10.height, - LocaleKeys.wouldYouLikeToLoginWithCurrentUsername - .tr() - .toText16(), + LocaleKeys.wouldYouLikeToLoginWithCurrentUsername.tr().toText16(), Container( height: 72, margin: const EdgeInsets.only(top: 23, bottom: 23), @@ -126,42 +114,26 @@ class _VerifyLastLoginScreenState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ LocaleKeys.lastLoginDetails.tr().toText16(), - DateUtil.formatDateToDate( - DateUtil.convertStringToDate( - mobileLoginInfoListModel!.editedOn!), - false) - .toText12(), + DateUtil.formatDateToDate(DateUtil.convertStringToDate(mobileLoginInfoListModel!.editedOn!), false).toText12(), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - LocaleKeys.verificationType - .tr() - .toText10(color: MyColors.grey57Color), - getVerificationType( - mobileLoginInfoListModel!.loginType!) - .toText12(), + LocaleKeys.verificationType.tr().toText10(color: MyColors.grey57Color), + getVerificationType(mobileLoginInfoListModel!.loginType!).toText12(), Expanded(child: SizedBox()), - DateUtil.formatDateToTime( - DateUtil.convertStringToDate( - mobileLoginInfoListModel!.editedOn!)) - .toText12(), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(mobileLoginInfoListModel!.editedOn!)).toText12(), ], ) ], ), ), LocaleKeys.pleaseVerify.tr().toText16(), - if (isNeedVerifyWithFaceIDAndBiometrics) - LocaleKeys.pleaseVerifyForBio.tr().toText12(), + if (isNeedVerifyWithFaceIDAndBiometrics) LocaleKeys.pleaseVerifyForBio.tr().toText12(), GridView( - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 13, - mainAxisSpacing: 9), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), physics: const NeverScrollableScrollPhysics(), padding: const EdgeInsets.only(top: 9), shrinkWrap: true, @@ -214,9 +186,7 @@ class _VerifyLastLoginScreenState extends State { DefaultButton( LocaleKeys.useAnotherAccount.tr(), () { - Navigator.pushNamedAndRemoveUntil( - context, AppRoutes.login, (Route route) => false, - arguments: false); + Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route route) => false, arguments: false); }, ).insideContainer, ], @@ -248,19 +218,11 @@ class _VerifyLastLoginScreenState extends State { } Future loginWithFaceIDAndBiometrics() async { - IOSAuthMessages iosStrings = const IOSAuthMessages( - cancelButton: 'cancel', - goToSettingsButton: 'settings', - goToSettingsDescription: 'Please set up your Touch ID.', - lockOut: 'Please reenable your Touch ID'); + IOSAuthMessages iosStrings = + const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); bool authenticated = false; try { - authenticated = await auth.authenticate( - localizedReason: 'Scan your fingerprint to authenticate', - useErrorDialogs: true, - stickyAuth: true, - biometricOnly: true, - iOSAuthStrings: iosStrings); + authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings); } on PlatformException catch (e) { print(e); Utils.hideLoading(context); @@ -269,11 +231,8 @@ class _VerifyLastLoginScreenState extends State { return authenticated; } - Widget _loginOptionButton( - String _title, String _icon, int _flag, int? _loginIndex) { - bool isDisable = ((_flag == 3 && - !checkBiometricIsAvailable(BiometricType.face)) || - (_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint))); + Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) { + bool isDisable = ((_flag == 3 && !checkBiometricIsAvailable(BiometricType.face)) || (_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint))); return InkWell( onTap: isDisable ? null @@ -284,21 +243,18 @@ class _VerifyLastLoginScreenState extends State { }); } else { if (_flag == 3 || _flag == 4) { - bool authenticateWithFaceAndTouchID = - await loginWithFaceIDAndBiometrics(); + bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); if (!authenticateWithFaceAndTouchID) { return; } else { - if (mobileLoginInfoListModel!.loginType == 3 || - mobileLoginInfoListModel!.loginType == 4) { + if (mobileLoginInfoListModel!.loginType == 3 || mobileLoginInfoListModel!.loginType == 4) { // bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); // if (!authenticateWithFaceAndTouchID) { // return; // } else { // performApiCall(_title, _icon, _flag, isDirectLogin: true); // } - performApiCall(_title, _icon, _flag, _flag, - isDirectLogin: true); + performApiCall(_title, _icon, _flag, _flag, isDirectLogin: true); } else { isNeedVerifyWithFaceIDAndBiometrics = true; selectedFlag = _flag; @@ -316,8 +272,7 @@ class _VerifyLastLoginScreenState extends State { } }, child: Container( - padding: - const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + padding: const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), color: isDisable ? Colors.grey.withOpacity(0.3) : Colors.white, @@ -343,23 +298,13 @@ class _VerifyLastLoginScreenState extends State { Widget getButton(int flag) { switch (flag) { case 1: - return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), - 'assets/images/login/verify_sms.svg', flag, null); + return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), 'assets/images/login/verify_sms.svg', flag, null); case 2: - return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), - 'assets/images/login/verify_whatsapp.svg', flag, null); + return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), 'assets/images/login/verify_whatsapp.svg', flag, null); case 3: - return _loginOptionButton( - LocaleKeys.verifyThroughFace.tr(), - 'assets/images/login/verify_face.svg', - flag, - BiometricType.face.index); + return _loginOptionButton(LocaleKeys.verifyThroughFace.tr(), 'assets/images/login/verify_face.svg', flag, BiometricType.face.index); case 4: - return _loginOptionButton( - LocaleKeys.verifyThroughFingerprint.tr(), - 'assets/images/login/verify_thumb.svg', - flag, - BiometricType.fingerprint.index); + return _loginOptionButton(LocaleKeys.verifyThroughFingerprint.tr(), 'assets/images/login/verify_thumb.svg', flag, BiometricType.fingerprint.index); default: return const SizedBox(); } @@ -376,9 +321,7 @@ class _VerifyLastLoginScreenState extends State { return isAvailable; } - Future performApiCall( - String _title, String _icon, int _flag, int sendVerificationFlat, - {bool isDirectLogin = false}) async { + Future performApiCall(String _title, String _icon, int _flag, int sendVerificationFlat, {bool isDirectLogin = false}) async { try { if (isDirectLogin) setState(() { @@ -387,16 +330,10 @@ class _VerifyLastLoginScreenState extends State { else Utils.showLoading(context); await LoginApiClient().checkMobileAppVersion(); - await LoginApiClient() - .memberLogin(AppState().getUserName!, AppState().password!); + await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!); if (!isDirectLogin) BasicMemberInformationModel? memberInformationModel = - await LoginApiClient() - .mohemmSendActivationCodeByOTPNotificationType( - 0, - AppState().memberLoginList?.pMOBILENUMBER, - sendVerificationFlat, - AppState().getUserName); + await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, ""); if (!isDirectLogin) Utils.hideLoading(context); if (!isDirectLogin) @@ -411,6 +348,9 @@ class _VerifyLastLoginScreenState extends State { () => { Navigator.pop(context), }, + onResendCode: () { + performApiCall(_title, _icon, _flag, sendVerificationFlat, isDirectLogin: isDirectLogin); + }, ).displayDialog(context); } catch (ex) { Utils.hideLoading(context); @@ -418,34 +358,26 @@ class _VerifyLastLoginScreenState extends State { } } - Future performDirectApiCall( - String _title, String _icon, int _flag, String value, - {bool isDirectLogin = false}) async { + Future performDirectApiCall(String _title, String _icon, int _flag, String value, {bool isDirectLogin = false}) async { try { - GenericResponseModel? genericResponseModel = await LoginApiClient() - .checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, - value, AppState().getUserName); - GenericResponseModel? genericResponseModel1 = await LoginApiClient() - .insertMobileLoginInfoNEW( - AppState().memberLoginList?.pEMAILADDRESS ?? "", - genericResponseModel?.pSESSIONID ?? 0, - genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? - "", - _flag, - AppState().memberLoginList?.pMOBILENUMBER ?? "", - AppState().getUserName!, - mobileLoginInfoListModel!.deviceToken!, - Platform.isAndroid ? "android" : "ios"); - AppState().setMemberInformationListModel = - genericResponseModel!.memberInformationList?.first; + GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName); + GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW( + AppState().memberLoginList?.pEMAILADDRESS ?? "", + genericResponseModel?.pSESSIONID ?? 0, + genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? "", + _flag, + AppState().memberLoginList?.pMOBILENUMBER ?? "", + AppState().getUserName!, + mobileLoginInfoListModel!.deviceToken!, + Platform.isAndroid ? "android" : "ios"); + AppState().setMemberInformationListModel = genericResponseModel!.memberInformationList?.first; if (genericResponseModel?.errorMessage != null) { Utils.showToast(genericResponseModel?.errorMessage ?? ""); // Navigator.pop(context); } Utils.hideLoading(context); Navigator.pop(context); - Navigator.pushNamedAndRemoveUntil( - context, AppRoutes.dashboard, (Route route) => false); + Navigator.pushNamedAndRemoveUntil(context, AppRoutes.dashboard, (Route route) => false); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/login/verify_login_screen.dart b/lib/ui/login/verify_login_screen.dart index f31311f..8dba16c 100644 --- a/lib/ui/login/verify_login_screen.dart +++ b/lib/ui/login/verify_login_screen.dart @@ -511,7 +511,6 @@ class _VerifyLoginScreenState extends State { // } // - Future loginWithFaceIDAndBiometrics() async { IOSAuthMessages iosStrings = const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); @@ -550,9 +549,9 @@ class _VerifyLoginScreenState extends State { } } else { if (isNeedVerifyWithFaceIDAndBiometrics) - performApiCall(_title, _icon, selectedFlag,_flag); + performApiCall(_title, _icon, selectedFlag, _flag); else - performApiCall(_title, _icon, _flag,_flag); + performApiCall(_title, _icon, _flag, _flag); } } }, @@ -606,13 +605,13 @@ class _VerifyLoginScreenState extends State { return isAvailable; } - Future performApiCall(String _title, String _icon, int _flag,int sendVerificationFlat) async { + Future performApiCall(String _title, String _icon, int _flag, int sendVerificationFlat) async { try { Utils.showLoading(context); await LoginApiClient().checkMobileAppVersion(); await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!); - BasicMemberInformationModel? memberInformationModel = await LoginApiClient() - .mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); + BasicMemberInformationModel? memberInformationModel = + await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); Utils.hideLoading(context); OtpDialog( context, @@ -633,8 +632,6 @@ class _VerifyLoginScreenState extends State { Platform.isAndroid ? "android" : "ios"); if (genericResponseModel?.errorMessage != null) { Utils.showToast(genericResponseModel?.errorMessage ?? ""); - - } else { AppState().setPrivilegeListModel = genericResponseModel!.privilegeList ?? []; AppState().setMemberInformationListModel = genericResponseModel.memberInformationList?.first; @@ -662,6 +659,9 @@ class _VerifyLoginScreenState extends State { () => { Navigator.pop(context), }, + onResendCode: () { + performApiCall(_title, _icon, _flag, sendVerificationFlat); + }, ).displayDialog(context); } catch (ex) { Utils.hideLoading(context); From 5880e227716e19a8e79bbcf5bf83a9e42bf12ca3 Mon Sep 17 00:00:00 2001 From: "mirza.shafique" Date: Wed, 2 Nov 2022 14:34:55 +0300 Subject: [PATCH 10/10] merge fix --- assets/langs/ar-SA.json | 4 +--- assets/langs/en-US.json | 3 +-- lib/generated/codegen_loader.g.dart | 8 +++++--- lib/generated/locale_keys.g.dart | 1 + 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index bf3c1a8..f72ea36 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -497,8 +497,6 @@ "otp": "OTP", "verification": "تَحَقّق", "resend": "إعادة إرسال", - "codeExpire": "انتهت صلاحية رمز التحقق" - - "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح.", + "codeExpire": "انتهت صلاحية رمز التحقق", "typeheretoreply": "اكتب هنا للرد" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 0543013..896a365 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -493,11 +493,10 @@ "winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.", "fingersCrossed": "Fingers Crossed!!!", "congrats": "Congratulations!!!", - "allQuestionsCorrect": "You have answered all questions correct", "otp": "OTP", "verification": "Verification", "resend": "Resend", - "codeExpire": "The verification code has been expired" + "codeExpire": "The verification code has been expired", "allQuestionsCorrect": "You have answered all questions correct", "typeheretoreply": "Type here to reply" } \ No newline at end of file diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 66e4f97..83910f7 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -513,7 +513,8 @@ class CodegenLoader extends AssetLoader{ "otp": "OTP", "verification": "تَحَقّق", "resend": "إعادة إرسال", - "codeExpire": "انتهت صلاحية رمز التحقق" + "codeExpire": "انتهت صلاحية رمز التحقق", + "typeheretoreply": "اكتب هنا للرد" }; static const Map en_US = { "mohemm": "Mohemm", @@ -1010,11 +1011,12 @@ static const Map en_US = { "winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.", "fingersCrossed": "Fingers Crossed!!!", "congrats": "Congratulations!!!", - "allQuestionsCorrect": "You have answered all questions correct", "otp": "OTP", "verification": "Verification", "resend": "Resend", - "codeExpire": "The verification code has been expired" + "codeExpire": "The verification code has been expired", + "allQuestionsCorrect": "You have answered all questions correct", + "typeheretoreply": "Type here to reply" }; static const Map> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 835157b..f52bb89 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -484,5 +484,6 @@ abstract class LocaleKeys { static const verification = 'verification'; static const resend = 'resend'; static const codeExpire = 'codeExpire'; + static const typeheretoreply = 'typeheretoreply'; }