@plusscommunities/pluss-core-app 7.0.1-beta.1 → 7.0.2-auth.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 (34) hide show
  1. package/dist/module/apis/fileActions.js +21 -28
  2. package/dist/module/apis/fileActions.js.map +1 -1
  3. package/dist/module/components/DocumentUploader.js +237 -0
  4. package/dist/module/components/DocumentUploader.js.map +1 -0
  5. package/dist/module/components/ImagePopup.js +42 -20
  6. package/dist/module/components/ImagePopup.js.map +1 -1
  7. package/dist/module/components/ImageUploader.js +50 -25
  8. package/dist/module/components/ImageUploader.js.map +1 -1
  9. package/dist/module/components/MediaPlayer.js +2 -2
  10. package/dist/module/components/MediaPlayer.js.map +1 -1
  11. package/dist/module/components/PlussChat.js +80 -6
  12. package/dist/module/components/PlussChat.js.map +1 -1
  13. package/dist/module/components/PlussChatMessage.js +41 -4
  14. package/dist/module/components/PlussChatMessage.js.map +1 -1
  15. package/dist/module/components/index.js +1 -0
  16. package/dist/module/components/index.js.map +1 -1
  17. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +2 -1
  18. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -1
  19. package/dist/module/config.js +6 -1
  20. package/dist/module/config.js.map +1 -1
  21. package/dist/module/session.js +2 -2
  22. package/dist/module/session.js.map +1 -1
  23. package/package.json +4 -1
  24. package/src/apis/fileActions.js +19 -27
  25. package/src/components/DocumentUploader.js +207 -0
  26. package/src/components/ImagePopup.js +41 -26
  27. package/src/components/ImageUploader.js +66 -28
  28. package/src/components/MediaPlayer.js +2 -2
  29. package/src/components/PlussChat.js +88 -2
  30. package/src/components/PlussChatMessage.js +40 -3
  31. package/src/components/index.js +1 -0
  32. package/src/components/react-native-expo-image-cropper/ExpoImageManipulator.js +1 -1
  33. package/src/config.js +5 -0
  34. package/src/session.js +2 -2
@@ -119,7 +119,8 @@ export default class PlussChatMessage extends React.Component {
119
119
  }
120
120
 
121
121
  renderReply() {
122
- if (!this.props.currentMessage || !this.props.currentMessage.replyingTo) {
122
+ // Don't show reply quote for deleted messages
123
+ if (!this.props.currentMessage || !this.props.currentMessage.replyingTo || this.props.currentMessage.deleted) {
123
124
  return null;
124
125
  }
125
126
  return (
@@ -134,6 +135,10 @@ export default class PlussChatMessage extends React.Component {
134
135
  }
135
136
 
136
137
  renderReplyButton() {
138
+ // Don't show reply button for deleted messages
139
+ if (this.props.currentMessage.deleted) {
140
+ return null;
141
+ }
137
142
  return (
138
143
  <TouchableOpacity style={styles[this.props.position].replyContainer} onPress={this.props.onPressReply}>
139
144
  <TextStyle type="button" style={{ color: this.props.colourBrandingMain }}>
@@ -143,6 +148,20 @@ export default class PlussChatMessage extends React.Component {
143
148
  );
144
149
  }
145
150
 
151
+ renderDeleteButton() {
152
+ // Only show delete button if handler is provided and for current user's messages that aren't already deleted
153
+ if (!this.props.onPressDelete || !this.isCurrentUser() || this.props.currentMessage.deleted) {
154
+ return null;
155
+ }
156
+ return (
157
+ <TouchableOpacity style={styles[this.props.position].deleteContainer} onPress={this.props.onPressDelete}>
158
+ <TextStyle type="button" style={{ color: this.props.colourBrandingMain }}>
159
+ Delete
160
+ </TextStyle>
161
+ </TouchableOpacity>
162
+ );
163
+ }
164
+
146
165
  render() {
147
166
  const sameUserAsLast = isSameUser(this.props.currentMessage, this.props.previousMessage);
148
167
  const sameUser = isSameUser(this.props.currentMessage, this.props.nextMessage);
@@ -166,7 +185,10 @@ export default class PlussChatMessage extends React.Component {
166
185
  <View>
167
186
  {this.renderReply()}
168
187
  {this.renderBubble()}
169
- {this.renderReplyButton()}
188
+ <View style={styles[this.props.position].actionButtons}>
189
+ {this.renderReplyButton()}
190
+ {this.renderDeleteButton()}
191
+ </View>
170
192
  </View>
171
193
  {this.props.position === 'right' ? this.renderAvatar() : null}
172
194
  </View>
@@ -216,6 +238,14 @@ const styles = {
216
238
  },
217
239
  replyContainer: {
218
240
  paddingLeft: 20,
241
+ paddingRight: 10,
242
+ },
243
+ deleteContainer: {
244
+ paddingLeft: 10,
245
+ },
246
+ actionButtons: {
247
+ flexDirection: 'row',
248
+ alignItems: 'center',
219
249
  },
220
250
  }),
221
251
  right: StyleSheet.create({
@@ -255,9 +285,16 @@ const styles = {
255
285
  textAlign: 'right',
256
286
  },
257
287
  replyContainer: {
258
- alignSelf: 'flex-end',
259
288
  paddingRight: 10,
260
289
  },
290
+ deleteContainer: {
291
+ paddingRight: 10,
292
+ },
293
+ actionButtons: {
294
+ flexDirection: 'row',
295
+ alignItems: 'center',
296
+ alignSelf: 'flex-end',
297
+ },
261
298
  }),
262
299
  };
263
300
 
@@ -47,6 +47,7 @@ export { default as LoadingStateWidget } from './LoadingStateWidget';
47
47
  export { default as Header } from './Header';
48
48
  export { default as LoadingIndicator } from './LoadingIndicator';
49
49
  export { default as ImageUploader } from './ImageUploader';
50
+ // export { default as DocumentUploader } from './DocumentUploader';
50
51
  export { default as ImageUploadProgress } from './ImageUploadProgress';
51
52
  export { default as UserListing } from './UserListing';
52
53
  export { default as PlussChat } from './PlussChat';
@@ -273,7 +273,7 @@ class ExpoImageManipulator extends Component {
273
273
  pinchGestureEnabled={false}
274
274
  >
275
275
  <AutoHeightImage
276
- style={{ backgroundColor: 'black' }}
276
+ style={{ backgroundColor: 'black', marginTop: cropInitialTop }}
277
277
  source={{ uri }}
278
278
  resizeMode={imageRatio >= 1 ? 'contain' : 'contain'}
279
279
  width={width}
package/src/config.js CHANGED
@@ -18,6 +18,11 @@ const CoreConfig = {
18
18
  strings: {},
19
19
  newEventDefaults: '',
20
20
  defaultAllowComments: true,
21
+ AuthStrategy: {
22
+ getAccessToken: async () => null,
23
+ getCurrentUserId: async () => null,
24
+ hasActiveSession: async () => false,
25
+ },
21
26
  },
22
27
  init: (environment, navigation) => {
23
28
  CoreConfig.env = environment;
package/src/session.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import _ from 'lodash';
2
2
  import axios from 'axios';
3
3
  import { Auth } from 'aws-amplify';
4
+ import Config from './config';
4
5
 
5
6
  export const getSessionTokenAWS = async prefix => {
6
- const data = await Auth.currentSession();
7
- const token = data.accessToken.jwtToken;
7
+ const token = await Config.env.AuthStrategy.getAccessToken();
8
8
  if (_.isUndefined(prefix)) return token;
9
9
  return `${prefix} ${token}`;
10
10
  };