@plusscommunities/pluss-circles-app-groups 1.2.2-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 +81 -0
- package/dist/module/actions/ChatActions.js.map +1 -0
- package/dist/module/actions/GroupActions.js +335 -0
- package/dist/module/actions/GroupActions.js.map +1 -0
- package/dist/module/actions/index.js +41 -0
- package/dist/module/actions/index.js.map +1 -0
- package/dist/module/actions/types.js +26 -0
- package/dist/module/actions/types.js.map +1 -0
- package/dist/module/assets/fonts.js +3 -0
- package/dist/module/assets/fonts.js.map +1 -0
- package/dist/module/components/chat/Chat.js +613 -0
- package/dist/module/components/chat/Chat.js.map +1 -0
- package/dist/module/components/chat/ChatList.js +557 -0
- package/dist/module/components/chat/ChatList.js.map +1 -0
- package/dist/module/components/chat/ContactsList.js +204 -0
- package/dist/module/components/chat/ContactsList.js.map +1 -0
- package/dist/module/components/chat/KioskPeoplePage.js +345 -0
- package/dist/module/components/chat/KioskPeoplePage.js.map +1 -0
- package/dist/module/components/chat/PeopleContainer.js +24 -0
- package/dist/module/components/chat/PeopleContainer.js.map +1 -0
- package/dist/module/components/chat/PeoplePage.js +438 -0
- package/dist/module/components/chat/PeoplePage.js.map +1 -0
- package/dist/module/components/common/index.js +26 -0
- package/dist/module/components/common/index.js.map +1 -0
- package/dist/module/components/events/EventInvitePopup.js +563 -0
- package/dist/module/components/events/EventInvitePopup.js.map +1 -0
- package/dist/module/components/groups/EditGroup.js +548 -0
- package/dist/module/components/groups/EditGroup.js.map +1 -0
- package/dist/module/components/groups/GroupDetails.js +388 -0
- package/dist/module/components/groups/GroupDetails.js.map +1 -0
- package/dist/module/components/groups/GroupsList.js +111 -0
- package/dist/module/components/groups/GroupsList.js.map +1 -0
- package/dist/module/components/groups/GroupsWidget.js +150 -0
- package/dist/module/components/groups/GroupsWidget.js.map +1 -0
- package/dist/module/components/groups/NewGroup.js +703 -0
- package/dist/module/components/groups/NewGroup.js.map +1 -0
- package/dist/module/components/groups/PublicGroup.js +131 -0
- package/dist/module/components/groups/PublicGroup.js.map +1 -0
- package/dist/module/components/groups/PublicGroupAction.js +296 -0
- package/dist/module/components/groups/PublicGroupAction.js.map +1 -0
- package/dist/module/components/notifications/GroupInvite.js +166 -0
- package/dist/module/components/notifications/GroupInvite.js.map +1 -0
- package/dist/module/components/notifications/GroupInviteAction.js +338 -0
- package/dist/module/components/notifications/GroupInviteAction.js.map +1 -0
- package/dist/module/components/notifications/GroupMessage.js +131 -0
- package/dist/module/components/notifications/GroupMessage.js.map +1 -0
- package/dist/module/components/takeover/TakeoverBackground.js +27 -0
- package/dist/module/components/takeover/TakeoverBackground.js.map +1 -0
- package/dist/module/config/index.js +9 -0
- package/dist/module/config/index.js.map +1 -0
- package/dist/module/core.config.js +17 -0
- package/dist/module/core.config.js.map +1 -0
- package/dist/module/feature.config.js +266 -0
- package/dist/module/feature.config.js.map +1 -0
- package/dist/module/index.js +27 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/js/Colors.js +17 -0
- package/dist/module/js/Colors.js.map +1 -0
- package/dist/module/js/NavigationService.js +8 -0
- package/dist/module/js/NavigationService.js.map +1 -0
- package/dist/module/js/Styles.js +3 -0
- package/dist/module/js/Styles.js.map +1 -0
- package/dist/module/js/circles/MapStateToDirectMessages.js +11 -0
- package/dist/module/js/circles/MapStateToDirectMessages.js.map +1 -0
- package/dist/module/js/index.js +21 -0
- package/dist/module/js/index.js.map +1 -0
- package/dist/module/reducers/ChatsReducer.js +82 -0
- package/dist/module/reducers/ChatsReducer.js.map +1 -0
- package/dist/module/reducers/GroupsReducer.js +174 -0
- package/dist/module/reducers/GroupsReducer.js.map +1 -0
- package/dist/module/reducers/reducerKeys.js +4 -0
- package/dist/module/reducers/reducerKeys.js.map +1 -0
- package/dist/module/values.config.default.js +33 -0
- package/dist/module/values.config.default.js.map +1 -0
- package/dist/module/values.config.groups.js +33 -0
- package/dist/module/values.config.groups.js.map +1 -0
- package/dist/module/values.config.js +33 -0
- package/dist/module/values.config.js.map +1 -0
- package/dist/module/webapi/circleActions.js +127 -0
- package/dist/module/webapi/circleActions.js.map +1 -0
- package/dist/module/webapi/helper.js +4 -0
- package/dist/module/webapi/helper.js.map +1 -0
- package/dist/module/webapi/index.js +7 -0
- package/dist/module/webapi/index.js.map +1 -0
- package/dist/module/webapi/messageActions.js +45 -0
- package/dist/module/webapi/messageActions.js.map +1 -0
- package/package.json +55 -0
- package/src/actions/ChatActions.js +92 -0
- package/src/actions/GroupActions.js +368 -0
- package/src/actions/index.js +43 -0
- package/src/actions/types.js +29 -0
- package/src/assets/fonts.js +3 -0
- package/src/components/chat/Chat.js +568 -0
- package/src/components/chat/ChatList.js +491 -0
- package/src/components/chat/ContactsList.js +168 -0
- package/src/components/chat/KioskPeoplePage.js +317 -0
- package/src/components/chat/PeopleContainer.js +21 -0
- package/src/components/chat/PeoplePage.js +418 -0
- package/src/components/common/index.js +26 -0
- package/src/components/events/EventInvitePopup.js +508 -0
- package/src/components/groups/EditGroup.js +486 -0
- package/src/components/groups/GroupDetails.js +335 -0
- package/src/components/groups/GroupsList.js +93 -0
- package/src/components/groups/GroupsWidget.js +134 -0
- package/src/components/groups/NewGroup.js +650 -0
- package/src/components/groups/PublicGroup.js +116 -0
- package/src/components/groups/PublicGroupAction.js +266 -0
- package/src/components/notifications/GroupInvite.js +154 -0
- package/src/components/notifications/GroupInviteAction.js +295 -0
- package/src/components/notifications/GroupMessage.js +114 -0
- package/src/components/takeover/TakeoverBackground.js +26 -0
- package/src/config/index.js +9 -0
- package/src/core.config.js +5 -0
- package/src/feature.config.js +274 -0
- package/src/index.js +24 -0
- package/src/js/Colors.js +17 -0
- package/src/js/NavigationService.js +9 -0
- package/src/js/Styles.js +3 -0
- package/src/js/circles/MapStateToDirectMessages.js +10 -0
- package/src/js/index.js +24 -0
- package/src/reducers/ChatsReducer.js +63 -0
- package/src/reducers/GroupsReducer.js +142 -0
- package/src/reducers/reducerKeys.js +4 -0
- package/src/values.config.default.js +39 -0
- package/src/values.config.groups.js +39 -0
- package/src/values.config.js +39 -0
- package/src/webapi/circleActions.js +104 -0
- package/src/webapi/helper.js +4 -0
- package/src/webapi/index.js +8 -0
- package/src/webapi/messageActions.js +39 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
// import * as PlussCore from '../../pluss-core/src';
|
|
3
|
+
import * as PlussCore from '@plusscommunities/pluss-core-app';
|
|
4
|
+
import { CIRCLE_INVITES_LOADED, CIRCLES_LOAD_INITIALISE, UPDATE_CIRCLE_UNREAD } from './actions/types';
|
|
5
|
+
import { getSessionTokenAWS, mapStateToDirectMessages } from './js';
|
|
6
|
+
import { circleActions } from './webapi';
|
|
7
|
+
import { refreshGroups } from './actions';
|
|
8
|
+
import { values } from './values.config';
|
|
9
|
+
|
|
10
|
+
export const Services = {
|
|
11
|
+
navigation: null,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const BaseComponents = {
|
|
15
|
+
NotificationBell: null,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const INVITE_KEY = values.inviteKey;
|
|
19
|
+
const MESSAGE_KEY = values.messageKey;
|
|
20
|
+
const CHAT_TYPE = values.notificationMessage;
|
|
21
|
+
const CHAT_ROUTE = values.chatRoute;
|
|
22
|
+
|
|
23
|
+
const getInvites = state => {
|
|
24
|
+
return state[values.reducerKey].invites.map(invite => {
|
|
25
|
+
invite.InviteType = INVITE_KEY;
|
|
26
|
+
invite.Timestamp = invite.CreatedTime;
|
|
27
|
+
return invite;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getMessages = state => {
|
|
32
|
+
const circles = state[values.reducerKey];
|
|
33
|
+
const { user } = state;
|
|
34
|
+
|
|
35
|
+
let messages = [];
|
|
36
|
+
if (user.uid != null) {
|
|
37
|
+
circles.list.forEach(element => {
|
|
38
|
+
if (
|
|
39
|
+
!element.Deleted &&
|
|
40
|
+
!_.isUndefined(element.Unread) &&
|
|
41
|
+
!_.isEmpty(element.Unread) &&
|
|
42
|
+
!_.isUndefined(element.Unread[user.uid]) &&
|
|
43
|
+
element.Unread[user.uid] > 0
|
|
44
|
+
) {
|
|
45
|
+
messages.push({
|
|
46
|
+
...element,
|
|
47
|
+
MessageType: MESSAGE_KEY,
|
|
48
|
+
Timestamp: element.Changed * 1000,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
circles.privateList.forEach(element => {
|
|
53
|
+
if (
|
|
54
|
+
!element.Deleted &&
|
|
55
|
+
!!element.PrivateChatUser &&
|
|
56
|
+
!_.isUndefined(element.Unread) &&
|
|
57
|
+
!_.isEmpty(element.Unread) &&
|
|
58
|
+
!_.isUndefined(element.Unread[user.uid]) &&
|
|
59
|
+
element.Unread[user.uid] > 0
|
|
60
|
+
) {
|
|
61
|
+
messages.push({
|
|
62
|
+
...element,
|
|
63
|
+
isPrivate: true,
|
|
64
|
+
MessageType: MESSAGE_KEY,
|
|
65
|
+
Timestamp: element.Changed * 1000,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return _.orderBy(messages, 'Changed', 'desc');
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const getCount = state => {
|
|
75
|
+
const circles = state[values.reducerKey];
|
|
76
|
+
const { user } = state;
|
|
77
|
+
const inviteCount = circles?.invites?.length || 0;
|
|
78
|
+
|
|
79
|
+
let circleUnread = 0;
|
|
80
|
+
if (user.uid != null) {
|
|
81
|
+
circles.list.forEach(element => {
|
|
82
|
+
if (
|
|
83
|
+
!_.isUndefined(element.Unread) &&
|
|
84
|
+
!_.isEmpty(element.Unread) &&
|
|
85
|
+
!_.isUndefined(element.Unread[user.uid]) &&
|
|
86
|
+
element.Unread[user.uid] > 0
|
|
87
|
+
) {
|
|
88
|
+
circleUnread += 1;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
circles.privateList.forEach(element => {
|
|
92
|
+
if (
|
|
93
|
+
!!element.PrivateChatUser &&
|
|
94
|
+
!_.isUndefined(element.Unread) &&
|
|
95
|
+
!_.isEmpty(element.Unread) &&
|
|
96
|
+
!_.isUndefined(element.Unread[user.uid]) &&
|
|
97
|
+
element.Unread[user.uid] > 0
|
|
98
|
+
) {
|
|
99
|
+
circleUnread += 1;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// console.log('circles', inviteCount, circleUnread);
|
|
105
|
+
return inviteCount + circleUnread;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const getUserCircles = async (props, store) => {
|
|
109
|
+
// Get user circles
|
|
110
|
+
const { data } = await circleActions.getGroups();
|
|
111
|
+
store.dispatch({
|
|
112
|
+
type: CIRCLES_LOAD_INITIALISE,
|
|
113
|
+
payload: data.Items,
|
|
114
|
+
});
|
|
115
|
+
// Update unread
|
|
116
|
+
if (!_.isEmpty(data.Items)) {
|
|
117
|
+
let counter = 0;
|
|
118
|
+
data.Items.forEach(element => {
|
|
119
|
+
if (
|
|
120
|
+
!element.Deleted &&
|
|
121
|
+
!_.isUndefined(element.Unread) &&
|
|
122
|
+
!_.isEmpty(element.Unread) &&
|
|
123
|
+
!_.isUndefined(element.Unread[props.user.uid])
|
|
124
|
+
) {
|
|
125
|
+
counter += element.Unread[props.user.uid];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
store.dispatch({
|
|
129
|
+
type: UPDATE_CIRCLE_UNREAD,
|
|
130
|
+
payload: counter,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const fetchAll = async (props, store) => {
|
|
136
|
+
try {
|
|
137
|
+
// Get circle invites
|
|
138
|
+
const token = await getSessionTokenAWS('Bearer');
|
|
139
|
+
const { data } = await circleActions.getGroupInvites(props.user.uid, token);
|
|
140
|
+
store.dispatch({
|
|
141
|
+
type: CIRCLE_INVITES_LOADED,
|
|
142
|
+
payload: data.Items,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
await getUserCircles(props, store);
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.error('pluss-circles fetch all', error);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const fetchToaster = (props, store) => {
|
|
152
|
+
try {
|
|
153
|
+
const { notification } = props;
|
|
154
|
+
if (notification.data.type === CHAT_TYPE || notification.data.type === values.notificationDirectMessage) {
|
|
155
|
+
setTimeout(async () => {
|
|
156
|
+
await getUserCircles(props, store);
|
|
157
|
+
}, 100);
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
} catch (error) {
|
|
161
|
+
console.error('pluss-circles fetch toaster', error);
|
|
162
|
+
}
|
|
163
|
+
return false;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const handle = (notification, props, currentRoute) => {
|
|
167
|
+
if (notification.data.type === CHAT_TYPE) {
|
|
168
|
+
if (currentRoute !== CHAT_ROUTE) props.displayToast(notification);
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
return false;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const navigate = (notification, currentRoute, refreshFunc, navigateFunc) => {
|
|
175
|
+
if (notification.data.type === CHAT_TYPE) {
|
|
176
|
+
const prop = {
|
|
177
|
+
chat: {
|
|
178
|
+
key: notification.data.key,
|
|
179
|
+
Id: notification.data.key,
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
if (currentRoute === CHAT_ROUTE) {
|
|
183
|
+
refreshFunc(prop);
|
|
184
|
+
} else {
|
|
185
|
+
navigateFunc(CHAT_ROUTE, prop);
|
|
186
|
+
}
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
return false;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const openDirectMessage = (site, targetUserId, chat, loadingChanged) => {
|
|
193
|
+
if (chat) {
|
|
194
|
+
Services.navigation.navigate(values.screenCircleChat, { chat });
|
|
195
|
+
} else {
|
|
196
|
+
loadingChanged && loadingChanged(true);
|
|
197
|
+
circleActions.getDirect(site, targetUserId).then(res => {
|
|
198
|
+
Services.navigation.navigate(values.screenCircleChat, { chat: res.data });
|
|
199
|
+
loadingChanged && loadingChanged(false);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const FeatureConfig = {
|
|
205
|
+
key: values.featureKey,
|
|
206
|
+
title: values.textFeatureTitle,
|
|
207
|
+
gridMenu: {
|
|
208
|
+
icon: 'groups',
|
|
209
|
+
viewBox: '0 0 30 30',
|
|
210
|
+
navigate: values.screenCirclePeopleContainer,
|
|
211
|
+
options: {
|
|
212
|
+
onlyGroups: true,
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
addMenu: {
|
|
216
|
+
order: 5,
|
|
217
|
+
icon: 'groups',
|
|
218
|
+
title: values.textAddMenuTitle,
|
|
219
|
+
navigate: values.screenNewCircle,
|
|
220
|
+
visibleExps: values.settings.allowAnyCreate
|
|
221
|
+
? { type: 'feature', value: values.featureKey }
|
|
222
|
+
: {
|
|
223
|
+
type: 'and',
|
|
224
|
+
exps: [
|
|
225
|
+
{ type: 'feature', value: values.featureKey },
|
|
226
|
+
{ type: 'permission', value: values.permission },
|
|
227
|
+
],
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
notification: {
|
|
231
|
+
invite: {
|
|
232
|
+
key: INVITE_KEY,
|
|
233
|
+
getInvites,
|
|
234
|
+
},
|
|
235
|
+
message: {
|
|
236
|
+
key: MESSAGE_KEY,
|
|
237
|
+
getMessages,
|
|
238
|
+
},
|
|
239
|
+
getCount,
|
|
240
|
+
fetchAll,
|
|
241
|
+
fetchToaster,
|
|
242
|
+
handle,
|
|
243
|
+
navigate,
|
|
244
|
+
},
|
|
245
|
+
messaging: {
|
|
246
|
+
openDirectMessage,
|
|
247
|
+
mapStateToDirectMessages,
|
|
248
|
+
refreshChats: refreshGroups,
|
|
249
|
+
},
|
|
250
|
+
hideTabBar: [values.screenNewCircle, values.screenCircleDetails, values.screenEditCircle],
|
|
251
|
+
env: {
|
|
252
|
+
baseStage: '',
|
|
253
|
+
baseAPIUrl: '',
|
|
254
|
+
hasGradientHeader: false,
|
|
255
|
+
defaultProfileImage: '',
|
|
256
|
+
tinyChatDefault: '',
|
|
257
|
+
baseUploadsUrl: '',
|
|
258
|
+
allowMediaDownload: false,
|
|
259
|
+
allowMediaSharing: false,
|
|
260
|
+
awsUploadsBucket: '',
|
|
261
|
+
awsStorageBucket: '',
|
|
262
|
+
preferredSite: '',
|
|
263
|
+
strings: {},
|
|
264
|
+
newEventDefaults: '',
|
|
265
|
+
defaultAllowComments: true,
|
|
266
|
+
},
|
|
267
|
+
init: (environment, navigation, notificationBell) => {
|
|
268
|
+
FeatureConfig.env = environment;
|
|
269
|
+
Services.navigation = navigation;
|
|
270
|
+
BaseComponents.NotificationBell = notificationBell;
|
|
271
|
+
PlussCore.Config.init(environment, navigation);
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
export default FeatureConfig;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import NewGroup from './components/groups/NewGroup';
|
|
2
|
+
import GroupDetails from './components/groups/GroupDetails';
|
|
3
|
+
import EditGroup from './components/groups/EditGroup';
|
|
4
|
+
import PeopleContainer from './components/chat/PeopleContainer';
|
|
5
|
+
import Chat from './components/chat/Chat';
|
|
6
|
+
import ChatList from './components/chat/ChatList';
|
|
7
|
+
import GroupsReducer from './reducers/GroupsReducer';
|
|
8
|
+
import ChatsReducer from './reducers/ChatsReducer';
|
|
9
|
+
import { values } from './values.config';
|
|
10
|
+
|
|
11
|
+
export const Reducers = { [values.reducerKey]: GroupsReducer, [values.reducerKeyChats]: ChatsReducer };
|
|
12
|
+
export const Screens = {
|
|
13
|
+
[values.screenNewCircle]: NewGroup,
|
|
14
|
+
[values.screenCircleDetails]: GroupDetails,
|
|
15
|
+
[values.screenEditCircle]: EditGroup,
|
|
16
|
+
[values.screenCirclePeopleContainer]: PeopleContainer,
|
|
17
|
+
[values.screenCircleChat]: Chat,
|
|
18
|
+
[values.screenCircleChatList]: ChatList,
|
|
19
|
+
};
|
|
20
|
+
export { default as Config } from './feature.config';
|
|
21
|
+
export { default as WidgetSmall } from './components/groups/GroupsWidget';
|
|
22
|
+
export { default as WidgetLarge } from './components/groups/GroupsList';
|
|
23
|
+
export { default as NotificationInvite } from './components/notifications/GroupInvite';
|
|
24
|
+
export { default as NotificationMessage } from './components/notifications/GroupMessage';
|
package/src/js/Colors.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Colours } from '../core.config';
|
|
2
|
+
|
|
3
|
+
export const getMainBrandingColourFromState = Colours.getMainBrandingColourFromState;
|
|
4
|
+
export const getLightBrandingColourFromState = Colours.getLightBrandingColourFromState;
|
|
5
|
+
export const LINEGREY = Colours.LINEGREY;
|
|
6
|
+
export const TEXT_DARKEST = Colours.TEXT_DARKEST;
|
|
7
|
+
export const TEXT_DARK = Colours.TEXT_DARK;
|
|
8
|
+
export const TEXT_MID = Colours.TEXT_MID;
|
|
9
|
+
export const TEXT_LIGHT = Colours.TEXT_LIGHT;
|
|
10
|
+
export const TEXT_LIGHTER = Colours.TEXT_LIGHTER;
|
|
11
|
+
export const TEXT_BLUEGREY = Colours.TEXT_BLUEGREY;
|
|
12
|
+
export const COLOUR_GREEN = Colours.COLOUR_GREEN;
|
|
13
|
+
export const COLOUR_TRANSPARENT = Colours.COLOUR_TRANSPARENT;
|
|
14
|
+
export const COLOUR_TEAL = Colours.COLOUR_TEAL;
|
|
15
|
+
export const COLOUR_PURPLE = Colours.COLOUR_PURPLE;
|
|
16
|
+
export const COLOUR_TANGERINE = Colours.COLOUR_TANGERINE;
|
|
17
|
+
export const COLOUR_DUSK = Colours.COLOUR_DUSK;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Services } from '../feature.config';
|
|
2
|
+
|
|
3
|
+
const navService = {
|
|
4
|
+
navigate: (routeName, params) => Services.navigation.navigate(routeName, params),
|
|
5
|
+
goBack: routeName => Services.navigation.goBack(routeName),
|
|
6
|
+
getParentRoute: () => Services.navigation.getParentRoute(),
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default navService;
|
package/src/js/Styles.js
ADDED
package/src/js/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Session, Helper } from '../core.config';
|
|
2
|
+
import mapStateToDirectMessages from './circles/MapStateToDirectMessages';
|
|
3
|
+
|
|
4
|
+
// Session
|
|
5
|
+
export const authedFunction = Session.authedFunction;
|
|
6
|
+
export const getSessionTokenAWS = Session.getSessionTokenAWS;
|
|
7
|
+
export const getSessionUidAWS = Session.getSessionUidAWS;
|
|
8
|
+
|
|
9
|
+
// Helper
|
|
10
|
+
export const getFirstName = Helper.getFirstName;
|
|
11
|
+
export const getFileName = Helper.getFileName;
|
|
12
|
+
export const getImageSource = Helper.getImageSource;
|
|
13
|
+
export const StatusBarHeight = Helper.StatusBarHeight;
|
|
14
|
+
export const getPluralS = Helper.getPluralS;
|
|
15
|
+
export const getShadowStyle = Helper.getShadowStyle;
|
|
16
|
+
export const getSite = Helper.getSite;
|
|
17
|
+
export const getSiteSettingFromState = Helper.getSiteSettingFromState;
|
|
18
|
+
export const getValueOrDefault = Helper.getValueOrDefault;
|
|
19
|
+
export const usersToSearchResult = Helper.usersToSearchResult;
|
|
20
|
+
export const searchUsers = Helper.searchUsers;
|
|
21
|
+
|
|
22
|
+
export { mapStateToDirectMessages };
|
|
23
|
+
|
|
24
|
+
export * from './Colors';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { REHYDRATE } from 'redux-persist';
|
|
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';
|
|
12
|
+
|
|
13
|
+
const INITIAL_STATE = {
|
|
14
|
+
selectedChatKey: null,
|
|
15
|
+
list: [],
|
|
16
|
+
messages: {},
|
|
17
|
+
unreadCount: 0,
|
|
18
|
+
blockedUsers: {},
|
|
19
|
+
};
|
|
20
|
+
|
|
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 };
|
|
36
|
+
|
|
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);
|
|
55
|
+
fixRepeatedTimes(action.payload[CHAT_REDUCER_KEY].list); */
|
|
56
|
+
return action.payload[CHAT_REDUCER_KEY];
|
|
57
|
+
}
|
|
58
|
+
return state;
|
|
59
|
+
|
|
60
|
+
default:
|
|
61
|
+
return state;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/* eslint-disable no-param-reassign */
|
|
2
|
+
/* eslint-disable no-case-declarations */
|
|
3
|
+
import { REHYDRATE } from 'redux-persist';
|
|
4
|
+
import _ from 'lodash';
|
|
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
|
+
} from '../actions/types';
|
|
18
|
+
import { GROUPS_REDUCER_KEY } from './reducerKeys';
|
|
19
|
+
|
|
20
|
+
const INITIAL_STATE = {
|
|
21
|
+
list: [],
|
|
22
|
+
publicList: [],
|
|
23
|
+
privateList: [],
|
|
24
|
+
invites: [],
|
|
25
|
+
unreadCount: 0,
|
|
26
|
+
privateCount: 0,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default (state = INITIAL_STATE, action) => {
|
|
30
|
+
switch (action.type) {
|
|
31
|
+
case LOGOUT:
|
|
32
|
+
case CHANGE_ROLE:
|
|
33
|
+
return INITIAL_STATE;
|
|
34
|
+
case UPDATE_CIRCLE_UNREAD: {
|
|
35
|
+
return { ...state, unreadCount: action.payload };
|
|
36
|
+
}
|
|
37
|
+
case CLEAR_SINGLE_CIRCLE_UNREAD: {
|
|
38
|
+
const growps = [...state.list];
|
|
39
|
+
let newCount = state.unreadCount;
|
|
40
|
+
if (!_.isEmpty(growps)) {
|
|
41
|
+
growps.forEach(g => {
|
|
42
|
+
if (!g.Unread) {
|
|
43
|
+
g.Unread = {};
|
|
44
|
+
}
|
|
45
|
+
if (g.Id === action.payload.groupId) {
|
|
46
|
+
g.Unread[action.payload.userId] = 0;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
let counter = 0;
|
|
50
|
+
growps.forEach(element => {
|
|
51
|
+
if (!_.isUndefined(element.Unread) && !_.isEmpty(element.Unread) && !_.isUndefined(element.Unread[action.payload.userId])) {
|
|
52
|
+
counter += element.Unread[action.payload.userId];
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
newCount = counter;
|
|
56
|
+
}
|
|
57
|
+
return { ...state, list: growps, unreadCount: newCount };
|
|
58
|
+
}
|
|
59
|
+
case CIRCLE_INVITES_LOADED:
|
|
60
|
+
if (action.payload == null) {
|
|
61
|
+
return state;
|
|
62
|
+
}
|
|
63
|
+
return { ...state, invites: action.payload };
|
|
64
|
+
case CIRCLE_INVITES_UPDATED:
|
|
65
|
+
if (action.payload == null || action.payload.length === 0) {
|
|
66
|
+
return state;
|
|
67
|
+
}
|
|
68
|
+
let pInvites = [...state.invites];
|
|
69
|
+
if (pInvites === null) pInvites = [];
|
|
70
|
+
|
|
71
|
+
let pInvResult = _.unionWith(action.payload, pInvites, (v1, v2) => {
|
|
72
|
+
return v1 != null && v2 != null && v1.Id === v2.Id;
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
pInvResult = _.filter(pInvResult, group => {
|
|
76
|
+
return group != null && !group.Deleted;
|
|
77
|
+
});
|
|
78
|
+
return { ...state, invites: pInvResult };
|
|
79
|
+
case PUBLIC_CIRCLES_LOAD_INITIALISE:
|
|
80
|
+
// console.log('PUBLIC_CIRCLES_LOAD_INITIALISE', action.payload);
|
|
81
|
+
if (action.payload == null) {
|
|
82
|
+
return state;
|
|
83
|
+
}
|
|
84
|
+
return { ...state, publicList: action.payload };
|
|
85
|
+
case CIRCLES_LOAD_INITIALISE:
|
|
86
|
+
if (action.payload == null) {
|
|
87
|
+
return state;
|
|
88
|
+
}
|
|
89
|
+
// return { ...state, list: action.payload };
|
|
90
|
+
return {
|
|
91
|
+
...state,
|
|
92
|
+
list: _.filter(action.payload, group => {
|
|
93
|
+
return group != null && !group.Deleted;
|
|
94
|
+
}),
|
|
95
|
+
};
|
|
96
|
+
case CIRCLES_LOADED:
|
|
97
|
+
if (action.payload == null || action.payload.length === 0) {
|
|
98
|
+
return state;
|
|
99
|
+
}
|
|
100
|
+
let pGroups = state.list;
|
|
101
|
+
if (pGroups === null) pGroups = [];
|
|
102
|
+
|
|
103
|
+
let pResult = _.unionWith(action.payload, pGroups, (v1, v2) => {
|
|
104
|
+
return v1 != null && v2 != null && v1.Id === v2.Id;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
pResult = _.filter(pResult, group => {
|
|
108
|
+
return group != null && !group.Deleted;
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
...state,
|
|
112
|
+
list: _.filter(pResult, group => {
|
|
113
|
+
return group != null && !group.Deleted;
|
|
114
|
+
}),
|
|
115
|
+
};
|
|
116
|
+
case CREATED_CIRCLE:
|
|
117
|
+
const zzzz = [...state.list];
|
|
118
|
+
zzzz.push(action.payload);
|
|
119
|
+
return { ...state, list: zzzz };
|
|
120
|
+
case CLEAR_CIRCLES:
|
|
121
|
+
return { list: [], invites: [] };
|
|
122
|
+
case REHYDRATE:
|
|
123
|
+
if (!action.payload) return state;
|
|
124
|
+
if (action.payload[GROUPS_REDUCER_KEY]) {
|
|
125
|
+
if (action.payload[GROUPS_REDUCER_KEY].list == null) {
|
|
126
|
+
action.payload[GROUPS_REDUCER_KEY].list = [];
|
|
127
|
+
}
|
|
128
|
+
if (action.payload[GROUPS_REDUCER_KEY].invites == null) {
|
|
129
|
+
action.payload[GROUPS_REDUCER_KEY].invites = [];
|
|
130
|
+
}
|
|
131
|
+
if (action.payload[GROUPS_REDUCER_KEY].unreadCount == null) {
|
|
132
|
+
action.payload[GROUPS_REDUCER_KEY].unreadCount = 0;
|
|
133
|
+
}
|
|
134
|
+
/* fixSelectedTimes(action.payload[GROUPS_REDUCER_KEY].list);
|
|
135
|
+
fixRepeatedTimes(action.payload[GROUPS_REDUCER_KEY].list); */
|
|
136
|
+
return action.payload[GROUPS_REDUCER_KEY];
|
|
137
|
+
}
|
|
138
|
+
return state;
|
|
139
|
+
default:
|
|
140
|
+
return state;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const values = {
|
|
2
|
+
featureKey: 'circles',
|
|
3
|
+
entityKey: 'circle',
|
|
4
|
+
entityName: 'circle',
|
|
5
|
+
serviceKey: 'circles',
|
|
6
|
+
permission: 'circles',
|
|
7
|
+
|
|
8
|
+
reducerKey: 'circles',
|
|
9
|
+
reducerKeyChats: 'circleChats',
|
|
10
|
+
|
|
11
|
+
actionCircleKey: 'CIRCLE',
|
|
12
|
+
|
|
13
|
+
screenNewCircle: 'newCircle',
|
|
14
|
+
screenCircleDetails: 'circleDetails',
|
|
15
|
+
screenEditCircle: 'editCircle',
|
|
16
|
+
screenCirclePeopleContainer: 'circlePeopleContainer',
|
|
17
|
+
screenCircleChat: 'circleChat',
|
|
18
|
+
screenCircleChatList: 'circleChatList',
|
|
19
|
+
|
|
20
|
+
notificationInvite: 'CircleInvite',
|
|
21
|
+
notificationMessage: 'CircleChat',
|
|
22
|
+
notificationDirectMessage: 'CircleProfileChat',
|
|
23
|
+
|
|
24
|
+
textFeatureTitle: 'Circles',
|
|
25
|
+
textAddMenuTitle: 'Circle',
|
|
26
|
+
textEmptyGroups: "You aren't in any Circles",
|
|
27
|
+
textEmptyPeople: 'Contacts will show here',
|
|
28
|
+
|
|
29
|
+
inviteKey: 'circleInvite',
|
|
30
|
+
messageKey: 'circleMessage',
|
|
31
|
+
chatRoute: 'circleChat',
|
|
32
|
+
updateKeyUserCircles: 'userCircles',
|
|
33
|
+
allowPublicKey: 'circleAllowPublicCircles',
|
|
34
|
+
|
|
35
|
+
settings: {
|
|
36
|
+
allowAnyCreate: false,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
exports.values = values;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const values = {
|
|
2
|
+
featureKey: 'groups',
|
|
3
|
+
entityKey: 'group',
|
|
4
|
+
entityName: 'group',
|
|
5
|
+
serviceKey: 'groups',
|
|
6
|
+
permission: 'groups',
|
|
7
|
+
|
|
8
|
+
reducerKey: 'groups',
|
|
9
|
+
reducerKeyChats: 'groupChats',
|
|
10
|
+
|
|
11
|
+
actionCircleKey: 'GROUP',
|
|
12
|
+
|
|
13
|
+
screenNewCircle: 'newGroup',
|
|
14
|
+
screenCircleDetails: 'groupDetails',
|
|
15
|
+
screenEditCircle: 'editGroup',
|
|
16
|
+
screenCirclePeopleContainer: 'groupPeopleContainer',
|
|
17
|
+
screenCircleChat: 'groupChat',
|
|
18
|
+
screenCircleChatList: 'groupChatList',
|
|
19
|
+
|
|
20
|
+
notificationInvite: 'GroupInvite',
|
|
21
|
+
notificationMessage: 'GroupChat',
|
|
22
|
+
notificationDirectMessage: 'GroupProfileChat',
|
|
23
|
+
|
|
24
|
+
textFeatureTitle: 'Groups',
|
|
25
|
+
textAddMenuTitle: 'Group',
|
|
26
|
+
textEmptyGroups: "You aren't in any Groups",
|
|
27
|
+
textEmptyPeople: 'Contacts will show here',
|
|
28
|
+
|
|
29
|
+
inviteKey: 'groupInvite',
|
|
30
|
+
messageKey: 'groupMessage',
|
|
31
|
+
chatRoute: 'groupChat',
|
|
32
|
+
updateKeyUserCircles: 'userGroups',
|
|
33
|
+
allowPublicKey: 'groupAllowPublicGroups',
|
|
34
|
+
|
|
35
|
+
settings: {
|
|
36
|
+
allowAnyCreate: true,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
exports.values = values;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const values = {
|
|
2
|
+
featureKey: 'groups',
|
|
3
|
+
entityKey: 'group',
|
|
4
|
+
entityName: 'group',
|
|
5
|
+
serviceKey: 'groups',
|
|
6
|
+
permission: 'groups',
|
|
7
|
+
|
|
8
|
+
reducerKey: 'groups',
|
|
9
|
+
reducerKeyChats: 'groupChats',
|
|
10
|
+
|
|
11
|
+
actionCircleKey: 'GROUP',
|
|
12
|
+
|
|
13
|
+
screenNewCircle: 'newGroup',
|
|
14
|
+
screenCircleDetails: 'groupDetails',
|
|
15
|
+
screenEditCircle: 'editGroup',
|
|
16
|
+
screenCirclePeopleContainer: 'groupPeopleContainer',
|
|
17
|
+
screenCircleChat: 'groupChat',
|
|
18
|
+
screenCircleChatList: 'groupChatList',
|
|
19
|
+
|
|
20
|
+
notificationInvite: 'GroupInvite',
|
|
21
|
+
notificationMessage: 'GroupChat',
|
|
22
|
+
notificationDirectMessage: 'GroupProfileChat',
|
|
23
|
+
|
|
24
|
+
textFeatureTitle: 'Groups',
|
|
25
|
+
textAddMenuTitle: 'Group',
|
|
26
|
+
textEmptyGroups: "You aren't in any Groups",
|
|
27
|
+
textEmptyPeople: 'Contacts will show here',
|
|
28
|
+
|
|
29
|
+
inviteKey: 'groupInvite',
|
|
30
|
+
messageKey: 'groupMessage',
|
|
31
|
+
chatRoute: 'groupChat',
|
|
32
|
+
updateKeyUserCircles: 'userGroups',
|
|
33
|
+
allowPublicKey: 'groupAllowPublicGroups',
|
|
34
|
+
|
|
35
|
+
settings: {
|
|
36
|
+
allowAnyCreate: true,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
exports.values = values;
|