|
|
|
|
@ -29,7 +29,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
late HubConnection hubConnection;
|
|
|
|
|
L.Logger logger = L.Logger();
|
|
|
|
|
bool hubConInitialized = false;
|
|
|
|
|
|
|
|
|
|
String chatCID = '';
|
|
|
|
|
bool isLoading = true;
|
|
|
|
|
bool isChatScreenActive = false;
|
|
|
|
|
late File selectedFile;
|
|
|
|
|
@ -40,17 +40,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
List<ChatUser> favUsersList = [];
|
|
|
|
|
int paginationVal = 0;
|
|
|
|
|
|
|
|
|
|
//Scroll
|
|
|
|
|
bool _firstAutoscrollExecuted = false;
|
|
|
|
|
bool _shouldAutoscroll = false;
|
|
|
|
|
|
|
|
|
|
Future<void> getUserAutoLoginToken(BuildContext cxt) async {
|
|
|
|
|
Response response = await ApiClient().postJsonForResponse(
|
|
|
|
|
"${ApiConsts.chatServerBaseApiUrl}user/externaluserlogin",
|
|
|
|
|
{
|
|
|
|
|
"employeeNumber": int.parse(
|
|
|
|
|
"employeeNumber":
|
|
|
|
|
AppState().memberInformationList!.eMPLOYEENUMBER.toString(),
|
|
|
|
|
),
|
|
|
|
|
"password": "FxIu26rWIKoF8n6mpbOmAjDLphzFGmpG"
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@ -173,6 +168,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
userChatHistory,
|
|
|
|
|
receiverUID,
|
|
|
|
|
);
|
|
|
|
|
generateConvId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void generateConvId() async {
|
|
|
|
|
Uuid uuid = const Uuid();
|
|
|
|
|
chatCID = uuid.v4();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void markRead(List<SingleUserChatModel> data, reciverID) {
|
|
|
|
|
@ -506,13 +507,14 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
Future<void> sendChatToServer(
|
|
|
|
|
{required int chatEventId, required fileTypeId, required int targetUserId, required String targetUserName, required chatReplyId, required bool isAttachment, required bool isReply}) async {
|
|
|
|
|
Uuid uuid = const Uuid();
|
|
|
|
|
|
|
|
|
|
var msg = message.text;
|
|
|
|
|
SingleUserChatModel data = SingleUserChatModel(
|
|
|
|
|
chatEventId: chatEventId,
|
|
|
|
|
chatSource: 1,
|
|
|
|
|
contant: msg,
|
|
|
|
|
contantNo: uuid.v4(),
|
|
|
|
|
conversationId: uuid.v4(),
|
|
|
|
|
conversationId: chatCID,
|
|
|
|
|
createdDate: DateTime.now(),
|
|
|
|
|
currentUserId: AppState().chatDetails!.response!.id,
|
|
|
|
|
currentUserName: AppState().chatDetails!.response!.userName,
|
|
|
|
|
@ -743,22 +745,22 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
sFileType = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void scrollListener() {
|
|
|
|
|
_firstAutoscrollExecuted = true;
|
|
|
|
|
if (scrollController.hasClients && scrollController.position.pixels == scrollController.position.maxScrollExtent) {
|
|
|
|
|
_shouldAutoscroll = true;
|
|
|
|
|
} else {
|
|
|
|
|
_shouldAutoscroll = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void scrollToBottom() {
|
|
|
|
|
scrollController.animateTo(
|
|
|
|
|
scrollController.position.maxScrollExtent + 100,
|
|
|
|
|
duration: const Duration(milliseconds: 500),
|
|
|
|
|
curve: Curves.easeIn,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
// void scrollListener() {
|
|
|
|
|
// _firstAutoscrollExecuted = true;
|
|
|
|
|
// if (scrollController.hasClients && scrollController.position.pixels == scrollController.position.maxScrollExtent) {
|
|
|
|
|
// _shouldAutoscroll = true;
|
|
|
|
|
// } else {
|
|
|
|
|
// _shouldAutoscroll = false;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// void scrollToBottom() {
|
|
|
|
|
// scrollController.animateTo(
|
|
|
|
|
// scrollController.position.maxScrollExtent + 100,
|
|
|
|
|
// duration: const Duration(milliseconds: 500),
|
|
|
|
|
// curve: Curves.easeIn,
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
void msgScroll() {
|
|
|
|
|
scrollController.animateTo(
|
|
|
|
|
|