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