Chat Favorite Screen & Fixes

merge-requests/56/head
Aamir Muhammad 3 years ago
parent 27b8f48c3f
commit ab6f265ef4

@ -380,10 +380,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
Future<void> sendChatToServer( Future<void> sendChatToServer(
{required int chatEventId, required fileTypeId, required int targetUserId, required String targetUserName, required chatReplyId, required bool isAttachment, required bool isReply}) async { {required int chatEventId, required fileTypeId, required int targetUserId, required String targetUserName, required chatReplyId, required bool isAttachment, required bool isReply}) async {
Uuid uuid = const Uuid(); Uuid uuid = const Uuid();
String msg = message.text;
SingleUserChatModel data = SingleUserChatModel( SingleUserChatModel data = SingleUserChatModel(
chatEventId: chatEventId, chatEventId: chatEventId,
chatSource: 1, chatSource: 1,
contant: message.text, contant: msg,
contantNo: uuid.v4(), contantNo: uuid.v4(),
conversationId: uuid.v4(), conversationId: uuid.v4(),
createdDate: DateTime.now(), createdDate: DateTime.now(),
@ -412,7 +413,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
notifyListeners(); notifyListeners();
String chatData = String chatData =
'{"contant":"${message.text}","contantNo":"${uuid.v4()}","chatEventId":$chatEventId,"fileTypeId": $fileTypeId,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"userChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":$targetUserId,"targetUserStatus":1}],"chatReplyId":$chatReplyId,"conversationId":"${uuid.v4()}"}'; '{"contant":"$msg","contantNo":"${uuid.v4()}","chatEventId":$chatEventId,"fileTypeId": $fileTypeId,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"userChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":$targetUserId,"targetUserStatus":1}],"chatReplyId":$chatReplyId,"conversationId":"${uuid.v4()}"}';
await hubConnection.invoke("AddChatUserAsync", args: <Object>[json.decode(chatData)]); await hubConnection.invoke("AddChatUserAsync", args: <Object>[json.decode(chatData)]);
} }
@ -452,9 +453,10 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
if (isFileSelected && isMsgReply) { if (isFileSelected && isMsgReply) {
logger.d("Attachment Message With Reply"); logger.d("Attachment Message With Reply");
logger.d(repliedMsg.first.userChatHistoryId); Utils.showLoading(context);
dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), selectedFile); dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), selectedFile);
String? ext = getFileExtension(selectedFile.path); String? ext = getFileExtension(selectedFile.path);
Utils.hideLoading(context);
sendChatToServer( sendChatToServer(
chatEventId: 2, chatEventId: 2,
fileTypeId: getFileType(ext.toString()), fileTypeId: getFileType(ext.toString()),

@ -1,7 +1,7 @@
class ApiConsts { class ApiConsts {
//static String baseUrl = "http://10.200.204.20:2801/"; // Local server //static String baseUrl = "http://10.200.204.20:2801/"; // Local server
//static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
static String baseUrl = "https://hmgwebservices.com"; // Live server //static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/";

@ -26,7 +26,6 @@ class _ChatHomeState extends State<ChatHome> {
PageController controller = PageController(); PageController controller = PageController();
late ChatProviderModel data; late ChatProviderModel data;
@override @override
void initState() { void initState() {
// TODO: implement initState // TODO: implement initState
@ -46,7 +45,6 @@ class _ChatHomeState extends State<ChatHome> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: MyColors.white, backgroundColor: MyColors.white,
appBar: AppBarWidget( appBar: AppBarWidget(

@ -141,12 +141,11 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
icon: Icon(m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == false ? Icons.star_sharp : Icons.star_sharp), icon: Icon(m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == false ? Icons.star_sharp : Icons.star_sharp),
color: m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == true ? MyColors.yellowColor : MyColors.grey35Color, color: m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == true ? MyColors.yellowColor : MyColors.grey35Color,
onPressed: () { onPressed: () {
if (m.searchedChats![index].isFav == null || m.searchedChats![index].isFav == false) { if (m.searchedChats![index].isFav == null || m.searchedChats![index].isFav == false) {
m.favoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!); m.favoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!);
}else if( m.searchedChats![index].isFav == true){ } else if (m.searchedChats![index].isFav == true) {
m.unFavoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!); m.unFavoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!);
} else{ } else {
m.favoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!); m.favoriteUser(userID: AppState().chatDetails!.response!.id!, targetUserID: m.searchedChats![index].id!);
} }
}, },

Loading…
Cancel
Save