Chat Fixes & Call Button Disabled

merge-requests/107/head
Aamir Muhammad 3 years ago
parent 28d055c449
commit 2266ace39a

@ -60,17 +60,6 @@ class ChatApiClient {
json.decode(response.body),
);
} catch (e) {
// if (e.message == "api_common_unauthorized") {
// user.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
// if (userLoginResponse.response != null) {
// AppState().setchatUserDetails = userLoginResponse;
// getRecentChats();
// } else {
// Utils.showToast(
// userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr",
// );
// }
// }
throw e;
}
}
@ -97,16 +86,6 @@ class ChatApiClient {
}
return response;
} catch (e) {
// e as APIException;
// if (e.message == "api_common_unauthorized") {
// user.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
// if (userLoginResponse.response != null) {
// AppState().setchatUserDetails = userLoginResponse;
// getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal);
// } else {
// Utils.showToast(userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr");
// }
// }
throw e;
}
}
@ -135,15 +114,6 @@ class ChatApiClient {
return favoriteChatUser;
} catch (e) {
e as APIException;
// if (e.message == "api_common_unauthorized") {
// user.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
// if (userLoginResponse.response != null) {
// AppState().setchatUserDetails = userLoginResponse;
// unFavUser(userID: userID, targetUserID: targetUserID);
// } else {
// Utils.showToast(userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr");
// }
// }
throw e;
}
}

@ -36,6 +36,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
String chatCID = '';
bool isLoading = true;
bool isChatScreenActive = false;
int ReceiverID = 0;
late File selectedFile;
bool isFileSelected = false;
String sFileType = "";
@ -142,6 +144,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
if (isNewChat) userChatHistory = [];
if (!loadMore) paginationVal = 0;
isChatScreenActive = true;
ReceiverID = receiverUID;
Response response = await ChatApiClient().getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal);
if (response.statusCode == 204) {
if (isNewChat) {
@ -371,13 +374,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
}
setMsgTune();
if (isChatScreenActive) {
if (data.first.targetUserId == AppState().chatDetails!.response!.id) {
userChatHistory.insert(0, data.first);
}
if (isChatScreenActive && data.first.currentUserId == ReceiverID) {
userChatHistory.insert(0, data.first);
}
if (searchedChats != null && !isChatScreenActive) {
if (searchedChats != null) {
for (ChatUser user in searchedChats!) {
if (user.id == data.first.currentUserId) {
int tempCount = user.unreadMessageCount ?? 0;

@ -85,14 +85,14 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
showTyping: true,
chatUser: params!.chatUser,
actions: [
SvgPicture.asset("assets/icons/chat/call.svg", width: 21, height: 23).onPress(() {
// makeCall(callType: "AUDIO", con: hubConnection);
}),
24.width,
SvgPicture.asset("assets/icons/chat/video_call.svg", width: 21, height: 18).onPress(() {
// makeCall(callType: "VIDEO", con: hubConnection);
}),
21.width,
// SvgPicture.asset("assets/icons/chat/call.svg", width: 21, height: 23).onPress(() {
// // makeCall(callType: "AUDIO", con: hubConnection);
// }),
// 24.width,
// SvgPicture.asset("assets/icons/chat/video_call.svg", width: 21, height: 18).onPress(() {
// // makeCall(callType: "VIDEO", con: hubConnection);
// }),
// 21.width,
],
),
body: SafeArea(

Loading…
Cancel
Save