@plusscommunities/pluss-core-app 1.4.9 → 1.5.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 +34 -0
- package/dist/module/actions/FollowerActions.js.map +1 -0
- package/dist/module/actions/MediaActions.js +20 -0
- package/dist/module/actions/MediaActions.js.map +1 -0
- package/dist/module/actions/ResidentActions.js +26 -0
- package/dist/module/actions/ResidentActions.js.map +1 -0
- package/dist/module/actions/UserActions.js +214 -0
- package/dist/module/actions/UserActions.js.map +1 -0
- package/dist/module/actions/index.js +5 -0
- package/dist/module/actions/index.js.map +1 -0
- package/dist/module/actions/types.js +14 -0
- package/dist/module/actions/types.js.map +1 -0
- package/dist/module/apis/analyticsActions.js +20 -0
- package/dist/module/apis/analyticsActions.js.map +1 -0
- package/dist/module/apis/contactActions.js +27 -0
- package/dist/module/apis/contactActions.js.map +1 -0
- package/dist/module/apis/eventActions.js +163 -0
- package/dist/module/apis/eventActions.js.map +1 -0
- package/dist/module/apis/fileActions.js +96 -0
- package/dist/module/apis/fileActions.js.map +1 -0
- package/dist/module/apis/followerActions.js +38 -0
- package/dist/module/apis/followerActions.js.map +1 -0
- package/dist/module/apis/index.js +11 -0
- package/dist/module/apis/index.js.map +1 -0
- package/dist/module/apis/notificationActions.js +60 -0
- package/dist/module/apis/notificationActions.js.map +1 -0
- package/dist/module/apis/profileActions.js +14 -0
- package/dist/module/apis/profileActions.js.map +1 -0
- package/dist/module/apis/reactionActions.js +78 -0
- package/dist/module/apis/reactionActions.js.map +1 -0
- package/dist/module/apis/typeActions.js +15 -0
- package/dist/module/apis/typeActions.js.map +1 -0
- package/dist/module/apis/userActions.js +104 -0
- package/dist/module/apis/userActions.js.map +1 -0
- package/{assets → dist/module/assets}/icons/reactions/heart.png +0 -0
- package/{assets → dist/module/assets}/icons/reactions/party.png +0 -0
- package/{assets → dist/module/assets}/icons/reactions/sad.png +0 -0
- package/{assets → dist/module/assets}/icons/reactions/smile.png +0 -0
- package/dist/module/colours.js +149 -0
- package/dist/module/colours.js.map +1 -0
- package/dist/module/components/AddButton.js +45 -0
- package/dist/module/components/AddButton.js.map +1 -0
- package/dist/module/components/Attachment.js +59 -0
- package/dist/module/components/Attachment.js.map +1 -0
- package/dist/module/components/AudienceSelectorLauncher.js +70 -0
- package/dist/module/components/AudienceSelectorLauncher.js.map +1 -0
- package/dist/module/components/AudienceSelectorPage.js +376 -0
- package/dist/module/components/AudienceSelectorPage.js.map +1 -0
- package/dist/module/components/BackButton.js +62 -0
- package/dist/module/components/BackButton.js.map +1 -0
- package/dist/module/components/CategoryTabs.js +171 -0
- package/dist/module/components/CategoryTabs.js.map +1 -0
- package/dist/module/components/CommentReply.js +363 -0
- package/dist/module/components/CommentReply.js.map +1 -0
- package/dist/module/components/CommentSection.js +785 -0
- package/dist/module/components/CommentSection.js.map +1 -0
- package/dist/module/components/ConfirmPopup.js +85 -0
- package/dist/module/components/ConfirmPopup.js.map +1 -0
- package/dist/module/components/ConfirmationPopup.js +77 -0
- package/dist/module/components/ConfirmationPopup.js.map +1 -0
- package/dist/module/components/DropDownItem.js +82 -0
- package/dist/module/components/DropDownItem.js.map +1 -0
- package/dist/module/components/DropDownMenu.js +46 -0
- package/dist/module/components/DropDownMenu.js.map +1 -0
- package/dist/module/components/EmptyStateMain.js +50 -0
- package/dist/module/components/EmptyStateMain.js.map +1 -0
- package/dist/module/components/EmptyStateWidget.js +52 -0
- package/dist/module/components/EmptyStateWidget.js.map +1 -0
- package/dist/module/components/FontScaleButton.js +37 -0
- package/dist/module/components/FontScaleButton.js.map +1 -0
- package/dist/module/components/FontScalePopup.js +77 -0
- package/dist/module/components/FontScalePopup.js.map +1 -0
- package/dist/module/components/FormCard.js +28 -0
- package/dist/module/components/FormCard.js.map +1 -0
- package/dist/module/components/FormCardSection.js +240 -0
- package/dist/module/components/FormCardSection.js.map +1 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js +77 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -0
- package/dist/module/components/FormattedText.js +145 -0
- package/dist/module/components/FormattedText.js.map +1 -0
- package/dist/module/components/GenericInput.js +161 -0
- package/dist/module/components/GenericInput.js.map +1 -0
- package/dist/module/components/GenericInputSection.js +174 -0
- package/dist/module/components/GenericInputSection.js.map +1 -0
- package/dist/module/components/Header.js +491 -0
- package/dist/module/components/Header.js.map +1 -0
- package/dist/module/components/ImagePopup.js +257 -0
- package/dist/module/components/ImagePopup.js.map +1 -0
- package/dist/module/components/ImageUploadProgress.js +72 -0
- package/dist/module/components/ImageUploadProgress.js.map +1 -0
- package/dist/module/components/ImageUploader.js +850 -0
- package/dist/module/components/ImageUploader.js.map +1 -0
- package/dist/module/components/InlineButton.js +72 -0
- package/dist/module/components/InlineButton.js.map +1 -0
- package/dist/module/components/Input.js +164 -0
- package/dist/module/components/Input.js.map +1 -0
- package/dist/module/components/LoadingCircles.js +224 -0
- package/dist/module/components/LoadingCircles.js.map +1 -0
- package/dist/module/components/LoadingIndicator.js +95 -0
- package/dist/module/components/LoadingIndicator.js.map +1 -0
- package/dist/module/components/LoadingStateWidget.js +51 -0
- package/dist/module/components/LoadingStateWidget.js.map +1 -0
- package/dist/module/components/MediaPlayer.js +440 -0
- package/dist/module/components/MediaPlayer.js.map +1 -0
- package/dist/module/components/MiddlePopup.js +46 -0
- package/dist/module/components/MiddlePopup.js.map +1 -0
- package/dist/module/components/PDFPopup.js +188 -0
- package/dist/module/components/PDFPopup.js.map +1 -0
- package/dist/module/components/PlussChat.js +997 -0
- package/dist/module/components/PlussChat.js.map +1 -0
- package/dist/module/components/PlussChatMessage.js +204 -0
- package/dist/module/components/PlussChatMessage.js.map +1 -0
- package/dist/module/components/PlussChatTime.js +66 -0
- package/dist/module/components/PlussChatTime.js.map +1 -0
- package/dist/module/components/Popup.js +138 -0
- package/dist/module/components/Popup.js.map +1 -0
- package/dist/module/components/PopupMenu.js +128 -0
- package/dist/module/components/PopupMenu.js.map +1 -0
- package/dist/module/components/PositionedImage.js +333 -0
- package/dist/module/components/PositionedImage.js.map +1 -0
- package/dist/module/components/ProfilePic.js +119 -0
- package/dist/module/components/ProfilePic.js.map +1 -0
- package/dist/module/components/RadioButton.js +84 -0
- package/dist/module/components/RadioButton.js.map +1 -0
- package/dist/module/components/Reaction.js +129 -0
- package/dist/module/components/Reaction.js.map +1 -0
- package/dist/module/components/Reactions.js +84 -0
- package/dist/module/components/Reactions.js.map +1 -0
- package/dist/module/components/SharingTools.js +162 -0
- package/dist/module/components/SharingTools.js.map +1 -0
- package/dist/module/components/Spinner.js +25 -0
- package/dist/module/components/Spinner.js.map +1 -0
- package/dist/module/components/StickyFooter.js +37 -0
- package/dist/module/components/StickyFooter.js.map +1 -0
- package/dist/module/components/TextStyle.js +34 -0
- package/dist/module/components/TextStyle.js.map +1 -0
- package/dist/module/components/Toggle.js +70 -0
- package/dist/module/components/Toggle.js.map +1 -0
- package/dist/module/components/TouchableSearchBar.js +73 -0
- package/dist/module/components/TouchableSearchBar.js.map +1 -0
- package/dist/module/components/UserListPopup.js +146 -0
- package/dist/module/components/UserListPopup.js.map +1 -0
- package/dist/module/components/UserListing.js +291 -0
- package/dist/module/components/UserListing.js.map +1 -0
- package/dist/module/components/VideoPopup.js +123 -0
- package/dist/module/components/VideoPopup.js.map +1 -0
- package/dist/module/components/WarningPopup.js +87 -0
- package/dist/module/components/WarningPopup.js.map +1 -0
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +325 -0
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -0
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js +123 -0
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -0
- package/dist/module/components/index.js +53 -0
- package/dist/module/components/index.js.map +1 -0
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +416 -0
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -0
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +405 -0
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -0
- package/dist/module/config.js +27 -0
- package/dist/module/config.js.map +1 -0
- package/dist/module/constants.js +16 -0
- package/dist/module/constants.js.map +1 -0
- package/dist/module/fonts/index.js +2 -0
- package/dist/module/fonts/index.js.map +1 -0
- package/dist/module/fonts/pluss60-icons.js +5 -0
- package/dist/module/fonts/pluss60-icons.js.map +1 -0
- package/dist/module/fonts/pluss60-icons.json +1097 -0
- package/dist/module/helper.js +436 -0
- package/dist/module/helper.js.map +1 -0
- package/dist/module/index.js +13 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/session.js +54 -0
- package/dist/module/session.js.map +1 -0
- package/dist/module/styles.js +67 -0
- package/dist/module/styles.js.map +1 -0
- package/package.json +22 -5
- package/src/assets/icons/reactions/heart.png +0 -0
- package/src/assets/icons/reactions/party.png +0 -0
- package/src/assets/icons/reactions/sad.png +0 -0
- package/src/assets/icons/reactions/smile.png +0 -0
- package/src/components/CommentReply.js +0 -2
- package/src/constants.js +4 -4
- package/src/helper.js +4 -4
|
@@ -0,0 +1,850 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import { View, ScrollView, TouchableOpacity, Text, Platform, Linking, Modal, Dimensions, StyleSheet, ImageBackground } from 'react-native';
|
|
5
|
+
import { connect } from 'react-redux';
|
|
6
|
+
import { Icon } from 'react-native-elements';
|
|
7
|
+
import _ from 'lodash';
|
|
8
|
+
import { Camera } from 'expo-camera';
|
|
9
|
+
import * as MediaLibrary from 'expo-media-library';
|
|
10
|
+
import * as ImageManipulator from 'expo-image-manipulator';
|
|
11
|
+
import * as ImagePicker from 'expo-image-picker';
|
|
12
|
+
import ImageBrowser from './expo-image-picker-multiple/ImageBrowser';
|
|
13
|
+
import ExpoImageManipulator from './react-native-expo-image-cropper/ExpoImageManipulator';
|
|
14
|
+
import Header from './Header';
|
|
15
|
+
import { Popup } from './Popup';
|
|
16
|
+
import { PopupMenu } from './PopupMenu';
|
|
17
|
+
import { InlineButton } from './InlineButton';
|
|
18
|
+
import { getValueOrDefault, getThumb300, isVideo } from '../helper';
|
|
19
|
+
import { getMainBrandingColourFromState, BOXGREY, INACTIVE_BUTTON, TEXT_BLUEGREY, TEXT_DARK, LINEGREY } from '../colours';
|
|
20
|
+
import Config from '../config';
|
|
21
|
+
import { fileActions } from '../apis';
|
|
22
|
+
import { stockImagesLoaded, imageLibraryLoaded } from '../actions';
|
|
23
|
+
const SCREEN_WIDTH = Dimensions.get('window').width;
|
|
24
|
+
const SCREEN_HEIGHT = Dimensions.get('window').height;
|
|
25
|
+
const DEFAULT_ASPECT = [1, 1];
|
|
26
|
+
const DEFAULT_ALLOWS_EDITING = true;
|
|
27
|
+
const DEFAULT_ALLOWS_IOS_CAMERA_EDITING = false;
|
|
28
|
+
const DEFAULT_EXIF = true;
|
|
29
|
+
const DEFULAT_IMAGE_TYPE = 'jpeg';
|
|
30
|
+
const DEFAULT_IMAGE_NAME = 'image';
|
|
31
|
+
const DEFAULT_VIDEO_NAME = 'video';
|
|
32
|
+
const DEFAULT_SIZE = {
|
|
33
|
+
width: 1400
|
|
34
|
+
};
|
|
35
|
+
const DEFAULT_COMPRESSION = 0.8;
|
|
36
|
+
|
|
37
|
+
class ImageUploader extends Component {
|
|
38
|
+
constructor(props) {
|
|
39
|
+
super(props);
|
|
40
|
+
|
|
41
|
+
_defineProperty(this, "loadLocalAlbums", async () => {
|
|
42
|
+
const hasPermission = await MediaLibrary.getPermissionsAsync();
|
|
43
|
+
if (!hasPermission.granted) return;
|
|
44
|
+
this.setState({
|
|
45
|
+
loadingLocalFolders: true
|
|
46
|
+
}, async () => {
|
|
47
|
+
try {
|
|
48
|
+
const localAlbums = await MediaLibrary.getAlbumsAsync({
|
|
49
|
+
includeSmartAlbums: true
|
|
50
|
+
});
|
|
51
|
+
this.setState({
|
|
52
|
+
loadingLocalFolders: false,
|
|
53
|
+
localAlbums: [{
|
|
54
|
+
title: 'All Photos',
|
|
55
|
+
id: ''
|
|
56
|
+
}, ...localAlbums]
|
|
57
|
+
});
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.log('loadLocalAlbums - error', error);
|
|
60
|
+
this.setState({
|
|
61
|
+
loadingLocalFolders: false
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
_defineProperty(this, "loadRemoteAlbums", () => {
|
|
68
|
+
this.setState({
|
|
69
|
+
loadingRemoteFolders: true
|
|
70
|
+
}, async () => {
|
|
71
|
+
try {
|
|
72
|
+
const stockImages = await fileActions.getStockPhotos();
|
|
73
|
+
this.props.stockImagesLoaded(stockImages);
|
|
74
|
+
const libraryRes = await fileActions.getMediaFolders(this.props.user.site);
|
|
75
|
+
this.props.imageLibraryLoaded(libraryRes.data);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.log('loadRemoteAlbums - error', error);
|
|
78
|
+
} finally {
|
|
79
|
+
this.setState({
|
|
80
|
+
loadingRemoteFolders: false
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
_defineProperty(this, "retryUpload", async (mediaUri, uploadUri) => {
|
|
87
|
+
try {
|
|
88
|
+
const uri = isVideo(uploadUri) ? mediaUri : (await this.resizeImageAsync(mediaUri)).uri;
|
|
89
|
+
const res = await fileActions.uploadUserMediaWithProgress(uri, uploadUri, progress => {
|
|
90
|
+
if (this.props.onUploadProgress) this.props.onUploadProgress(progress);
|
|
91
|
+
});
|
|
92
|
+
this.props.onUploadSuccess(Config.env.baseUploadsUrl + res.key, uploadUri);
|
|
93
|
+
console.log('upload(retry) success', Config.env.baseUploadsUrl + res.key);
|
|
94
|
+
} catch (e) {
|
|
95
|
+
console.log('retryUpload error', e);
|
|
96
|
+
this.props.onUploadFailed(uploadUri);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
_defineProperty(this, "resizeImageAsync", async uri => {
|
|
101
|
+
const actions = [{
|
|
102
|
+
resize: getValueOrDefault(this.props.size, DEFAULT_SIZE)
|
|
103
|
+
}];
|
|
104
|
+
const saveOptions = {
|
|
105
|
+
format: DEFULAT_IMAGE_TYPE,
|
|
106
|
+
compress: getValueOrDefault(this.props.quality, DEFAULT_COMPRESSION),
|
|
107
|
+
base64: true
|
|
108
|
+
};
|
|
109
|
+
return await ImageManipulator.manipulateAsync(uri, actions, saveOptions);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
_defineProperty(this, "handleImagePicked", async imageUri => {
|
|
113
|
+
let uploadUri;
|
|
114
|
+
|
|
115
|
+
try {
|
|
116
|
+
const fileName = `${getValueOrDefault(this.props.fileName, DEFAULT_IMAGE_NAME)}.${DEFULAT_IMAGE_TYPE}`;
|
|
117
|
+
uploadUri = fileActions.getUploadUrl(this.props.userId, fileName);
|
|
118
|
+
this.props.onUploadStarted(uploadUri, imageUri);
|
|
119
|
+
this.hideUploadMenu();
|
|
120
|
+
const resized = await this.resizeImageAsync(imageUri);
|
|
121
|
+
|
|
122
|
+
if (this.props.onlySelectImage) {
|
|
123
|
+
this.props.onImageSelected(resized, fileName);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const res = await fileActions.uploadUserMediaWithProgress(resized.uri, uploadUri, progress => {
|
|
128
|
+
if (this.props.onUploadProgress) this.props.onUploadProgress(progress);
|
|
129
|
+
});
|
|
130
|
+
this.props.onUploadSuccess(Config.env.baseUploadsUrl + res.key, uploadUri);
|
|
131
|
+
console.log('upload success', Config.env.baseUploadsUrl + res.key);
|
|
132
|
+
} catch (e) {
|
|
133
|
+
console.log('handleImagePicked error', e);
|
|
134
|
+
this.props.onUploadFailed(uploadUri);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
_defineProperty(this, "handleMultiImagePicked", async imagesSelected => {
|
|
139
|
+
// Signal start of all images selected
|
|
140
|
+
const imagesUploaded = imagesSelected.map(image => {
|
|
141
|
+
const fileName = `${getValueOrDefault(this.props.fileName, DEFAULT_IMAGE_NAME)}.${DEFULAT_IMAGE_TYPE}`;
|
|
142
|
+
const uploadUri = fileActions.getUploadUrl(this.props.userId, fileName);
|
|
143
|
+
if (!this.props.onlySelectImage) this.props.onUploadStarted(uploadUri, image.uri);
|
|
144
|
+
return {
|
|
145
|
+
imageUri: image.uri,
|
|
146
|
+
uploadUri,
|
|
147
|
+
fileName
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
this.hideUploadMenu(); // Sequentially upload all imagesUploaded
|
|
151
|
+
|
|
152
|
+
for (let i = 0; i < imagesUploaded.length; i++) {
|
|
153
|
+
const image = imagesUploaded[i];
|
|
154
|
+
const {
|
|
155
|
+
imageUri,
|
|
156
|
+
uploadUri,
|
|
157
|
+
fileName
|
|
158
|
+
} = image;
|
|
159
|
+
|
|
160
|
+
try {
|
|
161
|
+
const resized = await this.resizeImageAsync(imageUri);
|
|
162
|
+
|
|
163
|
+
if (this.props.onlySelectImage) {
|
|
164
|
+
this.props.onImageSelected(resized, fileName);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const res = await fileActions.uploadUserMediaWithProgress(resized.uri, uploadUri, progress => {
|
|
169
|
+
if (this.props.onUploadProgress) this.props.onUploadProgress(progress);
|
|
170
|
+
});
|
|
171
|
+
this.props.onUploadSuccess(Config.env.baseUploadsUrl + res.key, uploadUri);
|
|
172
|
+
console.log('upload success', Config.env.baseUploadsUrl + res.key);
|
|
173
|
+
} catch (e) {
|
|
174
|
+
console.log('handleMultiImagePicked error', e);
|
|
175
|
+
this.props.onUploadFailed(uploadUri);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
_defineProperty(this, "handleVideoPicked", async uri => {
|
|
181
|
+
let uploadUri;
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
const fileType = uri.substring(uri.lastIndexOf('.') + 1);
|
|
185
|
+
const fileName = `${getValueOrDefault(this.props.fileName, DEFAULT_VIDEO_NAME)}.${fileType}`;
|
|
186
|
+
uploadUri = fileActions.getUploadUrl(this.props.userId, fileName);
|
|
187
|
+
this.props.onUploadStarted(uploadUri, uri);
|
|
188
|
+
this.hideUploadMenu();
|
|
189
|
+
const res = await fileActions.uploadUserMediaWithProgress(uri, uploadUri, progress => {
|
|
190
|
+
if (this.props.onUploadProgress) this.props.onUploadProgress(progress);
|
|
191
|
+
});
|
|
192
|
+
this.props.onUploadSuccess(Config.env.baseUploadsUrl + res.key, uploadUri);
|
|
193
|
+
console.log('upload success', Config.env.baseUploadsUrl + res.key);
|
|
194
|
+
} catch (e) {
|
|
195
|
+
console.log('handleVideoPicked error', e);
|
|
196
|
+
this.props.onUploadFailed(uploadUri);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
_defineProperty(this, "askPermissionsAsync", async () => {
|
|
201
|
+
var _this$state$localAlbu;
|
|
202
|
+
|
|
203
|
+
const cameraPermission = await Camera.requestCameraPermissionsAsync();
|
|
204
|
+
const rollPermission = await MediaLibrary.requestPermissionsAsync();
|
|
205
|
+
|
|
206
|
+
if (cameraPermission.status !== 'granted' || rollPermission.status !== 'granted') {
|
|
207
|
+
this.showWarningPopup(cameraPermission.status !== 'granted', rollPermission.status !== 'granted');
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (((_this$state$localAlbu = this.state.localAlbums) === null || _this$state$localAlbu === void 0 ? void 0 : _this$state$localAlbu.length) <= 0) this.loadLocalAlbums();
|
|
212
|
+
return true;
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
_defineProperty(this, "isEditingEnabled", () => {
|
|
216
|
+
return !this.props.multiple && !this.props.allowVideo && getValueOrDefault(this.props.allowsEditing, DEFAULT_ALLOWS_EDITING);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
_defineProperty(this, "openCameraRoll", async () => {
|
|
220
|
+
if (!(await this.askPermissionsAsync())) return;
|
|
221
|
+
const result = await ImagePicker.launchImageLibraryAsync({
|
|
222
|
+
mediaTypes: ImagePicker.MediaTypeOptions.Images,
|
|
223
|
+
allowsEditing: this.isEditingEnabled(),
|
|
224
|
+
aspect: getValueOrDefault(this.props.aspect, DEFAULT_ASPECT),
|
|
225
|
+
exif: true,
|
|
226
|
+
base64: true
|
|
227
|
+
});
|
|
228
|
+
if (!result.cancelled) this.handleImagePicked(result.uri);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
_defineProperty(this, "openVideoRoll", async () => {
|
|
232
|
+
if (!(await this.askPermissionsAsync())) return;
|
|
233
|
+
const result = await ImagePicker.launchImageLibraryAsync({
|
|
234
|
+
mediaTypes: ImagePicker.MediaTypeOptions.Videos,
|
|
235
|
+
allowsEditing: this.isEditingEnabled()
|
|
236
|
+
});
|
|
237
|
+
if (!result.cancelled) this.handleVideoPicked(result.uri);
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
_defineProperty(this, "openCamera", async () => {
|
|
241
|
+
if (!(await this.askPermissionsAsync())) return;
|
|
242
|
+
let editingAllowed = this.isEditingEnabled();
|
|
243
|
+
|
|
244
|
+
if (Platform.OS === 'ios') {
|
|
245
|
+
editingAllowed = getValueOrDefault(this.props.allowsEditingIOSCamera, getValueOrDefault(this.props.allowsEditing, DEFAULT_ALLOWS_IOS_CAMERA_EDITING));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const result = await ImagePicker.launchCameraAsync({
|
|
249
|
+
allowsEditing: editingAllowed,
|
|
250
|
+
aspect: getValueOrDefault(this.props.aspect, DEFAULT_ASPECT),
|
|
251
|
+
exif: getValueOrDefault(this.props.exif, DEFAULT_EXIF)
|
|
252
|
+
});
|
|
253
|
+
if (!result.cancelled) this.handleImagePicked(result.uri);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
_defineProperty(this, "openVideoCamera", async () => {
|
|
257
|
+
if (!(await this.askPermissionsAsync())) return;
|
|
258
|
+
const result = await ImagePicker.launchCameraAsync({
|
|
259
|
+
allowsEditing: this.isEditingEnabled(),
|
|
260
|
+
mediaTypes: ImagePicker.MediaTypeOptions.Videos
|
|
261
|
+
});
|
|
262
|
+
if (!result.cancelled) this.handleVideoPicked(result.uri);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
_defineProperty(this, "openLibrary", async () => {
|
|
266
|
+
this.setState({
|
|
267
|
+
showUploadMenu: false,
|
|
268
|
+
showPhotos: true,
|
|
269
|
+
selected: [],
|
|
270
|
+
showRemote: true,
|
|
271
|
+
selectedAlbumId: ''
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
_defineProperty(this, "openPhotos", async () => {
|
|
276
|
+
if (!(await this.askPermissionsAsync())) return;
|
|
277
|
+
this.setState({
|
|
278
|
+
showUploadMenu: false,
|
|
279
|
+
showPhotos: true,
|
|
280
|
+
selected: [],
|
|
281
|
+
showRemote: false,
|
|
282
|
+
selectedAlbumId: ''
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
_defineProperty(this, "hidePhotos", () => {
|
|
287
|
+
this.setState({
|
|
288
|
+
showPhotos: false
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
_defineProperty(this, "openCropper", () => {
|
|
293
|
+
this.setState({
|
|
294
|
+
showPhotos: false,
|
|
295
|
+
showCropper: true
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
_defineProperty(this, "toggleCropper", () => {
|
|
300
|
+
this.setState({
|
|
301
|
+
showCropper: !this.state.showCropper
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
_defineProperty(this, "onSelectAlbum", () => {
|
|
306
|
+
this.setState({
|
|
307
|
+
showSelectAlbum: true
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
_defineProperty(this, "onSelectAlbumClosed", () => {
|
|
312
|
+
this.setState({
|
|
313
|
+
showSelectAlbum: false
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
_defineProperty(this, "onAlbumSelected", selectedAlbumId => {
|
|
318
|
+
this.setState({
|
|
319
|
+
showSelectAlbum: false,
|
|
320
|
+
selectedAlbumId
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
_defineProperty(this, "onSelectionChange", (selected, videoSelected, onAttach) => {
|
|
325
|
+
this.setState({
|
|
326
|
+
selected,
|
|
327
|
+
selectedType: videoSelected ? 'video' : 'image',
|
|
328
|
+
onAttach
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
_defineProperty(this, "onSelected", async callback => {
|
|
333
|
+
if (this.isEditingEnabled()) {
|
|
334
|
+
this.openCropper();
|
|
335
|
+
} else {
|
|
336
|
+
const mediaSelected = await callback; // console.log('mediaSelected', mediaSelected);
|
|
337
|
+
|
|
338
|
+
if (this.state.showRemote) {
|
|
339
|
+
if (this.props.onLibrarySelected) {
|
|
340
|
+
mediaSelected.map(media => {
|
|
341
|
+
this.props.onLibrarySelected(media.uri);
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
} else {
|
|
345
|
+
if (mediaSelected[0].mediaType === MediaLibrary.MediaType.video) {
|
|
346
|
+
this.handleVideoPicked(mediaSelected[0].localUri);
|
|
347
|
+
} else {
|
|
348
|
+
this.handleMultiImagePicked(mediaSelected);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
this.hidePhotos();
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
_defineProperty(this, "onRemoveImage", uri => {
|
|
357
|
+
const selected = [...this.state.selected];
|
|
358
|
+
const deleteIndex = selected.indexOf(uri);
|
|
359
|
+
selected.splice(deleteIndex, 1);
|
|
360
|
+
this.setState({
|
|
361
|
+
selected
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
_defineProperty(this, "buildOptions", () => {
|
|
366
|
+
const options = [{
|
|
367
|
+
text: 'Take photo',
|
|
368
|
+
onPress: this.openCamera
|
|
369
|
+
}];
|
|
370
|
+
if (this.props.allowVideo) options.push({
|
|
371
|
+
text: 'Record video',
|
|
372
|
+
onPress: this.openVideoCamera
|
|
373
|
+
});
|
|
374
|
+
options.push({
|
|
375
|
+
text: 'Camera Roll',
|
|
376
|
+
onPress: this.openPhotos
|
|
377
|
+
});
|
|
378
|
+
if (!this.props.hideLibrary) options.push({
|
|
379
|
+
text: 'Image Library',
|
|
380
|
+
onPress: this.openLibrary
|
|
381
|
+
});
|
|
382
|
+
return options;
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
_defineProperty(this, "renderSelectedComponent", selectedItemNumber => {
|
|
386
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
387
|
+
style: styles.selectedItemContainer
|
|
388
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
389
|
+
style: [styles.selectedMarkerContainer, {
|
|
390
|
+
backgroundColor: this.props.colourBrandingMain
|
|
391
|
+
}]
|
|
392
|
+
}, this.props.multiple ? /*#__PURE__*/React.createElement(Text, {
|
|
393
|
+
style: styles.selectedItemText
|
|
394
|
+
}, selectedItemNumber) : /*#__PURE__*/React.createElement(Icon, {
|
|
395
|
+
name: "check",
|
|
396
|
+
type: "font-awesome",
|
|
397
|
+
iconStyle: styles.selectedItemIcon
|
|
398
|
+
})));
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
this.state = {
|
|
402
|
+
showUploadMenu: false,
|
|
403
|
+
warning: null,
|
|
404
|
+
showPhotos: false,
|
|
405
|
+
showRemote: false,
|
|
406
|
+
selected: [],
|
|
407
|
+
selectedType: '',
|
|
408
|
+
onAttach: null,
|
|
409
|
+
selectedAlbumId: '',
|
|
410
|
+
showSelectAlbum: false,
|
|
411
|
+
showCropper: false,
|
|
412
|
+
localAlbums: [],
|
|
413
|
+
loadingLocalFolders: false,
|
|
414
|
+
loadingRemoteFolders: false
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
componentDidMount() {
|
|
419
|
+
this.loadLocalAlbums();
|
|
420
|
+
this.loadRemoteAlbums();
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
showUploadMenu() {
|
|
424
|
+
this.setState({
|
|
425
|
+
showUploadMenu: true
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
hideUploadMenu() {
|
|
430
|
+
this.setState({
|
|
431
|
+
showUploadMenu: false
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
showWarningPopup(camera, roll) {
|
|
436
|
+
if (Platform.OS !== 'ios') {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
let innerWarning = '';
|
|
441
|
+
|
|
442
|
+
if (camera && roll) {
|
|
443
|
+
innerWarning = 'both your camera and photo library';
|
|
444
|
+
} else if (camera) {
|
|
445
|
+
innerWarning = 'your camera';
|
|
446
|
+
} else if (roll) {
|
|
447
|
+
innerWarning = 'your photo library';
|
|
448
|
+
} else {
|
|
449
|
+
// nothing to warn about
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
this.setState({
|
|
454
|
+
warning: `You must grant access to ${innerWarning}. Tap Go to settings to change your permission settings.`
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
closeWarningPopup() {
|
|
459
|
+
this.setState({
|
|
460
|
+
warning: null
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
goToPermissionSettings() {
|
|
465
|
+
Linking.openURL('app-settings:');
|
|
466
|
+
this.setState({
|
|
467
|
+
warning: null
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
renderSelectionPreview() {
|
|
472
|
+
const {
|
|
473
|
+
selected,
|
|
474
|
+
showRemote
|
|
475
|
+
} = this.state;
|
|
476
|
+
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(ScrollView, {
|
|
477
|
+
horizontal: true,
|
|
478
|
+
showsHorizontalScrollIndicator: false,
|
|
479
|
+
contentContainerStyle: styles.selectionPreviewContainer
|
|
480
|
+
}, selected && selected.map(uri => {
|
|
481
|
+
const imageUri = showRemote ? getThumb300(uri) : uri;
|
|
482
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
483
|
+
key: uri,
|
|
484
|
+
style: styles.previewItemContainer
|
|
485
|
+
}, /*#__PURE__*/React.createElement(ImageBackground, {
|
|
486
|
+
style: styles.previewItemImage,
|
|
487
|
+
source: {
|
|
488
|
+
uri: imageUri
|
|
489
|
+
}
|
|
490
|
+
}), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
491
|
+
style: styles.previewItemRemoveButton,
|
|
492
|
+
onPress: () => this.onRemoveImage(uri)
|
|
493
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
494
|
+
style: [styles.previewItemRemoveContainer, {
|
|
495
|
+
backgroundColor: this.props.colourBrandingMain
|
|
496
|
+
}]
|
|
497
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
498
|
+
name: "times",
|
|
499
|
+
type: "font-awesome",
|
|
500
|
+
iconStyle: styles.previewItemRemoveIcon
|
|
501
|
+
}))));
|
|
502
|
+
})));
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
renderSelectedAlbum() {
|
|
506
|
+
const {
|
|
507
|
+
localAlbums,
|
|
508
|
+
selectedAlbumId,
|
|
509
|
+
showRemote
|
|
510
|
+
} = this.state;
|
|
511
|
+
const selectedAlbum = (showRemote ? this.props.imageLibrary : localAlbums).find(album => album.id === selectedAlbumId);
|
|
512
|
+
const selectedAlbumText = selectedAlbum ? selectedAlbum.title : '';
|
|
513
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
514
|
+
onPress: this.onSelectAlbum
|
|
515
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
516
|
+
style: styles.selectAlbumButton
|
|
517
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
518
|
+
style: styles.selectAlbumButtonText
|
|
519
|
+
}, selectedAlbumText), /*#__PURE__*/React.createElement(Icon, {
|
|
520
|
+
name: "angle-down",
|
|
521
|
+
type: "font-awesome",
|
|
522
|
+
iconStyle: styles.selectAlbumButtonIcon
|
|
523
|
+
})));
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
renderBrowser() {
|
|
527
|
+
const {
|
|
528
|
+
selected,
|
|
529
|
+
selectedAlbumId,
|
|
530
|
+
showRemote
|
|
531
|
+
} = this.state;
|
|
532
|
+
const {
|
|
533
|
+
imagesLimit,
|
|
534
|
+
multiple,
|
|
535
|
+
allowVideo,
|
|
536
|
+
imageLibrary
|
|
537
|
+
} = this.props;
|
|
538
|
+
const width = (SCREEN_WIDTH - 10 * 2) / 4;
|
|
539
|
+
return /*#__PURE__*/React.createElement(ImageBrowser, {
|
|
540
|
+
max: !multiple ? 1 : imagesLimit,
|
|
541
|
+
loadCount: 30,
|
|
542
|
+
onChange: this.onSelectionChange,
|
|
543
|
+
renderSelectedComponent: this.renderSelectedComponent,
|
|
544
|
+
callback: this.onSelected,
|
|
545
|
+
selected: selected,
|
|
546
|
+
allowVideo: allowVideo,
|
|
547
|
+
style: styles.browserContainer,
|
|
548
|
+
itemStyle: styles.itemContainer,
|
|
549
|
+
itemWidth: width,
|
|
550
|
+
itemHeight: width,
|
|
551
|
+
album: selectedAlbumId,
|
|
552
|
+
remoteAlbums: showRemote ? imageLibrary : null
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
renderAttachButton() {
|
|
557
|
+
const {
|
|
558
|
+
selected,
|
|
559
|
+
selectedType
|
|
560
|
+
} = this.state;
|
|
561
|
+
const canAttach = selected.length > 0 && !_.isEmpty(selectedType);
|
|
562
|
+
const attachText = `Attach ${canAttach ? selected.length : ''} ${canAttach ? selectedType : ''}${selected.length > 1 ? 's' : ''}`;
|
|
563
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
564
|
+
style: styles.buttonContainer
|
|
565
|
+
}, /*#__PURE__*/React.createElement(InlineButton, {
|
|
566
|
+
color: canAttach ? this.props.colourBrandingMain : INACTIVE_BUTTON,
|
|
567
|
+
onPress: this.state.onAttach,
|
|
568
|
+
fillTouchable: true,
|
|
569
|
+
large: true,
|
|
570
|
+
disabled: !canAttach
|
|
571
|
+
}, attachText));
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
renderSelectAlbumPopup() {
|
|
575
|
+
const {
|
|
576
|
+
showSelectAlbum,
|
|
577
|
+
localAlbums,
|
|
578
|
+
showRemote
|
|
579
|
+
} = this.state;
|
|
580
|
+
if (!showSelectAlbum) return null;
|
|
581
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
582
|
+
visible: true,
|
|
583
|
+
transparent: true,
|
|
584
|
+
animationType: "slide",
|
|
585
|
+
onRequestClose: this.onSelectAlbumClosed
|
|
586
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
587
|
+
style: styles.selectAlbumModal
|
|
588
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
589
|
+
style: styles.selectAlbumContainer
|
|
590
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
591
|
+
style: styles.selectAlbumTitleContainer
|
|
592
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
593
|
+
style: styles.selectAlbumTitle
|
|
594
|
+
}, "Select Album")), /*#__PURE__*/React.createElement(ScrollView, null, (showRemote ? this.props.imageLibrary : localAlbums).map((album, index) => {
|
|
595
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
596
|
+
key: album.id,
|
|
597
|
+
onPress: () => this.onAlbumSelected(album.id)
|
|
598
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
599
|
+
style: [styles.albumOptionContainer, index === 0 && {
|
|
600
|
+
borderTopWidth: 0
|
|
601
|
+
}]
|
|
602
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
603
|
+
style: styles.albumOptionText
|
|
604
|
+
}, album.title)));
|
|
605
|
+
})), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
606
|
+
onPress: this.onSelectAlbumClosed
|
|
607
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
608
|
+
style: [styles.albumOptionContainer, {
|
|
609
|
+
marginHorizontal: 0
|
|
610
|
+
}]
|
|
611
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
612
|
+
style: [styles.albumOptionText, {
|
|
613
|
+
color: this.props.colourBrandingMain
|
|
614
|
+
}]
|
|
615
|
+
}, "Cancel"))))));
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
renderPhotos() {
|
|
619
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
620
|
+
visible: true,
|
|
621
|
+
transparent: true,
|
|
622
|
+
animationType: "slide",
|
|
623
|
+
onRequestClose: this.hidePhotos
|
|
624
|
+
}, /*#__PURE__*/React.createElement(Header, {
|
|
625
|
+
leftIcon: "angle-left",
|
|
626
|
+
onPressLeft: this.hidePhotos,
|
|
627
|
+
text: this.props.popupTitle || 'Attach image'
|
|
628
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
629
|
+
style: styles.contentContainer
|
|
630
|
+
}, this.renderSelectionPreview(), this.renderSelectedAlbum(), this.renderBrowser()), this.renderAttachButton(), this.renderSelectAlbumPopup());
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
render() {
|
|
634
|
+
const {
|
|
635
|
+
warning,
|
|
636
|
+
showUploadMenu,
|
|
637
|
+
showPhotos,
|
|
638
|
+
showCropper,
|
|
639
|
+
selected
|
|
640
|
+
} = this.state;
|
|
641
|
+
|
|
642
|
+
if (warning != null) {
|
|
643
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
644
|
+
title: "Permissions missing",
|
|
645
|
+
text: warning,
|
|
646
|
+
options: [{
|
|
647
|
+
text: 'Go to settings',
|
|
648
|
+
action: this.goToPermissionSettings.bind(this),
|
|
649
|
+
bold: true
|
|
650
|
+
}, {
|
|
651
|
+
text: 'Ignore',
|
|
652
|
+
action: this.closeWarningPopup.bind(this)
|
|
653
|
+
}]
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
if (showUploadMenu) {
|
|
658
|
+
const options = this.buildOptions();
|
|
659
|
+
return /*#__PURE__*/React.createElement(PopupMenu, {
|
|
660
|
+
onClose: this.hideUploadMenu.bind(this),
|
|
661
|
+
options: options,
|
|
662
|
+
title: this.props.popupTitle,
|
|
663
|
+
cancelText: "Cancel"
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
if (showPhotos) return this.renderPhotos();
|
|
668
|
+
|
|
669
|
+
if (showCropper) {
|
|
670
|
+
return /*#__PURE__*/React.createElement(ExpoImageManipulator, {
|
|
671
|
+
photo: {
|
|
672
|
+
uri: selected[0]
|
|
673
|
+
},
|
|
674
|
+
onToggleModal: this.toggleCropper,
|
|
675
|
+
isVisible: showCropper,
|
|
676
|
+
onPictureChoosed: data => {
|
|
677
|
+
this.handleImagePicked(data.uri);
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
return null;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
const styles = StyleSheet.create({
|
|
688
|
+
contentContainer: {
|
|
689
|
+
flex: 1,
|
|
690
|
+
backgroundColor: BOXGREY
|
|
691
|
+
},
|
|
692
|
+
browserContainer: {
|
|
693
|
+
padding: 10
|
|
694
|
+
},
|
|
695
|
+
itemContainer: {
|
|
696
|
+
padding: 4
|
|
697
|
+
},
|
|
698
|
+
selectedItemContainer: {
|
|
699
|
+
flex: 1,
|
|
700
|
+
backgroundColor: '#0008'
|
|
701
|
+
},
|
|
702
|
+
selectedMarkerContainer: {
|
|
703
|
+
position: 'absolute',
|
|
704
|
+
top: 6,
|
|
705
|
+
right: 6,
|
|
706
|
+
width: 20,
|
|
707
|
+
height: 20,
|
|
708
|
+
borderRadius: 10,
|
|
709
|
+
alignItems: 'center',
|
|
710
|
+
justifyContent: 'center'
|
|
711
|
+
},
|
|
712
|
+
selectedItemText: {
|
|
713
|
+
fontFamily: 'sf-semibold',
|
|
714
|
+
fontSize: 12,
|
|
715
|
+
color: '#fff',
|
|
716
|
+
marginBottom: 1
|
|
717
|
+
},
|
|
718
|
+
selectedItemIcon: {
|
|
719
|
+
fontSize: 12,
|
|
720
|
+
color: '#fff',
|
|
721
|
+
marginBottom: 1
|
|
722
|
+
},
|
|
723
|
+
buttonContainer: {
|
|
724
|
+
alignItems: 'center',
|
|
725
|
+
justifyContent: 'center',
|
|
726
|
+
height: 60,
|
|
727
|
+
paddingHorizontal: 14,
|
|
728
|
+
backgroundColor: '#fff'
|
|
729
|
+
},
|
|
730
|
+
selectAlbumButton: {
|
|
731
|
+
paddingTop: 13,
|
|
732
|
+
paddingHorizontal: 14,
|
|
733
|
+
flexDirection: 'row',
|
|
734
|
+
alignItems: 'center'
|
|
735
|
+
},
|
|
736
|
+
selectAlbumButtonText: {
|
|
737
|
+
fontFamily: 'sf-medium',
|
|
738
|
+
fontSize: 14,
|
|
739
|
+
color: TEXT_BLUEGREY,
|
|
740
|
+
marginRight: 6
|
|
741
|
+
},
|
|
742
|
+
selectAlbumButtonIcon: {
|
|
743
|
+
fontSize: 20,
|
|
744
|
+
color: TEXT_BLUEGREY
|
|
745
|
+
},
|
|
746
|
+
selectAlbumModal: {
|
|
747
|
+
position: 'absolute',
|
|
748
|
+
bottom: 0,
|
|
749
|
+
left: 0,
|
|
750
|
+
right: 0,
|
|
751
|
+
top: 0,
|
|
752
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
753
|
+
zIndex: 1000
|
|
754
|
+
},
|
|
755
|
+
selectAlbumContainer: {
|
|
756
|
+
position: 'absolute',
|
|
757
|
+
bottom: 0,
|
|
758
|
+
left: 0,
|
|
759
|
+
right: 0,
|
|
760
|
+
backgroundColor: '#fff',
|
|
761
|
+
borderTopLeftRadius: 12,
|
|
762
|
+
borderTopRightRadius: 12,
|
|
763
|
+
maxHeight: SCREEN_HEIGHT / 2
|
|
764
|
+
},
|
|
765
|
+
selectAlbumTitleContainer: {
|
|
766
|
+
padding: 16,
|
|
767
|
+
borderColor: LINEGREY,
|
|
768
|
+
borderBottomWidth: 1
|
|
769
|
+
},
|
|
770
|
+
selectAlbumTitle: {
|
|
771
|
+
fontFamily: 'sf-semibold',
|
|
772
|
+
fontSize: 16,
|
|
773
|
+
textAlign: 'center',
|
|
774
|
+
color: TEXT_DARK
|
|
775
|
+
},
|
|
776
|
+
albumOptionContainer: {
|
|
777
|
+
marginHorizontal: 16,
|
|
778
|
+
paddingVertical: 16,
|
|
779
|
+
borderColor: LINEGREY,
|
|
780
|
+
borderTopWidth: 1
|
|
781
|
+
},
|
|
782
|
+
albumOptionText: {
|
|
783
|
+
fontFamily: 'sf-regular',
|
|
784
|
+
fontSize: 16,
|
|
785
|
+
textAlign: 'center',
|
|
786
|
+
color: TEXT_DARK
|
|
787
|
+
},
|
|
788
|
+
selectionPreviewContainer: {
|
|
789
|
+
paddingTop: 14,
|
|
790
|
+
paddingRight: 2,
|
|
791
|
+
paddingLeft: 14
|
|
792
|
+
},
|
|
793
|
+
previewItemContainer: {
|
|
794
|
+
marginRight: 12
|
|
795
|
+
},
|
|
796
|
+
previewItemImage: {
|
|
797
|
+
width: 50,
|
|
798
|
+
height: 50,
|
|
799
|
+
alignItems: 'center',
|
|
800
|
+
justifyContent: 'center',
|
|
801
|
+
borderRadius: 4,
|
|
802
|
+
overflow: 'hidden'
|
|
803
|
+
},
|
|
804
|
+
previewItemRemoveButton: {
|
|
805
|
+
position: 'absolute',
|
|
806
|
+
top: -8,
|
|
807
|
+
right: -8
|
|
808
|
+
},
|
|
809
|
+
previewItemRemoveContainer: {
|
|
810
|
+
justifyContent: 'center',
|
|
811
|
+
alignItems: 'center',
|
|
812
|
+
borderRadius: 10,
|
|
813
|
+
width: 20,
|
|
814
|
+
height: 20,
|
|
815
|
+
borderWidth: 2,
|
|
816
|
+
borderColor: '#fff'
|
|
817
|
+
},
|
|
818
|
+
previewItemRemoveIcon: {
|
|
819
|
+
fontSize: 10,
|
|
820
|
+
color: '#fff',
|
|
821
|
+
marginBottom: 1
|
|
822
|
+
}
|
|
823
|
+
});
|
|
824
|
+
|
|
825
|
+
const mapStateToProps = state => {
|
|
826
|
+
const {
|
|
827
|
+
user,
|
|
828
|
+
media
|
|
829
|
+
} = state;
|
|
830
|
+
const imageLibrary = media.imageLibrary.filter(folder => !folder.Public).map(album => {
|
|
831
|
+
return {
|
|
832
|
+
title: album.Name,
|
|
833
|
+
id: album.RowId || '',
|
|
834
|
+
images: album.RowId ? album.Images : media.stockImages
|
|
835
|
+
};
|
|
836
|
+
});
|
|
837
|
+
return {
|
|
838
|
+
user,
|
|
839
|
+
imageLibrary,
|
|
840
|
+
colourBrandingMain: getMainBrandingColourFromState(state)
|
|
841
|
+
};
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
export default connect(mapStateToProps, {
|
|
845
|
+
stockImagesLoaded,
|
|
846
|
+
imageLibraryLoaded
|
|
847
|
+
}, null, {
|
|
848
|
+
forwardRef: true
|
|
849
|
+
})(ImageUploader);
|
|
850
|
+
//# sourceMappingURL=ImageUploader.js.map
|