@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,997 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
import React, { Component } from 'react';
|
|
6
|
+
import { View, Image, ImageBackground, TouchableOpacity, Text, KeyboardAvoidingView, Platform, ScrollView } from 'react-native';
|
|
7
|
+
import { GiftedChat, Bubble, MessageText, Send, InputToolbar, Composer } from 'react-native-gifted-chat';
|
|
8
|
+
import { connect } from 'react-redux';
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
import moment from 'moment';
|
|
11
|
+
import { Icon } from 'react-native-elements';
|
|
12
|
+
import { getBottomSpace } from 'react-native-iphone-x-helper';
|
|
13
|
+
import { Spinner } from './Spinner';
|
|
14
|
+
import { ProfilePic } from './ProfilePic';
|
|
15
|
+
import PlussChatTime from './PlussChatTime';
|
|
16
|
+
import { PDFPopup } from './PDFPopup';
|
|
17
|
+
import { Attachment } from './Attachment';
|
|
18
|
+
import PlussChatMessage from './PlussChatMessage';
|
|
19
|
+
import { TEXT_DARK, LINEGREY, TEXT_DARKEST, getMainBrandingColourFromState, getLightBrandingColourFromState, BG_GREY, TEXT_BLUEGREY } from '../colours';
|
|
20
|
+
import { getEnabledTabsFromState, get1400, getThumb300, imageExists, isVideo, getImageSource, getFileName } from '../helper';
|
|
21
|
+
import Config, { Services } from '../config';
|
|
22
|
+
import ImageUploader from './ImageUploader';
|
|
23
|
+
import ImageUploadProgress from './ImageUploadProgress';
|
|
24
|
+
import { ImagePopup } from './ImagePopup';
|
|
25
|
+
import { VideoPopup } from './VideoPopup';
|
|
26
|
+
const IMAGE_SIZE_SMALL = 55;
|
|
27
|
+
const IMAGE_SIZE_LARGE = 110;
|
|
28
|
+
const IMAGES_PER_ROW = 4;
|
|
29
|
+
const IMAGE_MARGIN = 2;
|
|
30
|
+
const IMAGE_PREVIEW_AREA_HEIGHT = 105;
|
|
31
|
+
const IMAGE_PREVIEW_SIZE = IMAGE_PREVIEW_AREA_HEIGHT - 25;
|
|
32
|
+
|
|
33
|
+
class PlussChat extends Component {
|
|
34
|
+
constructor(props) {
|
|
35
|
+
var _this;
|
|
36
|
+
|
|
37
|
+
super(props);
|
|
38
|
+
_this = this;
|
|
39
|
+
|
|
40
|
+
_defineProperty(this, "onPressEvent", event => {
|
|
41
|
+
Services.navigation.navigate('eventDetail', {
|
|
42
|
+
event
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
_defineProperty(this, "onPressAttachment", attachment => {
|
|
47
|
+
switch (attachment.Type) {
|
|
48
|
+
case 'Event':
|
|
49
|
+
Services.navigation.navigate('eventDetail', {
|
|
50
|
+
event: attachment
|
|
51
|
+
});
|
|
52
|
+
break;
|
|
53
|
+
|
|
54
|
+
case 'Place':
|
|
55
|
+
Services.navigation.navigate('placeDetail', {
|
|
56
|
+
place: attachment
|
|
57
|
+
});
|
|
58
|
+
break;
|
|
59
|
+
|
|
60
|
+
default:
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
_defineProperty(this, "hasImagesAttached", function () {
|
|
66
|
+
let imagesToUpload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
67
|
+
return !_.isEmpty(imagesToUpload || _this.state.imagesToUpload);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
_defineProperty(this, "hasImagesReady", function () {
|
|
71
|
+
let imagesToUpload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
72
|
+
const upload = imagesToUpload || _this.state.imagesToUpload;
|
|
73
|
+
return _this.hasImagesAttached(upload) && upload.every(i => !i.uploading && i.thumbNailExists);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
_defineProperty(this, "waitForThumbnails", () => {
|
|
77
|
+
if (this.checkThumb) return;
|
|
78
|
+
this.checkThumb = setInterval(async () => {
|
|
79
|
+
const imagesToUpload = [];
|
|
80
|
+
await Promise.all(this.state.imagesToUpload.map(image => {
|
|
81
|
+
return new Promise(async resolve => {
|
|
82
|
+
const newImage = { ...image
|
|
83
|
+
};
|
|
84
|
+
imagesToUpload.push(newImage);
|
|
85
|
+
|
|
86
|
+
if (newImage.url && !newImage.thumbNailExists) {
|
|
87
|
+
newImage.uploading = false;
|
|
88
|
+
newImage.allowRetry = false;
|
|
89
|
+
newImage.thumbNailExists = await imageExists(newImage.thumbNailUrl);
|
|
90
|
+
resolve(newImage.thumbNailExists);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
resolve(true);
|
|
94
|
+
});
|
|
95
|
+
}));
|
|
96
|
+
const thumbnailsExist = imagesToUpload.every(image => !image.url || image.thumbNailExists);
|
|
97
|
+
|
|
98
|
+
if (thumbnailsExist) {
|
|
99
|
+
clearInterval(this.checkThumb);
|
|
100
|
+
this.checkThumb = null;
|
|
101
|
+
this.setState({
|
|
102
|
+
imagesToUpload
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}, 2000);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
_defineProperty(this, "onOpenAttachment", a => {
|
|
109
|
+
this.setState({
|
|
110
|
+
selectedPDF: a
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
_defineProperty(this, "onCloseAttachment", () => {
|
|
115
|
+
this.setState({
|
|
116
|
+
selectedPDF: null
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
_defineProperty(this, "onFocusInput", () => {
|
|
121
|
+
this.setState({
|
|
122
|
+
keyboardOpen: true
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
if (this.props.keyboardOpen) {
|
|
126
|
+
this.props.keyboardOpen();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
_defineProperty(this, "onBlurInput", () => {
|
|
131
|
+
this.setState({
|
|
132
|
+
keyboardOpen: false
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
_defineProperty(this, "onUploadStarted", (uploadUri, imageUri) => {
|
|
137
|
+
const imagesToUpload = [...this.state.imagesToUpload, {
|
|
138
|
+
uploading: true,
|
|
139
|
+
uploadProgress: '0%',
|
|
140
|
+
uploadUri,
|
|
141
|
+
imageUri,
|
|
142
|
+
allowRetry: true
|
|
143
|
+
}];
|
|
144
|
+
this.setState({
|
|
145
|
+
imagesToUpload
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
_defineProperty(this, "onUploadProgress", progress => {
|
|
150
|
+
const imagesToUpload = [...this.state.imagesToUpload];
|
|
151
|
+
imagesToUpload.map(img => {
|
|
152
|
+
if (img.uploadUri === progress.uri) {
|
|
153
|
+
img.uploadProgress = progress.percentage;
|
|
154
|
+
img.uploading = true;
|
|
155
|
+
img.allowRetry = true;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
this.setState({
|
|
159
|
+
imagesToUpload
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
_defineProperty(this, "onUploadSuccess", async (uri, uploadUri) => {
|
|
164
|
+
const imagesToUpload = [...this.state.imagesToUpload];
|
|
165
|
+
imagesToUpload.map(img => {
|
|
166
|
+
if (img.uploadUri === uploadUri && img.uploading) {
|
|
167
|
+
img.url = uri.replace('/general/', '/general1400/');
|
|
168
|
+
img.thumbNailExists = false;
|
|
169
|
+
img.thumbNailUrl = getThumb300(img.url);
|
|
170
|
+
img.allowRetry = true;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
this.setState({
|
|
174
|
+
imagesToUpload
|
|
175
|
+
}, () => this.waitForThumbnails());
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
_defineProperty(this, "onUploadFailed", uploadUri => {
|
|
179
|
+
const imagesToUpload = [...this.state.imagesToUpload];
|
|
180
|
+
imagesToUpload.map(img => {
|
|
181
|
+
if (img.uploadUri === uploadUri) {
|
|
182
|
+
img.uploading = true; // Requried for retry
|
|
183
|
+
|
|
184
|
+
img.uploadProgress = '';
|
|
185
|
+
img.allowRetry = true;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
this.setState({
|
|
189
|
+
imagesToUpload
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
_defineProperty(this, "onLibrarySelected", uri => {
|
|
194
|
+
const imagesToUpload = [...this.state.imagesToUpload, {
|
|
195
|
+
uploading: false,
|
|
196
|
+
allowRetry: false,
|
|
197
|
+
url: get1400(uri),
|
|
198
|
+
thumbNailExists: true,
|
|
199
|
+
thumbNailUrl: getThumb300(uri)
|
|
200
|
+
}];
|
|
201
|
+
this.setState({
|
|
202
|
+
imagesToUpload
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
_defineProperty(this, "onPressImage", (images, selected) => {
|
|
207
|
+
this.setState({
|
|
208
|
+
imagePopupSource: images,
|
|
209
|
+
imagePopupIndex: images.indexOf(selected),
|
|
210
|
+
imagePopupOpen: true
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
_defineProperty(this, "onRemoveImage", url => {
|
|
215
|
+
const imagesToUpload = this.state.imagesToUpload.filter(image => image.url !== url);
|
|
216
|
+
this.setState({
|
|
217
|
+
imagesToUpload
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
_defineProperty(this, "toggleFullscreenVideo", url => {
|
|
222
|
+
if (typeof url !== 'string') url = '';
|
|
223
|
+
this.setState({
|
|
224
|
+
showFullscreenVideo: url.length > 0,
|
|
225
|
+
currentVideoUrl: url
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
const isSingleTab = this.props.tabCount === 1 && getBottomSpace() > 0;
|
|
230
|
+
this.MIN_COMPOSER_HEIGHT = Platform.select({
|
|
231
|
+
ios: isSingleTab ? 42 : 33,
|
|
232
|
+
android: 41
|
|
233
|
+
});
|
|
234
|
+
this.state = {
|
|
235
|
+
currentUser: {
|
|
236
|
+
_id: this.props.user.uid,
|
|
237
|
+
name: this.props.user.displayName,
|
|
238
|
+
avatar: !_.isUndefined(this.props.user.profilePic) && !_.isEmpty(this.props.user.profilePic) ? this.props.user.profilePic : Config.env.tinyChatDefault
|
|
239
|
+
},
|
|
240
|
+
messages: [],
|
|
241
|
+
imagePopupSource: [],
|
|
242
|
+
imagePopupIndex: 0,
|
|
243
|
+
imagePopupOpen: false,
|
|
244
|
+
imagesToUpload: [],
|
|
245
|
+
showFullscreenVideo: false,
|
|
246
|
+
currentVideoUrl: ''
|
|
247
|
+
};
|
|
248
|
+
this.checkThumb = null;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
UNSAFE_componentWillMount() {
|
|
252
|
+
this.updateMessages(this.props);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
256
|
+
this.updateMessages(nextProps);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
updateMessages(props) {
|
|
260
|
+
const newState = {};
|
|
261
|
+
|
|
262
|
+
if (!_.isUndefined(props.messages)) {
|
|
263
|
+
newState.messages = props.messages;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
this.setState(newState);
|
|
267
|
+
}
|
|
268
|
+
/***
|
|
269
|
+
*
|
|
270
|
+
* Messaging functionality
|
|
271
|
+
*/
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
onSend() {// if (this.chatKey) {
|
|
275
|
+
// this.sendMessage(messages[0]);
|
|
276
|
+
// }
|
|
277
|
+
|
|
278
|
+
let messages = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
showUploadMenu() {
|
|
282
|
+
this.imageUploader.showUploadMenu();
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
closeGallery() {
|
|
286
|
+
this.setState({
|
|
287
|
+
imagePopupSource: [],
|
|
288
|
+
imagePopupIndex: 0,
|
|
289
|
+
imagePopupOpen: false
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
sendMessages(messages) {
|
|
294
|
+
if (this.hasImagesAttached()) {
|
|
295
|
+
// Don't allow send if attached images aren't ready
|
|
296
|
+
if (!this.hasImagesReady()) return;
|
|
297
|
+
messages[0].image = this.state.imagesToUpload.map(image => image.url);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (_.isEmpty(messages[0].text)) {
|
|
301
|
+
messages[0].text = '';
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (!messages[0].text && !messages[0].image) return;
|
|
305
|
+
this.props.onSend(messages);
|
|
306
|
+
this.setState({
|
|
307
|
+
imagesToUpload: []
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
*
|
|
312
|
+
* Render Functions
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
renderBubble(bubbleProps) {
|
|
317
|
+
const wrapperStyle = {};
|
|
318
|
+
|
|
319
|
+
if (!_.isEmpty(bubbleProps.currentMessage.text) && !_.isEmpty(bubbleProps.currentMessage.image)) {
|
|
320
|
+
wrapperStyle.paddingTop = 8;
|
|
321
|
+
wrapperStyle.paddingBottom = 16;
|
|
322
|
+
wrapperStyle.minWidth = 142; // 110 image width + 16 padding either side
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (!_.isEmpty(bubbleProps.currentMessage.attachments)) {
|
|
326
|
+
wrapperStyle.paddingTop = 8;
|
|
327
|
+
wrapperStyle.paddingBottom = 16;
|
|
328
|
+
wrapperStyle.paddingHorizontal = 16;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return /*#__PURE__*/React.createElement(Bubble, _extends({}, bubbleProps, {
|
|
332
|
+
renderMessageImage: () => null,
|
|
333
|
+
isCustomViewBottom: true,
|
|
334
|
+
wrapperStyle: {
|
|
335
|
+
left: {
|
|
336
|
+
backgroundColor: LINEGREY,
|
|
337
|
+
borderRadius: 25,
|
|
338
|
+
...wrapperStyle
|
|
339
|
+
},
|
|
340
|
+
right: {
|
|
341
|
+
backgroundColor: this.props.colourBrandingLight,
|
|
342
|
+
borderRadius: 25,
|
|
343
|
+
...wrapperStyle
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
containerToNextStyle: {
|
|
347
|
+
left: {
|
|
348
|
+
borderBottomLeftRadius: 5
|
|
349
|
+
},
|
|
350
|
+
right: {
|
|
351
|
+
borderBottomRightRadius: 5
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
containerToPreviousStyle: {
|
|
355
|
+
left: {
|
|
356
|
+
borderTopLeftRadius: 5
|
|
357
|
+
},
|
|
358
|
+
right: {
|
|
359
|
+
borderTopRightRadius: 5
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}));
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
renderMessage(props) {
|
|
366
|
+
return /*#__PURE__*/React.createElement(PlussChatMessage, _extends({
|
|
367
|
+
key: props.RowId
|
|
368
|
+
}, props));
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
renderMessageText(messageTextProps) {
|
|
372
|
+
return /*#__PURE__*/React.createElement(MessageText, _extends({}, messageTextProps, {
|
|
373
|
+
textStyle: {
|
|
374
|
+
left: {
|
|
375
|
+
fontFamily: 'sf-regular',
|
|
376
|
+
fontSize: 16,
|
|
377
|
+
color: TEXT_DARKEST,
|
|
378
|
+
marginTop: 10,
|
|
379
|
+
marginBottom: 10,
|
|
380
|
+
marginLeft: 15,
|
|
381
|
+
marginRight: 15
|
|
382
|
+
},
|
|
383
|
+
right: {
|
|
384
|
+
fontFamily: 'sf-regular',
|
|
385
|
+
fontSize: 16,
|
|
386
|
+
color: this.props.colourBrandingMain,
|
|
387
|
+
marginTop: 10,
|
|
388
|
+
marginBottom: 10,
|
|
389
|
+
marginLeft: 15,
|
|
390
|
+
marginRight: 15
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
linkStyle: {
|
|
394
|
+
left: {
|
|
395
|
+
color: TEXT_DARKEST
|
|
396
|
+
},
|
|
397
|
+
right: {
|
|
398
|
+
color: this.props.colourBrandingMain
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}));
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
renderTime() {
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
renderDay(dayProps) {
|
|
409
|
+
return /*#__PURE__*/React.createElement(PlussChatTime, _extends({}, dayProps, {
|
|
410
|
+
textStyle: {
|
|
411
|
+
fontFamily: 'sf-semibold',
|
|
412
|
+
color: TEXT_DARK,
|
|
413
|
+
fontSize: 12
|
|
414
|
+
}
|
|
415
|
+
}));
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
renderCustomView(_ref) {
|
|
419
|
+
let {
|
|
420
|
+
currentMessage,
|
|
421
|
+
position
|
|
422
|
+
} = _ref;
|
|
423
|
+
|
|
424
|
+
if (currentMessage.image) {
|
|
425
|
+
const images = typeof currentMessage.image === 'string' ? [currentMessage.image] : currentMessage.image;
|
|
426
|
+
|
|
427
|
+
const containerWidth = (() => {
|
|
428
|
+
if (images.length === 0) return 0;
|
|
429
|
+
if (images.length === 1) return IMAGE_SIZE_LARGE;
|
|
430
|
+
if (images.length <= IMAGES_PER_ROW) return (IMAGE_SIZE_SMALL + IMAGE_MARGIN) * images.length;
|
|
431
|
+
return (IMAGE_SIZE_SMALL + IMAGE_MARGIN) * IMAGES_PER_ROW;
|
|
432
|
+
})();
|
|
433
|
+
|
|
434
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
435
|
+
style: [styles.imagesContainer, {
|
|
436
|
+
width: containerWidth,
|
|
437
|
+
paddingVertical: currentMessage.text ? 0 : 20
|
|
438
|
+
}]
|
|
439
|
+
}, images.map(img => {
|
|
440
|
+
const thumb = getThumb300(img);
|
|
441
|
+
|
|
442
|
+
if (isVideo(img)) {
|
|
443
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
444
|
+
key: thumb,
|
|
445
|
+
onPress: this.toggleFullscreenVideo.bind(this, img)
|
|
446
|
+
}, /*#__PURE__*/React.createElement(ImageBackground, {
|
|
447
|
+
style: images.length > 1 ? styles.messageImageSmall : styles.messageImageLarge,
|
|
448
|
+
source: {
|
|
449
|
+
uri: thumb
|
|
450
|
+
}
|
|
451
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
452
|
+
style: styles.imagePlayContainer
|
|
453
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
454
|
+
name: "play",
|
|
455
|
+
type: "font-awesome",
|
|
456
|
+
iconStyle: styles.imageControlIcon
|
|
457
|
+
}))));
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
461
|
+
key: thumb,
|
|
462
|
+
onPress: () => this.onPressImage(images, img)
|
|
463
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
464
|
+
source: {
|
|
465
|
+
uri: thumb
|
|
466
|
+
},
|
|
467
|
+
style: images.length > 1 ? styles.messageImageSmall : styles.messageImageLarge
|
|
468
|
+
}));
|
|
469
|
+
}));
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if (!_.isEmpty(currentMessage.attachments)) {
|
|
473
|
+
console.log('rendering attachments');
|
|
474
|
+
console.log(currentMessage.attachments);
|
|
475
|
+
return /*#__PURE__*/React.createElement(View, null, currentMessage.attachments.map((url, i) => {
|
|
476
|
+
return /*#__PURE__*/React.createElement(Attachment, {
|
|
477
|
+
onPress: () => {
|
|
478
|
+
this.onOpenAttachment(url);
|
|
479
|
+
},
|
|
480
|
+
key: i,
|
|
481
|
+
title: getFileName(url)
|
|
482
|
+
});
|
|
483
|
+
}));
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
if (currentMessage.event) {
|
|
487
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
488
|
+
onPress: this.onPressEvent.bind(this, currentMessage.event)
|
|
489
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
490
|
+
style: styles.eventContainer[position]
|
|
491
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
492
|
+
style: [styles.eventImage, styles.eventImageMargin[position]],
|
|
493
|
+
source: {
|
|
494
|
+
uri: currentMessage.event.Thumbnail
|
|
495
|
+
}
|
|
496
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
497
|
+
style: styles.eventInfo
|
|
498
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
499
|
+
numberOfLines: 3,
|
|
500
|
+
style: [styles.eventTitle, styles.eventInfoAlign[position], {
|
|
501
|
+
color: this.props.colourBrandingMain
|
|
502
|
+
}]
|
|
503
|
+
}, currentMessage.event.Title), /*#__PURE__*/React.createElement(Text, {
|
|
504
|
+
style: [styles.eventDate, styles.eventInfoAlign[position], {
|
|
505
|
+
color: this.props.colourBrandingMain
|
|
506
|
+
}]
|
|
507
|
+
}, moment.utc(currentMessage.event.StartTime).local().format('ddd D MMM')))));
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if (currentMessage.attachment) {
|
|
511
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
512
|
+
onPress: this.onPressAttachment.bind(this, currentMessage.attachment)
|
|
513
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
514
|
+
style: styles.eventContainer[position]
|
|
515
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
516
|
+
style: [styles.eventImage, styles.eventImageMargin[position]],
|
|
517
|
+
source: {
|
|
518
|
+
uri: currentMessage.attachment.Thumbnail
|
|
519
|
+
}
|
|
520
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
521
|
+
style: styles.eventInfo
|
|
522
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
523
|
+
numberOfLines: 3,
|
|
524
|
+
style: [styles.eventTitle, styles.eventInfoAlign[position], {
|
|
525
|
+
color: this.props.colourBrandingMain
|
|
526
|
+
}]
|
|
527
|
+
}, currentMessage.attachment.Title), currentMessage.attachment.StartTime && /*#__PURE__*/React.createElement(Text, {
|
|
528
|
+
style: [styles.eventDate, styles.eventInfoAlign[position], {
|
|
529
|
+
color: this.props.colourBrandingMain
|
|
530
|
+
}]
|
|
531
|
+
}, moment.utc(currentMessage.attachment.StartTime).local().format('ddd D MMM')))));
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
renderSend(props) {
|
|
538
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
539
|
+
style: {
|
|
540
|
+
position: 'absolute',
|
|
541
|
+
top: 0,
|
|
542
|
+
right: 0
|
|
543
|
+
}
|
|
544
|
+
}, (!_.isEmpty(props.text) || this.hasImagesReady(props.imagesToUpload)) && /*#__PURE__*/React.createElement(Send, _extends({}, props, {
|
|
545
|
+
alwaysShowSend: true,
|
|
546
|
+
containerStyle: [styles.sendContainer, {
|
|
547
|
+
width: this.MIN_COMPOSER_HEIGHT,
|
|
548
|
+
height: this.MIN_COMPOSER_HEIGHT
|
|
549
|
+
}]
|
|
550
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
551
|
+
name: 'paper-plane',
|
|
552
|
+
type: "font-awesome",
|
|
553
|
+
iconStyle: [styles.send, {
|
|
554
|
+
width: this.MIN_COMPOSER_HEIGHT
|
|
555
|
+
}]
|
|
556
|
+
})), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
557
|
+
onPress: this.showUploadMenu.bind(this),
|
|
558
|
+
style: [styles.sendContainer, {
|
|
559
|
+
right: _.isEmpty(props.text) && !this.hasImagesReady(props.imagesToUpload) ? 0 : 8 + this.MIN_COMPOSER_HEIGHT,
|
|
560
|
+
width: this.MIN_COMPOSER_HEIGHT,
|
|
561
|
+
height: this.MIN_COMPOSER_HEIGHT
|
|
562
|
+
}]
|
|
563
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
564
|
+
name: 'picture-o',
|
|
565
|
+
type: "font-awesome",
|
|
566
|
+
iconStyle: [styles.send, {
|
|
567
|
+
width: this.MIN_COMPOSER_HEIGHT
|
|
568
|
+
}]
|
|
569
|
+
})));
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
renderAccessory(props) {
|
|
573
|
+
return /*#__PURE__*/React.createElement(ScrollView, {
|
|
574
|
+
horizontal: true,
|
|
575
|
+
style: styles.uploadImagesContainer
|
|
576
|
+
}, props.imagesToUpload.map(image => {
|
|
577
|
+
if (image.uploading) {
|
|
578
|
+
return /*#__PURE__*/React.createElement(ImageUploadProgress, {
|
|
579
|
+
key: image.uploadUri,
|
|
580
|
+
uploader: this.imageUploader,
|
|
581
|
+
image: image,
|
|
582
|
+
color: this.props.colourBrandingMain,
|
|
583
|
+
style: {
|
|
584
|
+
width: IMAGE_PREVIEW_SIZE,
|
|
585
|
+
marginRight: 10
|
|
586
|
+
},
|
|
587
|
+
progressTextStyle: {
|
|
588
|
+
fontSize: 10
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
const isVideoUrl = isVideo(image.url);
|
|
594
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
595
|
+
key: image.url,
|
|
596
|
+
style: styles.accessoryImageContainer
|
|
597
|
+
}, /*#__PURE__*/React.createElement(ImageBackground, {
|
|
598
|
+
style: styles.accessoryImage,
|
|
599
|
+
imageStyle: styles.accessoryImageBorder,
|
|
600
|
+
source: getImageSource(image.thumbNailExists ? image.thumbNailUrl : image.url)
|
|
601
|
+
}, isVideoUrl && /*#__PURE__*/React.createElement(View, {
|
|
602
|
+
style: styles.imagePlayContainer
|
|
603
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
604
|
+
onPress: this.toggleFullscreenVideo.bind(this, image.url)
|
|
605
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
606
|
+
name: "play",
|
|
607
|
+
type: "font-awesome",
|
|
608
|
+
iconStyle: styles.imageControlIcon
|
|
609
|
+
})))), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
610
|
+
style: styles.previewItemRemoveButton,
|
|
611
|
+
onPress: () => this.onRemoveImage(image.url),
|
|
612
|
+
hitSlop: {
|
|
613
|
+
top: 8,
|
|
614
|
+
right: 8,
|
|
615
|
+
bottom: 8,
|
|
616
|
+
left: 8
|
|
617
|
+
}
|
|
618
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
619
|
+
style: [styles.previewItemRemoveContainer, {
|
|
620
|
+
backgroundColor: this.props.colourBrandingMain
|
|
621
|
+
}]
|
|
622
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
623
|
+
name: "times",
|
|
624
|
+
type: "font-awesome",
|
|
625
|
+
iconStyle: styles.previewItemRemoveIcon
|
|
626
|
+
}))));
|
|
627
|
+
}));
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
renderInputToolbar(props) {
|
|
631
|
+
if (!this.hasImagesAttached(props.imagesToUpload)) {
|
|
632
|
+
return /*#__PURE__*/React.createElement(InputToolbar, _extends({}, props, {
|
|
633
|
+
containerStyle: styles.inputContainer,
|
|
634
|
+
renderComposer: this.renderComposer.bind(this)
|
|
635
|
+
}));
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
return /*#__PURE__*/React.createElement(InputToolbar, _extends({}, props, {
|
|
639
|
+
containerStyle: styles.inputContainer,
|
|
640
|
+
renderComposer: this.renderComposer.bind(this),
|
|
641
|
+
renderAccessory: this.renderAccessory.bind(this),
|
|
642
|
+
accessoryStyle: styles.accessory
|
|
643
|
+
}));
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
renderFooter() {
|
|
647
|
+
// if (this.state.keyboardOpen) {
|
|
648
|
+
// return null;
|
|
649
|
+
// }
|
|
650
|
+
// fixes an issue where there's no gap between bottom message and reply container
|
|
651
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
652
|
+
style: {
|
|
653
|
+
height: 10
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
renderLoading() {
|
|
659
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
660
|
+
style: {
|
|
661
|
+
marginTop: 15,
|
|
662
|
+
justifyContent: 'center',
|
|
663
|
+
alignContent: 'center'
|
|
664
|
+
}
|
|
665
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
666
|
+
size: 'small',
|
|
667
|
+
color: this.props.colourBrandingMain
|
|
668
|
+
}));
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
renderAvatar(props) {
|
|
672
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
673
|
+
style: {
|
|
674
|
+
marginRight: 2
|
|
675
|
+
}
|
|
676
|
+
}, /*#__PURE__*/React.createElement(ProfilePic, {
|
|
677
|
+
ProfilePic: props.currentMessage.user.avatar,
|
|
678
|
+
Diameter: 28
|
|
679
|
+
}));
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
renderComposer(props) {
|
|
683
|
+
//console.log(props.composerHeight);
|
|
684
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
685
|
+
style: [styles.input, {
|
|
686
|
+
//height: props.composerHeight + 10,
|
|
687
|
+
//borderRadius: (this.MIN_COMPOSER_HEIGHT + 10) / 2,
|
|
688
|
+
marginRight: _.isEmpty(props.text) && !this.hasImagesReady(props.imagesToUpload) ? 8 + this.MIN_COMPOSER_HEIGHT : 2 * (this.MIN_COMPOSER_HEIGHT + 8),
|
|
689
|
+
justifyContent: 'center'
|
|
690
|
+
}, Platform.OS === 'ios' && {
|
|
691
|
+
height: props.composerHeight + 10
|
|
692
|
+
}]
|
|
693
|
+
}, /*#__PURE__*/React.createElement(Composer, _extends({}, props, {
|
|
694
|
+
//composerHeight={props.composerHeight}
|
|
695
|
+
placeholder: "Type a message...",
|
|
696
|
+
textInputStyle: styles.inputText,
|
|
697
|
+
textInputProps: {
|
|
698
|
+
onFocus: this.onFocusInput.bind(this),
|
|
699
|
+
onBlur: this.onBlurInput.bind(this)
|
|
700
|
+
}
|
|
701
|
+
})));
|
|
702
|
+
}
|
|
703
|
+
/***
|
|
704
|
+
* Main Render
|
|
705
|
+
*/
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
renderChat() {
|
|
709
|
+
const {
|
|
710
|
+
tabCount,
|
|
711
|
+
noTab
|
|
712
|
+
} = this.props;
|
|
713
|
+
const iosBottomOffset = (tabCount === 1 || noTab ? -10 : 52) + getBottomSpace();
|
|
714
|
+
const minInputToolbarHeight = this.MIN_COMPOSER_HEIGHT + 16 + (this.hasImagesAttached() ? IMAGE_PREVIEW_AREA_HEIGHT : 0);
|
|
715
|
+
return /*#__PURE__*/React.createElement(GiftedChat, {
|
|
716
|
+
alwaysShowSend: false,
|
|
717
|
+
keyboardShouldPersistTaps: 'never',
|
|
718
|
+
renderAvatarOnTop: true,
|
|
719
|
+
minInputToolbarHeight: minInputToolbarHeight,
|
|
720
|
+
bottomOffset: Platform.OS === 'android' ? 0 : iosBottomOffset,
|
|
721
|
+
onSend: this.sendMessages.bind(this),
|
|
722
|
+
messages: this.state.messages,
|
|
723
|
+
user: this.state.currentUser,
|
|
724
|
+
renderBubble: this.renderBubble.bind(this),
|
|
725
|
+
renderMessage: this.renderMessage.bind(this),
|
|
726
|
+
renderMessageText: this.renderMessageText.bind(this),
|
|
727
|
+
renderTime: this.renderTime.bind(this),
|
|
728
|
+
renderDay: this.renderDay.bind(this),
|
|
729
|
+
renderCustomView: this.renderCustomView.bind(this),
|
|
730
|
+
renderSend: this.renderSend.bind(this),
|
|
731
|
+
renderInputToolbar: this.renderInputToolbar.bind(this),
|
|
732
|
+
renderFooter: this.renderFooter.bind(this),
|
|
733
|
+
renderLoading: this.renderLoading.bind(this),
|
|
734
|
+
renderAvatar: this.renderAvatar.bind(this),
|
|
735
|
+
imagesToUpload: this.state.imagesToUpload
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
renderImageUploader() {
|
|
740
|
+
return /*#__PURE__*/React.createElement(ImageUploader, {
|
|
741
|
+
ref: ref => this.imageUploader = ref,
|
|
742
|
+
onUploadStarted: this.onUploadStarted,
|
|
743
|
+
onUploadProgress: this.onUploadProgress,
|
|
744
|
+
onUploadSuccess: this.onUploadSuccess,
|
|
745
|
+
onUploadFailed: this.onUploadFailed,
|
|
746
|
+
onLibrarySelected: this.onLibrarySelected,
|
|
747
|
+
quality: 0.8,
|
|
748
|
+
allowsEditing: false,
|
|
749
|
+
fileName: 'imageInput',
|
|
750
|
+
popupTitle: 'Add Image',
|
|
751
|
+
userId: this.props.user.uid,
|
|
752
|
+
multiple: true,
|
|
753
|
+
allowVideo: true
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
renderImagePopup() {
|
|
758
|
+
const {
|
|
759
|
+
imagePopupOpen,
|
|
760
|
+
imagePopupSource,
|
|
761
|
+
imagePopupIndex
|
|
762
|
+
} = this.state;
|
|
763
|
+
return /*#__PURE__*/React.createElement(ImagePopup, {
|
|
764
|
+
visible: imagePopupOpen,
|
|
765
|
+
images: imagePopupSource,
|
|
766
|
+
index: imagePopupIndex,
|
|
767
|
+
onClose: this.closeGallery.bind(this),
|
|
768
|
+
ref: "imagePopup"
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
renderVideoPlayerPopup() {
|
|
773
|
+
const {
|
|
774
|
+
showFullscreenVideo,
|
|
775
|
+
currentVideoUrl
|
|
776
|
+
} = this.state;
|
|
777
|
+
if (!currentVideoUrl) return;
|
|
778
|
+
return /*#__PURE__*/React.createElement(VideoPopup, {
|
|
779
|
+
uri: currentVideoUrl,
|
|
780
|
+
visible: showFullscreenVideo,
|
|
781
|
+
onClose: this.toggleFullscreenVideo
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
renderPDF() {
|
|
786
|
+
if (_.isEmpty(this.state.selectedPDF)) {
|
|
787
|
+
return null;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
return /*#__PURE__*/React.createElement(PDFPopup, {
|
|
791
|
+
source: this.state.selectedPDF,
|
|
792
|
+
onClose: this.onCloseAttachment,
|
|
793
|
+
title: getFileName(this.state.selectedPDF),
|
|
794
|
+
pdfCount: 1
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
render() {
|
|
799
|
+
if (Platform.OS === 'android' && !this.props.noAndroidAvoid) {
|
|
800
|
+
return /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
|
801
|
+
behavior: Platform.OS === 'ios' && 'padding',
|
|
802
|
+
style: styles.chatContainer
|
|
803
|
+
}, this.renderChat(), this.renderImageUploader(), this.renderImagePopup(), this.renderVideoPlayerPopup(), this.renderPDF());
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
807
|
+
style: styles.chatContainer
|
|
808
|
+
}, this.renderChat(), this.renderImageUploader(), this.renderImagePopup(), this.renderVideoPlayerPopup(), this.renderPDF());
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
const styles = {
|
|
814
|
+
chatContainer: {
|
|
815
|
+
flex: 1,
|
|
816
|
+
justifyContent: 'center'
|
|
817
|
+
},
|
|
818
|
+
eventContainer: {
|
|
819
|
+
left: {
|
|
820
|
+
paddingTop: 5,
|
|
821
|
+
paddingLeft: 15,
|
|
822
|
+
paddingRight: 15,
|
|
823
|
+
paddingBottom: 5,
|
|
824
|
+
flexDirection: 'row'
|
|
825
|
+
},
|
|
826
|
+
right: {
|
|
827
|
+
paddingTop: 5,
|
|
828
|
+
paddingLeft: 15,
|
|
829
|
+
paddingRight: 15,
|
|
830
|
+
paddingBottom: 5,
|
|
831
|
+
flexDirection: 'row-reverse'
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
eventImage: {
|
|
835
|
+
width: 80,
|
|
836
|
+
height: 80,
|
|
837
|
+
resizeMode: 'cover',
|
|
838
|
+
borderRadius: 2
|
|
839
|
+
},
|
|
840
|
+
eventImageMargin: {
|
|
841
|
+
right: {
|
|
842
|
+
marginLeft: 15
|
|
843
|
+
},
|
|
844
|
+
left: {
|
|
845
|
+
marginRight: 15
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
eventInfo: {
|
|
849
|
+
minHeight: 80,
|
|
850
|
+
width: 150
|
|
851
|
+
},
|
|
852
|
+
eventTitle: {
|
|
853
|
+
fontSize: 12,
|
|
854
|
+
fontFamily: 'sf-bold',
|
|
855
|
+
backgroundColor: 'rgba(255,255,255,0)'
|
|
856
|
+
},
|
|
857
|
+
eventInfoAlign: {
|
|
858
|
+
left: {
|
|
859
|
+
textAlign: 'left'
|
|
860
|
+
},
|
|
861
|
+
right: {
|
|
862
|
+
textAlign: 'right'
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
messageImageLarge: {
|
|
866
|
+
width: IMAGE_SIZE_LARGE,
|
|
867
|
+
height: IMAGE_SIZE_LARGE,
|
|
868
|
+
borderRadius: 2,
|
|
869
|
+
alignSelf: 'center'
|
|
870
|
+
},
|
|
871
|
+
messageImageSmall: {
|
|
872
|
+
width: IMAGE_SIZE_SMALL,
|
|
873
|
+
height: IMAGE_SIZE_SMALL,
|
|
874
|
+
borderRadius: 2,
|
|
875
|
+
alignSelf: 'center',
|
|
876
|
+
marginRight: IMAGE_MARGIN,
|
|
877
|
+
marginBottom: IMAGE_MARGIN
|
|
878
|
+
},
|
|
879
|
+
eventDate: {
|
|
880
|
+
fontSize: 12,
|
|
881
|
+
fontFamily: 'sf-regular',
|
|
882
|
+
backgroundColor: 'rgba(255,255,255,0)'
|
|
883
|
+
},
|
|
884
|
+
inputContainer: {
|
|
885
|
+
backgroundColor: '#fff',
|
|
886
|
+
paddingVertical: 8,
|
|
887
|
+
paddingHorizontal: 8
|
|
888
|
+
},
|
|
889
|
+
inputText: {
|
|
890
|
+
color: TEXT_DARKEST,
|
|
891
|
+
fontSize: 14,
|
|
892
|
+
fontFamily: 'sf-medium'
|
|
893
|
+
},
|
|
894
|
+
input: {
|
|
895
|
+
margin: 0,
|
|
896
|
+
backgroundColor: BG_GREY,
|
|
897
|
+
borderRadius: 5,
|
|
898
|
+
flex: 1
|
|
899
|
+
},
|
|
900
|
+
sendContainer: {
|
|
901
|
+
position: 'absolute',
|
|
902
|
+
top: 0,
|
|
903
|
+
right: 0,
|
|
904
|
+
height: 30,
|
|
905
|
+
width: 30,
|
|
906
|
+
alignItems: 'center',
|
|
907
|
+
justifyContent: 'center',
|
|
908
|
+
backgroundColor: '#fff'
|
|
909
|
+
},
|
|
910
|
+
send: {
|
|
911
|
+
fontSize: 15,
|
|
912
|
+
color: TEXT_BLUEGREY,
|
|
913
|
+
fontSize: 24,
|
|
914
|
+
textAlign: 'center'
|
|
915
|
+
},
|
|
916
|
+
accessory: {
|
|
917
|
+
height: IMAGE_PREVIEW_AREA_HEIGHT,
|
|
918
|
+
borderTopWidth: 1,
|
|
919
|
+
borderTopColor: LINEGREY,
|
|
920
|
+
paddingTop: 8,
|
|
921
|
+
marginTop: 8
|
|
922
|
+
},
|
|
923
|
+
accessoryImageContainer: {
|
|
924
|
+
paddingRight: 8,
|
|
925
|
+
paddingTop: 8,
|
|
926
|
+
marginRight: 5
|
|
927
|
+
},
|
|
928
|
+
accessoryImage: {
|
|
929
|
+
width: IMAGE_PREVIEW_SIZE,
|
|
930
|
+
height: IMAGE_PREVIEW_SIZE
|
|
931
|
+
},
|
|
932
|
+
accessoryImageBorder: {
|
|
933
|
+
borderRadius: 2
|
|
934
|
+
},
|
|
935
|
+
settingDropDownOpen: {
|
|
936
|
+
height: 'auto'
|
|
937
|
+
},
|
|
938
|
+
imagesContainer: {
|
|
939
|
+
marginLeft: 10,
|
|
940
|
+
marginRight: 10,
|
|
941
|
+
flexDirection: 'row',
|
|
942
|
+
flexWrap: 'wrap'
|
|
943
|
+
},
|
|
944
|
+
uploadImagesContainer: {
|
|
945
|
+
flexDirection: 'row',
|
|
946
|
+
overflow: 'visible'
|
|
947
|
+
},
|
|
948
|
+
previewItemRemoveButton: {
|
|
949
|
+
position: 'absolute',
|
|
950
|
+
top: 0,
|
|
951
|
+
right: 0
|
|
952
|
+
},
|
|
953
|
+
previewItemRemoveContainer: {
|
|
954
|
+
justifyContent: 'center',
|
|
955
|
+
alignItems: 'center',
|
|
956
|
+
borderRadius: 10,
|
|
957
|
+
width: 20,
|
|
958
|
+
height: 20,
|
|
959
|
+
borderWidth: 2,
|
|
960
|
+
borderColor: '#fff'
|
|
961
|
+
},
|
|
962
|
+
previewItemRemoveIcon: {
|
|
963
|
+
fontSize: 10,
|
|
964
|
+
color: '#fff',
|
|
965
|
+
marginBottom: 1
|
|
966
|
+
},
|
|
967
|
+
imagePlayContainer: {
|
|
968
|
+
position: 'absolute',
|
|
969
|
+
top: 0,
|
|
970
|
+
left: 0,
|
|
971
|
+
right: 0,
|
|
972
|
+
bottom: 0,
|
|
973
|
+
alignItems: 'center',
|
|
974
|
+
justifyContent: 'center'
|
|
975
|
+
},
|
|
976
|
+
imageControlIcon: {
|
|
977
|
+
color: '#fff',
|
|
978
|
+
fontSize: 20,
|
|
979
|
+
textShadowColor: 'rgba(0,0,0,0.3)',
|
|
980
|
+
textShadowOffset: {
|
|
981
|
+
width: 2,
|
|
982
|
+
height: 2
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
const mapStateToProps = state => {
|
|
988
|
+
return {
|
|
989
|
+
user: state.user,
|
|
990
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
991
|
+
colourBrandingLight: getLightBrandingColourFromState(state),
|
|
992
|
+
tabCount: getEnabledTabsFromState(state).length
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
export default connect(mapStateToProps, {})(PlussChat);
|
|
997
|
+
//# sourceMappingURL=PlussChat.js.map
|