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