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