|
|
|
@ -16,6 +16,7 @@ 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';
|
|
|
|
import 'package:mohem_flutter_app/classes/encryption.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/encryption.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
|
|
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/main.dart';
|
|
|
|
import 'package:mohem_flutter_app/models/chat/chat_user_image_model.dart';
|
|
|
|
import 'package:mohem_flutter_app/models/chat/chat_user_image_model.dart';
|
|
|
|
import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
|
|
|
|
import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
|
|
|
|
@ -23,6 +24,7 @@ import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.da
|
|
|
|
import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' as userLoginToken;
|
|
|
|
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/make_user_favotire_unfavorite_chat_model.dart' as fav;
|
|
|
|
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.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';
|
|
|
|
import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/image_picker.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/image_picker.dart';
|
|
|
|
import 'package:open_file/open_file.dart';
|
|
|
|
import 'package:open_file/open_file.dart';
|
|
|
|
@ -125,9 +127,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
ChatUserModel favUList = await ChatApiClient().getFavUsers();
|
|
|
|
ChatUserModel favUList = await ChatApiClient().getFavUsers();
|
|
|
|
if (favUList.response != null && recentChat.response != null) {
|
|
|
|
if (favUList.response != null && recentChat.response != null) {
|
|
|
|
favUsersList = favUList.response!;
|
|
|
|
favUsersList = favUList.response!;
|
|
|
|
favUsersList.sort(
|
|
|
|
favUsersList.sort((ChatUser a, ChatUser b) => a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase()));
|
|
|
|
(ChatUser a, ChatUser b) => a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase()),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
for (dynamic user in recentChat.response!) {
|
|
|
|
for (dynamic user in recentChat.response!) {
|
|
|
|
for (dynamic favUser in favUList.response!) {
|
|
|
|
for (dynamic favUser in favUList.response!) {
|
|
|
|
if (user.id == favUser.id) {
|
|
|
|
if (user.id == favUser.id) {
|
|
|
|
@ -319,7 +319,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
user.userStatus = items.first["userStatus"];
|
|
|
|
user.userStatus = items.first["userStatus"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (teamMembersList != null) {
|
|
|
|
|
|
|
|
if (teamMembersList.isNotEmpty) {
|
|
|
|
if (teamMembersList.isNotEmpty) {
|
|
|
|
for (ChatUser user in teamMembersList!) {
|
|
|
|
for (ChatUser user in teamMembersList!) {
|
|
|
|
if (user.id == items.first["id"]) {
|
|
|
|
if (user.id == items.first["id"]) {
|
|
|
|
@ -327,7 +326,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1453,24 +1451,19 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void openChatByNoti(BuildContext context) async {
|
|
|
|
void openChatByNoti(BuildContext context) async {
|
|
|
|
print(AppState().getNotificationData!.messageId);
|
|
|
|
SingleUserChatModel nUser = SingleUserChatModel.fromJson(
|
|
|
|
logger.d(AppState().getNotificationData!.toMap());
|
|
|
|
jsonDecode(await Utils.getStringFromPrefs("notificationData")),
|
|
|
|
if (AppState().getNotificationData!.data != null) {
|
|
|
|
);
|
|
|
|
logger.d(AppState().getNotificationData!.data["user_chat_history_response"]);
|
|
|
|
Utils.saveStringFromPrefs("isAppOpendByChat", "false");
|
|
|
|
logger.w("-----------------------This is the Read Data------------------------------------");
|
|
|
|
Utils.saveStringFromPrefs("notificationData", "null");
|
|
|
|
var tempData = jsonDecode(AppState().getNotificationData!.data["user_chat_history_response"]);
|
|
|
|
Future.delayed(const Duration(seconds: 1));
|
|
|
|
// List<SingleUserChatModel> Temp = singleUserChatModelFromJson();
|
|
|
|
for (ChatUser user in searchedChats!) {
|
|
|
|
// print(Temp.first.contant);
|
|
|
|
if (user.id == nUser.targetUserId) {
|
|
|
|
AppState().setIsAppOpendByChat = false;
|
|
|
|
Navigator.pushNamed(context, AppRoutes.chatDetailed, arguments: ChatDetailedScreenParams(user, false));
|
|
|
|
AppState().setNotificationData = null;
|
|
|
|
return;
|
|
|
|
// Navigator.pushNamed(
|
|
|
|
} else {
|
|
|
|
// context,
|
|
|
|
openChatByNoti(context);
|
|
|
|
// AppRoutes.chatDetailed,
|
|
|
|
}
|
|
|
|
// arguments: ChatDetailedScreenParams(m.searchedChats![index], false),
|
|
|
|
|
|
|
|
// ).then((Object? value) {
|
|
|
|
|
|
|
|
// clearSelections();
|
|
|
|
|
|
|
|
// notifyListeners();
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|