@plusscommunities/pluss-circles-app-groups 8.0.5 → 8.0.6-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/actions/ChatActions.js +3 -3
- package/dist/module/actions/ChatActions.js.map +1 -1
- package/dist/module/actions/GroupActions.js +18 -18
- package/dist/module/actions/GroupActions.js.map +1 -1
- package/dist/module/actions/index.js +3 -3
- package/dist/module/actions/index.js.map +1 -1
- package/dist/module/actions/types.js +2 -2
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/assets/fonts.js +1 -1
- package/dist/module/assets/fonts.js.map +1 -1
- package/dist/module/components/chat/Chat.js +83 -101
- package/dist/module/components/chat/Chat.js.map +1 -1
- package/dist/module/components/chat/ChatList.js +49 -49
- package/dist/module/components/chat/ChatList.js.map +1 -1
- package/dist/module/components/chat/ContactsList.js +21 -21
- package/dist/module/components/chat/ContactsList.js.map +1 -1
- package/dist/module/components/chat/KioskPeoplePage.js +38 -37
- package/dist/module/components/chat/KioskPeoplePage.js.map +1 -1
- package/dist/module/components/chat/PeopleContainer.js +5 -5
- package/dist/module/components/chat/PeopleContainer.js.map +1 -1
- package/dist/module/components/chat/PeoplePage.js +41 -41
- package/dist/module/components/chat/PeoplePage.js.map +1 -1
- package/dist/module/components/common/SwipeableUserListing.js +22 -22
- package/dist/module/components/common/SwipeableUserListing.js.map +1 -1
- package/dist/module/components/common/index.js +2 -2
- package/dist/module/components/common/index.js.map +1 -1
- package/dist/module/components/events/EventInvitePopup.js +40 -40
- package/dist/module/components/events/EventInvitePopup.js.map +1 -1
- package/dist/module/components/groups/EditGroup.js +62 -62
- package/dist/module/components/groups/EditGroup.js.map +1 -1
- package/dist/module/components/groups/GroupDetails.js +32 -32
- package/dist/module/components/groups/GroupDetails.js.map +1 -1
- package/dist/module/components/groups/GroupsList.js +10 -10
- package/dist/module/components/groups/GroupsList.js.map +1 -1
- package/dist/module/components/groups/GroupsWidget.js +18 -18
- package/dist/module/components/groups/GroupsWidget.js.map +1 -1
- package/dist/module/components/groups/NewGroup.js +101 -101
- package/dist/module/components/groups/NewGroup.js.map +1 -1
- package/dist/module/components/groups/PublicGroup.js +17 -17
- package/dist/module/components/groups/PublicGroup.js.map +1 -1
- package/dist/module/components/groups/PublicGroupAction.js +39 -39
- package/dist/module/components/groups/PublicGroupAction.js.map +1 -1
- package/dist/module/components/notifications/GroupInvite.js +25 -25
- package/dist/module/components/notifications/GroupInvite.js.map +1 -1
- package/dist/module/components/notifications/GroupInviteAction.js +44 -44
- package/dist/module/components/notifications/GroupInviteAction.js.map +1 -1
- package/dist/module/components/notifications/GroupMessage.js +17 -17
- package/dist/module/components/notifications/GroupMessage.js.map +1 -1
- package/dist/module/components/takeover/TakeoverBackground.js +5 -5
- package/dist/module/components/takeover/TakeoverBackground.js.map +1 -1
- package/dist/module/config/index.js +2 -2
- package/dist/module/config/index.js.map +1 -1
- package/dist/module/core.config.js +1 -1
- package/dist/module/core.config.js.map +1 -1
- package/dist/module/feature.config.js +27 -27
- package/dist/module/feature.config.js.map +1 -1
- package/dist/module/index.js +14 -14
- package/dist/module/index.js.map +1 -1
- package/dist/module/js/Colors.js +1 -1
- package/dist/module/js/Colors.js.map +1 -1
- package/dist/module/js/NavigationService.js +1 -1
- package/dist/module/js/NavigationService.js.map +1 -1
- package/dist/module/js/Styles.js +1 -1
- package/dist/module/js/Styles.js.map +1 -1
- package/dist/module/js/circles/MapStateToDirectMessages.js +2 -2
- package/dist/module/js/circles/MapStateToDirectMessages.js.map +1 -1
- package/dist/module/js/index.js +3 -3
- package/dist/module/js/index.js.map +1 -1
- package/dist/module/reducers/ChatsReducer.js +4 -4
- package/dist/module/reducers/ChatsReducer.js.map +1 -1
- package/dist/module/reducers/GroupsReducer.js +5 -5
- package/dist/module/reducers/GroupsReducer.js.map +1 -1
- package/dist/module/reducers/reducerKeys.js +1 -1
- package/dist/module/reducers/reducerKeys.js.map +1 -1
- package/dist/module/values.config.default.js +25 -25
- package/dist/module/values.config.default.js.map +1 -1
- package/dist/module/values.config.groups.js +25 -25
- package/dist/module/values.config.groups.js.map +1 -1
- package/dist/module/values.config.js +25 -25
- package/dist/module/values.config.js.map +1 -1
- package/dist/module/webapi/circleActions.js +31 -31
- package/dist/module/webapi/circleActions.js.map +1 -1
- package/dist/module/webapi/helper.js +1 -1
- package/dist/module/webapi/helper.js.map +1 -1
- package/dist/module/webapi/index.js +3 -3
- package/dist/module/webapi/index.js.map +1 -1
- package/dist/module/webapi/messageActions.js +10 -10
- package/dist/module/webapi/messageActions.js.map +1 -1
- package/package.json +54 -54
- package/src/actions/ChatActions.js +55 -55
- package/src/actions/GroupActions.js +245 -237
- package/src/actions/index.js +3 -3
- package/src/actions/types.js +2 -2
- package/src/assets/fonts.js +1 -1
- package/src/components/chat/Chat.js +730 -669
- package/src/components/chat/ChatList.js +603 -512
- package/src/components/chat/ContactsList.js +186 -169
- package/src/components/chat/KioskPeoplePage.js +315 -291
- package/src/components/chat/PeopleContainer.js +14 -14
- package/src/components/chat/PeoplePage.js +450 -383
- package/src/components/common/SwipeableUserListing.js +118 -106
- package/src/components/common/index.js +2 -2
- package/src/components/events/EventInvitePopup.js +587 -505
- package/src/components/groups/EditGroup.js +607 -538
- package/src/components/groups/GroupDetails.js +385 -305
- package/src/components/groups/GroupsList.js +91 -79
- package/src/components/groups/GroupsWidget.js +122 -116
- package/src/components/groups/NewGroup.js +758 -639
- package/src/components/groups/PublicGroup.js +129 -101
- package/src/components/groups/PublicGroupAction.js +312 -244
- package/src/components/notifications/GroupInvite.js +167 -139
- package/src/components/notifications/GroupInviteAction.js +371 -273
- package/src/components/notifications/GroupMessage.js +110 -102
- package/src/components/takeover/TakeoverBackground.js +24 -18
- package/src/config/index.js +4 -4
- package/src/core.config.js +27 -3
- package/src/feature.config.js +257 -245
- package/src/index.js +24 -21
- package/src/js/Colors.js +5 -3
- package/src/js/NavigationService.js +5 -4
- package/src/js/Styles.js +1 -1
- package/src/js/circles/MapStateToDirectMessages.js +6 -6
- package/src/js/index.js +3 -3
- package/src/reducers/ChatsReducer.js +66 -53
- package/src/reducers/GroupsReducer.js +203 -190
- package/src/reducers/reducerKeys.js +1 -1
- package/src/values.config.default.js +29 -29
- package/src/values.config.groups.js +29 -29
- package/src/values.config.js +29 -29
- package/src/webapi/circleActions.js +109 -109
- package/src/webapi/helper.js +1 -1
- package/src/webapi/index.js +3 -3
- package/src/webapi/messageActions.js +47 -47
package/src/js/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Session, Helper } from
|
|
2
|
-
import mapStateToDirectMessages from
|
|
1
|
+
import { Session, Helper } from "../core.config";
|
|
2
|
+
import mapStateToDirectMessages from "./circles/MapStateToDirectMessages";
|
|
3
3
|
|
|
4
4
|
// Session
|
|
5
5
|
export const authedFunction = Session.authedFunction;
|
|
@@ -21,4 +21,4 @@ export const searchUsers = Helper.searchUsers;
|
|
|
21
21
|
|
|
22
22
|
export { mapStateToDirectMessages };
|
|
23
23
|
|
|
24
|
-
export * from
|
|
24
|
+
export * from "./Colors";
|
|
@@ -1,63 +1,76 @@
|
|
|
1
|
-
import { REHYDRATE } from
|
|
1
|
+
import { REHYDRATE } from "redux-persist";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from
|
|
11
|
-
import { CHAT_REDUCER_KEY } from
|
|
3
|
+
SOFT_ADD_CIRCLE_CHAT,
|
|
4
|
+
CREATED_CIRCLE_CHAT,
|
|
5
|
+
RECEIVED_CIRCLE_CHATS,
|
|
6
|
+
RECEIVED_CIRCLE_MESSAGES,
|
|
7
|
+
RECEIVED_BLOCKED_CIRCLE_USERS,
|
|
8
|
+
LOGOUT,
|
|
9
|
+
CHANGE_ROLE,
|
|
10
|
+
} from "../actions/types";
|
|
11
|
+
import { CHAT_REDUCER_KEY } from "./reducerKeys";
|
|
12
12
|
|
|
13
13
|
const INITIAL_STATE = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
selectedChatKey: null,
|
|
15
|
+
list: [],
|
|
16
|
+
messages: {},
|
|
17
|
+
unreadCount: 0,
|
|
18
|
+
blockedUsers: {},
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export default (state = INITIAL_STATE, action) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
switch (action.type) {
|
|
23
|
+
case LOGOUT:
|
|
24
|
+
case CHANGE_ROLE:
|
|
25
|
+
return INITIAL_STATE;
|
|
26
|
+
case CREATED_CIRCLE_CHAT:
|
|
27
|
+
return { ...state, selectedChatKey: action.payload, messages: [] };
|
|
28
|
+
case SOFT_ADD_CIRCLE_CHAT:
|
|
29
|
+
return { ...state, list: [...state.list, ...action.payload] };
|
|
30
|
+
case RECEIVED_CIRCLE_CHATS:
|
|
31
|
+
return {
|
|
32
|
+
...state,
|
|
33
|
+
list: action.payload,
|
|
34
|
+
unreadCount: action.unreadCount,
|
|
35
|
+
};
|
|
36
|
+
case RECEIVED_CIRCLE_MESSAGES:
|
|
37
|
+
return {
|
|
38
|
+
...state,
|
|
39
|
+
messages: {
|
|
40
|
+
...state.messages,
|
|
41
|
+
[action.payload.chatKey]: action.payload.messages,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
case RECEIVED_BLOCKED_CIRCLE_USERS:
|
|
45
|
+
return { ...state, blockedUsers: action.payload };
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
case REHYDRATE:
|
|
48
|
+
if (!action.payload) return state;
|
|
49
|
+
if (
|
|
50
|
+
action.payload[CHAT_REDUCER_KEY] &&
|
|
51
|
+
Array.isArray(action.payload[CHAT_REDUCER_KEY])
|
|
52
|
+
) {
|
|
53
|
+
return {
|
|
54
|
+
list: action.payload[CHAT_REDUCER_KEY],
|
|
55
|
+
// areas: _.groupBy(action.payload[CHAT_REDUCER_KEY], (event) => { return event.Area })
|
|
56
|
+
};
|
|
57
|
+
} else if (action.payload[CHAT_REDUCER_KEY]) {
|
|
58
|
+
if (action.payload[CHAT_REDUCER_KEY].messages == null) {
|
|
59
|
+
action.payload[CHAT_REDUCER_KEY].messages = {};
|
|
60
|
+
}
|
|
61
|
+
if (action.payload[CHAT_REDUCER_KEY].unreadCount == null) {
|
|
62
|
+
action.payload[CHAT_REDUCER_KEY].unreadCount = 0;
|
|
63
|
+
}
|
|
64
|
+
if (action.payload[CHAT_REDUCER_KEY].blockedUsers == null) {
|
|
65
|
+
action.payload[CHAT_REDUCER_KEY].blockedUsers = {};
|
|
66
|
+
}
|
|
67
|
+
/* fixSelectedTimes(action.payload[CHAT_REDUCER_KEY].list);
|
|
55
68
|
fixRepeatedTimes(action.payload[CHAT_REDUCER_KEY].list); */
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
return action.payload[CHAT_REDUCER_KEY];
|
|
70
|
+
}
|
|
71
|
+
return state;
|
|
59
72
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
default:
|
|
74
|
+
return state;
|
|
75
|
+
}
|
|
63
76
|
};
|
|
@@ -1,205 +1,218 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
2
|
/* eslint-disable no-case-declarations */
|
|
3
|
-
import { REHYDRATE } from
|
|
4
|
-
import _ from
|
|
3
|
+
import { REHYDRATE } from "redux-persist";
|
|
4
|
+
import _ from "lodash";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from
|
|
19
|
-
import { GROUPS_REDUCER_KEY } from
|
|
6
|
+
LOGOUT,
|
|
7
|
+
CIRCLE_INVITES_LOADED,
|
|
8
|
+
CIRCLE_INVITES_UPDATED,
|
|
9
|
+
PUBLIC_CIRCLES_LOAD_INITIALISE,
|
|
10
|
+
CIRCLES_LOAD_INITIALISE,
|
|
11
|
+
CIRCLES_LOADED,
|
|
12
|
+
CREATED_CIRCLE,
|
|
13
|
+
CLEAR_CIRCLES,
|
|
14
|
+
UPDATE_CIRCLE_UNREAD,
|
|
15
|
+
CLEAR_SINGLE_CIRCLE_UNREAD,
|
|
16
|
+
CHANGE_ROLE,
|
|
17
|
+
ARCHIVE_CIRCLE,
|
|
18
|
+
} from "../actions/types";
|
|
19
|
+
import { GROUPS_REDUCER_KEY } from "./reducerKeys";
|
|
20
20
|
|
|
21
21
|
const INITIAL_STATE = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
list: [],
|
|
23
|
+
publicList: [],
|
|
24
|
+
invites: [],
|
|
25
|
+
unreadCount: 0,
|
|
26
|
+
privateCount: 0,
|
|
27
|
+
recentlyArchived: {}, // Track recently archived with last message timestamp
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export default (state = INITIAL_STATE, action) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
31
|
+
switch (action.type) {
|
|
32
|
+
case LOGOUT:
|
|
33
|
+
case CHANGE_ROLE:
|
|
34
|
+
return INITIAL_STATE;
|
|
35
|
+
case UPDATE_CIRCLE_UNREAD: {
|
|
36
|
+
return { ...state, unreadCount: action.payload };
|
|
37
|
+
}
|
|
38
|
+
case CLEAR_SINGLE_CIRCLE_UNREAD: {
|
|
39
|
+
const growps = [...state.list];
|
|
40
|
+
let newCount = state.unreadCount;
|
|
41
|
+
if (!_.isEmpty(growps)) {
|
|
42
|
+
growps.forEach((g) => {
|
|
43
|
+
if (!g.Unread) {
|
|
44
|
+
g.Unread = {};
|
|
45
|
+
}
|
|
46
|
+
if (g.Id === action.payload.groupId) {
|
|
47
|
+
g.Unread[action.payload.userId] = 0;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
let counter = 0;
|
|
51
|
+
growps.forEach((element) => {
|
|
52
|
+
if (
|
|
53
|
+
!_.isUndefined(element.Unread) &&
|
|
54
|
+
!_.isEmpty(element.Unread) &&
|
|
55
|
+
!_.isUndefined(element.Unread[action.payload.userId])
|
|
56
|
+
) {
|
|
57
|
+
counter += element.Unread[action.payload.userId];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
newCount = counter;
|
|
61
|
+
}
|
|
62
|
+
return { ...state, list: growps, unreadCount: newCount };
|
|
63
|
+
}
|
|
64
|
+
case CIRCLE_INVITES_LOADED:
|
|
65
|
+
if (action.payload == null) {
|
|
66
|
+
return state;
|
|
67
|
+
}
|
|
68
|
+
return { ...state, invites: action.payload };
|
|
69
|
+
case CIRCLE_INVITES_UPDATED:
|
|
70
|
+
if (action.payload == null || action.payload.length === 0) {
|
|
71
|
+
return state;
|
|
72
|
+
}
|
|
73
|
+
let pInvites = [...state.invites];
|
|
74
|
+
if (pInvites === null) pInvites = [];
|
|
71
75
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
let pInvResult = _.unionWith(action.payload, pInvites, (v1, v2) => {
|
|
77
|
+
return v1 != null && v2 != null && v1.Id === v2.Id;
|
|
78
|
+
});
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// Check if this was recently archived
|
|
95
|
-
const archivedInfo = state.recentlyArchived[group.Id];
|
|
96
|
-
if (archivedInfo) {
|
|
97
|
-
// If there's a new message since archiving, allow it (auto-unarchived)
|
|
98
|
-
if (group.lastMessage && group.lastMessage.createdAt > archivedInfo.timestamp) {
|
|
99
|
-
// Remove from recently archived since it's been unarchived
|
|
100
|
-
delete state.recentlyArchived[group.Id];
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
// Otherwise filter it out (still archived)
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
return true;
|
|
107
|
-
});
|
|
108
|
-
return {
|
|
109
|
-
...state,
|
|
110
|
-
list: filteredList,
|
|
111
|
-
};
|
|
112
|
-
case CIRCLES_LOADED:
|
|
113
|
-
if (action.payload == null || action.payload.length === 0) {
|
|
114
|
-
return state;
|
|
115
|
-
}
|
|
116
|
-
let pGroups = state.list;
|
|
117
|
-
if (pGroups === null) pGroups = [];
|
|
80
|
+
pInvResult = _.filter(pInvResult, (group) => {
|
|
81
|
+
return group != null && !group.Deleted;
|
|
82
|
+
});
|
|
83
|
+
return { ...state, invites: pInvResult };
|
|
84
|
+
case PUBLIC_CIRCLES_LOAD_INITIALISE:
|
|
85
|
+
// console.log('PUBLIC_CIRCLES_LOAD_INITIALISE', action.payload);
|
|
86
|
+
if (action.payload == null) {
|
|
87
|
+
return state;
|
|
88
|
+
}
|
|
89
|
+
return { ...state, publicList: action.payload };
|
|
90
|
+
case CIRCLES_LOAD_INITIALISE:
|
|
91
|
+
if (action.payload == null) {
|
|
92
|
+
return state;
|
|
93
|
+
}
|
|
94
|
+
// Filter out recently archived items UNLESS they have new messages (auto-unarchived)
|
|
95
|
+
const filteredList = _.filter(action.payload, (group) => {
|
|
96
|
+
if (group == null || group.Deleted) return false;
|
|
118
97
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
98
|
+
// Check if this was recently archived
|
|
99
|
+
const archivedInfo = state.recentlyArchived[group.Id];
|
|
100
|
+
if (archivedInfo) {
|
|
101
|
+
// If there's a new message since archiving, allow it (auto-unarchived)
|
|
102
|
+
if (
|
|
103
|
+
group.lastMessage &&
|
|
104
|
+
group.lastMessage.createdAt > archivedInfo.timestamp
|
|
105
|
+
) {
|
|
106
|
+
// Remove from recently archived since it's been unarchived
|
|
107
|
+
delete state.recentlyArchived[group.Id];
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
// Otherwise filter it out (still archived)
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
return true;
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
...state,
|
|
117
|
+
list: filteredList,
|
|
118
|
+
};
|
|
119
|
+
case CIRCLES_LOADED:
|
|
120
|
+
if (action.payload == null || action.payload.length === 0) {
|
|
121
|
+
return state;
|
|
122
|
+
}
|
|
123
|
+
let pGroups = state.list;
|
|
124
|
+
if (pGroups === null) pGroups = [];
|
|
122
125
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
pResult = _.filter(pResult, group => {
|
|
127
|
-
if (group == null || group.Deleted) return false;
|
|
128
|
-
|
|
129
|
-
const archivedInfo = cleanedRecentlyArchived[group.Id];
|
|
130
|
-
if (archivedInfo) {
|
|
131
|
-
// Check for new messages that would trigger auto-unarchive
|
|
132
|
-
if (group.lastMessage && group.lastMessage.createdAt > archivedInfo.timestamp) {
|
|
133
|
-
delete cleanedRecentlyArchived[group.Id];
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
return true;
|
|
139
|
-
});
|
|
126
|
+
let pResult = _.unionWith(action.payload, pGroups, (v1, v2) => {
|
|
127
|
+
return v1 != null && v2 != null && v1.Id === v2.Id;
|
|
128
|
+
});
|
|
140
129
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
130
|
+
// Clean up recently archived based on new messages
|
|
131
|
+
const cleanedRecentlyArchived = { ...state.recentlyArchived };
|
|
132
|
+
|
|
133
|
+
pResult = _.filter(pResult, (group) => {
|
|
134
|
+
if (group == null || group.Deleted) return false;
|
|
135
|
+
|
|
136
|
+
const archivedInfo = cleanedRecentlyArchived[group.Id];
|
|
137
|
+
if (archivedInfo) {
|
|
138
|
+
// Check for new messages that would trigger auto-unarchive
|
|
139
|
+
if (
|
|
140
|
+
group.lastMessage &&
|
|
141
|
+
group.lastMessage.createdAt > archivedInfo.timestamp
|
|
142
|
+
) {
|
|
143
|
+
delete cleanedRecentlyArchived[group.Id];
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
return true;
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
...state,
|
|
153
|
+
list: pResult,
|
|
154
|
+
recentlyArchived: cleanedRecentlyArchived,
|
|
155
|
+
};
|
|
156
|
+
case CREATED_CIRCLE:
|
|
157
|
+
const zzzz = [...state.list];
|
|
158
|
+
zzzz.push(action.payload);
|
|
159
|
+
return { ...state, list: zzzz };
|
|
160
|
+
case CLEAR_CIRCLES:
|
|
161
|
+
return { list: [], invites: [] };
|
|
162
|
+
case ARCHIVE_CIRCLE:
|
|
163
|
+
// Remove the archived conversation from the list
|
|
164
|
+
const newList = state.list.filter((group) => group.Id !== action.payload);
|
|
165
|
+
|
|
166
|
+
// Find the group being archived to get its last message timestamp
|
|
167
|
+
const archivedGroup = state.list.find(
|
|
168
|
+
(group) => group.Id === action.payload,
|
|
169
|
+
);
|
|
170
|
+
const lastMessageTime =
|
|
171
|
+
archivedGroup?.lastMessage?.createdAt || Date.now();
|
|
172
|
+
|
|
173
|
+
// Track when it was archived with last message timestamp
|
|
174
|
+
const updatedRecentlyArchived = {
|
|
175
|
+
...state.recentlyArchived,
|
|
176
|
+
[action.payload]: {
|
|
177
|
+
timestamp: lastMessageTime,
|
|
178
|
+
archivedAt: Date.now(),
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// Clean up old archived entries (older than 5 minutes)
|
|
183
|
+
const fiveMinutesAgo = Date.now() - 5 * 60 * 1000;
|
|
184
|
+
Object.keys(updatedRecentlyArchived).forEach((key) => {
|
|
185
|
+
if (updatedRecentlyArchived[key].archivedAt < fiveMinutesAgo) {
|
|
186
|
+
delete updatedRecentlyArchived[key];
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
...state,
|
|
192
|
+
list: newList,
|
|
193
|
+
recentlyArchived: updatedRecentlyArchived,
|
|
194
|
+
};
|
|
195
|
+
case REHYDRATE:
|
|
196
|
+
if (!action.payload) return state;
|
|
197
|
+
if (action.payload[GROUPS_REDUCER_KEY]) {
|
|
198
|
+
if (action.payload[GROUPS_REDUCER_KEY].list == null) {
|
|
199
|
+
action.payload[GROUPS_REDUCER_KEY].list = [];
|
|
200
|
+
}
|
|
201
|
+
if (action.payload[GROUPS_REDUCER_KEY].invites == null) {
|
|
202
|
+
action.payload[GROUPS_REDUCER_KEY].invites = [];
|
|
203
|
+
}
|
|
204
|
+
if (action.payload[GROUPS_REDUCER_KEY].unreadCount == null) {
|
|
205
|
+
action.payload[GROUPS_REDUCER_KEY].unreadCount = 0;
|
|
206
|
+
}
|
|
207
|
+
if (action.payload[GROUPS_REDUCER_KEY].recentlyArchived == null) {
|
|
208
|
+
action.payload[GROUPS_REDUCER_KEY].recentlyArchived = {};
|
|
209
|
+
}
|
|
210
|
+
/* fixSelectedTimes(action.payload[GROUPS_REDUCER_KEY].list);
|
|
198
211
|
fixRepeatedTimes(action.payload[GROUPS_REDUCER_KEY].list); */
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
212
|
+
return action.payload[GROUPS_REDUCER_KEY];
|
|
213
|
+
}
|
|
214
|
+
return state;
|
|
215
|
+
default:
|
|
216
|
+
return state;
|
|
217
|
+
}
|
|
205
218
|
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
const values = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
featureKey: "circles",
|
|
3
|
+
entityKey: "circle",
|
|
4
|
+
entityName: "circle",
|
|
5
|
+
serviceKey: "circles",
|
|
6
|
+
permission: "circles",
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
reducerKey: "circles",
|
|
9
|
+
reducerKeyChats: "circleChats",
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
actionCircleKey: "CIRCLE",
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
screenNewCircle: "newCircle",
|
|
14
|
+
screenCircleDetails: "circleDetails",
|
|
15
|
+
screenEditCircle: "editCircle",
|
|
16
|
+
screenCirclePeopleContainer: "circlePeopleContainer",
|
|
17
|
+
screenCircleChat: "circleChat",
|
|
18
|
+
screenCircleChatList: "circleChatList",
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
notificationInvite: "CircleInvite",
|
|
21
|
+
notificationMessage: "CircleChat",
|
|
22
|
+
notificationDirectMessage: "CircleProfileChat",
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
textFeatureTitle: "Circles",
|
|
25
|
+
textAddMenuTitle: "Circle",
|
|
26
|
+
textEmptyGroups: "You aren't in any Circles",
|
|
27
|
+
textEmptyPeople: "Contacts will show here",
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
inviteKey: "circleInvite",
|
|
30
|
+
messageKey: "circleMessage",
|
|
31
|
+
chatRoute: "circleChat",
|
|
32
|
+
updateKeyUserCircles: "userCircles",
|
|
33
|
+
allowPublicKey: "circleAllowPublicCircles",
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
settings: {
|
|
36
|
+
allowAnyCreate: false,
|
|
37
|
+
},
|
|
38
38
|
};
|
|
39
39
|
exports.values = values;
|