@plusscommunities/pluss-core-app 6.0.8-auth.0 → 6.0.8-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/FollowerActions.js.map +1 -1
- package/dist/module/actions/MediaActions.js.map +1 -1
- package/dist/module/actions/ResidentActions.js.map +1 -1
- package/dist/module/actions/UserActions.js.map +1 -1
- package/dist/module/actions/UserSettingsActions.js.map +1 -1
- package/dist/module/actions/index.js.map +1 -1
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/analyticsActions.js.map +1 -1
- package/dist/module/apis/contactActions.js.map +1 -1
- package/dist/module/apis/eventActions.js.map +1 -1
- package/dist/module/apis/fileActions.js +28 -21
- package/dist/module/apis/fileActions.js.map +1 -1
- package/dist/module/apis/followerActions.js.map +1 -1
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/notificationActions.js.map +1 -1
- package/dist/module/apis/profileActions.js.map +1 -1
- package/dist/module/apis/reactionActions.js.map +1 -1
- package/dist/module/apis/stringActions.js.map +1 -1
- package/dist/module/apis/typeActions.js.map +1 -1
- package/dist/module/apis/userActions.js.map +1 -1
- package/dist/module/colours.js.map +1 -1
- package/dist/module/components/AddButton.js.map +1 -1
- package/dist/module/components/AddToCalendarButton.js +5 -4
- package/dist/module/components/AddToCalendarButton.js.map +1 -1
- package/dist/module/components/Attachment.js.map +1 -1
- package/dist/module/components/AudienceSelectorLauncher.js +3 -3
- package/dist/module/components/AudienceSelectorLauncher.js.map +1 -1
- package/dist/module/components/AudienceSelectorPage.js +3 -3
- package/dist/module/components/AudienceSelectorPage.js.map +1 -1
- package/dist/module/components/AutoOffsetImage.js +5 -3
- package/dist/module/components/AutoOffsetImage.js.map +1 -1
- package/dist/module/components/BackButton.js.map +1 -1
- package/dist/module/components/CategoryTabs.js.map +1 -1
- package/dist/module/components/CommentReply.js +3 -3
- package/dist/module/components/CommentReply.js.map +1 -1
- package/dist/module/components/CommentSection.js +4 -3
- package/dist/module/components/CommentSection.js.map +1 -1
- package/dist/module/components/ConfirmPopup.js.map +1 -1
- package/dist/module/components/ConfirmationPopup.js.map +1 -1
- package/dist/module/components/DropDownItem.js +3 -3
- package/dist/module/components/DropDownItem.js.map +1 -1
- package/dist/module/components/DropDownMenu.js +3 -3
- package/dist/module/components/DropDownMenu.js.map +1 -1
- package/dist/module/components/EmptyStateMain.js.map +1 -1
- package/dist/module/components/EmptyStateWidget.js.map +1 -1
- package/dist/module/components/FontScaleButton.js.map +1 -1
- package/dist/module/components/FontScalePopup.js.map +1 -1
- package/dist/module/components/Forbidden.js +58 -0
- package/dist/module/components/Forbidden.js.map +1 -0
- package/dist/module/components/FormCard.js.map +1 -1
- package/dist/module/components/FormCardSection.js.map +1 -1
- package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -1
- package/dist/module/components/FormattedText.js +3 -3
- package/dist/module/components/FormattedText.js.map +1 -1
- package/dist/module/components/GenericInput.js.map +1 -1
- package/dist/module/components/GenericInputSection.js +1 -1
- package/dist/module/components/GenericInputSection.js.map +1 -1
- package/dist/module/components/Header.js.map +1 -1
- package/dist/module/components/ImagePopup.js +3 -3
- package/dist/module/components/ImagePopup.js.map +1 -1
- package/dist/module/components/ImageUploadProgress.js +3 -3
- package/dist/module/components/ImageUploadProgress.js.map +1 -1
- package/dist/module/components/ImageUploader.js +35 -26
- package/dist/module/components/ImageUploader.js.map +1 -1
- package/dist/module/components/InlineButton.js.map +1 -1
- package/dist/module/components/Input.js +3 -3
- package/dist/module/components/Input.js.map +1 -1
- package/dist/module/components/LoadingCircles.js +4 -3
- package/dist/module/components/LoadingCircles.js.map +1 -1
- package/dist/module/components/LoadingIndicator.js +3 -3
- package/dist/module/components/LoadingIndicator.js.map +1 -1
- package/dist/module/components/LoadingStateWidget.js.map +1 -1
- package/dist/module/components/MediaPlayer.js +20 -32
- package/dist/module/components/MediaPlayer.js.map +1 -1
- package/dist/module/components/MiddlePopup.js.map +1 -1
- package/dist/module/components/PDFPopup.js +4 -3
- package/dist/module/components/PDFPopup.js.map +1 -1
- package/dist/module/components/PlussChat.js +5 -4
- package/dist/module/components/PlussChat.js.map +1 -1
- package/dist/module/components/PlussChatMessage.js +1 -1
- package/dist/module/components/PlussChatMessage.js.map +1 -1
- package/dist/module/components/PlussChatTime.js.map +1 -1
- package/dist/module/components/Popup.js.map +1 -1
- package/dist/module/components/PopupMenu.js.map +1 -1
- package/dist/module/components/PositionedImage.js +4 -4
- package/dist/module/components/PositionedImage.js.map +1 -1
- package/dist/module/components/ProfilePic.js +1 -0
- package/dist/module/components/ProfilePic.js.map +1 -1
- package/dist/module/components/RadioButton.js.map +1 -1
- package/dist/module/components/Reaction.js +3 -3
- package/dist/module/components/Reaction.js.map +1 -1
- package/dist/module/components/Reactions.js +3 -3
- package/dist/module/components/Reactions.js.map +1 -1
- package/dist/module/components/SharingTools.js +3 -3
- package/dist/module/components/SharingTools.js.map +1 -1
- package/dist/module/components/Spinner.js.map +1 -1
- package/dist/module/components/StickyFooter.js.map +1 -1
- package/dist/module/components/TextStyle.js +1 -1
- package/dist/module/components/TextStyle.js.map +1 -1
- package/dist/module/components/TickIcon.js +24 -0
- package/dist/module/components/TickIcon.js.map +1 -0
- package/dist/module/components/Toggle.js.map +1 -1
- package/dist/module/components/TouchableSearchBar.js +3 -3
- package/dist/module/components/TouchableSearchBar.js.map +1 -1
- package/dist/module/components/UserListPopup.js.map +1 -1
- package/dist/module/components/UserListing.js.map +1 -1
- package/dist/module/components/VideoPopup.js +3 -3
- package/dist/module/components/VideoPopup.js.map +1 -1
- package/dist/module/components/WarningPopup.js.map +1 -1
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +3 -3
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -1
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -1
- package/dist/module/components/index.js +2 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +4 -3
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -1
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +4 -4
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -1
- package/dist/module/config.js +1 -6
- package/dist/module/config.js.map +1 -1
- package/dist/module/constants.js.map +1 -1
- package/dist/module/fonts/index.js.map +1 -1
- package/dist/module/fonts/pluss60-icons.js.map +1 -1
- package/dist/module/helper.js +13 -1
- package/dist/module/helper.js.map +1 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/js/images/detectFaces.js.map +1 -1
- package/dist/module/js/images/findLandmarkRange.js.map +1 -1
- package/dist/module/js/images/getScaledOffset.js.map +1 -1
- package/dist/module/js/site/getSiteLevelFromState.js.map +1 -1
- package/dist/module/js/site/isTVEnabled.js.map +1 -1
- package/dist/module/session.js +2 -2
- package/dist/module/session.js.map +1 -1
- package/dist/module/styles.js.map +1 -1
- package/package.json +1 -4
- package/src/apis/fileActions.js +27 -19
- package/src/components/CommentSection.js +1 -1
- package/src/components/Forbidden.js +54 -0
- package/src/components/ImageUploader.js +32 -24
- package/src/components/MediaPlayer.js +16 -29
- package/src/components/TickIcon.js +25 -0
- package/src/components/index.js +2 -0
- package/src/config.js +0 -5
- package/src/helper.js +13 -0
- package/src/session.js +2 -2
package/src/apis/fileActions.js
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import mime from 'mime-types';
|
|
2
|
+
import { Storage } from 'aws-amplify';
|
|
2
3
|
import { getUrl, generateImageName, randomString } from '../helper';
|
|
3
4
|
import { authedFunction } from '../session';
|
|
5
|
+
import Config from '../config';
|
|
4
6
|
|
|
5
7
|
export const fileActions = {
|
|
6
|
-
getPresignedUrl: async (filename, contentType) => {
|
|
7
|
-
// const newFilename = filename.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
|
|
8
|
-
const signedUrlRes = await authedFunction({
|
|
9
|
-
method: 'GET',
|
|
10
|
-
url: getUrl('media', 'get/presignedurl', { filename, contentType }),
|
|
11
|
-
});
|
|
12
|
-
return signedUrlRes.data;
|
|
13
|
-
},
|
|
14
8
|
getUploadUrl: (userId, fileName) => {
|
|
15
9
|
const newFilename = fileName.replace(/[^a-z0-9+.]+/gi, '').toLowerCase();
|
|
16
10
|
return `uploads/users/${userId}/public/${randomString()}/${newFilename}`;
|
|
17
11
|
},
|
|
18
|
-
uploadUserMediaWithProgress: async (
|
|
19
|
-
|
|
12
|
+
uploadUserMediaWithProgress: async (imageUri, url, progressCallback = null) => {
|
|
13
|
+
const blob = await fileActions.imageToBlob(imageUri);
|
|
14
|
+
return fileActions.uploadBlobAWS(Config.env.awsUploadsBucket, url, blob, '', progressCallback);
|
|
20
15
|
},
|
|
16
|
+
// uploadUserMedia: async (userId, image, fileName) => {
|
|
17
|
+
// const blob = await fileActions.imageToBlob(image.uri);
|
|
18
|
+
// const url = fileActions.getUploadUrl(userId, fileName);
|
|
19
|
+
// return fileActions.uploadBlobAWS(Config.env.awsUploadsBucket, url, blob);
|
|
20
|
+
// },
|
|
21
|
+
// uploadSignatureImage: async (image, name) => {
|
|
22
|
+
// const blob = await fileActions.imageToBlob(image);
|
|
23
|
+
// const newImageName = generateImageName(name, 'signature.png');
|
|
24
|
+
// return fileActions.uploadBlobAWS(Config.env.awsStorageBucket, newImageName, blob, 'images/');
|
|
25
|
+
// },
|
|
21
26
|
imageToBlob: async imageUri => {
|
|
22
27
|
const response = await fetch(imageUri);
|
|
23
28
|
return response.blob();
|
|
24
29
|
},
|
|
25
|
-
uploadBlobAWS:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
uploadBlobAWS: (bucket, uri, blob, prefix = '', progressCallback = null) => {
|
|
31
|
+
const imageName = prefix ? uri.replace(/^.*[\\/]/, '') : uri;
|
|
32
|
+
const fileType = mime.lookup(uri);
|
|
33
|
+
const access = {
|
|
34
|
+
level: 'public',
|
|
35
|
+
bucket,
|
|
36
|
+
contentType: fileType,
|
|
37
|
+
customPrefix: { public: '' },
|
|
38
|
+
progressCallback: progress =>
|
|
32
39
|
progressCallback &&
|
|
33
40
|
progressCallback({
|
|
34
41
|
uri,
|
|
@@ -36,7 +43,8 @@ export const fileActions = {
|
|
|
36
43
|
total: progress.total,
|
|
37
44
|
percentage: `${Math.floor((progress.loaded / progress.total) * 100)}%`,
|
|
38
45
|
}),
|
|
39
|
-
}
|
|
46
|
+
};
|
|
47
|
+
return Storage.put(`${prefix}${imageName}`, blob, access);
|
|
40
48
|
},
|
|
41
49
|
getStockPhotos: async () => {
|
|
42
50
|
const response = await authedFunction({
|
|
@@ -416,7 +416,7 @@ class CommentSection extends Component {
|
|
|
416
416
|
content = (
|
|
417
417
|
<View style={styles.multiReplyContainer}>
|
|
418
418
|
{profilePics.map((c, i) => {
|
|
419
|
-
return <ProfilePic style={{ marginRight: -10 }} Diameter={20} ProfilePic={c.User.profilePic} />;
|
|
419
|
+
return <ProfilePic key={c.Id} style={{ marginRight: -10 }} Diameter={20} ProfilePic={c.User.profilePic} />;
|
|
420
420
|
})}
|
|
421
421
|
<Text style={[styles.commentRepliesText, { marginLeft: 20, color: this.props.colourBrandingMain }]}>{`${
|
|
422
422
|
threadComments.length
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { TextStyle } from './TextStyle';
|
|
5
|
+
import { getMainBrandingColourFromState } from '../colours';
|
|
6
|
+
import { InlineButton } from './InlineButton';
|
|
7
|
+
import { Services } from '../config';
|
|
8
|
+
import { connect } from 'react-redux';
|
|
9
|
+
import Header from './Header';
|
|
10
|
+
|
|
11
|
+
const Forbidden = ({ colourBrandingMain, title, description }) => {
|
|
12
|
+
const goBack = () => {
|
|
13
|
+
Services.navigation.goBack();
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<View
|
|
18
|
+
style={{
|
|
19
|
+
flex: 1,
|
|
20
|
+
backgroundColor: '#fff',
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
<Header leftIcon="angle-left" onPressLeft={goBack} />
|
|
24
|
+
<View
|
|
25
|
+
style={{
|
|
26
|
+
padding: 16,
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<TextStyle type="pageHeading" style={{ color: colourBrandingMain }}>
|
|
30
|
+
{!_.isEmpty(title) ? title : 'Oops!'}
|
|
31
|
+
</TextStyle>
|
|
32
|
+
<TextStyle type="body" style={{ marginTop: 10 }}>
|
|
33
|
+
{!_.isEmpty(description)
|
|
34
|
+
? description
|
|
35
|
+
: 'It seems this item is no longer accessible. It may have been removed or your access might have changed.'}
|
|
36
|
+
</TextStyle>
|
|
37
|
+
<View style={{ marginTop: 20 }}>
|
|
38
|
+
<InlineButton onPress={goBack} color={colourBrandingMain}>
|
|
39
|
+
Go back
|
|
40
|
+
</InlineButton>
|
|
41
|
+
</View>
|
|
42
|
+
</View>
|
|
43
|
+
</View>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const mapStateToProps = state => {
|
|
48
|
+
return {
|
|
49
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const forbidden = connect(mapStateToProps, {}, null, { forwardRef: true })(Forbidden);
|
|
54
|
+
export { forbidden as Forbidden };
|
|
@@ -142,25 +142,23 @@ class ImageUploader extends Component {
|
|
|
142
142
|
let uploadUri;
|
|
143
143
|
try {
|
|
144
144
|
const fileName = `${getValueOrDefault(this.props.fileName, DEFAULT_IMAGE_NAME)}.${DEFULAT_IMAGE_TYPE}`;
|
|
145
|
+
uploadUri = fileActions.getUploadUrl(this.props.userId, fileName);
|
|
145
146
|
|
|
147
|
+
this.props.onUploadStarted(uploadUri, imageUri);
|
|
146
148
|
this.hideUploadMenu();
|
|
147
149
|
|
|
148
150
|
const resized = await this.resizeImageAsync(imageUri);
|
|
149
|
-
const blob = await fileActions.imageToBlob(resized.uri);
|
|
150
|
-
const presignedUriRes = await fileActions.getPresignedUrl(_.last(resized.uri.split('/')), blob.type);
|
|
151
|
-
uploadUri = presignedUriRes.key;
|
|
152
|
-
this.props.onUploadStarted(uploadUri, imageUri);
|
|
153
151
|
if (this.props.onlySelectImage) {
|
|
154
152
|
this.props.onImageSelected(resized, fileName);
|
|
155
153
|
return;
|
|
156
154
|
}
|
|
157
155
|
|
|
158
|
-
const
|
|
156
|
+
const res = await fileActions.uploadUserMediaWithProgress(resized.uri, uploadUri, progress => {
|
|
159
157
|
if (this.props.onUploadProgress) this.props.onUploadProgress(progress);
|
|
160
158
|
});
|
|
161
159
|
|
|
162
|
-
this.props.onUploadSuccess(Config.env.baseUploadsUrl +
|
|
163
|
-
console.log('upload success', Config.env.baseUploadsUrl +
|
|
160
|
+
this.props.onUploadSuccess(Config.env.baseUploadsUrl + res.key, uploadUri);
|
|
161
|
+
console.log('upload success', Config.env.baseUploadsUrl + res.key);
|
|
164
162
|
} catch (e) {
|
|
165
163
|
console.log('handleImagePicked error', e);
|
|
166
164
|
this.props.onUploadFailed(uploadUri);
|
|
@@ -172,6 +170,7 @@ class ImageUploader extends Component {
|
|
|
172
170
|
const imagesUploaded = imagesSelected.map(image => {
|
|
173
171
|
const fileName = `${getValueOrDefault(this.props.fileName, DEFAULT_IMAGE_NAME)}.${DEFULAT_IMAGE_TYPE}`;
|
|
174
172
|
const uploadUri = fileActions.getUploadUrl(this.props.userId, fileName);
|
|
173
|
+
if (!this.props.onlySelectImage) this.props.onUploadStarted(uploadUri, image.uri);
|
|
175
174
|
return { imageUri: image.uri, uploadUri, fileName };
|
|
176
175
|
});
|
|
177
176
|
this.hideUploadMenu();
|
|
@@ -182,21 +181,16 @@ class ImageUploader extends Component {
|
|
|
182
181
|
const { imageUri, uploadUri, fileName } = image;
|
|
183
182
|
try {
|
|
184
183
|
const resized = await this.resizeImageAsync(imageUri);
|
|
185
|
-
const blob = await fileActions.imageToBlob(resized.uri);
|
|
186
184
|
if (this.props.onlySelectImage) {
|
|
187
185
|
this.props.onImageSelected(resized, fileName);
|
|
188
186
|
return;
|
|
189
187
|
}
|
|
190
|
-
const presignedUriRes = await fileActions.getPresignedUrl(_.last(resized.uri.split('/')), blob.type);
|
|
191
|
-
const uploadUri = presignedUriRes.key;
|
|
192
|
-
if (!this.props.onlySelectImage) this.props.onUploadStarted(uploadUri, imageUri);
|
|
193
188
|
|
|
194
|
-
const
|
|
189
|
+
const res = await fileActions.uploadUserMediaWithProgress(resized.uri, uploadUri, progress => {
|
|
195
190
|
if (this.props.onUploadProgress) this.props.onUploadProgress(progress);
|
|
196
191
|
});
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
console.log('upload success', Config.env.baseUploadsUrl + uploadUri);
|
|
192
|
+
this.props.onUploadSuccess(Config.env.baseUploadsUrl + res.key, uploadUri);
|
|
193
|
+
console.log('upload success', Config.env.baseUploadsUrl + res.key);
|
|
200
194
|
} catch (e) {
|
|
201
195
|
console.log('handleMultiImagePicked error', e);
|
|
202
196
|
this.props.onUploadFailed(uploadUri);
|
|
@@ -209,19 +203,17 @@ class ImageUploader extends Component {
|
|
|
209
203
|
try {
|
|
210
204
|
const fileType = uri.substring(uri.lastIndexOf('.') + 1);
|
|
211
205
|
const fileName = `${getValueOrDefault(this.props.fileName, DEFAULT_VIDEO_NAME)}.${fileType}`;
|
|
212
|
-
|
|
213
|
-
const presignedUriRes = await fileActions.getPresignedUrl(fileName, blob.type);
|
|
214
|
-
uploadUri = presignedUriRes.key;
|
|
206
|
+
uploadUri = fileActions.getUploadUrl(this.props.userId, fileName);
|
|
215
207
|
|
|
216
208
|
this.props.onUploadStarted(uploadUri, uri);
|
|
217
209
|
this.hideUploadMenu();
|
|
218
210
|
|
|
219
|
-
const
|
|
211
|
+
const res = await fileActions.uploadUserMediaWithProgress(uri, uploadUri, progress => {
|
|
220
212
|
if (this.props.onUploadProgress) this.props.onUploadProgress(progress);
|
|
221
213
|
});
|
|
222
214
|
|
|
223
|
-
this.props.onUploadSuccess(Config.env.baseUploadsUrl +
|
|
224
|
-
console.log('upload success', Config.env.baseUploadsUrl +
|
|
215
|
+
this.props.onUploadSuccess(Config.env.baseUploadsUrl + res.key, uploadUri);
|
|
216
|
+
console.log('upload success', Config.env.baseUploadsUrl + res.key);
|
|
225
217
|
} catch (e) {
|
|
226
218
|
console.log('handleVideoPicked error', e);
|
|
227
219
|
this.props.onUploadFailed(uploadUri);
|
|
@@ -264,7 +256,7 @@ class ImageUploader extends Component {
|
|
|
264
256
|
askPermissionsAsync = async () => {
|
|
265
257
|
const cameraPermission = await Camera.requestCameraPermissionsAsync();
|
|
266
258
|
const rollPermission = await MediaLibrary.requestPermissionsAsync();
|
|
267
|
-
if (cameraPermission.status !== 'granted' || rollPermission.status !== 'granted') {
|
|
259
|
+
if (cameraPermission.status !== 'granted' || (Platform.OS === 'ios' && rollPermission.status !== 'granted')) {
|
|
268
260
|
this.showWarningPopup(cameraPermission.status !== 'granted', rollPermission.status !== 'granted');
|
|
269
261
|
return false;
|
|
270
262
|
}
|
|
@@ -274,7 +266,6 @@ class ImageUploader extends Component {
|
|
|
274
266
|
};
|
|
275
267
|
|
|
276
268
|
isEditingEnabled = () => {
|
|
277
|
-
return false;
|
|
278
269
|
return !this.props.multiple && !this.props.allowVideo && getValueOrDefault(this.props.allowsEditing, DEFAULT_ALLOWS_EDITING);
|
|
279
270
|
};
|
|
280
271
|
|
|
@@ -323,6 +314,24 @@ class ImageUploader extends Component {
|
|
|
323
314
|
};
|
|
324
315
|
|
|
325
316
|
openPhotos = async () => {
|
|
317
|
+
if (Platform.OS === 'android') {
|
|
318
|
+
const result = await ImagePicker.launchImageLibraryAsync({
|
|
319
|
+
allowsEditing: this.isEditingEnabled(),
|
|
320
|
+
aspect: getValueOrDefault(this.props.aspect, DEFAULT_ASPECT),
|
|
321
|
+
exif: getValueOrDefault(this.props.exif, DEFAULT_EXIF),
|
|
322
|
+
mediaTypes: this.props.allowVideo ? ImagePicker.MediaTypeOptions.All : ImagePicker.MediaTypeOptions.Images,
|
|
323
|
+
});
|
|
324
|
+
if (!result.cancelled) {
|
|
325
|
+
if (result.assets.length === 1 && result.assets[0].type === 'video') {
|
|
326
|
+
this.handleVideoPicked(result.assets[0].uri);
|
|
327
|
+
} else {
|
|
328
|
+
this.handleMultiImagePicked(result.assets);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// iOS behaviour
|
|
326
335
|
if (!(await this.askPermissionsAsync())) return;
|
|
327
336
|
|
|
328
337
|
this.setState({
|
|
@@ -381,7 +390,6 @@ class ImageUploader extends Component {
|
|
|
381
390
|
} else {
|
|
382
391
|
if (mediaSelected[0].mediaType === MediaLibrary.MediaType.video) {
|
|
383
392
|
const uri = mediaSelected[0].localUri || mediaSelected[0].uri;
|
|
384
|
-
console.log('picked a video');
|
|
385
393
|
this.handleVideoPicked(uri);
|
|
386
394
|
} else {
|
|
387
395
|
this.handleMultiImagePicked(mediaSelected);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import * as ScreenOrientation from 'expo-screen-orientation';
|
|
4
|
-
import { DeviceMotion } from 'expo-sensors';
|
|
2
|
+
import { View, StyleSheet, Dimensions } from 'react-native';
|
|
5
3
|
import YoutubePlayer, { getYoutubeMeta } from 'react-native-youtube-iframe';
|
|
6
4
|
import { Vimeo } from 'react-native-vimeo-iframe';
|
|
7
5
|
import { WebView } from 'react-native-webview';
|
|
8
6
|
import { Video } from 'expo-av';
|
|
9
|
-
import VideoPlayer from 'expo-video-player';
|
|
10
7
|
import { Spinner } from './Spinner';
|
|
11
8
|
|
|
12
9
|
const SCREEN_HEIGHT = Dimensions.get('window').height;
|
|
@@ -40,20 +37,10 @@ class MediaPlayer extends Component {
|
|
|
40
37
|
|
|
41
38
|
componentDidMount = async () => {
|
|
42
39
|
await this.setupForPlaying();
|
|
43
|
-
|
|
44
|
-
ScreenOrientation.lockAsync(Platform.OS === 'ios' ? ScreenOrientation.OrientationLock.DEFAULT : ScreenOrientation.OrientationLock.ALL);
|
|
45
|
-
const motionAvailalble = await DeviceMotion.isAvailableAsync();
|
|
46
|
-
// console.log('motionAvailalble', motionAvailalble);
|
|
47
|
-
if (motionAvailalble) {
|
|
48
|
-
DeviceMotion.setUpdateInterval(500);
|
|
49
|
-
DeviceMotion.addListener(this.onMotionChange);
|
|
50
|
-
}
|
|
51
40
|
};
|
|
52
41
|
|
|
53
42
|
componentWillUnmount = () => {
|
|
54
43
|
if (this.checkStreamLoaded) clearInterval(this.checkStreamLoaded);
|
|
55
|
-
DeviceMotion.removeAllListeners();
|
|
56
|
-
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP);
|
|
57
44
|
};
|
|
58
45
|
|
|
59
46
|
getYoutubeVideoId = url => {
|
|
@@ -292,20 +279,20 @@ class MediaPlayer extends Component {
|
|
|
292
279
|
/>
|
|
293
280
|
);
|
|
294
281
|
|
|
295
|
-
getVideoPlayer = (embedUrl, width, height, autoPlay) => (
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
);
|
|
282
|
+
// getVideoPlayer = (embedUrl, width, height, autoPlay) => (
|
|
283
|
+
// <VideoPlayer
|
|
284
|
+
// videoProps={{
|
|
285
|
+
// shouldPlay: autoPlay,
|
|
286
|
+
// resizeMode: Video.RESIZE_MODE_CONTAIN,
|
|
287
|
+
// source: { uri: embedUrl },
|
|
288
|
+
// }}
|
|
289
|
+
// showFullscreenButton={false}
|
|
290
|
+
// errorCallback={this.onVideoPlayError}
|
|
291
|
+
// playbackCallback={this.onVideoPlayStatusUpdate}
|
|
292
|
+
// height={height}
|
|
293
|
+
// width={width}
|
|
294
|
+
// />
|
|
295
|
+
// );
|
|
309
296
|
|
|
310
297
|
render() {
|
|
311
298
|
let width, height;
|
|
@@ -351,7 +338,7 @@ class MediaPlayer extends Component {
|
|
|
351
338
|
} else if (useVideoPlayer) {
|
|
352
339
|
embedUrl = source;
|
|
353
340
|
// console.log('getVideoPlayer', embedUrl, width, height, autoPlay);
|
|
354
|
-
player = this.
|
|
341
|
+
player = this.getStreamPlayer(embedUrl, width, height, autoPlay);
|
|
355
342
|
}
|
|
356
343
|
}
|
|
357
344
|
if (!player && isUrlLink) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import stylez from '../styles';
|
|
4
|
+
import { Pl60Icon } from '../fonts';
|
|
5
|
+
|
|
6
|
+
class TickIcon extends PureComponent {
|
|
7
|
+
render() {
|
|
8
|
+
const size = this.props.diameter || 20;
|
|
9
|
+
const radius = size / 2;
|
|
10
|
+
return (
|
|
11
|
+
<View
|
|
12
|
+
style={[
|
|
13
|
+
stylez.tickBox,
|
|
14
|
+
{ height: size, width: size, borderRadius: radius },
|
|
15
|
+
this.props.color && { backgroundColor: this.props.color },
|
|
16
|
+
this.props.style,
|
|
17
|
+
]}
|
|
18
|
+
>
|
|
19
|
+
<Pl60Icon name="tick" style={stylez.tickIcon} />
|
|
20
|
+
</View>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { TickIcon };
|
package/src/components/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './InlineButton';
|
|
2
2
|
export * from './AddToCalendarButton';
|
|
3
|
+
export * from './Forbidden';
|
|
3
4
|
export * from './FormCard';
|
|
4
5
|
export * from './FormCardSection';
|
|
5
6
|
export * from './FormCardSectionOptionLauncher';
|
|
@@ -23,6 +24,7 @@ export * from './GenericInput';
|
|
|
23
24
|
export * from './RadioButton';
|
|
24
25
|
export * from './PDFPopup';
|
|
25
26
|
export * from './TextStyle';
|
|
27
|
+
export * from './TickIcon';
|
|
26
28
|
export * from './Toggle';
|
|
27
29
|
export * from './Input';
|
|
28
30
|
export * from './StickyFooter';
|
package/src/config.js
CHANGED
|
@@ -18,11 +18,6 @@ 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
|
-
},
|
|
26
21
|
},
|
|
27
22
|
init: (environment, navigation) => {
|
|
28
23
|
CoreConfig.env = environment;
|
package/src/helper.js
CHANGED
|
@@ -256,6 +256,18 @@ const getPluralOptions = (count, singular, plural) => {
|
|
|
256
256
|
return plural;
|
|
257
257
|
};
|
|
258
258
|
|
|
259
|
+
const isEmail = email => {
|
|
260
|
+
if (_.isEmpty(email)) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
const atpos = email.indexOf('@');
|
|
264
|
+
const dotpos = email.lastIndexOf('.');
|
|
265
|
+
if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= email.length) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
return true;
|
|
269
|
+
};
|
|
270
|
+
|
|
259
271
|
const randomString = (name = '') => {
|
|
260
272
|
return `xxxxxxxx4xxxyxxxxxxxxxxxxx${name}`.replace(/[xy]/g, c => {
|
|
261
273
|
// eslint-disable-next-line
|
|
@@ -469,6 +481,7 @@ export {
|
|
|
469
481
|
imageExists,
|
|
470
482
|
getPluralS,
|
|
471
483
|
getPluralOptions,
|
|
484
|
+
isEmail,
|
|
472
485
|
formatTime,
|
|
473
486
|
minutesToString,
|
|
474
487
|
randomString,
|
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';
|
|
5
4
|
|
|
6
5
|
export const getSessionTokenAWS = async prefix => {
|
|
7
|
-
const
|
|
6
|
+
const data = await Auth.currentSession();
|
|
7
|
+
const token = data.accessToken.jwtToken;
|
|
8
8
|
if (_.isUndefined(prefix)) return token;
|
|
9
9
|
return `${prefix} ${token}`;
|
|
10
10
|
};
|