Skip to content

Commit

Permalink
1.7v
Browse files Browse the repository at this point in the history
remdex committed Feb 2, 2022
1 parent 3cf941e commit 400990e
Showing 36 changed files with 795 additions and 36 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
100755 → 100644
Original file line number Diff line number Diff line change
@@ -45,8 +45,8 @@ android {
applicationId "com.livehelperchat.chat"
minSdkVersion 16
targetSdkVersion 30
versionCode 36
versionName "1.7"
versionCode 38
versionName "1.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

5 changes: 0 additions & 5 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
1.2

1. Chat between operators
2. Notifications fixes.

1.1

To see online visitor status it's require 3.42v
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions lib/bloc/chats_list/chatslist_bloc.dart
Original file line number Diff line number Diff line change
@@ -65,6 +65,8 @@ class ChatslistBloc extends Bloc<ChatslistEvent, ChatListState> {
transferChatList: server.transferChatList,
twilioChatList: server.twilioChatList,
closedChatList: server.closedChatList,
botChatList: server.botChatList,
subjectChatList: server.subjectChatList,
operatorsChatList: server.operatorsChatList
);
} catch (ex) {
@@ -80,6 +82,8 @@ class ChatslistBloc extends Bloc<ChatslistEvent, ChatListState> {
List<Chat> transferChats = List.from(currentState.transferChatList);
List<Chat> twilioChats = List.from(currentState.twilioChatList);
List<Chat> closedChats = List.from(currentState.closedChatList);
List<Chat> botChats = List.from(currentState.botChatList);
List<Chat> subjectChats = List.from(currentState.subjectChatList);
List<User> operatorsChatChats = List.from(currentState.operatorsChatList);

List<Chat> activeList =
@@ -88,6 +92,12 @@ class ChatslistBloc extends Bloc<ChatslistEvent, ChatListState> {
List<Chat> closedList =
await _cleanList(ChatListName.closed, server, closedChats);

List<Chat> botList =
await _cleanList(ChatListName.bot, server, botChats);

List<Chat> subjectList =
await _cleanList(ChatListName.subject, server, subjectChats);

List<User> operatorsList =
await _cleanListOperator(ChatListName.operators, server, operatorsChatChats);

@@ -106,6 +116,8 @@ class ChatslistBloc extends Bloc<ChatslistEvent, ChatListState> {
transferChatList: transferList,
twilioChatList: _sortByLastMessageTime(twilioList),
closedChatList: _sortById(closedList),
botChatList: _sortByLastMessageTime(botList),
subjectChatList: _sortByLastMessageTime(subjectList),
operatorsChatList: _sortByLastOperatorMessageTime(operatorsList)
);
}
@@ -157,6 +169,28 @@ class ChatslistBloc extends Bloc<ChatslistEvent, ChatListState> {
}
return listToClean;

case ChatListName.bot:
if (server.botChatList.length == 0) {
if (listToClean.length > 0) {
listToClean.removeWhere((chat) => chat.serverid == server.id);
}
} else {
listToClean =
await _updateChatList(listToClean, server.botChatList);
}
return listToClean;

case ChatListName.subject:
if (server.subjectChatList.length == 0) {
if (listToClean.length > 0) {
listToClean.removeWhere((chat) => chat.serverid == server.id);
}
} else {
listToClean =
await _updateChatList(listToClean, server.subjectChatList);
}
return listToClean;

case ChatListName.closed:
if (server.closedChatList.length == 0) {
if (listToClean.length > 0) {
12 changes: 11 additions & 1 deletion lib/bloc/chats_list/chatslist_state.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
part of 'chatslist_bloc.dart';

enum ChatListName { active, pending, transfer, twilio, closed, operators }
enum ChatListName { active, pending, transfer, twilio, closed, subject, bot, operators }

abstract class ChatListState extends Equatable {
ChatListState();
@@ -26,6 +26,8 @@ class ChatListLoaded extends ChatListState {
final List<Chat> transferChatList;
final List<Chat> twilioChatList;
final List<Chat> closedChatList;
final List<Chat> botChatList;
final List<Chat> subjectChatList;
final List<User> operatorsChatList;
final bool isLoading;

@@ -35,6 +37,8 @@ class ChatListLoaded extends ChatListState {
this.transferChatList = const [],
this.twilioChatList = const [],
this.closedChatList = const [],
this.botChatList = const [],
this.subjectChatList = const [],
this.operatorsChatList = const [],
this.isLoading = false});

@@ -44,6 +48,8 @@ class ChatListLoaded extends ChatListState {
List<Chat> transferChatList,
List<Chat> twilioChatList,
List<Chat> closedChatList,
List<Chat> botChatList,
List<Chat> subjectChatList,
List<User> operatorsChatList,
bool isLoading = false}) {
return ChatListLoaded(
@@ -52,6 +58,8 @@ class ChatListLoaded extends ChatListState {
transferChatList: transferChatList ?? this.transferChatList,
twilioChatList: twilioChatList ?? this.twilioChatList,
closedChatList: closedChatList ?? this.closedChatList,
botChatList: botChatList ?? this.botChatList,
subjectChatList: subjectChatList ?? this.subjectChatList,
operatorsChatList: operatorsChatList ?? this.operatorsChatList,
isLoading: isLoading ?? this.isLoading);
}
@@ -63,6 +71,8 @@ class ChatListLoaded extends ChatListState {
transferChatList,
twilioChatList,
closedChatList,
botChatList,
subjectChatList,
operatorsChatList,
isLoading
];
9 changes: 9 additions & 0 deletions lib/bloc/fcm/fcmtoken_bloc.dart
Original file line number Diff line number Diff line change
@@ -158,6 +158,15 @@ class FcmTokenBloc extends Bloc<FcmTokenEvent, FcmTokenState> {
body: data['msg'].toString());
}

if (data["chat_type"].toString() == "subject") {
return ReceivedNotification(
server: server,
chat: Chat.fromJson(chat),
type: NotificationType.SUBJECT,
title: "New subject",
body: data['msg'].toString());
}

if (data["chat_type"].toString() == "unread") {
return ReceivedNotification(
server: server,
29 changes: 24 additions & 5 deletions lib/model/chat.dart
Original file line number Diff line number Diff line change
@@ -26,6 +26,8 @@ class Chat extends Equatable {
"db_last_user_msg_time": "last_user_msg_time",
"db_phone": "phone",
"db_user_status_front": "user_status_front",
"db_subject_front": "subject_front",
"db_aicon_front": "aicon_front"
};

final int id,
@@ -48,7 +50,9 @@ class Chat extends Equatable {
department_name,
user_typing_txt,
owner,
phone;
phone,
subject_front,
aicon_front;

int get last_msg_time {
if (last_op_msg_time != null && last_user_msg_time != null) {
@@ -85,7 +89,10 @@ class Chat extends Equatable {
this.last_user_msg_time,
this.last_op_msg_time,
this.phone,
this.user_status_front});
this.user_status_front,
this.subject_front,
this.aicon_front,
});

Chat copyWith(
{int id,
@@ -108,7 +115,10 @@ class Chat extends Equatable {
last_user_msg_time,
last_op_msg_time,
String phone,
String user_status_front}) {
String user_status_front,
String subject_front,
String aicon_front
}) {
return Chat(
id: id ?? this.id,
serverid: serverid ?? this.serverid,
@@ -130,7 +140,10 @@ class Chat extends Equatable {
last_user_msg_time: last_user_msg_time ?? this.last_user_msg_time,
last_op_msg_time: last_op_msg_time ?? this.last_op_msg_time,
phone: phone ?? this.phone,
user_status_front: user_status_front ?? this.user_status_front);
user_status_front: user_status_front ?? this.user_status_front,
subject_front: subject_front ?? this.subject_front,
aicon_front: aicon_front ?? this.aicon_front
);
}

static int checkInt(dynamic value) {
@@ -161,6 +174,8 @@ class Chat extends Equatable {
last_op_msg_time: checkInt(map['last_op_msg_time']),
phone: map['phone'] ?? "",
user_status_front: map['user_status_front'] ?? 0,
subject_front: map['subject_front'] ?? "",
aicon_front: map['aicon_front'] ?? "",
);

Map<String, dynamic> toJson() {
@@ -185,6 +200,8 @@ class Chat extends Equatable {
'last_msg_time': last_msg_time,
columns['db_phone']: phone,
columns['db_user_status_front']: user_status_front,
columns['db_subject_front']: subject_front,
columns['db_aicon_front']: aicon_front,
};
}

@@ -210,6 +227,8 @@ class Chat extends Equatable {
last_user_msg_time,
last_op_msg_time,
phone,
user_status_front
user_status_front,
subject_front,
aicon_front,
];
}
26 changes: 26 additions & 0 deletions lib/model/server.dart
Original file line number Diff line number Diff line change
@@ -73,6 +73,8 @@ class Server {
List<Chat> transferChatList;
List<Chat> twilioChatList;
List<Chat> closedChatList;
List<Chat> botChatList;
List<Chat> subjectChatList;
List<User> operatorsChatList;

Server(
@@ -104,6 +106,8 @@ class Server {
transferChatList = List<Chat>();
twilioChatList = List<Chat>();
closedChatList = List<Chat>();
botChatList = List<Chat>();
subjectChatList = List<Chat>();
operatorsChatList = List<User>();
}

@@ -180,6 +184,16 @@ class Server {
this.closedChatList = _cleanUpLists(this.closedChatList, newChatList);
this.closedChatList.sort((a, b) => a.id.compareTo(b.id));
break;
case "bot":
this.botChatList ??= new List<Chat>();
this.botChatList = _cleanUpLists(this.botChatList, newChatList);
this.botChatList.sort((a, b) => a.id.compareTo(b.id));
break;
case "subject":
this.subjectChatList ??= new List<Chat>();
this.subjectChatList = _cleanUpLists(this.subjectChatList, newChatList);
this.subjectChatList.sort((a, b) => a.id.compareTo(b.id));
break;
case "twilio":
this.twilioChatList ??= new List<Chat>();
this.twilioChatList = _cleanUpLists(this.twilioChatList, newChatList);
@@ -278,6 +292,12 @@ class Server {
case 'transfer':
this.transferChatList?.clear();
break;
case 'bot':
this.botChatList?.clear();
break;
case 'subject':
this.subjectChatList?.clear();
break;
case 'closed':
this.closedChatList?.clear();
break;
@@ -300,6 +320,12 @@ class Server {
case 'pending':
this.pendingChatList.removeWhere((chat) => chat.id == id);
break;
case 'subject':
this.subjectChatList.removeWhere((chat) => chat.id == id);
break;
case 'bot':
this.botChatList.removeWhere((chat) => chat.id == id);
break;
case 'transfer':
this.transferChatList.removeWhere((chat) => chat.id == id);
break;
7 changes: 0 additions & 7 deletions lib/pages/chat/chat_page.dart
Original file line number Diff line number Diff line change
@@ -307,13 +307,6 @@ class ChatPageState extends State<ChatPage>
onPressed: () {
_isActionLoading = true;
_acceptChat();
// Use timer to accept the chat. To handle problematic network connection
/* _acceptTimer = new Timer.periodic(
new Duration(seconds: 10), (Timer timer){
if (!_isOwnerOfChat)_acceptChat();
else _cancelAccept();
});
*/
},
)),
new IconButton(
Loading

0 comments on commit 400990e

Please sign in to comment.