diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index ed1a787..2f8758c 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
\ No newline at end of file
diff --git a/assets/icons/close.svg b/assets/icons/close.svg
new file mode 100644
index 0000000..631fcfa
--- /dev/null
+++ b/assets/icons/close.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/chat-group.svg b/assets/images/chat-group.svg
new file mode 100644
index 0000000..127a793
--- /dev/null
+++ b/assets/images/chat-group.svg
@@ -0,0 +1,56 @@
+
+
+
\ No newline at end of file
diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json
index 48f443e..2ed5acc 100644
--- a/assets/langs/ar-SA.json
+++ b/assets/langs/ar-SA.json
@@ -527,6 +527,8 @@
"noWinner": "حزين! لم يفز أحد اليوم.",
"myTeam": "فريقي",
"youCanPlayDemo": "لكن يمكنك لعب العرض",
+ "group" : "مجموعة",
+ "searchGroup": "مجموعة البحث",
"connectHmgWifi": "قم بتوصيل HMG WIFI",
"connectedHmgWifi": "اتصال HMG WIFI",
"itgForms": "نماذج (ITG)",
diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json
index b005710..38aeaa7 100644
--- a/assets/langs/en-US.json
+++ b/assets/langs/en-US.json
@@ -527,6 +527,8 @@
"noWinner": "Sad! No one won today.",
"myTeam": "My Team",
"youCanPlayDemo": "But you can play demo",
+ "group": "Groups",
+ "searchGroup": "Search Group",
"connectHmgWifi": "Connect HMG WIFI",
"connectedHmgWifi": "Connected HMG WIFI",
"itgForms": "ITG Forms",
@@ -538,4 +540,24 @@
"expiredDocuments": "Expired\nDocuments",
"missingDocuments": "Missing\nDocuments",
"uploadedDocuments": "Uploaded\nDocuments"
+ "resetAdPassword": "Reset AD Password"
+ "manage": "Manage",
+ "members": "Members",
+ "areYouSureWantTodelete": "Are you sure want to delete?",
+ "groupMembers": "Group Members",
+ "manageGroup": "Manage Group",
+ "admin": "Admin",
+ "addUsers": "Add users to the group",
+ "editGroups":"Edit Group",
+ "groupNameshouldbe": "Group name should be minimum 10 character long",
+ "enterGroupName": "Please enter valid group Name",
+ "groupName": "Group Name",
+ "enterGroupNamePlease": "Please enter group name",
+ "audioCall": "Audio Call",
+ "videoCall": "Video Call",
+ "shareScreen": "Share Screen",
+ "searchByUserName": "Search By Username",
+ "userSearch": "User Search",
+ "userName": "User Name",
+ "userId": "UserID"
}
\ No newline at end of file
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 24ba08c..cb62b88 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -65,7 +65,6 @@
fetch
remote-notification
- voip
UILaunchStoryboardName
LaunchScreen
diff --git a/lib/api/chat/chat_api_client.dart b/lib/api/chat/chat_api_client.dart
index f727c7d..05af905 100644
--- a/lib/api/chat/chat_api_client.dart
+++ b/lib/api/chat/chat_api_client.dart
@@ -12,9 +12,17 @@ import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/exceptions/api_exception.dart';
import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/chat/chat_user_image_model.dart';
+import 'package:mohem_flutter_app/models/chat/create_group_request.dart'
+ as createGroup;
+import 'package:mohem_flutter_app/models/chat/get_group_chat_history.dart';
import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
-import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' as user;
-import 'package:mohem_flutter_app/models/chat/make_user_favotire_unfavorite_chat_model.dart' as fav;
+import 'package:mohem_flutter_app/models/chat/get_user_groups_by_id.dart'
+ as groups;
+import 'package:mohem_flutter_app/models/chat/get_user_groups_by_id.dart';
+import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart'
+ as user;
+import 'package:mohem_flutter_app/models/chat/make_user_favotire_unfavorite_chat_model.dart'
+ as fav;
class ChatApiClient {
static final ChatApiClient _instance = ChatApiClient._internal();
@@ -28,10 +36,13 @@ class ChatApiClient {
Response response = await ApiClient().postJsonForResponse(
"${ApiConsts.chatLoginTokenUrl}externaluserlogin",
{
- "employeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER.toString(),
+ "employeeNumber":
+ AppState().memberInformationList!.eMPLOYEENUMBER.toString(),
"password": "FxIu26rWIKoF8n6mpbOmAjDLphzFGmpG",
"isMobile": true,
- "deviceToken":AppState().getIsHuawei ? AppState().getHuaweiPushToken : AppState().getDeviceToken,
+ "deviceToken": AppState().getIsHuawei
+ ? AppState().getHuaweiPushToken
+ : AppState().getDeviceToken,
"isHuaweiDevice": AppState().getIsHuawei,
},
);
@@ -41,7 +52,10 @@ class ChatApiClient {
}
if (response.statusCode == 200) {
userLoginResponse = user.userAutoLoginModelFromJson(response.body);
- } else if (response.statusCode == 501 || response.statusCode == 502 || response.statusCode == 503 || response.statusCode == 504) {
+ } else if (response.statusCode == 501 ||
+ response.statusCode == 502 ||
+ response.statusCode == 503 ||
+ response.statusCode == 504) {
getUserLoginToken();
} else {
userLoginResponse = user.userAutoLoginModelFromJson(response.body);
@@ -50,9 +64,16 @@ class ChatApiClient {
return userLoginResponse;
}
- Future getChatMemberFromSearch(String searchParam, int cUserId, int pageNo) async {
+ Future getChatMemberFromSearch(
+ String searchParam, int cUserId, int pageNo) async {
ChatUserModel chatUserModel;
- Response response = await ApiClient().postJsonForResponse("${ApiConsts.chatLoginTokenUrl}getUserWithStatusAndFavAsync", {"employeeNumber": cUserId, "userName": searchParam, "pageNumber": pageNo},
+ Response response = await ApiClient().postJsonForResponse(
+ "${ApiConsts.chatLoginTokenUrl}getUserWithStatusAndFavAsync",
+ {
+ "employeeNumber": cUserId,
+ "userName": searchParam,
+ "pageNumber": pageNo
+ },
token: AppState().chatDetails!.response!.token);
if (!kReleaseMode) {
logger.i("res: " + response.body);
@@ -92,7 +113,12 @@ class ChatApiClient {
}
//Get User Chat History
- Future getSingleUserChatHistory({required int senderUID, required int receiverUID, required bool loadMore, bool isNewChat = false, required int paginationVal}) async {
+ Future getSingleUserChatHistory(
+ {required int senderUID,
+ required int receiverUID,
+ required bool loadMore,
+ bool isNewChat = false,
+ required int paginationVal}) async {
try {
Response response = await ApiClient().getJsonForResponse(
"${ApiConsts.chatSingleUserHistoryUrl}GetUserChatHistory/$senderUID/$receiverUID/$paginationVal",
@@ -103,23 +129,33 @@ class ChatApiClient {
}
return response;
} catch (e) {
- getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal);
+ getSingleUserChatHistory(
+ senderUID: senderUID,
+ receiverUID: receiverUID,
+ loadMore: loadMore,
+ paginationVal: paginationVal);
throw e;
}
}
//Favorite Users
- Future favUser({required int userID, required int targetUserID}) async {
- Response response = await ApiClient().postJsonForResponse("${ApiConsts.chatFavUser}addFavUser", {"targetUserId": targetUserID, "userId": userID}, token: AppState().chatDetails!.response!.token);
+ Future favUser(
+ {required int userID, required int targetUserID}) async {
+ Response response = await ApiClient().postJsonForResponse(
+ "${ApiConsts.chatFavUser}addFavUser",
+ {"targetUserId": targetUserID, "userId": userID},
+ token: AppState().chatDetails!.response!.token);
if (!kReleaseMode) {
logger.i("res: " + response.body);
}
- fav.FavoriteChatUser favoriteChatUser = fav.FavoriteChatUser.fromRawJson(response.body);
+ fav.FavoriteChatUser favoriteChatUser =
+ fav.FavoriteChatUser.fromRawJson(response.body);
return favoriteChatUser;
}
//UnFavorite Users
- Future unFavUser({required int userID, required int targetUserID}) async {
+ Future unFavUser(
+ {required int userID, required int targetUserID}) async {
try {
Response response = await ApiClient().postJsonForResponse(
"${ApiConsts.chatFavUser}deleteFavUser",
@@ -129,7 +165,8 @@ class ChatApiClient {
if (!kReleaseMode) {
logger.i("res: " + response.body);
}
- fav.FavoriteChatUser favoriteChatUser = fav.FavoriteChatUser.fromRawJson(response.body);
+ fav.FavoriteChatUser favoriteChatUser =
+ fav.FavoriteChatUser.fromRawJson(response.body);
return favoriteChatUser;
} catch (e) {
e as APIException;
@@ -144,10 +181,12 @@ class ChatApiClient {
print(AppState().chatDetails!.response!.token);
}
- dynamic request = MultipartRequest('POST', Uri.parse('${ApiConsts.chatMediaImageUploadUrl}upload'));
+ dynamic request = MultipartRequest(
+ 'POST', Uri.parse('${ApiConsts.chatMediaImageUploadUrl}upload'));
request.fields.addAll({'userId': userId, 'fileSource': '1'});
request.files.add(await MultipartFile.fromPath('files', file.path));
- request.headers.addAll({'Authorization': 'Bearer ${AppState().chatDetails!.response!.token}'});
+ request.headers.addAll(
+ {'Authorization': 'Bearer ${AppState().chatDetails!.response!.token}'});
StreamedResponse response = await request.send();
String data = await response.stream.bytesToString();
if (!kReleaseMode) {
@@ -157,7 +196,8 @@ class ChatApiClient {
}
// Download File For Chat
- Future downloadURL({required String fileName, required String fileTypeDescription}) async {
+ Future downloadURL(
+ {required String fileName, required String fileTypeDescription}) async {
Response response = await ApiClient().postJsonForResponse(
"${ApiConsts.chatMediaImageUploadUrl}download",
{"fileType": fileTypeDescription, "fileName": fileName, "fileSource": 1},
@@ -168,7 +208,8 @@ class ChatApiClient {
}
//Get Chat Users & Favorite Images
- Future> getUsersImages({required List encryptedEmails}) async {
+ Future> getUsersImages(
+ {required List encryptedEmails}) async {
List imagesData = [];
Response response = await ApiClient().postJsonForResponse(
"${ApiConsts.chatUserImages}images",
@@ -188,4 +229,128 @@ class ChatApiClient {
}
return imagesData;
}
+
+ //group chat apis start here.
+ Future getGroupsByUserId() async {
+ try {
+ Response response = await ApiClient().getJsonForResponse(
+ "${ApiConsts.getGroupByUserId}${AppState().chatDetails!.response!.id}",
+ token: AppState().chatDetails!.response!.token,
+ );
+ if (!kReleaseMode) {
+ logger.i("res: " + response.body);
+ }
+ return groups.GetUserGroups.fromRawJson(response.body);
+ } catch (e) {
+ //if fail api returning 500 hence just printing here
+ print(e);
+ throw e;
+ }
+ }
+
+ Future deleteGroup(int? groupId) async {
+ try {
+ Response response = await ApiClient().postJsonForResponse(
+ ApiConsts.deleteGroup,
+ {"groupId":groupId},
+ token: AppState().chatDetails!.response!.token,
+ );
+ if (!kReleaseMode) {
+ logger.i("res: " + response.body);
+ }
+ return response;
+ } catch (e) {
+ //if fail api returning 500 hence just printing here
+ print(e);
+ throw e;
+ }
+ }
+
+ Future updateGroupAdmin(
+ int? groupId, List groupList) async {
+ try {
+ Response response = await ApiClient().postJsonForResponse(
+ ApiConsts.updateGroupAdmin,
+ {"groupId": groupId, "groupUserList": groupList},
+ token: AppState().chatDetails!.response!.token,
+ );
+ if (!kReleaseMode) {
+ logger.i("res: " + response.body);
+ }
+ return response;
+ } catch (e) {
+ //if fail api returning 500 hence just printing here
+ print(e);
+ throw e;
+ }
+ }
+
+ Future> getGroupChatHistory(
+ int? groupId, List groupList) async {
+ try {
+ Response response = await ApiClient().postJsonForResponse(
+ ApiConsts.getGroupChatHistoryAsync,
+ {
+ "groupId": groupId,
+ "targetUserList": groupList,
+ "CurrentId": AppState().chatDetails!.response!.id
+ },
+ token: AppState().chatDetails!.response!.token,
+ );
+ if (!kReleaseMode) {
+ logger.i("res: " + response.body);
+ }
+ List groupChat = [];
+ List groupChatData = json.decode(response.body);
+ for (var i in groupChatData) {
+ groupChat.add(GetGroupChatHistoryAsync.fromJson(i));
+ }
+
+ groupChat.sort((a, b) => b.createdDate!.compareTo(a.createdDate!));
+ return groupChat;
+ // for(GetGroupChatHistoryAsync i in groupChat) {
+ // return GetGroupChatHistoryAsync.fromJson(jsonEncode(i));
+ // }
+ } catch (e) {
+ //if fail api returning 500 hence just printing here
+ print(e);
+ throw e;
+ }
+ }
+
+ Future addGroupAndUsers(createGroup.CreateGroupRequest request) async {
+ try {
+ Response response = await ApiClient().postJsonForResponse(
+ ApiConsts.addGroupsAndUsers,
+ request,
+ token: AppState().chatDetails!.response!.token,
+ );
+ if (!kReleaseMode) {
+ logger.i("res: " + response.body);
+ }
+ return response.body;
+ } catch (e) {
+ //if fail api returning 500 hence just printing here
+ print(e);
+ throw e;
+ }
+ }
+
+ Future updateGroupAndUsers(createGroup.CreateGroupRequest request) async {
+ try {
+ Response response = await ApiClient().postJsonForResponse(
+ ApiConsts.updateGroupsAndUsers,
+ request,
+ token: AppState().chatDetails!.response!.token,
+ );
+ if (!kReleaseMode) {
+ logger.i("res: " + response.body);
+ }
+ return response.body;
+ } catch (e) {
+ //if fail api returning 500 hence just printing here
+ print(e);
+ throw e;
+ }
+ }
}
diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart
index 544ba71..77cc37d 100644
--- a/lib/api/dashboard_api_client.dart
+++ b/lib/api/dashboard_api_client.dart
@@ -201,7 +201,7 @@ class DashboardApiClient {
}, url, postParams);
}
- Future setAdvertisementViewed(String masterID, int advertisementId, String ackValue) async {
+ Future setAdvertisementViewed(String masterID, int advertisementId, String? ackValue) async {
String url = "${ApiConsts.cocRest}Mohemm_ITG_UpdateAdvertisementAsViewed";
Map postParams = {
diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart
index 030a949..342ac31 100644
--- a/lib/api/profile_api_client.dart
+++ b/lib/api/profile_api_client.dart
@@ -180,7 +180,7 @@ class ProfileApiClient {
],
"P_CONTACT_RELATIONSHIP_ID": contactRelationId,
"P_ACTION": actionType,
- "PayrollCodeStr": "CS",
+ "PayrollCodeStr": "HMG",
"LegislationCodeStr": "SA",
};
postParams.addAll(AppState().postParamsJson);
diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart
index f59994c..b0c93ee 100644
--- a/lib/app_state/app_state.dart
+++ b/lib/app_state/app_state.dart
@@ -90,7 +90,7 @@ class AppState {
String get getHuaweiPushToken => _huaweiPushToken;
- final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 4.9, mobileType: Platform.isAndroid ? "android" : "ios");
+ final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 5.0, mobileType: Platform.isAndroid ? "android" : "ios");
void setPostParamsInitConfig() {
isAuthenticated = false;
diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart
index 45ef661..64047e5 100644
--- a/lib/classes/consts.dart
+++ b/lib/classes/consts.dart
@@ -20,6 +20,14 @@ class ApiConsts {
static String chatLoginTokenUrl = chatServerBaseApiUrl + "user/";
static String chatHubConnectionUrl = chatServerBaseUrl + "ConnectionChatHub";
+ //Groups
+ static String getGroupByUserId = chatServerBaseApiUrl + "group/getgroupsbyuserid/";
+ static String deleteGroup = chatServerBaseApiUrl + "group/updateGroupIsDeleted/";
+ static String updateGroupAdmin = chatServerBaseApiUrl + "group/updateGroupAdmin/";
+ static String getGroupChatHistoryAsync = chatServerBaseApiUrl + "GroupChat/GetGroupChatHistoryAsync/";
+ static String addGroupsAndUsers = chatServerBaseApiUrl + "group/addgroupandusers/";
+ static String updateGroupsAndUsers = chatServerBaseApiUrl + "group/updategroupandusers/";
+
// static String chatSearchMember = chatLoginTokenUrl + "user/";
static String chatRecentUrl = chatServerBaseApiUrl + "UserChatHistory/"; //For a Mem
static String chatSingleUserHistoryUrl = chatServerBaseApiUrl + "UserChatHistory/";
diff --git a/lib/classes/notifications.dart b/lib/classes/notifications.dart
index 47d4acd..8f432d7 100644
--- a/lib/classes/notifications.dart
+++ b/lib/classes/notifications.dart
@@ -109,7 +109,10 @@ class AppNotifications {
debugPrint("HUAWEI PUSH TOKEN: $_huaweiToken");
}
- void _onTokenError(Object error) {}
+ void _onTokenError(Object error) {
+ debugPrint("HUAWEI PUSH TOKEN ERROR: $error");
+ Utils.hideLoading(context);
+ }
Future initTokenStream(Function loginCallback) async {
huawei_push.Push.getTokenStream.listen(_onTokenEvent, onError: _onTokenError).onData((data) {
diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart
index 7885fad..9c55375 100644
--- a/lib/classes/utils.dart
+++ b/lib/classes/utils.dart
@@ -349,7 +349,7 @@ class Utils {
}
static Future selectDate(BuildContext context, DateTime selectedDate) async {
- if (Platform.isIOS) {
+ if (!Platform.isIOS) {
await showCupertinoModalPopup(
context: context,
builder: (BuildContext cxt) => Container(
@@ -401,7 +401,6 @@ class Utils {
}
return false;
}
-
static bool isDate(String input, String format) {
try {
DateTime d = DateFormat(format).parseStrict(input);
diff --git a/lib/config/routes.dart b/lib/config/routes.dart
index 705e40d..07a927d 100644
--- a/lib/config/routes.dart
+++ b/lib/config/routes.dart
@@ -8,6 +8,9 @@ import 'package:mohem_flutter_app/ui/bottom_sheets/attendence_details_bottom_she
import 'package:mohem_flutter_app/ui/chat/chat_detailed_screen.dart';
import 'package:mohem_flutter_app/ui/chat/chat_home.dart';
import 'package:mohem_flutter_app/ui/chat/favorite_users_screen.dart';
+import 'package:mohem_flutter_app/ui/chat/group_chat_detaied_screen.dart';
+import 'package:mohem_flutter_app/ui/chat/group_members.dart';
+import 'package:mohem_flutter_app/ui/chat/manage_group.dart';
import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart';
import 'package:mohem_flutter_app/ui/landing/itg/change_itg_ad_password_screen.dart';
import 'package:mohem_flutter_app/ui/landing/itg/its_add_screen_video_image.dart';
@@ -190,6 +193,10 @@ class AppRoutes {
static const String chatDetailed = "/chatDetailed";
static const String chatFavoriteUsers = "/chatFavoriteUsers";
+ //Group Chat
+ static const String manageGroup = "/manageGroup";
+ static const String groupMembers = "/groupmembers";
+ static const String groupChatDetailed = "/groupChatDetailed";
//Marathon
static const String marathonIntroScreen = "/marathonIntroScreen";
static const String marathonScreen = "/marathonScreen";
@@ -302,6 +309,11 @@ class AppRoutes {
chatDetailed: (BuildContext context) => ChatDetailScreen(),
chatFavoriteUsers: (BuildContext context) => ChatFavoriteUsersScreen(),
+ //Group Chat
+ manageGroup: (BuildContext context) => ManageGroupScreen(),
+ groupMembers: (BuildContext context) => GroupMembersScreen(),
+ groupChatDetailed: (BuildContext context) => GroupChatDetailScreen(),
+
// Marathon
marathonIntroScreen: (BuildContext context) => MarathonIntroScreen(),
marathonScreen: (BuildContext context) => MarathonScreen(),
diff --git a/lib/extensions/int_extensions.dart b/lib/extensions/int_extensions.dart
index 16bdd29..f46d5bb 100644
--- a/lib/extensions/int_extensions.dart
+++ b/lib/extensions/int_extensions.dart
@@ -10,6 +10,4 @@ extension IntExtensions on int {
Widget get divider => Divider(height: toDouble(), thickness: toDouble(), color: MyColors.lightGreyEFColor);
Widget get makeItSquare => SizedBox(width: toDouble(), height: toDouble());
-
-
}
diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart
index c8bfdfa..1e2d5af 100644
--- a/lib/generated/codegen_loader.g.dart
+++ b/lib/generated/codegen_loader.g.dart
@@ -543,6 +543,8 @@ class CodegenLoader extends AssetLoader{
"noWinner": "حزين! لم يفز أحد اليوم.",
"myTeam": "فريقي",
"youCanPlayDemo": "لكن يمكنك لعب العرض",
+ "group": "مجموعة",
+ "searchGroup": "مجموعة البحث",
"connectHmgWifi": "قم بتوصيل HMG WIFI",
"connectedHmgWifi": "اتصال HMG WIFI",
"itgForms": "نماذج (ITG)",
@@ -1084,6 +1086,8 @@ static const Map en_US = {
"noWinner": "Sad! No one won today.",
"myTeam": "My Team",
"youCanPlayDemo": "But you can play demo",
+ "group": "Groups",
+ "searchGroup": "Search Group",
"connectHmgWifi": "Connect HMG WIFI",
"connectedHmgWifi": "Connected HMG WIFI",
"itgForms": "ITG Forms",
@@ -1094,7 +1098,26 @@ static const Map en_US = {
"allDocuments": "All\nDocuments",
"expiredDocuments": "Expired\nDocuments",
"missingDocuments": "Missing\nDocuments",
- "uploadedDocuments": "Uploaded\nDocuments"
+ "uploadedDocuments": "Uploaded\nDocuments",
+ "manage": "Manage",
+ "members": "Members",
+ "areYouSureWantTodelete": "Are you sure want to delete?",
+ "groupMembers": "Group Members",
+ "manageGroup": "Manage Group",
+ "admin": "Admin",
+ "addUsers": "Add users to the group",
+ "editGroups": "Edit Group",
+ "groupNameshouldbe": "Group name should be minimum 10 character long",
+ "enterGroupName": "Please enter valid group Name",
+ "groupName": "Group Name",
+ "enterGroupNamePlease": "Please enter group name",
+ "audioCall": "Audio Call",
+ "videoCall": "Video Call",
+ "shareScreen": "Share Screen",
+ "searchByUserName": "Search By Username",
+ "userSearch": "User Search",
+ "userName": "User Name",
+ "userId": "UserID"
};
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 3a4921f..c5ec04f 100644
--- a/lib/generated/locale_keys.g.dart
+++ b/lib/generated/locale_keys.g.dart
@@ -513,6 +513,8 @@ abstract class LocaleKeys {
static const noWinner = 'noWinner';
static const myTeam = 'myTeam';
static const youCanPlayDemo = 'youCanPlayDemo';
+ static const group = 'group';
+ static const searchGroup = 'searchGroup';
static const connectHmgWifi = 'connectHmgWifi';
static const connectedHmgWifi = 'connectedHmgWifi';
static const itgForms = 'itgForms';
@@ -525,4 +527,23 @@ abstract class LocaleKeys {
static const missingDocuments = 'missingDocuments';
static const uploadedDocuments = 'uploadedDocuments';
+ static const manage = 'manage';
+ static const members = 'members';
+ static const areYouSureWantTodelete = 'areYouSureWantTodelete';
+ static const groupMembers = "groupMembers";
+ static const manageGroup = "manageGroup";
+ static const admin = "admin";
+ static const addUsers ="addUsers";
+ static const editGroups ="editGroups";
+ static const groupNameshouldbe ="groupNameshouldbe";
+ static const enterGroupName ="enterGroupName";
+ static const groupName ="groupName";
+ static const enterGroupNamePlease ="enterGroupNamePlease";
+ static const audioCall = 'audioCall';
+ static const videoCall ='videoCall';
+ static const shareScreen ='shareScreen';
+ static const searchByUserName ='searchByUserName';
+ static const userSearch ='userSearch';
+ static const userName ='userName';
+ static const userId ='userId';
}
diff --git a/lib/generated_plugin_registrant.dart b/lib/generated_plugin_registrant.dart
index 642c8ec..b59eec2 100644
--- a/lib/generated_plugin_registrant.dart
+++ b/lib/generated_plugin_registrant.dart
@@ -16,7 +16,7 @@ import 'package:geolocator_web/geolocator_web.dart';
import 'package:google_maps_flutter_web/google_maps_flutter_web.dart';
import 'package:image_picker_for_web/image_picker_for_web.dart';
import 'package:just_audio_web/just_audio_web.dart';
-import 'package:record_web/record_web.dart';
+// import 'package:record_web/record_web.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:video_player_web/video_player_web.dart';
@@ -35,7 +35,7 @@ void registerPlugins(Registrar registrar) {
GoogleMapsPlugin.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar);
JustAudioPlugin.registerWith(registrar);
- RecordPluginWeb.registerWith(registrar);
+ //RecordPluginWeb.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar);
VideoPlayerPlugin.registerWith(registrar);
diff --git a/lib/models/chat/create_group_request.dart b/lib/models/chat/create_group_request.dart
new file mode 100644
index 0000000..b33297f
--- /dev/null
+++ b/lib/models/chat/create_group_request.dart
@@ -0,0 +1,159 @@
+import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
+
+class CreateGroupRequest {
+ String? groupName;
+ int? adminUserId;
+ List? groupUserList;
+ bool? canAttach;
+ bool? canAudioC;
+ bool? canShareS;
+ bool? canVideoC;
+ bool? isMeeting;
+ bool? canArchive;
+ int? groupId;
+ CreateGroupRequest(
+ {this.groupName,
+ this.adminUserId,
+ this.groupUserList,
+ this.canAttach,
+ this.canAudioC,
+ this.canShareS,
+ this.canVideoC,
+ this.isMeeting,
+ this.canArchive,
+ this.groupId
+ });
+
+ CreateGroupRequest.fromJson(Map json) {
+ groupName = json['groupName'];
+ adminUserId = json['adminUserId'];
+ if (json['groupUserList'] != null) {
+ groupUserList = [];
+ json['groupUserList'].forEach((v) {
+ groupUserList!.add(new ChatUser.fromJson(v));
+ });
+ }
+ canAttach = json['canAttach'];
+ canAudioC = json['canAudioC'];
+ canShareS = json['canShareS'];
+ canVideoC = json['canVideoC'];
+ isMeeting = json['isMeeting'];
+ canArchive = json['canArchive'];
+ groupId = json['groupId'];
+ }
+
+ Map toJson() {
+ Map data = new Map();
+ data['groupName'] = this.groupName;
+ data['adminUserId'] = this.adminUserId;
+ if (this.groupUserList != null) {
+ data['groupUserList'] =
+ this.groupUserList!.map((v) => v.toJson()).toList();
+ }
+ data['canAttach'] = this.canAttach;
+ data['canAudioC'] = this.canAudioC;
+ data['canShareS'] = this.canShareS;
+ data['canVideoC'] = this.canVideoC;
+ data['isMeeting'] = this.isMeeting;
+ data['canArchive'] = this.canArchive;
+ data['groupId'] = this.groupId;
+ return data;
+ }
+}
+
+class GroupUserList {
+ int? id;
+ String? userName;
+ String? email;
+ dynamic? phone;
+ String? title;
+ int? userStatus;
+ String? image;
+ int? unreadMessageCount;
+ int? userAction;
+ bool? isPin;
+ bool? isFav;
+ bool? isAdmin;
+ Null? rKey;
+ int? totalCount;
+ bool? isHuaweiDevice;
+ Null? deviceToken;
+ String? token;
+ bool? isDomainUser;
+ bool? isActiveCode;
+ String? encryptedUserId;
+ String? encryptedUserName;
+
+ GroupUserList(
+ {this.id,
+ this.userName,
+ this.email,
+ this.phone,
+ this.title,
+ this.userStatus,
+ this.image,
+ this.unreadMessageCount,
+ this.userAction,
+ this.isPin,
+ this.isFav,
+ this.isAdmin,
+ this.rKey,
+ this.totalCount,
+ this.isHuaweiDevice,
+ this.deviceToken,
+ this.token,
+ this.isDomainUser,
+ this.isActiveCode,
+ this.encryptedUserId,
+ this.encryptedUserName});
+
+ GroupUserList.fromJson(Map json) {
+ id = json['id'];
+ userName = json['userName'];
+ email = json['email'];
+ phone = json['phone'];
+ title = json['title'];
+ userStatus = json['userStatus'];
+ image = json['image'];
+ unreadMessageCount = json['unreadMessageCount'];
+ userAction = json['userAction'];
+ isPin = json['isPin'];
+ isFav = json['isFav'];
+ isAdmin = json['isAdmin'];
+ rKey = json['rKey'];
+ totalCount = json['totalCount'];
+ isHuaweiDevice = json['isHuaweiDevice'];
+ deviceToken = json['deviceToken'];
+ token = json['token'];
+ isDomainUser = json['isDomainUser'];
+ isActiveCode = json['isActiveCode'];
+ encryptedUserId = json['encryptedUserId'];
+ encryptedUserName = json['encryptedUserName'];
+ }
+
+ Map toJson() {
+ Map data = new Map();
+ data['id'] = this.id;
+ data['userName'] = this.userName;
+ data['email'] = this.email;
+ data['phone'] = this.phone;
+ data['title'] = this.title;
+ data['userStatus'] = this.userStatus;
+ data['image'] = this.image;
+ data['unreadMessageCount'] = this.unreadMessageCount;
+ data['userAction'] = this.userAction;
+ data['isPin'] = this.isPin;
+ data['isFav'] = this.isFav;
+ data['isAdmin'] = this.isAdmin;
+ data['rKey'] = this.rKey;
+ data['totalCount'] = this.totalCount;
+ data['isHuaweiDevice'] = this.isHuaweiDevice;
+ data['deviceToken'] = this.deviceToken;
+ data['token'] = this.token;
+ data['isDomainUser'] = this.isDomainUser;
+ data['isActiveCode'] = this.isActiveCode;
+ data['encryptedUserId'] = this.encryptedUserId;
+ data['encryptedUserName'] = this.encryptedUserName;
+ return data;
+ }
+}
diff --git a/lib/models/chat/get_group_chat_history.dart b/lib/models/chat/get_group_chat_history.dart
new file mode 100644
index 0000000..c8476b1
--- /dev/null
+++ b/lib/models/chat/get_group_chat_history.dart
@@ -0,0 +1,264 @@
+import 'dart:convert';
+import 'dart:io';
+import 'dart:typed_data';
+
+import 'package:just_audio/just_audio.dart';
+
+class GetGroupChatHistoryAsync {
+ int? groupChatHistoryId;
+ String? contant;
+ String? contantNo;
+ int? chatEventId;
+ dynamic? fileTypeId;
+ bool? isSeen;
+ bool? isDelivered;
+ String? createdDate;
+ int? chatSource;
+ int? currentUserId;
+ String? currentUserName;
+ int? groupId;
+ String? groupName;
+ dynamic? encryptedGroupId;
+ dynamic? encryptedGroupName;
+ dynamic? callStatus;
+ String? conversationId;
+ List? groupChatHistoryTargetUserList;
+ FileTypeResponse? fileTypeResponse;
+ GroupChatReplyResponse? groupChatReplyResponse;
+ bool? isReplied;
+ bool? isImageLoaded;
+ Uint8List? image;
+ File? voice;
+ AudioPlayer? voiceController;
+ GetGroupChatHistoryAsync(
+ {this.groupChatHistoryId,
+ this.contant,
+ this.contantNo,
+ this.chatEventId,
+ this.fileTypeId,
+ this.isSeen,
+ this.isDelivered,
+ this.createdDate,
+ this.chatSource,
+ this.currentUserId,
+ this.currentUserName,
+ this.groupId,
+ this.groupName,
+ this.encryptedGroupId,
+ this.encryptedGroupName,
+ this.callStatus,
+ this.conversationId,
+ this.groupChatHistoryTargetUserList,
+ this.fileTypeResponse,
+ this.groupChatReplyResponse,
+ this.image,
+ this.isImageLoaded,
+ this.isReplied,
+ this.voice,
+ this.voiceController
+ });
+
+ GetGroupChatHistoryAsync.fromJson(Map json) {
+ groupChatHistoryId = json['groupChatHistoryId'];
+ contant = json['contant'];
+ contantNo = json['contantNo'];
+ chatEventId = json['chatEventId'];
+ fileTypeId = json['fileTypeId'];
+ isSeen = json['isSeen'];
+ isDelivered = json['isDelivered'];
+ createdDate = json['createdDate'];
+ chatSource = json['chatSource'];
+ currentUserId = json['currentUserId'];
+ currentUserName = json['currentUserName'];
+ groupId = json['groupId'];
+ groupName = json['groupName'];
+ encryptedGroupId = json['encryptedGroupId'];
+ encryptedGroupName = json['encryptedGroupName'];
+ callStatus = json['callStatus'];
+ conversationId = json['conversationId'];
+ if (json['groupChatHistoryTargetUserList'] != null) {
+ groupChatHistoryTargetUserList = [];
+ json['groupChatHistoryTargetUserList'].forEach((v) {
+ groupChatHistoryTargetUserList!
+ .add(new GroupChatHistoryTargetUserList.fromJson(v));
+ });
+ }
+ fileTypeResponse = json['fileTypeResponse'] != null
+ ? new FileTypeResponse.fromJson(json['fileTypeResponse'])
+ : null;
+ groupChatReplyResponse = json["groupChatReplyResponse"] == null ? null : GroupChatReplyResponse.fromJson(json["groupChatReplyResponse"]);
+
+ isReplied= json['isReplied'];
+ isImageLoaded= json['isImageLoaded'] ??false;
+ image= json['image'];
+ voice= json['voice'];
+ voiceController = json["fileTypeId"] == 13 ? AudioPlayer() : null;
+ }
+
+ Map toJson() {
+ Map data = new Map();
+ data['groupChatHistoryId'] = this.groupChatHistoryId;
+ data['contant'] = this.contant;
+ data['contantNo'] = this.contantNo;
+ data['chatEventId'] = this.chatEventId;
+ data['fileTypeId'] = this.fileTypeId;
+ data['isSeen'] = this.isSeen;
+ data['isDelivered'] = this.isDelivered;
+ data['createdDate'] = this.createdDate;
+ data['chatSource'] = this.chatSource;
+ data['currentUserId'] = this.currentUserId;
+ data['currentUserName'] = this.currentUserName;
+ data['groupId'] = this.groupId;
+ data['groupName'] = this.groupName;
+ data['encryptedGroupId'] = this.encryptedGroupId;
+ data['encryptedGroupName'] = this.encryptedGroupName;
+ data['callStatus'] = this.callStatus;
+ data['conversationId'] = this.conversationId;
+ if (this.groupChatHistoryTargetUserList != null) {
+ data['groupChatHistoryTargetUserList'] =
+ this.groupChatHistoryTargetUserList!.map((v) => v.toJson()).toList();
+ }
+ if (this.fileTypeResponse != null) {
+ data['fileTypeResponse'] = this.fileTypeResponse!.toJson();
+ }
+ if(this.groupChatReplyResponse !=null) {
+ data['groupChatReplyResponse'] = this.groupChatReplyResponse;
+ }
+
+ data['isReplied'] =isReplied;
+ data['isImageLoaded'] = isImageLoaded ?? false;
+ data['image'] = image;
+ data['voice'] = voice;
+ data["fileTypeId"] == 13 ? AudioPlayer() : null;
+ return data;
+ }
+}
+
+class GroupChatHistoryTargetUserList {
+ int? groupChatHistoryLineId;
+ bool? isSeen;
+ bool? isDelivered;
+ int? targetUserId;
+ String? targetUserName;
+ dynamic? userAction;
+
+ GroupChatHistoryTargetUserList(
+ {this.groupChatHistoryLineId,
+ this.isSeen,
+ this.isDelivered,
+ this.targetUserId,
+ this.targetUserName,
+ this.userAction});
+
+ GroupChatHistoryTargetUserList.fromJson(Map json) {
+ groupChatHistoryLineId = json['groupChatHistoryLineId'];
+ isSeen = json['isSeen'];
+ isDelivered = json['isDelivered'];
+ targetUserId = json['targetUserId'];
+ targetUserName = json['targetUserName'];
+ userAction = json['userAction'];
+ }
+
+ Map toJson() {
+ Map data = new Map();
+ data['groupChatHistoryLineId'] = this.groupChatHistoryLineId;
+ data['isSeen'] = this.isSeen;
+ data['isDelivered'] = this.isDelivered;
+ data['targetUserId'] = this.targetUserId;
+ data['targetUserName'] = this.targetUserName;
+ data['userAction'] = this.userAction;
+ return data;
+ }
+}
+
+class FileTypeResponse {
+ int? fileTypeId;
+ dynamic? fileTypeName;
+ dynamic? fileTypeDescription;
+ dynamic? fileKind;
+ dynamic? fileName;
+
+ FileTypeResponse(
+ {this.fileTypeId,
+ this.fileTypeName,
+ this.fileTypeDescription,
+ this.fileKind,
+ this.fileName});
+
+ FileTypeResponse.fromJson(Map json) {
+ fileTypeId = json['fileTypeId'];
+ fileTypeName = json['fileTypeName'];
+ fileTypeDescription = json['fileTypeDescription'];
+ fileKind = json['fileKind'];
+ fileName = json['fileName'];
+ }
+
+ Map toJson() {
+ Map data = new Map();
+ data['fileTypeId'] = this.fileTypeId;
+ data['fileTypeName'] = this.fileTypeName;
+ data['fileTypeDescription'] = this.fileTypeDescription;
+ data['fileKind'] = this.fileKind;
+ data['fileName'] = this.fileName;
+ return data;
+ }
+
+}
+
+
+class GroupChatReplyResponse {
+ GroupChatReplyResponse(
+ {this.userChatHistoryId,
+ this.chatEventId,
+ this.contant,
+ this.contantNo,
+ this.fileTypeId,
+ this.createdDate,
+ this.targetUserId,
+ this.targetUserName,
+ this.fileTypeResponse,
+ this.isImageLoaded,
+ this.image,
+ this.voice});
+
+ int? userChatHistoryId;
+ int? chatEventId;
+ String? contant;
+ String? contantNo;
+ dynamic? fileTypeId;
+ DateTime? createdDate;
+ int? targetUserId;
+ String? targetUserName;
+ FileTypeResponse? fileTypeResponse;
+ bool? isImageLoaded;
+ Uint8List? image;
+ Uint8List? voice;
+
+ factory GroupChatReplyResponse.fromJson(Map json) => GroupChatReplyResponse(
+ userChatHistoryId: json["userChatHistoryId"] == null ? null : json["userChatHistoryId"],
+ chatEventId: json["chatEventId"] == null ? null : json["chatEventId"],
+ contant: json["contant"] == null ? null : json["contant"],
+ contantNo: json["contantNo"] == null ? null : json["contantNo"],
+ fileTypeId: json["fileTypeId"],
+ createdDate: json["createdDate"] == null ? null : DateTime.parse(json["createdDate"]),
+ targetUserId: json["targetUserId"] == null ? null : json["targetUserId"],
+ targetUserName: json["targetUserName"] == null ? null : json["targetUserName"],
+ fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]),
+ isImageLoaded: false,
+ image: null,
+ voice: null,
+ );
+
+ Map toJson() => {
+ "userChatHistoryId": userChatHistoryId == null ? null : userChatHistoryId,
+ "chatEventId": chatEventId == null ? null : chatEventId,
+ "contant": contant == null ? null : contant,
+ "contantNo": contantNo == null ? null : contantNo,
+ "fileTypeId": fileTypeId,
+ "createdDate": createdDate == null ? null : createdDate!.toIso8601String(),
+ "targetUserId": targetUserId == null ? null : targetUserId,
+ "targetUserName": targetUserName == null ? null : targetUserName,
+ "fileTypeResponse": fileTypeResponse == null ? null : fileTypeResponse!.toJson(),
+ };
+}
+
diff --git a/lib/models/chat/get_search_user_chat_model.dart b/lib/models/chat/get_search_user_chat_model.dart
index e69fd3b..7c638e9 100644
--- a/lib/models/chat/get_search_user_chat_model.dart
+++ b/lib/models/chat/get_search_user_chat_model.dart
@@ -69,6 +69,7 @@ class ChatUser {
this.isImageLoaded,
this.isImageLoading,
this.userLocalDownlaodedImage,
+ this.isChecked
});
int? id;
@@ -89,7 +90,7 @@ class ChatUser {
bool? isImageLoaded;
bool? isImageLoading;
File? userLocalDownlaodedImage;
-
+ bool? isChecked;
factory ChatUser.fromRawJson(String str) => ChatUser.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
@@ -112,7 +113,9 @@ class ChatUser {
isTyping: false,
isImageLoaded: false,
isImageLoading: true,
- userLocalDownlaodedImage: null);
+ userLocalDownlaodedImage: null,
+ isChecked: false
+ );
Map toJson() => {
"id": id == null ? null : id,
@@ -129,5 +132,6 @@ class ChatUser {
"isAdmin": isAdmin == null ? null : isAdmin,
"rKey": rKey,
"totalCount": totalCount == null ? null : totalCount,
+ "isChecked":isChecked
};
}
diff --git a/lib/models/chat/get_user_groups_by_id.dart b/lib/models/chat/get_user_groups_by_id.dart
new file mode 100644
index 0000000..2520c43
--- /dev/null
+++ b/lib/models/chat/get_user_groups_by_id.dart
@@ -0,0 +1,261 @@
+import 'dart:convert';
+
+class GetUserGroups {
+ List? groupresponse;
+ Null? errorResponses;
+
+ GetUserGroups({this.groupresponse, this.errorResponses});
+ factory GetUserGroups.fromRawJson(String str) => GetUserGroups.fromJson(json.decode(str));
+
+ String toRawJson() => json.encode(toJson());
+ GetUserGroups.fromJson(Map json) {
+ if (json['response'] != null) {
+ groupresponse = [];
+ json['response'].forEach((v) {
+ if(v['isDeleted'] == false)
+ groupresponse!.add(new GroupResponse.fromJson(v));
+ });
+ }
+ errorResponses = json['errorResponses'];
+ }
+
+ Map toJson() {
+ Map data = new Map();
+ if (this.groupresponse != null) {
+ data['response'] = this.groupresponse!.map((v) => v.toJson()).toList();
+ }
+ data['errorResponses'] = this.errorResponses;
+ return data;
+ }
+}
+
+class GroupResponse {
+ int? groupId;
+ String? groupName;
+ Null? groupIcon;
+ bool? isDeleted;
+ bool? isAdmin;
+ bool? canVideoC;
+ bool? canAudioC;
+ bool? canShareS;
+ bool? canAttach;
+ bool? canArchive;
+ bool? isMeeting;
+ Null? meetingTime;
+ Null? extUserLink;
+ int? callStatus;
+ int? groupUnreadMessageCount;
+ AdminUser? adminUser;
+ List? groupUserList;
+
+ GroupResponse(
+ {this.groupId,
+ this.groupName,
+ this.groupIcon,
+ this.isDeleted,
+ this.isAdmin,
+ this.canVideoC,
+ this.canAudioC,
+ this.canShareS,
+ this.canAttach,
+ this.canArchive,
+ this.isMeeting,
+ this.meetingTime,
+ this.extUserLink,
+ this.callStatus,
+ this.groupUnreadMessageCount,
+ this.adminUser,
+ this.groupUserList});
+
+ GroupResponse.fromJson(Map json) {
+ groupId = json['groupId'];
+ groupName = json['groupName'];
+ groupIcon = json['groupIcon'];
+ isDeleted = json['isDeleted'];
+ isAdmin = json['isAdmin'];
+ canVideoC = json['canVideoC'];
+ canAudioC = json['canAudioC'];
+ canShareS = json['canShareS'];
+ canAttach = json['canAttach'];
+ canArchive = json['canArchive'];
+ isMeeting = json['isMeeting'];
+ meetingTime = json['meetingTime'];
+ extUserLink = json['extUserLink'];
+ callStatus = json['callStatus'];
+ groupUnreadMessageCount = json['groupUnreadMessageCount'];
+ adminUser = json['adminUser'] != null
+ ? new AdminUser.fromJson(json['adminUser'])
+ : null;
+ if (json['groupUserList'] != null) {
+ groupUserList = [];
+ json['groupUserList'].forEach((v) {
+ groupUserList!.add(new GroupUserList.fromJson(v));
+ });
+ }
+ }
+
+ Map toJson() {
+ Map data = new Map();
+ data['groupId'] = this.groupId;
+ data['groupName'] = this.groupName;
+ data['groupIcon'] = this.groupIcon;
+ data['isDeleted'] = this.isDeleted;
+ data['isAdmin'] = this.isAdmin;
+ data['canVideoC'] = this.canVideoC;
+ data['canAudioC'] = this.canAudioC;
+ data['canShareS'] = this.canShareS;
+ data['canAttach'] = this.canAttach;
+ data['canArchive'] = this.canArchive;
+ data['isMeeting'] = this.isMeeting;
+ data['meetingTime'] = this.meetingTime;
+ data['extUserLink'] = this.extUserLink;
+ data['callStatus'] = this.callStatus;
+ data['groupUnreadMessageCount'] = this.groupUnreadMessageCount;
+ if (this.adminUser != null) {
+ data['adminUser'] = this.adminUser!.toJson();
+ }
+ if (this.groupUserList != null) {
+ data['groupUserList'] =
+ this.groupUserList!.map((v) => v.toJson()).toList();
+ }
+ return data;
+ }
+}
+
+class AdminUser {
+ int? id;
+ String? userName;
+ String? email;
+ Null? phone;
+ String? title;
+ int? userStatus;
+ Null? image;
+ int? unreadMessageCount;
+ Null? userAction;
+ bool? isPin;
+ bool? isFav;
+ bool? isAdmin;
+ Null? rKey;
+ int? totalCount;
+
+ AdminUser(
+ {this.id,
+ this.userName,
+ this.email,
+ this.phone,
+ this.title,
+ this.userStatus,
+ this.image,
+ this.unreadMessageCount,
+ this.userAction,
+ this.isPin,
+ this.isFav,
+ this.isAdmin,
+ this.rKey,
+ this.totalCount});
+
+ AdminUser.fromJson(Map json) {
+ id = json['id'];
+ userName = json['userName'];
+ email = json['email'];
+ phone = json['phone'];
+ title = json['title'];
+ userStatus = json['userStatus'];
+ image = json['image'];
+ unreadMessageCount = json['unreadMessageCount'];
+ userAction = json['userAction'];
+ isPin = json['isPin'];
+ isFav = json['isFav'];
+ isAdmin = json['isAdmin'];
+ rKey = json['rKey'];
+ totalCount = json['totalCount'];
+ }
+
+ Map toJson() {
+ Map data = new Map();
+ data['id'] = this.id;
+ data['userName'] = this.userName;
+ data['email'] = this.email;
+ data['phone'] = this.phone;
+ data['title'] = this.title;
+ data['userStatus'] = this.userStatus;
+ data['image'] = this.image;
+ data['unreadMessageCount'] = this.unreadMessageCount;
+ data['userAction'] = this.userAction;
+ data['isPin'] = this.isPin;
+ data['isFav'] = this.isFav;
+ data['isAdmin'] = this.isAdmin;
+ data['rKey'] = this.rKey;
+ data['totalCount'] = this.totalCount;
+ return data;
+ }
+}
+
+class GroupUserList {
+ int? id;
+ String? userName;
+ String? email;
+ Null? phone;
+ String? title;
+ int? userStatus;
+ Null? image;
+ int? unreadMessageCount;
+ int? userAction;
+ bool? isPin;
+ bool? isFav;
+ bool? isAdmin;
+ Null? rKey;
+ int? totalCount;
+
+ GroupUserList(
+ {this.id,
+ this.userName,
+ this.email,
+ this.phone,
+ this.title,
+ this.userStatus,
+ this.image,
+ this.unreadMessageCount,
+ this.userAction,
+ this.isPin,
+ this.isFav,
+ this.isAdmin,
+ this.rKey,
+ this.totalCount});
+
+ GroupUserList.fromJson(Map json) {
+ id = json['id'];
+ userName = json['userName'];
+ email = json['email'];
+ phone = json['phone'];
+ title = json['title'];
+ userStatus = json['userStatus'];
+ image = json['image'];
+ unreadMessageCount = json['unreadMessageCount'];
+ userAction = json['userAction'];
+ isPin = json['isPin'];
+ isFav = json['isFav'];
+ isAdmin = json['isAdmin'];
+ rKey = json['rKey'];
+ totalCount = json['totalCount'];
+ }
+
+ Map toJson() {
+ Map data = new Map();
+ data['id'] = this.id;
+ data['userName'] = this.userName;
+ data['email'] = this.email;
+ data['phone'] = this.phone;
+ data['title'] = this.title;
+ data['userStatus'] = this.userStatus;
+ data['image'] = this.image;
+ data['unreadMessageCount'] = this.unreadMessageCount;
+ data['userAction'] = this.userAction;
+ data['isPin'] = this.isPin;
+ data['isFav'] = this.isFav;
+ data['isAdmin'] = this.isAdmin;
+ data['rKey'] = this.rKey;
+ data['totalCount'] = this.totalCount;
+ return data;
+ }
+}
diff --git a/lib/models/chat/target_users.dart b/lib/models/chat/target_users.dart
new file mode 100644
index 0000000..d399a38
--- /dev/null
+++ b/lib/models/chat/target_users.dart
@@ -0,0 +1,32 @@
+class TargetUsers {
+ bool? isSeen;
+ bool? isDelivered;
+ int? targetUserId;
+ int? userAction;
+ int? userStatus;
+
+ TargetUsers(
+ {this.isSeen,
+ this.isDelivered,
+ this.targetUserId,
+ this.userAction,
+ this.userStatus});
+
+ TargetUsers.fromJson(Map json) {
+ isSeen = json['isSeen'];
+ isDelivered = json['isDelivered'];
+ targetUserId = json['targetUserId'];
+ userAction = json['userAction'];
+ userStatus = json['userStatus'];
+ }
+
+ Map toJson() {
+ Map data = new Map();
+ data['isSeen'] = this.isSeen;
+ data['isDelivered'] = this.isDelivered;
+ data['targetUserId'] = this.targetUserId;
+ data['userAction'] = this.userAction;
+ data['userStatus'] = this.userStatus;
+ return data;
+ }
+}
diff --git a/lib/models/itg/advertisement.dart b/lib/models/itg/advertisement.dart
index 96f4037..ebcf704 100644
--- a/lib/models/itg/advertisement.dart
+++ b/lib/models/itg/advertisement.dart
@@ -1,108 +1,156 @@
class Advertisement {
+ int? advertisementId;
+ String? advertisementTitle;
+ int? durationInSeconds;
+ bool? showDelete;
+ dynamic acknowledgment;
+ late bool isOptional;
+ List? viewAttachFileColl;
+ int? skipButtonId;
+ List? actionButtonsColl;
+ bool? isActive;
+ num? pageSize;
+ num? pageNo;
+ num? languageId;
+
Advertisement({
this.advertisementId,
this.advertisementTitle,
this.durationInSeconds,
this.showDelete,
this.acknowledgment,
+ required this.isOptional,
+ // this.skipBtnTextEn,
+ // this.skipBtnTextAr,
this.viewAttachFileColl,
+ this.skipButtonId,
+ this.actionButtonsColl,
this.isActive,
this.pageSize,
this.pageNo,
this.languageId,
- this.isOptional,
- this.skipButtonTextEn,
- this.skipButtonTextAr,
});
- final int? advertisementId;
- final String? advertisementTitle;
- final int? durationInSeconds;
- final bool? showDelete;
- final dynamic acknowledgment;
- final List? viewAttachFileColl;
- final bool? isActive;
- final dynamic pageSize;
- final dynamic pageNo;
- final dynamic languageId;
- final bool? isOptional;
- final String? skipButtonTextEn;
- final String? skipButtonTextAr;
-
- factory Advertisement.fromJson(Map json) => Advertisement(
- advertisementId: json["advertisementId"] == null ? null : json["advertisementId"],
- advertisementTitle: json["advertisementTitle"] == null ? null : json["advertisementTitle"],
- durationInSeconds: json["durationInSeconds"] == null ? null : json["durationInSeconds"],
- showDelete: json["showDelete"] == null ? null : json["showDelete"],
- acknowledgment: json["acknowledgment"],
- viewAttachFileColl: json["viewAttachFileColl"] == null ? null : List.from(json["viewAttachFileColl"].map((x) => ViewAttachFileColl.fromJson(x))),
- isActive: json["isActive"] == null ? null : json["isActive"],
- pageSize: json["pageSize"],
- pageNo: json["pageNo"],
- languageId: json["languageId"],
- isOptional: json["isOptional"] == null ? null : json["isOptional"],
- skipButtonTextEn: json["skipBtnTextEn"] == null ? null : json["skipBtnTextEn"],
- skipButtonTextAr: json["skipBtnTextAr"] == null ? null : json["skipBtnTextAr"],
- );
+ Advertisement.fromJson(Map json) {
+ advertisementId = json['advertisementId'];
+ advertisementTitle = json['advertisementTitle'];
+ durationInSeconds = json['durationInSeconds'];
+ showDelete = json['showDelete'];
+ acknowledgment = json['acknowledgment'];
+ isOptional = json['isOptional'];
+ // skipBtnTextEn = json['skipBtnTextEn'];
+ // skipBtnTextAr = json['skipBtnTextAr'];
+ if (json['viewAttachFileColl'] != null) {
+ viewAttachFileColl = [];
+ json['viewAttachFileColl'].forEach((v) {
+ viewAttachFileColl!.add(ViewAttachFileColl.fromJson(v));
+ });
+ }
+ skipButtonId = json['skipButtonId'];
+ if (json['actionButtonsColl'] != null) {
+ actionButtonsColl = [];
+ json['actionButtonsColl'].forEach((v) {
+ actionButtonsColl!.add(ActionButtonsColl.fromJson(v));
+ });
+ }
+ isActive = json['isActive'];
+ pageSize = json['pageSize'];
+ pageNo = json['pageNo'];
+ languageId = json['languageId'];
+ }
- Map toJson() => {
- "advertisementId": advertisementId == null ? null : advertisementId,
- "advertisementTitle": advertisementTitle == null ? null : advertisementTitle,
- "durationInSeconds": durationInSeconds == null ? null : durationInSeconds,
- "showDelete": showDelete == null ? null : showDelete,
- "acknowledgment": acknowledgment,
- "viewAttachFileColl": viewAttachFileColl == null ? null : List.from(viewAttachFileColl!.map((x) => x.toJson())),
- "isActive": isActive == null ? null : isActive,
- "pageSize": pageSize,
- "pageNo": pageNo,
- "languageId": languageId,
- };
+ Map toJson() {
+ Map data = Map();
+ data['advertisementId'] = this.advertisementId;
+ data['advertisementTitle'] = this.advertisementTitle;
+ data['durationInSeconds'] = this.durationInSeconds;
+ data['showDelete'] = this.showDelete;
+ data['acknowledgment'] = this.acknowledgment;
+ data['isOptional'] = this.isOptional;
+ // data['skipBtnTextEn'] = this.skipBtnTextEn;
+ // data['skipBtnTextAr'] = this.skipBtnTextAr;
+ if (this.viewAttachFileColl != null) {
+ data['viewAttachFileColl'] = this.viewAttachFileColl!.map((v) => v.toJson()).toList();
+ }
+ data['skipButtonId'] = this.skipButtonId;
+ if (this.actionButtonsColl != null) {
+ data['actionButtonsColl'] = this.actionButtonsColl!.map((v) => v.toJson()).toList();
+ }
+ data['isActive'] = this.isActive;
+ data['pageSize'] = this.pageSize;
+ data['pageNo'] = this.pageNo;
+ data['languageId'] = this.languageId;
+ return data;
+ }
}
class ViewAttachFileColl {
- ViewAttachFileColl({
- this.attachmentId,
- this.fileName,
- this.contentType,
- this.attachFileStream,
- this.base64String,
- this.isActive,
- this.referenceItemId,
- this.content,
- this.filePath,
- });
+ dynamic attachmentId;
+ String? fileName;
+ String? contentType;
+ dynamic attachFileStream;
+ String? base64String;
+ dynamic isActive;
+ dynamic referenceItemId;
+ dynamic content;
+ dynamic filePath;
+
+ ViewAttachFileColl({this.attachmentId, this.fileName, this.contentType, this.attachFileStream, this.base64String, this.isActive, this.referenceItemId, this.content, this.filePath});
+
+ ViewAttachFileColl.fromJson(Map json) {
+ attachmentId = json['attachmentId'];
+ fileName = json['fileName'];
+ contentType = json['contentType'];
+ attachFileStream = json['attachFileStream'];
+ base64String = json['base64String'];
+ isActive = json['isActive'];
+ referenceItemId = json['referenceItemId'];
+ content = json['content'];
+ filePath = json['filePath'];
+ }
+
+ Map toJson() {
+ Map data = new Map();
+ data['attachmentId'] = this.attachmentId;
+ data['fileName'] = this.fileName;
+ data['contentType'] = this.contentType;
+ data['attachFileStream'] = this.attachFileStream;
+ data['base64String'] = this.base64String;
+ data['isActive'] = this.isActive;
+ data['referenceItemId'] = this.referenceItemId;
+ data['content'] = this.content;
+ data['filePath'] = this.filePath;
+ return data;
+ }
+}
+
+class ActionButtonsColl {
+ late int actionButtonId;
+ late String btnTextEn;
+ late String btnTextAr;
+ late String actionValue;
+ late dynamic iconOrImage;
+ late int orderNo;
- final dynamic attachmentId;
- final String? fileName;
- final String? contentType;
- final dynamic attachFileStream;
- final String? base64String;
- final dynamic isActive;
- final dynamic referenceItemId;
- final dynamic content;
- final dynamic filePath;
+ ActionButtonsColl({required this.actionButtonId, required this.btnTextEn, required this.btnTextAr, required this.actionValue, required this.iconOrImage, required this.orderNo});
- factory ViewAttachFileColl.fromJson(Map json) => ViewAttachFileColl(
- attachmentId: json["attachmentId"],
- fileName: json["fileName"] == null ? null : json["fileName"],
- contentType: json["contentType"] == null ? null : json["contentType"],
- attachFileStream: json["attachFileStream"],
- base64String: json["base64String"] == null ? null : json["base64String"],
- isActive: json["isActive"],
- referenceItemId: json["referenceItemId"],
- content: json["content"],
- filePath: json["filePath"],
- );
+ ActionButtonsColl.fromJson(Map json) {
+ actionButtonId = json['actionButtonId'];
+ btnTextEn = json['btnTextEn'];
+ btnTextAr = json['btnTextAr'];
+ actionValue = json['actionValue'];
+ iconOrImage = json['iconOrImage'];
+ orderNo = json['orderNo'];
+ }
- Map toJson() => {
- "attachmentId": attachmentId,
- "fileName": fileName == null ? null : fileName,
- "contentType": contentType == null ? null : contentType,
- "attachFileStream": attachFileStream,
- "base64String": base64String == null ? null : base64String,
- "isActive": isActive,
- "referenceItemId": referenceItemId,
- "content": content,
- "filePath": filePath,
- };
+ Map toJson() {
+ Map data = new Map();
+ data['actionButtonId'] = this.actionButtonId;
+ data['btnTextEn'] = this.btnTextEn;
+ data['btnTextAr'] = this.btnTextAr;
+ data['actionValue'] = this.actionValue;
+ data['iconOrImage'] = this.iconOrImage;
+ data['orderNo'] = this.orderNo;
+ return data;
+ }
}
diff --git a/lib/models/itg/survey_model.dart b/lib/models/itg/survey_model.dart
index 7cdbbdd..f9ac415 100644
--- a/lib/models/itg/survey_model.dart
+++ b/lib/models/itg/survey_model.dart
@@ -5,9 +5,9 @@ class SurveyModel {
String? description;
List? questions;
bool? isActive;
- Null? pageSize;
- Null? pageNo;
- Null? languageId;
+ dynamic pageSize;
+ dynamic pageNo;
+ dynamic languageId;
SurveyModel({this.surveyId, this.referenceNo, this.title, this.description, this.questions, this.isActive, this.pageSize, this.pageNo, this.languageId});
@@ -51,13 +51,13 @@ class Questions {
bool? isRequired;
String? type;
int? sequenceNo;
- Null? surveyId;
+ dynamic surveyId;
List? options;
- Null? rspPercentage;
- Null? isActive;
- Null? pageSize;
- Null? pageNo;
- Null? languageId;
+ dynamic rspPercentage;
+ dynamic isActive;
+ dynamic pageSize;
+ dynamic pageNo;
+ dynamic languageId;
Questions({this.questionId, this.title, this.isRequired, this.type, this.sequenceNo, this.surveyId, this.options, this.rspPercentage, this.isActive, this.pageSize, this.pageNo, this.languageId});
@@ -107,12 +107,12 @@ class Options {
bool? isCommentsRequired;
int? sequenceNo;
int? questionId;
- Null? rspPercentage;
- Null? count;
- Null? isActive;
- Null? pageSize;
- Null? pageNo;
- Null? languageId;
+ dynamic rspPercentage;
+ dynamic count;
+ dynamic isActive;
+ dynamic pageSize;
+ dynamic pageNo;
+ dynamic languageId;
Options({this.optionId, this.title, this.isCommentsRequired, this.sequenceNo, this.questionId, this.rspPercentage, this.count, this.isActive, this.pageSize, this.pageNo, this.languageId});
diff --git a/lib/models/itg_forms_models/itg_request_model.dart b/lib/models/itg_forms_models/itg_request_model.dart
index ba10305..87d8280 100644
--- a/lib/models/itg_forms_models/itg_request_model.dart
+++ b/lib/models/itg_forms_models/itg_request_model.dart
@@ -6,7 +6,7 @@ class ITGRequest {
List? allowedActions;
List? attachments;
List? fieldGoups;
- Null? grantFields;
+ dynamic grantFields;
List? wFHistory;
ITGRequest({this.allowedActions, this.attachments, this.fieldGoups, this.grantFields, this.wFHistory});
diff --git a/lib/provider/chat_provider_model.dart b/lib/provider/chat_provider_model.dart
index d374114..00545b2 100644
--- a/lib/provider/chat_provider_model.dart
+++ b/lib/provider/chat_provider_model.dart
@@ -19,10 +19,20 @@ import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/chat/chat_user_image_model.dart';
+import 'package:mohem_flutter_app/models/chat/create_group_request.dart'
+ as createGroup;
+import 'package:mohem_flutter_app/models/chat/get_group_chat_history.dart'
+ as groupchathistory;
import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.dart';
-import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' as userLoginToken;
-import 'package:mohem_flutter_app/models/chat/make_user_favotire_unfavorite_chat_model.dart' as fav;
+import 'package:mohem_flutter_app/models/chat/get_user_groups_by_id.dart'
+ as groups;
+import 'package:mohem_flutter_app/models/chat/get_user_groups_by_id.dart';
+import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart'
+ as userLoginToken;
+import 'package:mohem_flutter_app/models/chat/make_user_favotire_unfavorite_chat_model.dart'
+ as fav;
+import 'package:mohem_flutter_app/models/chat/target_users.dart';
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
import 'package:mohem_flutter_app/ui/chat/chat_detailed_screen.dart';
import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart';
@@ -40,6 +50,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
TextEditingController message = TextEditingController();
TextEditingController search = TextEditingController();
+ TextEditingController searchGroup = TextEditingController();
+
List userChatHistory = [], repliedMsg = [];
List? pChatHistory, searchedChats;
String chatCID = '';
@@ -52,7 +64,10 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
List favUsersList = [];
int paginationVal = 0;
int? cTypingUserId = 0;
- bool isTextMsg = false, isReplyMsg = false, isAttachmentMsg = false, isVoiceMsg = false;
+ bool isTextMsg = false,
+ isReplyMsg = false,
+ isAttachmentMsg = false,
+ isVoiceMsg = false;
// Audio Recoding Work
Timer? _timer;
@@ -67,7 +82,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
late PlayerController playerController;
List getEmployeeSubordinatesList = [];
List teamMembersList = [];
-
+ groups.GetUserGroups userGroups = groups.GetUserGroups();
Material.TextDirection textDirection = Material.TextDirection.ltr;
bool isRTL = false;
String msgText = "";
@@ -75,14 +90,18 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
//Chat Home Page Counter
int chatUConvCounter = 0;
+ late List groupChatHistory, groupChatReplyData;
+
/// Search Provider
List? chatUsersList = [];
int pageNo = 1;
bool disbaleChatForThisUser = false;
+ List? uGroups = [], searchGroups = [];
Future getUserAutoLoginToken() async {
- userLoginToken.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
+ userLoginToken.UserAutoLoginModel userLoginResponse =
+ await ChatApiClient().getUserLoginToken();
if (userLoginResponse.response != null) {
AppState().setchatUserDetails = userLoginResponse;
} else {
@@ -103,26 +122,43 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
chatHubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
chatHubConnection.on("OnGetChatConversationCount", onNewChatConversion);
+
+ //group On message
+
+ chatHubConnection.on("OnDeliveredGroupChatHistoryAsync", onGroupMsgReceived);
}
Future getHubConnection() async {
HubConnection hub;
- HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
+ HttpConnectionOptions httpOp =
+ HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
hub = HubConnectionBuilder()
- .withUrl(ApiConsts.chatHubConnectionUrl + "?UserId=${AppState().chatDetails!.response!.id}&source=Desktop&access_token=${AppState().chatDetails!.response!.token}", options: httpOp)
- .withAutomaticReconnect(retryDelays: [2000, 5000, 10000, 20000]).build();
+ .withUrl(
+ ApiConsts.chatHubConnectionUrl +
+ "?UserId=${AppState().chatDetails!.response!.id}&source=Desktop&access_token=${AppState().chatDetails!.response!.token}",
+ options: httpOp)
+ .withAutomaticReconnect(
+ retryDelays: [2000, 5000, 10000, 20000]).build();
return hub;
}
void registerEvents() {
chatHubConnection.on("OnUpdateUserStatusAsync", changeStatus);
// chatHubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
+
chatHubConnection.on("OnSubmitChatAsync", OnSubmitChatAsync);
chatHubConnection.on("OnUserTypingAsync", onUserTyping);
chatHubConnection.on("OnUserCountAsync", userCountAsync);
// chatHubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
- chatHubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
- chatHubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus);
+ chatHubConnection.on(
+ "OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
+ chatHubConnection.on(
+ "OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus);
+ chatHubConnection.on(
+ "OnGetGroupUserStatusAsync", getGroupUserStatus);
+
+ //
+ // {"type":1,"target":"","arguments":[[{"id":217869,"userName":"Sultan.Khan","email":"Sultan.Khan@cloudsolutions.com.sa","phone":null,"title":"Sultan.Khan","userStatus":1,"image":null,"unreadMessageCount":0,"userAction":3,"isPin":false,"isFav":false,"isAdmin":false,"rKey":null,"totalCount":0,"isHuaweiDevice":false,"deviceToken":null},{"id":15153,"userName":"Tamer.Fanasheh","email":"Tamer.F@cloudsolutions.com.sa","phone":null,"title":"Tamer Fanasheh","userStatus":2,"image":null,"unreadMessageCount":0,"userAction":3,"isPin":false,"isFav":false,"isAdmin":true,"rKey":null,"totalCount":0,"isHuaweiDevice":false,"deviceToken":null}]]}
if (kDebugMode) {
logger.i("All listeners registered");
@@ -132,9 +168,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
Future getUserRecentChats() async {
ChatUserModel recentChat = await ChatApiClient().getRecentChats();
ChatUserModel favUList = await ChatApiClient().getFavUsers();
+ // userGroups = await ChatApiClient().getGroupsByUserId();
if (favUList.response != null && recentChat.response != null) {
favUsersList = favUList.response!;
- favUsersList.sort((ChatUser a, ChatUser b) => a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase()));
+ favUsersList.sort((ChatUser a, ChatUser b) =>
+ a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase()));
for (dynamic user in recentChat.response!) {
for (dynamic favUser in favUList.response!) {
if (user.id == favUser.id) {
@@ -144,10 +182,13 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
}
pChatHistory = recentChat.response ?? [];
- pChatHistory!.sort((ChatUser a, ChatUser b) => a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase()));
+ uGroups = userGroups.groupresponse ?? [];
+ pChatHistory!.sort((ChatUser a, ChatUser b) =>
+ a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase()));
searchedChats = pChatHistory;
isLoading = false;
- await invokeUserChatHistoryNotDeliveredAsync(userId: int.parse(AppState().chatDetails!.response!.id.toString()));
+ await invokeUserChatHistoryNotDeliveredAsync(
+ userId: int.parse(AppState().chatDetails!.response!.id.toString()));
sort();
notifyListeners();
if (searchedChats!.isNotEmpty || favUsersList.isNotEmpty) {
@@ -156,27 +197,38 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
Future invokeUserChatHistoryNotDeliveredAsync({required int userId}) async {
- await chatHubConnection.invoke("GetUserChatHistoryNotDeliveredAsync", args: [userId]);
+ await chatHubConnection
+ .invoke("GetUserChatHistoryNotDeliveredAsync", args: [userId]);
return "";
}
- void getSingleUserChatHistory({required int senderUID, required int receiverUID, required bool loadMore, bool isNewChat = false}) async {
+ void getSingleUserChatHistory(
+ {required int senderUID,
+ required int receiverUID,
+ required bool loadMore,
+ bool isNewChat = false}) async {
isLoading = true;
if (isNewChat) userChatHistory = [];
if (!loadMore) paginationVal = 0;
isChatScreenActive = true;
receiverID = receiverUID;
- Response response = await ChatApiClient().getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal);
+ Response response = await ChatApiClient().getSingleUserChatHistory(
+ senderUID: senderUID,
+ receiverUID: receiverUID,
+ loadMore: loadMore,
+ paginationVal: paginationVal);
if (response.statusCode == 204) {
if (isNewChat) {
userChatHistory = [];
} else if (loadMore) {}
} else {
if (loadMore) {
- List temp = getSingleUserChatModel(response.body).reversed.toList();
+ List temp =
+ getSingleUserChatModel(response.body).reversed.toList();
userChatHistory.addAll(temp);
} else {
- userChatHistory = getSingleUserChatModel(response.body).reversed.toList();
+ userChatHistory =
+ getSingleUserChatModel(response.body).reversed.toList();
}
}
isLoading = false;
@@ -203,7 +255,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
dynamic data = [
{
"userChatHistoryId": element.userChatHistoryId,
- "TargetUserId": element.currentUserId == receiverID ? element.currentUserId : element.targetUserId,
+ "TargetUserId": element.currentUserId == receiverID
+ ? element.currentUserId
+ : element.targetUserId,
"isDelivered": true,
"isSeen": true,
}
@@ -225,7 +279,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void updateUserChatHistoryStatusAsync(List data) {
try {
- chatHubConnection.invoke("UpdateUserChatHistoryStatusAsync", args: [data]);
+ chatHubConnection
+ .invoke("UpdateUserChatHistoryStatusAsync", args: [data]);
} catch (e) {
throw e;
}
@@ -233,13 +288,21 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void updateUserChatHistoryOnMsg(List data) {
try {
- chatHubConnection.invoke("UpdateUserChatHistoryStatusAsync", args: [data]);
+ chatHubConnection
+ .invoke("UpdateUserChatHistoryStatusAsync", args: [data]);
} catch (e) {
throw e;
}
}
- List getSingleUserChatModel(String str) => List.from(json.decode(str).map((x) => SingleUserChatModel.fromJson(x)));
+ List getSingleUserChatModel(String str) =>
+ List.from(
+ json.decode(str).map((x) => SingleUserChatModel.fromJson(x)));
+
+ List getGroupChatHistoryAsync(String str) =>
+ List.from(
+ json.decode(str).map((x) => groupchathistory.GetGroupChatHistoryAsync.fromJson(x)));
+
Future uploadAttachments(String userId, File file) async {
dynamic result;
@@ -269,6 +332,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
notifyListeners();
}
+ void getGroupUserStatus(List