chat cont.

design_3.0_demo_module
Sikander Saleem 4 months ago
parent d2665fd10f
commit ec28f8992c

@ -15,6 +15,8 @@ class URLs {
// static final String _baseUrl = "$_host/v3/mobile"; // v3 for production CM,PM,TM // static final String _baseUrl = "$_host/v3/mobile"; // v3 for production CM,PM,TM
// static final String _baseUrl = "$_host/v5/mobile"; // v5 for data segregation // static final String _baseUrl = "$_host/v5/mobile"; // v5 for data segregation
static const String chatHubUrl = "https://apiderichat.hmg.com/chathub/api"; // new V2 apis
static String _host = host1; static String _host = host1;
set host(String value) => _host = value; set host(String value) => _host = value;

@ -1,10 +1,16 @@
// import 'dart:convert'; import 'dart:convert';
// import 'dart:io'; import 'dart:io';
// import 'dart:typed_data'; import 'dart:typed_data';
//
// import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
// import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// import 'package:http/http.dart'; import 'package:http/http.dart';
import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'model/get_search_user_chat_model.dart';
import 'model/get_user_login_token_model.dart';
// import 'package:mohem_flutter_app/api/api_client.dart'; // import 'package:mohem_flutter_app/api/api_client.dart';
// import 'package:mohem_flutter_app/app_state/app_state.dart'; // import 'package:mohem_flutter_app/app_state/app_state.dart';
// import 'package:mohem_flutter_app/classes/consts.dart'; // import 'package:mohem_flutter_app/classes/consts.dart';
@ -19,102 +25,108 @@
// import 'package:mohem_flutter_app/models/chat/get_user_groups_by_id.dart'; // 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/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/make_user_favotire_unfavorite_chat_model.dart' as fav;
//
// class ChatApiClient { class ChatApiClient {
// static final ChatApiClient _instance = ChatApiClient._internal(); static final ChatApiClient _instance = ChatApiClient._internal();
//
// ChatApiClient._internal(); ChatApiClient._internal();
//
// factory ChatApiClient() => _instance; factory ChatApiClient() => _instance;
//
// Future<user.UserAutoLoginModel> getUserLoginToken() async { Future<UserAutoLoginModel> getUserLoginToken() async {
// user.UserAutoLoginModel userLoginResponse = user.UserAutoLoginModel(); UserAutoLoginModel userLoginResponse = UserAutoLoginModel();
// String? deviceToken = AppState().getIsHuawei ? AppState().getHuaweiPushToken : AppState().getDeviceToken; String? deviceToken = AppState().getIsHuawei ? AppState().getHuaweiPushToken : AppState().getDeviceToken;
// Response response = await ApiClient().postJsonForResponse( Response response = await ApiClient().postJsonForResponse(
// "${ApiConsts.chatLoginTokenUrl}externaluserlogin", "${ApiConsts.chatLoginTokenUrl}externaluserlogin",
// { {
// "employeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER.toString(), "employeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER.toString(),
// "password": "FxIu26rWIKoF8n6mpbOmAjDLphzFGmpG", "password": "FxIu26rWIKoF8n6mpbOmAjDLphzFGmpG",
// "isMobile": true, "isMobile": true,
// "platform": Platform.isIOS ? "ios" : "android", "platform": Platform.isIOS ? "ios" : "android",
// "deviceToken": AppState().getIsHuawei ? AppState().getHuaweiPushToken : AppState().getDeviceToken, "deviceToken": AppState().getIsHuawei ? AppState().getHuaweiPushToken : AppState().getDeviceToken,
// "isHuaweiDevice": AppState().getIsHuawei, "isHuaweiDevice": AppState().getIsHuawei,
// "voipToken": Platform.isIOS ? "80a3b01fc1ef2453eb4f1daa4fc31d8142d9cb67baf848e91350b607971fe2ba" : "", "voipToken": Platform.isIOS ? "80a3b01fc1ef2453eb4f1daa4fc31d8142d9cb67baf848e91350b607971fe2ba" : "",
// }, },
// ); );
//
// if (!kReleaseMode) { if (!kReleaseMode) {
// logger.i("login-res: " + response.body); // logger.i("login-res: " + response.body);
// } }
// if (response.statusCode == 200) { if (response.statusCode == 200) {
// userLoginResponse = user.userAutoLoginModelFromJson(response.body); 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(); getUserLoginToken();
// } else { } else {
// userLoginResponse = user.userAutoLoginModelFromJson(response.body); userLoginResponse = user.userAutoLoginModelFromJson(response.body);
// Utils.showToast(userLoginResponse.errorResponses!.first.message!); userLoginResponse.errorResponses!.first.message!.showToast;
// } }
// return userLoginResponse; return userLoginResponse;
// } }
//
// Future<ChatUserModel> getChatMemberFromSearch(String searchParam, int cUserId, int pageNo) async { Future<ChatUserModel> getChatMemberFromSearch(String searchParam, int cUserId, int pageNo) async {
// ChatUserModel chatUserModel; 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); token: AppState().chatDetails!.response!.token);
// if (!kReleaseMode) { if (!kReleaseMode) {
// logger.i("res: " + response.body); logger.i("res: " + response.body);
// } }
// chatUserModel = chatUserModelFromJson(response.body); chatUserModel = chatUserModelFromJson(response.body);
// return chatUserModel; return chatUserModel;
// } }
//
// //Get User Recent Chats //Get User Recent Chats
// Future<ChatUserModel> getRecentChats() async { Future<ChatUserModel> getRecentChats() async {
// try { try {
// Response response = await ApiClient().getJsonForResponse( Response response =
// "${ApiConsts.chatRecentUrl}getchathistorybyuserid",
// token: AppState().chatDetails!.response!.token,
// ); // await ApiManager.instance.get(URLs.getAllRequestsAndCount,h);
// if (!kReleaseMode) {
// logger.i("res: " + response.body);
// } await ApiClient().getJsonForResponse(
// return ChatUserModel.fromJson( "${ApiConsts.chatRecentUrl}getchathistorybyuserid",
// json.decode(response.body), token: AppState().chatDetails!.response!.token,
// ); );
// } catch (e) { if (!kReleaseMode) {
// throw e; logger.i("res: " + response.body);
// } }
// } return ChatUserModel.fromJson(
// json.decode(response.body),
// // Get Favorite Users );
// Future<ChatUserModel> getFavUsers() async { } catch (e) {
// Response favRes = await ApiClient().getJsonForResponse( throw e;
// "${ApiConsts.chatFavUser}getFavUserById/${AppState().chatDetails!.response!.id}", }
// token: AppState().chatDetails!.response!.token, }
// );
// if (!kReleaseMode) { // // Get Favorite Users
// logger.i("res: " + favRes.body); // Future<ChatUserModel> getFavUsers() async {
// } // Response favRes = await ApiClient().getJsonForResponse(
// return ChatUserModel.fromJson(json.decode(favRes.body)); // "${ApiConsts.chatFavUser}getFavUserById/${AppState().chatDetails!.response!.id}",
// } // token: AppState().chatDetails!.response!.token,
// // );
// //Get User Chat History // if (!kReleaseMode) {
// Future<Response> getSingleUserChatHistory({required int senderUID, required int receiverUID, required bool loadMore, bool isNewChat = false, required int paginationVal}) async { // logger.i("res: " + favRes.body);
// try { // }
// Response response = await ApiClient().getJsonForResponse( // return ChatUserModel.fromJson(json.decode(favRes.body));
// "${ApiConsts.chatSingleUserHistoryUrl}GetUserChatHistory/$senderUID/$receiverUID/$paginationVal", // }
// token: AppState().chatDetails!.response!.token,
// ); //Get User Chat History
// if (!kReleaseMode) { Future<Response> getSingleUserChatHistory({required int senderUID, required int receiverUID, required bool loadMore, bool isNewChat = false, required int paginationVal}) async {
// logger.i("res: " + response.body); try {
// } Response response = await ApiClient().getJsonForResponse(
// return response; "${ApiConsts.chatSingleUserHistoryUrl}GetUserChatHistory/$senderUID/$receiverUID/$paginationVal",
// } catch (e) { token: AppState().chatDetails!.response!.token,
// getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal); );
// throw e; if (!kReleaseMode) {
// } logger.i("res: " + response.body);
// } }
// return response;
} catch (e) {
getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal);
throw e;
}
}
// //Favorite Users // //Favorite Users
// Future<fav.FavoriteChatUser> favUser({required int userID, required int targetUserID}) async { // Future<fav.FavoriteChatUser> 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); // Response response = await ApiClient().postJsonForResponse("${ApiConsts.chatFavUser}addFavUser", {"targetUserId": targetUserID, "userId": userID}, token: AppState().chatDetails!.response!.token);
@ -124,193 +136,193 @@
// fav.FavoriteChatUser favoriteChatUser = fav.FavoriteChatUser.fromRawJson(response.body); // fav.FavoriteChatUser favoriteChatUser = fav.FavoriteChatUser.fromRawJson(response.body);
// return favoriteChatUser; // return favoriteChatUser;
// } // }
//
// //UnFavorite Users // //UnFavorite Users
// Future<fav.FavoriteChatUser> unFavUser({required int userID, required int targetUserID}) async { // Future<fav.FavoriteChatUser> unFavUser({required int userID, required int targetUserID}) async {
// try { // try {
// Response response = await ApiClient().postJsonForResponse( // Response response = await ApiClient().postJsonForResponse(
// "${ApiConsts.chatFavUser}deleteFavUser", // "${ApiConsts.chatFavUser}deleteFavUser",
// {"targetUserId": targetUserID, "userId": userID}, // {"targetUserId": targetUserID, "userId": userID},
// token: AppState().chatDetails!.response!.token, // token: AppState().chatDetails!.response!.token,
// ); // );
// if (!kReleaseMode) { // if (!kReleaseMode) {
// logger.i("res: " + response.body); // logger.i("res: " + response.body);
// } // }
// fav.FavoriteChatUser favoriteChatUser = fav.FavoriteChatUser.fromRawJson(response.body); // fav.FavoriteChatUser favoriteChatUser = fav.FavoriteChatUser.fromRawJson(response.body);
// return favoriteChatUser; // return favoriteChatUser;
// } catch (e) { // } catch (e) {
// e as APIException; // e as APIException;
// throw e; // throw e;
// } // }
// }
// Upload Chat Media
Future<Object?> uploadMedia(String userId, File file, String fileSource) async {
if (kDebugMode) {
print("${ApiConsts.chatMediaImageUploadUrl}upload");
print(AppState().chatDetails!.response!.token);
}
dynamic request = MultipartRequest('POST', Uri.parse('${ApiConsts.chatMediaImageUploadUrl}upload'));
request.fields.addAll({'userId': userId, 'fileSource': fileSource});
request.files.add(await MultipartFile.fromPath('files', file.path));
request.headers.addAll({'Authorization': 'Bearer ${AppState().chatDetails!.response!.token}'});
StreamedResponse response = await request.send();
String data = await response.stream.bytesToString();
if (!kReleaseMode) {
logger.i("res: " + data);
}
return jsonDecode(data);
}
// Download File For Chat
Future<Uint8List> downloadURL({required String fileName, required String fileTypeDescription, required int fileSource}) async {
Response response = await ApiClient().postJsonForResponse(
"${ApiConsts.chatMediaImageUploadUrl}download",
{"fileType": fileTypeDescription, "fileName": fileName, "fileSource": fileSource},
token: AppState().chatDetails!.response!.token,
);
Uint8List data = Uint8List.fromList(response.bodyBytes);
return data;
}
// //Get Chat Users & Favorite Images
// Future<List<ChatUserImageModel>> getUsersImages({required List<String> encryptedEmails}) async {
// List<ChatUserImageModel> imagesData = [];
// Response response = await ApiClient().postJsonForResponse(
// "${ApiConsts.chatUserImages}images",
// {"encryptedEmails": encryptedEmails, "fromClient": false},
// token: AppState().chatDetails!.response!.token,
// );
// if (!kReleaseMode) {
// logger.i("res: " + response.body);
// } // }
// if (response.statusCode == 200) {
// imagesData = chatUserImageModelFromJson(response.body);
// } else if (response.statusCode == 500 || response.statusCode == 504) {
// getUsersImages(encryptedEmails: encryptedEmails);
// } else {
// Utils.showToast("Something went wrong while loading images");
// imagesData = [];
// }
// return imagesData;
// }
// //
// // Upload Chat Media // //group chat apis start here.
// Future<Object?> uploadMedia(String userId, File file, String fileSource) async { // Future<groups.GetUserGroups> getGroupsByUserId() async {
// if (kDebugMode) { // try {
// print("${ApiConsts.chatMediaImageUploadUrl}upload"); // Response response = await ApiClient().getJsonForResponse(
// print(AppState().chatDetails!.response!.token); // "${ApiConsts.getGroupByUserId}${AppState().chatDetails!.response!.id}",
// } // token: AppState().chatDetails!.response!.token,
// // );
// dynamic request = MultipartRequest('POST', Uri.parse('${ApiConsts.chatMediaImageUploadUrl}upload'));
// request.fields.addAll({'userId': userId, 'fileSource': fileSource});
// request.files.add(await MultipartFile.fromPath('files', file.path));
// request.headers.addAll({'Authorization': 'Bearer ${AppState().chatDetails!.response!.token}'});
// StreamedResponse response = await request.send();
// String data = await response.stream.bytesToString();
// if (!kReleaseMode) { // if (!kReleaseMode) {
// logger.i("res: " + data); // logger.i("res: " + response.body);
// } // }
// return jsonDecode(data); // return groups.GetUserGroups.fromRawJson(response.body);
// } catch (e) {
// //if fail api returning 500 hence just printing here
// print(e);
// throw e;
// } // }
// // }
// // Download File For Chat
// Future<Uint8List> downloadURL({required String fileName, required String fileTypeDescription, required int fileSource}) async { // Future<Response> deleteGroup(int? groupId) async {
// try {
// Response response = await ApiClient().postJsonForResponse( // Response response = await ApiClient().postJsonForResponse(
// "${ApiConsts.chatMediaImageUploadUrl}download", // ApiConsts.deleteGroup,
// {"fileType": fileTypeDescription, "fileName": fileName, "fileSource": fileSource}, // {"groupId": groupId},
// token: AppState().chatDetails!.response!.token, // token: AppState().chatDetails!.response!.token,
// ); // );
// Uint8List data = Uint8List.fromList(response.bodyBytes); // if (!kReleaseMode) {
// return data; // logger.i("res: " + response.body);
// }
// return response;
// } catch (e) {
// //if fail api returning 500 hence just printing here
// print(e);
// throw e;
// } // }
// // }
// //Get Chat Users & Favorite Images
// Future<List<ChatUserImageModel>> getUsersImages({required List<String> encryptedEmails}) async { // Future<Response> updateGroupAdmin(int? groupId, List<GroupUserList> groupList) async {
// List<ChatUserImageModel> imagesData = []; // try {
// Response response = await ApiClient().postJsonForResponse( // Response response = await ApiClient().postJsonForResponse(
// "${ApiConsts.chatUserImages}images", // ApiConsts.updateGroupAdmin,
// {"encryptedEmails": encryptedEmails, "fromClient": false}, // {"groupId": groupId, "groupUserList": groupList},
// token: AppState().chatDetails!.response!.token, // token: AppState().chatDetails!.response!.token,
// ); // );
// if (!kReleaseMode) { // if (!kReleaseMode) {
// logger.i("res: " + response.body); // logger.i("res: " + response.body);
// } // }
// if (response.statusCode == 200) { // return response;
// imagesData = chatUserImageModelFromJson(response.body); // } catch (e) {
// } else if (response.statusCode == 500 || response.statusCode == 504) { // //if fail api returning 500 hence just printing here
// getUsersImages(encryptedEmails: encryptedEmails); // print(e);
// } else { // throw e;
// Utils.showToast("Something went wrong while loading images");
// imagesData = [];
// }
// return imagesData;
// } // }
// // }
// //group chat apis start here.
// Future<groups.GetUserGroups> getGroupsByUserId() async { // Future<List<GetGroupChatHistoryAsync>> getGroupChatHistory(int? groupId, List<GroupUserList> groupList) async {
// try { // try {
// Response response = await ApiClient().getJsonForResponse( // Response response = await ApiClient().postJsonForResponse(
// "${ApiConsts.getGroupByUserId}${AppState().chatDetails!.response!.id}", // ApiConsts.getGroupChatHistoryAsync,
// token: AppState().chatDetails!.response!.token, // {"groupId": groupId, "targetUserList": groupList, "CurrentId": AppState().chatDetails!.response!.id},
// ); // token: AppState().chatDetails!.response!.token,
// if (!kReleaseMode) { // );
// logger.i("res: " + response.body); // 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<Response> 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;
// } // }
// } // List<GetGroupChatHistoryAsync> groupChat = [];
// // List groupChatData = json.decode(response.body);
// Future<Response> updateGroupAdmin(int? groupId, List<GroupUserList> groupList) async { // for (var i in groupChatData) {
// try { // groupChat.add(GetGroupChatHistoryAsync.fromJson(i));
// 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<List<GetGroupChatHistoryAsync>> getGroupChatHistory(int? groupId, List<GroupUserList> groupList) async { // groupChat.sort((a, b) => b.createdDate!.compareTo(a.createdDate!));
// try { // return groupChat;
// Response response = await ApiClient().postJsonForResponse( // // for(GetGroupChatHistoryAsync i in groupChat) {
// ApiConsts.getGroupChatHistoryAsync, // // return GetGroupChatHistoryAsync.fromJson(jsonEncode(i));
// {"groupId": groupId, "targetUserList": groupList, "CurrentId": AppState().chatDetails!.response!.id}, // // }
// token: AppState().chatDetails!.response!.token, // } catch (e) {
// ); // //if fail api returning 500 hence just printing here
// if (!kReleaseMode) { // print(e);
// logger.i("res: " + response.body); // throw e;
// }
// List<GetGroupChatHistoryAsync> 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 { // Future addGroupAndUsers(createGroup.CreateGroupRequest request) async {
// Response response = await ApiClient().postJsonForResponse( // try {
// ApiConsts.addGroupsAndUsers, // Response response = await ApiClient().postJsonForResponse(
// request, // ApiConsts.addGroupsAndUsers,
// token: AppState().chatDetails!.response!.token, // request,
// ); // token: AppState().chatDetails!.response!.token,
// if (!kReleaseMode) { // );
// logger.i("res: " + response.body); // 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;
// } // }
// 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 { // Future updateGroupAndUsers(createGroup.CreateGroupRequest request) async {
// Response response = await ApiClient().postJsonForResponse( // try {
// ApiConsts.updateGroupsAndUsers, // Response response = await ApiClient().postJsonForResponse(
// request, // ApiConsts.updateGroupsAndUsers,
// token: AppState().chatDetails!.response!.token, // request,
// ); // token: AppState().chatDetails!.response!.token,
// if (!kReleaseMode) { // );
// logger.i("res: " + response.body); // 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;
// } // }
// return response.body;
// } catch (e) {
// //if fail api returning 500 hence just printing here
// print(e);
// throw e;
// } // }
// } // }
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,137 @@
import 'dart:convert';
import 'dart:io';
ChatUserModel chatUserModelFromJson(String str) => ChatUserModel.fromJson(json.decode(str));
String chatUserModelToJson(ChatUserModel data) => json.encode(data.toJson());
class ChatUserModel {
ChatUserModel({
this.response,
this.errorResponses,
});
List<ChatUser>? response;
List<ErrorResponse>? errorResponses;
factory ChatUserModel.fromJson(Map<String, dynamic> json) => ChatUserModel(
response: json["response"] == null ? null : List<ChatUser>.from(json["response"].map((x) => ChatUser.fromJson(x))),
errorResponses: json["errorResponses"] == null ? null : List<ErrorResponse>.from(json["errorResponses"].map((x) => ErrorResponse.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"response": response == null ? null : List<dynamic>.from(response!.map((x) => x.toJson())),
"errorResponses": errorResponses == null ? null : List<dynamic>.from(errorResponses!.map((x) => x.toJson())),
};
}
class ErrorResponse {
ErrorResponse({
this.fieldName,
this.message,
});
dynamic? fieldName;
String? message;
factory ErrorResponse.fromRawJson(String str) => ErrorResponse.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory ErrorResponse.fromJson(Map<String, dynamic> json) => ErrorResponse(
fieldName: json["fieldName"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"fieldName": fieldName,
"message": message == null ? null : message,
};
}
class ChatUser {
ChatUser({
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.isTyping,
this.isImageLoaded,
this.isImageLoading,
this.userLocalDownlaodedImage,
this.isChecked
});
int? id;
String? userName;
String? email;
dynamic? phone;
String? title;
int? userStatus;
dynamic? image;
int? unreadMessageCount;
dynamic? userAction;
bool? isPin;
bool? isFav;
bool? isAdmin;
dynamic? rKey;
int? totalCount;
bool? isTyping;
bool? isImageLoaded;
bool? isImageLoading;
File? userLocalDownlaodedImage;
bool? isChecked;
factory ChatUser.fromRawJson(String str) => ChatUser.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory ChatUser.fromJson(Map<String, dynamic> json) => ChatUser(
id: json["id"] == null ? null : json["id"],
userName: json["userName"] == null ? null : json["userName"],
email: json["email"] == null ? null : json["email"],
phone: json["phone"],
title: json["title"] == null ? null : json["title"],
userStatus: json["userStatus"] == null ? null : json["userStatus"],
image: json["image"],
unreadMessageCount: json["unreadMessageCount"] == null ? null : json["unreadMessageCount"],
userAction: json["userAction"],
isPin: json["isPin"] == null ? null : json["isPin"],
isFav: json["isFav"] == null ? null : json["isFav"],
isAdmin: json["isAdmin"] == null ? null : json["isAdmin"],
rKey: json["rKey"],
totalCount: json["totalCount"] == null ? null : json["totalCount"],
isTyping: false,
isImageLoaded: false,
isImageLoading: true,
userLocalDownlaodedImage: null,
isChecked: false
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"userName": userName == null ? null : userName,
"email": email == null ? null : email,
"phone": phone,
"title": title == null ? null : title,
"userStatus": userStatus == null ? null : userStatus,
"image": image,
"unreadMessageCount": unreadMessageCount == null ? null : unreadMessageCount,
"userAction": userAction,
"isPin": isPin == null ? null : isPin,
"isFav": isFav == null ? null : isFav,
"isAdmin": isAdmin == null ? null : isAdmin,
"rKey": rKey,
"totalCount": totalCount == null ? null : totalCount,
"isChecked":isChecked
};
}

@ -0,0 +1,206 @@
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:just_audio/just_audio.dart';
List<SingleUserChatModel> singleUserChatModelFromJson(String str) => List<SingleUserChatModel>.from(json.decode(str).map((x) => SingleUserChatModel.fromJson(x)));
String singleUserChatModelToJson(List<SingleUserChatModel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class SingleUserChatModel {
SingleUserChatModel(
{this.userChatHistoryId,
this.userChatHistoryLineId,
this.contant,
this.contantNo,
this.currentUserId,
this.currentUserName,
this.targetUserId,
this.targetUserName,
this.encryptedTargetUserId,
this.encryptedTargetUserName,
this.currentUserEmail,
this.targetUserEmail,
this.chatEventId,
this.fileTypeId,
this.isSeen,
this.isDelivered,
this.createdDate,
this.chatSource,
this.conversationId,
this.fileTypeResponse,
this.userChatReplyResponse,
this.isReplied,
this.isImageLoaded,
this.image,
this.voice,
this.voiceController});
int? userChatHistoryId;
int? userChatHistoryLineId;
String? contant;
String? contantNo;
int? currentUserId;
String? currentUserName;
String? currentUserEmail;
int? targetUserId;
String? targetUserName;
String? targetUserEmail;
String? encryptedTargetUserId;
String? encryptedTargetUserName;
int? chatEventId;
dynamic? fileTypeId;
bool? isSeen;
bool? isDelivered;
DateTime? createdDate;
int? chatSource;
String? conversationId;
FileTypeResponse? fileTypeResponse;
UserChatReplyResponse? userChatReplyResponse;
bool? isReplied;
bool? isImageLoaded;
Uint8List? image;
File? voice;
AudioPlayer? voiceController;
factory SingleUserChatModel.fromJson(Map<String, dynamic> json) => SingleUserChatModel(
userChatHistoryId: json["userChatHistoryId"] == null ? null : json["userChatHistoryId"],
userChatHistoryLineId: json["userChatHistoryLineId"] == null ? null : json["userChatHistoryLineId"],
contant: json["contant"] == null ? null : json["contant"],
contantNo: json["contantNo"] == null ? null : json["contantNo"],
currentUserId: json["currentUserId"] == null ? null : json["currentUserId"],
currentUserName: json["currentUserName"] == null ? null : json["currentUserName"],
targetUserId: json["targetUserId"] == null ? null : json["targetUserId"],
targetUserName: json["targetUserName"] == null ? null : json["targetUserName"],
targetUserEmail: json["targetUserEmail"] == null ? null : json["targetUserEmail"],
currentUserEmail: json["currentUserEmail"] == null ? null : json["currentUserEmail"],
encryptedTargetUserId: json["encryptedTargetUserId"] == null ? null : json["encryptedTargetUserId"],
encryptedTargetUserName: json["encryptedTargetUserName"] == null ? null : json["encryptedTargetUserName"],
chatEventId: json["chatEventId"] == null ? null : json["chatEventId"],
fileTypeId: json["fileTypeId"],
isSeen: json["isSeen"] == null ? null : json["isSeen"],
isDelivered: json["isDelivered"] == null ? null : json["isDelivered"],
createdDate: json["createdDate"] == null ? null : DateTime.parse(json["createdDate"]),
chatSource: json["chatSource"] == null ? null : json["chatSource"],
conversationId: json["conversationId"] == null ? null : json["conversationId"],
fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]),
userChatReplyResponse: json["userChatReplyResponse"] == null ? null : UserChatReplyResponse.fromJson(json["userChatReplyResponse"]),
isReplied: false,
isImageLoaded: false,
image: null,
voice: null,
voiceController: json["fileTypeId"] == 13 ? AudioPlayer() : null);
Map<String, dynamic> toJson() => {
"userChatHistoryId": userChatHistoryId == null ? null : userChatHistoryId,
"userChatHistoryLineId": userChatHistoryLineId == null ? null : userChatHistoryLineId,
"contant": contant == null ? null : contant,
"contantNo": contantNo == null ? null : contantNo,
"currentUserId": currentUserId == null ? null : currentUserId,
"currentUserName": currentUserName == null ? null : currentUserName,
"targetUserId": targetUserId == null ? null : targetUserId,
"targetUserName": targetUserName == null ? null : targetUserName,
"encryptedTargetUserId": encryptedTargetUserId == null ? null : encryptedTargetUserId,
"encryptedTargetUserName": encryptedTargetUserName == null ? null : encryptedTargetUserName,
"currentUserEmail": currentUserEmail == null ? null : currentUserEmail,
"targetUserEmail": targetUserEmail == null ? null : targetUserEmail,
"chatEventId": chatEventId == null ? null : chatEventId,
"fileTypeId": fileTypeId,
"isSeen": isSeen == null ? null : isSeen,
"isDelivered": isDelivered == null ? null : isDelivered,
"createdDate": createdDate == null ? null : createdDate!.toIso8601String(),
"chatSource": chatSource == null ? null : chatSource,
"conversationId": conversationId == null ? null : conversationId,
"fileTypeResponse": fileTypeResponse == null ? null : fileTypeResponse!.toJson(),
"userChatReplyResponse": userChatReplyResponse == null ? null : userChatReplyResponse!.toJson(),
};
}
class FileTypeResponse {
FileTypeResponse({
this.fileTypeId,
this.fileTypeName,
this.fileTypeDescription,
this.fileKind,
this.fileName,
});
int? fileTypeId;
dynamic fileTypeName;
dynamic fileTypeDescription;
dynamic fileKind;
dynamic fileName;
factory FileTypeResponse.fromJson(Map<String, dynamic> json) => FileTypeResponse(
fileTypeId: json["fileTypeId"] == null ? null : json["fileTypeId"],
fileTypeName: json["fileTypeName"],
fileTypeDescription: json["fileTypeDescription"],
fileKind: json["fileKind"],
fileName: json["fileName"],
);
Map<String, dynamic> toJson() => {
"fileTypeId": fileTypeId == null ? null : fileTypeId,
"fileTypeName": fileTypeName,
"fileTypeDescription": fileTypeDescription,
"fileKind": fileKind,
"fileName": fileName,
};
}
class UserChatReplyResponse {
UserChatReplyResponse(
{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 UserChatReplyResponse.fromJson(Map<String, dynamic> json) => UserChatReplyResponse(
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<String, dynamic> 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(),
};
}

@ -0,0 +1,97 @@
import 'dart:convert';
UserAutoLoginModel userAutoLoginModelFromJson(String str) => UserAutoLoginModel.fromJson(json.decode(str));
String userAutoLoginModelToJson(UserAutoLoginModel data) => json.encode(data.toJson());
class UserAutoLoginModel {
UserAutoLoginModel({this.response, this.errorResponses, this.StatusCode});
Response? response;
List<ErrorResponse>? errorResponses;
int? StatusCode;
factory UserAutoLoginModel.fromJson(Map<String, dynamic> json) => UserAutoLoginModel(
response: json["response"] == null ? null : Response.fromJson(json["response"]),
StatusCode: json["StatusCode"],
errorResponses: json["errorResponses"] == null ? null : List<ErrorResponse>.from(json["errorResponses"].map((x) => ErrorResponse.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"response": response == null ? null : response!.toJson(),
"StatusCode": StatusCode,
"errorResponses": errorResponses == null ? null : List<dynamic>.from(errorResponses!.map((x) => x.toJson())),
};
}
class Response {
Response({
this.id,
this.userName,
this.email,
this.phone,
this.title,
this.token,
this.isDomainUser,
this.isActiveCode,
this.encryptedUserId,
this.encryptedUserName,
});
int? id;
String? userName;
String? email;
String? phone;
String? title;
String? token;
bool? isDomainUser;
bool? isActiveCode;
String? encryptedUserId;
String? encryptedUserName;
factory Response.fromJson(Map<String, dynamic> json) => Response(
id: json["id"] == null ? null : json["id"],
userName: json["userName"] == null ? null : json["userName"],
email: json["email"] == null ? null : json["email"],
phone: json["phone"] == null ? null : json["phone"],
title: json["title"] == null ? null : json["title"],
token: json["token"] == null ? null : json["token"],
isDomainUser: json["isDomainUser"] == null ? null : json["isDomainUser"],
isActiveCode: json["isActiveCode"] == null ? null : json["isActiveCode"],
encryptedUserId: json["encryptedUserId"] == null ? null : json["encryptedUserId"],
encryptedUserName: json["encryptedUserName"] == null ? null : json["encryptedUserName"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"userName": userName == null ? null : userName,
"email": email == null ? null : email,
"phone": phone == null ? null : phone,
"title": title == null ? null : title,
"token": token == null ? null : token,
"isDomainUser": isDomainUser == null ? null : isDomainUser,
"isActiveCode": isActiveCode == null ? null : isActiveCode,
"encryptedUserId": encryptedUserId == null ? null : encryptedUserId,
"encryptedUserName": encryptedUserName == null ? null : encryptedUserName,
};
}
class ErrorResponse {
ErrorResponse({
this.fieldName,
this.message,
});
String? fieldName;
String? message;
factory ErrorResponse.fromJson(Map<String, dynamic> json) => ErrorResponse(
fieldName: json["fieldName"] == null ? null : json["fieldName"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"fieldName": fieldName == null ? null : fieldName,
"message": message == null ? null : message,
};
}

@ -949,6 +949,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
logging:
dependency: transitive
description:
name: logging
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
url: "https://pub.dev"
source: hosted
version: "1.3.0"
lottie: lottie:
dependency: "direct main" dependency: "direct main"
description: description:
@ -973,6 +981,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.11.1" version: "0.11.1"
message_pack_dart:
dependency: transitive
description:
name: message_pack_dart
sha256: "71b9f0ff60e5896e60b337960bb535380d7dba3297b457ac763ccae807385b59"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -1293,6 +1309,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.10.2+1" version: "0.10.2+1"
pool:
dependency: transitive
description:
name: pool
sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d"
url: "https://pub.dev"
source: hosted
version: "1.5.2"
provider: provider:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1429,6 +1453,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.1" version: "2.4.1"
shelf:
dependency: transitive
description:
name: shelf
sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
url: "https://pub.dev"
source: hosted
version: "1.4.1"
shimmer: shimmer:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1437,6 +1469,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
signalr_netcore:
dependency: "direct main"
description:
name: signalr_netcore
sha256: "8d59dc61284c5ff8aa27c4e3e802fcf782367f06cf42b39d5ded81680b72f8b8"
url: "https://pub.dev"
source: hosted
version: "1.4.4"
signature: signature:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1506,6 +1546,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.5.4+4" version: "2.5.4+4"
sse:
dependency: transitive
description:
name: sse
sha256: fcc97470240bb37377f298e2bd816f09fd7216c07928641c0560719f50603643
url: "https://pub.dev"
source: hosted
version: "4.1.8"
sse_channel:
dependency: transitive
description:
name: sse_channel
sha256: "9aad5d4eef63faf6ecdefb636c0f857bd6f74146d2196087dcf4b17ab5b49b1b"
url: "https://pub.dev"
source: hosted
version: "0.1.1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -1578,6 +1634,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.0" version: "2.3.0"
tuple:
dependency: transitive
description:
name: tuple
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
url: "https://pub.dev"
source: hosted
version: "2.0.2"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -1714,6 +1778,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
web_socket:
dependency: transitive
description:
name: web_socket
sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8
url: "https://pub.dev"
source: hosted
version: "3.0.3"
wifi_iot: wifi_iot:
dependency: "direct main" dependency: "direct main"
description: description:

@ -97,6 +97,8 @@ dependencies:
clipboard: ^2.0.2 clipboard: ^2.0.2
audio_waveforms: ^1.3.0 audio_waveforms: ^1.3.0
signalr_netcore: ^1.4.4
local_auth_darwin: any local_auth_darwin: any
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save