@plusscommunities/pluss-core-app 8.0.0 → 8.0.1-auth.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 +4 -4
- package/dist/module/actions/FollowerActions.js.map +1 -1
- package/dist/module/actions/MediaActions.js +1 -1
- package/dist/module/actions/MediaActions.js.map +1 -1
- package/dist/module/actions/ResidentActions.js +1 -1
- package/dist/module/actions/ResidentActions.js.map +1 -1
- package/dist/module/actions/UserActions.js +1 -1
- package/dist/module/actions/UserActions.js.map +1 -1
- package/dist/module/actions/UserSettingsActions.js +1 -1
- package/dist/module/actions/UserSettingsActions.js.map +1 -1
- package/dist/module/actions/index.js +5 -5
- package/dist/module/actions/index.js.map +1 -1
- package/dist/module/actions/types.js +16 -16
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/analyticsActions.js +5 -5
- package/dist/module/apis/analyticsActions.js.map +1 -1
- package/dist/module/apis/contactActions.js +6 -6
- package/dist/module/apis/contactActions.js.map +1 -1
- package/dist/module/apis/eventActions.js +28 -28
- package/dist/module/apis/eventActions.js.map +1 -1
- package/dist/module/apis/fileActions.js +15 -15
- package/dist/module/apis/fileActions.js.map +1 -1
- package/dist/module/apis/followerActions.js +8 -8
- package/dist/module/apis/followerActions.js.map +1 -1
- package/dist/module/apis/index.js +12 -12
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/notificationActions.js +17 -17
- package/dist/module/apis/notificationActions.js.map +1 -1
- package/dist/module/apis/profileActions.js +4 -4
- package/dist/module/apis/profileActions.js.map +1 -1
- package/dist/module/apis/reactionActions.js +15 -15
- package/dist/module/apis/reactionActions.js.map +1 -1
- package/dist/module/apis/settingActions.js +6 -6
- package/dist/module/apis/settingActions.js.map +1 -1
- package/dist/module/apis/stringActions.js +8 -8
- package/dist/module/apis/stringActions.js.map +1 -1
- package/dist/module/apis/typeActions.js +4 -4
- package/dist/module/apis/typeActions.js.map +1 -1
- package/dist/module/apis/userActions.js +8 -8
- package/dist/module/apis/userActions.js.map +1 -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 +4205 -0
- package/dist/module/colours.js +26 -29
- package/dist/module/colours.js.map +1 -1
- package/dist/module/components/AddButton.js +8 -8
- package/dist/module/components/AddButton.js.map +1 -1
- package/dist/module/components/AddToCalendarButton.js +30 -29
- package/dist/module/components/AddToCalendarButton.js.map +1 -1
- package/dist/module/components/Attachment.js +10 -9
- package/dist/module/components/Attachment.js.map +1 -1
- package/dist/module/components/AudienceSelectorLauncher.js +11 -11
- package/dist/module/components/AudienceSelectorLauncher.js.map +1 -1
- package/dist/module/components/AudienceSelectorPage.js +45 -44
- package/dist/module/components/AudienceSelectorPage.js.map +1 -1
- package/dist/module/components/AutoOffsetImage.js +13 -13
- package/dist/module/components/AutoOffsetImage.js.map +1 -1
- package/dist/module/components/BackButton.js +10 -10
- package/dist/module/components/BackButton.js.map +1 -1
- package/dist/module/components/CalendarPopup.js +21 -21
- package/dist/module/components/CalendarPopup.js.map +1 -1
- package/dist/module/components/CategoryTabs.js +30 -29
- package/dist/module/components/CategoryTabs.js.map +1 -1
- package/dist/module/components/CommentReply.js +43 -37
- package/dist/module/components/CommentReply.js.map +1 -1
- package/dist/module/components/CommentSection.js +74 -74
- package/dist/module/components/CommentSection.js.map +1 -1
- package/dist/module/components/ConfirmPopup.js +21 -20
- package/dist/module/components/ConfirmPopup.js.map +1 -1
- package/dist/module/components/ConfirmationPopup.js +11 -11
- package/dist/module/components/ConfirmationPopup.js.map +1 -1
- package/dist/module/components/DocumentUploader.js +50 -50
- package/dist/module/components/DocumentUploader.js.map +1 -1
- package/dist/module/components/DropDownItem.js +14 -13
- package/dist/module/components/DropDownItem.js.map +1 -1
- package/dist/module/components/DropDownMenu.js +5 -5
- package/dist/module/components/DropDownMenu.js.map +1 -1
- package/dist/module/components/EmptyStateMain.js +10 -9
- package/dist/module/components/EmptyStateMain.js.map +1 -1
- package/dist/module/components/EmptyStateWidget.js +7 -6
- package/dist/module/components/EmptyStateWidget.js.map +1 -1
- package/dist/module/components/FontScaleButton.js +5 -4
- package/dist/module/components/FontScaleButton.js.map +1 -1
- package/dist/module/components/FontScalePopup.js +11 -10
- package/dist/module/components/FontScalePopup.js.map +1 -1
- package/dist/module/components/Forbidden.js +13 -13
- package/dist/module/components/Forbidden.js.map +1 -1
- package/dist/module/components/FormCard.js +4 -4
- package/dist/module/components/FormCard.js.map +1 -1
- package/dist/module/components/FormCardSection.js +20 -18
- package/dist/module/components/FormCardSection.js.map +1 -1
- package/dist/module/components/FormCardSectionOptionLauncher.js +13 -12
- package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -1
- package/dist/module/components/FormattedText.js +18 -16
- package/dist/module/components/FormattedText.js.map +1 -1
- package/dist/module/components/GenericInput.js +24 -21
- package/dist/module/components/GenericInput.js.map +1 -1
- package/dist/module/components/GenericInputSection.js +27 -26
- package/dist/module/components/GenericInputSection.js.map +1 -1
- package/dist/module/components/Header.js +70 -69
- package/dist/module/components/Header.js.map +1 -1
- package/dist/module/components/Icon.js +109 -0
- package/dist/module/components/Icon.js.map +1 -0
- package/dist/module/components/ImagePopup.js +211 -73
- package/dist/module/components/ImagePopup.js.map +1 -1
- package/dist/module/components/ImageUploadProgress.js +10 -9
- package/dist/module/components/ImageUploadProgress.js.map +1 -1
- package/dist/module/components/ImageUploader.js +116 -96
- package/dist/module/components/ImageUploader.js.map +1 -1
- package/dist/module/components/InlineButton.js +9 -8
- package/dist/module/components/InlineButton.js.map +1 -1
- package/dist/module/components/Input.js +28 -26
- package/dist/module/components/Input.js.map +1 -1
- package/dist/module/components/LoadingCircles.js +20 -20
- package/dist/module/components/LoadingCircles.js.map +1 -1
- package/dist/module/components/LoadingIndicator.js +11 -11
- package/dist/module/components/LoadingIndicator.js.map +1 -1
- package/dist/module/components/LoadingStateWidget.js +5 -5
- package/dist/module/components/LoadingStateWidget.js.map +1 -1
- package/dist/module/components/MediaPlayer.js +31 -31
- package/dist/module/components/MediaPlayer.js.map +1 -1
- package/dist/module/components/MiddlePopup.js +17 -11
- package/dist/module/components/MiddlePopup.js.map +1 -1
- package/dist/module/components/PDFPopup.js +52 -39
- package/dist/module/components/PDFPopup.js.map +1 -1
- package/dist/module/components/PlussChat.js +168 -149
- package/dist/module/components/PlussChat.js.map +1 -1
- package/dist/module/components/PlussChatMessage.js +42 -42
- package/dist/module/components/PlussChatMessage.js.map +1 -1
- package/dist/module/components/PlussChatTime.js +18 -17
- package/dist/module/components/PlussChatTime.js.map +1 -1
- package/dist/module/components/Popup.js +20 -19
- package/dist/module/components/Popup.js.map +1 -1
- package/dist/module/components/PopupMenu.js +15 -14
- package/dist/module/components/PopupMenu.js.map +1 -1
- package/dist/module/components/PositionedImage.js +20 -20
- package/dist/module/components/PositionedImage.js.map +1 -1
- package/dist/module/components/ProfilePic.js +10 -10
- package/dist/module/components/ProfilePic.js.map +1 -1
- package/dist/module/components/RadioButton.js +10 -9
- package/dist/module/components/RadioButton.js.map +1 -1
- package/dist/module/components/Reaction.js +18 -17
- package/dist/module/components/Reaction.js.map +1 -1
- package/dist/module/components/Reactions.js +7 -7
- package/dist/module/components/Reactions.js.map +1 -1
- package/dist/module/components/SharingTools.js +78 -43
- package/dist/module/components/SharingTools.js.map +1 -1
- package/dist/module/components/Spinner.js +5 -5
- package/dist/module/components/Spinner.js.map +1 -1
- package/dist/module/components/StickyFooter.js +6 -6
- package/dist/module/components/StickyFooter.js.map +1 -1
- package/dist/module/components/Text.js +57 -0
- package/dist/module/components/Text.js.map +1 -0
- package/dist/module/components/TickIcon.js +6 -6
- package/dist/module/components/TickIcon.js.map +1 -1
- package/dist/module/components/Toggle.js +10 -9
- package/dist/module/components/Toggle.js.map +1 -1
- package/dist/module/components/TouchableSearchBar.js +18 -17
- package/dist/module/components/TouchableSearchBar.js.map +1 -1
- package/dist/module/components/UserListPopup.js +20 -19
- package/dist/module/components/UserListPopup.js.map +1 -1
- package/dist/module/components/UserListing.js +41 -40
- package/dist/module/components/UserListing.js.map +1 -1
- package/dist/module/components/VideoPopup.js +20 -20
- package/dist/module/components/VideoPopup.js.map +1 -1
- package/dist/module/components/WarningPopup.js +21 -20
- package/dist/module/components/WarningPopup.js.map +1 -1
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +13 -13
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -1
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js +24 -23
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -1
- package/dist/module/components/index.js +59 -58
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +94 -64
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -1
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +64 -64
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -1
- package/dist/module/config.js +15 -10
- package/dist/module/config.js.map +1 -1
- package/dist/module/constants.js +3 -4
- package/dist/module/constants.js.map +1 -1
- package/dist/module/helper.js +83 -82
- package/dist/module/helper.js.map +1 -1
- package/dist/module/index.js +12 -12
- package/dist/module/index.js.map +1 -1
- package/dist/module/js/images/detectFaces.js +11 -10
- package/dist/module/js/images/detectFaces.js.map +1 -1
- package/dist/module/js/images/findLandmarkRange.js +8 -8
- package/dist/module/js/images/findLandmarkRange.js.map +1 -1
- package/dist/module/js/images/getScaledOffset.js.map +1 -1
- package/dist/module/js/site/getSiteLevelFromState.js +2 -2
- package/dist/module/js/site/getSiteLevelFromState.js.map +1 -1
- package/dist/module/js/site/isTVEnabled.js +2 -2
- package/dist/module/js/site/isTVEnabled.js.map +1 -1
- package/dist/module/session.js +6 -6
- package/dist/module/session.js.map +1 -1
- package/dist/module/styles.js +17 -17
- package/dist/module/styles.js.map +1 -1
- package/dist/module/withNavigationFocus.js +30 -0
- package/dist/module/withNavigationFocus.js.map +1 -0
- package/package.json +71 -68
- package/src/actions/FollowerActions.js +36 -32
- package/src/actions/MediaActions.js +25 -20
- package/src/actions/ResidentActions.js +26 -21
- package/src/actions/UserActions.js +22 -22
- package/src/actions/UserSettingsActions.js +11 -11
- package/src/actions/index.js +5 -5
- package/src/actions/types.js +16 -16
- package/src/apis/analyticsActions.js +17 -17
- package/src/apis/contactActions.js +20 -20
- package/src/apis/eventActions.js +153 -144
- package/src/apis/fileActions.js +96 -86
- package/src/apis/followerActions.js +29 -29
- package/src/apis/index.js +12 -12
- package/src/apis/notificationActions.js +44 -44
- package/src/apis/profileActions.js +8 -8
- package/src/apis/reactionActions.js +81 -73
- package/src/apis/settingActions.js +15 -15
- package/src/apis/stringActions.js +29 -25
- package/src/apis/typeActions.js +10 -10
- package/src/apis/userActions.js +93 -93
- package/src/assets/icons/fontawesome/fa-brands-400.ttf +0 -0
- package/src/assets/icons/fontawesome/fa-light-300.ttf +0 -0
- package/src/assets/icons/fontawesome/fa-regular-400.ttf +0 -0
- package/src/assets/icons/fontawesome/fa-solid-900.ttf +0 -0
- package/src/assets/icons/fontawesome/fa-thin-100.ttf +0 -0
- package/src/assets/icons/fontawesome/fa7-glyphmap.json +4205 -0
- package/src/colours.js +116 -96
- package/src/components/AddButton.js +32 -27
- package/src/components/AddToCalendarButton.js +236 -202
- package/src/components/Attachment.js +59 -36
- package/src/components/AudienceSelectorLauncher.js +52 -48
- package/src/components/AudienceSelectorPage.js +353 -311
- package/src/components/AutoOffsetImage.js +237 -196
- package/src/components/BackButton.js +57 -41
- package/src/components/CalendarPopup.js +127 -97
- package/src/components/CategoryTabs.js +208 -163
- package/src/components/CommentReply.js +370 -309
- package/src/components/CommentSection.js +974 -781
- package/src/components/ConfirmPopup.js +141 -110
- package/src/components/ConfirmationPopup.js +80 -69
- package/src/components/DocumentUploader.js +245 -215
- package/src/components/DropDownItem.js +70 -60
- package/src/components/DropDownMenu.js +31 -27
- package/src/components/EmptyStateMain.js +51 -44
- package/src/components/EmptyStateWidget.js +47 -38
- package/src/components/FontScaleButton.js +29 -25
- package/src/components/FontScalePopup.js +67 -56
- package/src/components/Forbidden.js +48 -46
- package/src/components/FormCard.js +21 -17
- package/src/components/FormCardSection.js +284 -233
- package/src/components/FormCardSectionOptionLauncher.js +72 -46
- package/src/components/FormattedText.js +128 -111
- package/src/components/GenericInput.js +168 -136
- package/src/components/GenericInputSection.js +209 -161
- package/src/components/Header.js +620 -474
- package/src/components/Icon.js +119 -0
- package/src/components/ImagePopup.js +425 -221
- package/src/components/ImageUploadProgress.js +49 -41
- package/src/components/ImageUploader.js +968 -797
- package/src/components/InlineButton.js +79 -69
- package/src/components/Input.js +190 -156
- package/src/components/LoadingCircles.js +233 -233
- package/src/components/LoadingIndicator.js +87 -76
- package/src/components/LoadingStateWidget.js +47 -37
- package/src/components/MediaPlayer.js +416 -387
- package/src/components/MiddlePopup.js +62 -33
- package/src/components/PDFPopup.js +212 -159
- package/src/components/PlussChat.js +1224 -1025
- package/src/components/PlussChatMessage.js +329 -298
- package/src/components/PlussChatTime.js +57 -53
- package/src/components/Popup.js +138 -116
- package/src/components/PopupMenu.js +140 -110
- package/src/components/PositionedImage.js +281 -237
- package/src/components/ProfilePic.js +122 -113
- package/src/components/RadioButton.js +76 -52
- package/src/components/Reaction.js +134 -96
- package/src/components/Reactions.js +65 -63
- package/src/components/SharingTools.js +185 -134
- package/src/components/Spinner.js +13 -13
- package/src/components/StickyFooter.js +36 -26
- package/src/components/Text.js +62 -0
- package/src/components/TickIcon.js +20 -20
- package/src/components/Toggle.js +74 -73
- package/src/components/TouchableSearchBar.js +68 -50
- package/src/components/UserListPopup.js +161 -124
- package/src/components/UserListing.js +273 -238
- package/src/components/VideoPopup.js +110 -96
- package/src/components/WarningPopup.js +92 -71
- package/src/components/expo-image-picker-multiple/ImageBrowser.js +288 -256
- package/src/components/expo-image-picker-multiple/ImageTile.js +108 -84
- package/src/components/index.js +59 -58
- package/src/components/react-native-expo-image-cropper/ExpoImageManipulator.js +444 -359
- package/src/components/react-native-expo-image-cropper/ImageCropOverlay.js +420 -324
- package/src/config.js +26 -21
- package/src/constants.js +8 -10
- package/src/helper.js +469 -438
- package/src/index.js +24 -12
- package/src/js/images/detectFaces.js +28 -21
- package/src/js/images/findLandmarkRange.js +97 -90
- package/src/js/images/getScaledOffset.js +80 -75
- package/src/js/site/getSiteLevelFromState.js +26 -26
- package/src/js/site/isTVEnabled.js +10 -10
- package/src/session.js +32 -32
- package/src/styles.js +61 -61
- package/src/withNavigationFocus.js +28 -0
- package/dist/module/components/TextStyle.js +0 -45
- package/dist/module/components/TextStyle.js.map +0 -1
- package/dist/module/fonts/index.js +0 -2
- package/dist/module/fonts/index.js.map +0 -1
- package/dist/module/fonts/pluss60-icons.js +0 -5
- package/dist/module/fonts/pluss60-icons.js.map +0 -1
- package/dist/module/fonts/pluss60-icons.json +0 -1097
- package/src/components/TextStyle.js +0 -48
- package/src/fonts/index.js +0 -1
- package/src/fonts/pluss60-icons.js +0 -7
- package/src/fonts/pluss60-icons.json +0 -1097
package/src/helper.js
CHANGED
|
@@ -1,525 +1,556 @@
|
|
|
1
|
-
import _ from
|
|
2
|
-
import React from
|
|
3
|
-
import { Platform, StatusBar, Dimensions
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Platform, StatusBar, Dimensions } from "react-native";
|
|
4
|
+
import { Text } from "./components";
|
|
5
|
+
import Constants from "expo-constants";
|
|
6
|
+
import Config from "./config";
|
|
7
|
+
import { LINEGREY } from "./colours";
|
|
8
|
+
import { getSessionTokenAWS } from "./session";
|
|
8
9
|
|
|
9
10
|
// seperated files to export
|
|
10
|
-
import detectFaces from
|
|
11
|
-
import findLandmarkRange from
|
|
12
|
-
import getScaledOffset from
|
|
11
|
+
import detectFaces from "./js/images/detectFaces";
|
|
12
|
+
import findLandmarkRange from "./js/images/findLandmarkRange";
|
|
13
|
+
import getScaledOffset from "./js/images/getScaledOffset";
|
|
13
14
|
|
|
14
|
-
import getSiteLevelFromState from
|
|
15
|
-
import isTVEnabled from
|
|
15
|
+
import getSiteLevelFromState from "./js/site/getSiteLevelFromState";
|
|
16
|
+
import isTVEnabled from "./js/site/isTVEnabled";
|
|
16
17
|
|
|
17
|
-
const TIMESTAMP_FORMAT =
|
|
18
|
-
const DATE_FORMAT =
|
|
18
|
+
const TIMESTAMP_FORMAT = "D MMM • h:mma";
|
|
19
|
+
const DATE_FORMAT = "D MMM YYYY";
|
|
19
20
|
|
|
20
21
|
const getUrl = (baseAction, action, query) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const { baseAPIUrl, baseStage } = Config.env;
|
|
23
|
+
let queryPart = "";
|
|
24
|
+
if (query) {
|
|
25
|
+
_.keys(query).forEach((key, index) => {
|
|
26
|
+
queryPart += `${index === 0 ? "?" : "&"}${key}=${encodeURIComponent(query[key])}`;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return `${baseAPIUrl}/${baseAction}-${baseStage}/${action}${queryPart}`;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
const getAuthTokenHeader = () => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
getSessionTokenAWS().then((idToken) => {
|
|
35
|
+
resolve(`Bearer ${idToken}`);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
const getShadowStyle = () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const StatusBarHeight = size => {
|
|
60
|
-
|
|
41
|
+
if (Platform.OS === "ios") {
|
|
42
|
+
return {
|
|
43
|
+
shadowColor: "#000",
|
|
44
|
+
shadowOffset: {
|
|
45
|
+
width: 0,
|
|
46
|
+
height: 1,
|
|
47
|
+
},
|
|
48
|
+
shadowOpacity: 0.1,
|
|
49
|
+
shadowRadius: 3,
|
|
50
|
+
backgroundColor: "#fff",
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
borderColor: LINEGREY,
|
|
55
|
+
backgroundColor: "#fff",
|
|
56
|
+
elevation: 8,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const StatusBarHeight = (size) => {
|
|
61
|
+
return getStatusBarHeight() + size;
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
const getStatusBarHeight = () => {
|
|
64
|
-
|
|
65
|
+
return Platform.OS === "ios"
|
|
66
|
+
? Constants.statusBarHeight
|
|
67
|
+
: StatusBar.currentHeight;
|
|
65
68
|
};
|
|
66
69
|
|
|
67
70
|
const getSiteSettingFromState = (state, key, defaultValue) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
if (
|
|
72
|
+
state &&
|
|
73
|
+
state.user &&
|
|
74
|
+
state.user.siteSettings &&
|
|
75
|
+
!_.isUndefined(state.user.siteSettings[key])
|
|
76
|
+
) {
|
|
77
|
+
return state.user.siteSettings[key];
|
|
78
|
+
}
|
|
79
|
+
return defaultValue || null;
|
|
72
80
|
};
|
|
73
81
|
|
|
74
82
|
const getValueOrDefault = (value, def) => {
|
|
75
|
-
|
|
83
|
+
return !_.isUndefined(value) ? value : def;
|
|
76
84
|
};
|
|
77
85
|
|
|
78
|
-
const getExtension = url => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
const getExtension = (url) => {
|
|
87
|
+
if (!url) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const fileSplit = url.split(".");
|
|
91
|
+
return fileSplit[fileSplit.length - 1].toLowerCase();
|
|
84
92
|
};
|
|
85
93
|
|
|
86
94
|
const getFileName = (url, noExtension) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const isVideo = url => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const isVideoUrl = url => {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const isStockImage = url => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
95
|
+
if (!url) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const fileSplit = url.split("/");
|
|
99
|
+
const name = fileSplit[fileSplit.length - 1].toLowerCase();
|
|
100
|
+
if (!noExtension) {
|
|
101
|
+
return name;
|
|
102
|
+
}
|
|
103
|
+
return name.split(".")[0];
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const isVideo = (url) => {
|
|
107
|
+
const extension = getExtension(url);
|
|
108
|
+
return ["mov", "mp4"].includes(extension);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const isVideoUrl = (url) => {
|
|
112
|
+
const urlToCheck = getValidUrl(url);
|
|
113
|
+
if (isVideo(urlToCheck)) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
if (isYoutube(urlToCheck)) {
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
if (isVimeo(urlToCheck)) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
return false;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const isStockImage = (url) => {
|
|
126
|
+
return (
|
|
127
|
+
url.indexOf(
|
|
128
|
+
"https://pluss60-dev-uploads.s3.ap-southeast-2.amazonaws.com/uploads/library",
|
|
129
|
+
) !== -1
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const getThumb300 = (url) => {
|
|
134
|
+
if (!url) {
|
|
135
|
+
return url;
|
|
136
|
+
}
|
|
137
|
+
if (isVideo(url)) {
|
|
138
|
+
return "https://pluss60-demo-uploads.s3.ap-southeast-2.amazonaws.com/uploads/users/ap-southeast-2:97769b56-25ec-41c0-a73c-6c2c4140f629/public/9d0bbec64614b1ed654a03f7e7/movie.jpg";
|
|
139
|
+
}
|
|
140
|
+
if (url.indexOf("https://plussprdstorage.blob.core.windows.net/") !== -1) {
|
|
141
|
+
return url.replace(
|
|
142
|
+
"https://plussprdstorage.blob.core.windows.net/",
|
|
143
|
+
"https://plusscdn.azureedge.net/",
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
if (url.indexOf("https://plusscdn.azureedge.net/") !== -1) {
|
|
147
|
+
return url
|
|
148
|
+
.replace("/uploads/", "/uploads-thumb/")
|
|
149
|
+
.replace("/general/", "/general300/")
|
|
150
|
+
.replace("/uploads1400/", "/uploads-thumb/")
|
|
151
|
+
.replace("/general1400/", "/general300/");
|
|
152
|
+
}
|
|
153
|
+
if (isStockImage(url) || url.indexOf(Config.env.baseUploadsUrl) !== -1) {
|
|
154
|
+
const extension = getExtension(url);
|
|
155
|
+
let urlToUse = url;
|
|
156
|
+
if (extension !== "jpg") {
|
|
157
|
+
urlToUse = `${url.substring(0, url.length - extension.length)}jpg`;
|
|
158
|
+
}
|
|
159
|
+
return urlToUse
|
|
160
|
+
.replace("/1400/", "/thumb300/")
|
|
161
|
+
.replace("/uploads/", "/thumb300/");
|
|
162
|
+
}
|
|
163
|
+
return url;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const get1400 = (url) => {
|
|
167
|
+
if (!url) {
|
|
168
|
+
return url;
|
|
169
|
+
}
|
|
170
|
+
if (url.indexOf("https://plussprdstorage.blob.core.windows.net/") !== -1) {
|
|
171
|
+
return url.replace(
|
|
172
|
+
"https://plussprdstorage.blob.core.windows.net/",
|
|
173
|
+
"https://plusscdn.azureedge.net/",
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
if (url.indexOf("https://plusscdn.azureedge.net/") !== -1) {
|
|
177
|
+
return url
|
|
178
|
+
.replace("/uploads/", "/uploads1400/")
|
|
179
|
+
.replace("/general/", "/general1400/");
|
|
180
|
+
}
|
|
181
|
+
if (isStockImage(url) || url.indexOf(Config.env.baseUploadsUrl) !== -1) {
|
|
182
|
+
const extension = getExtension(url);
|
|
183
|
+
let urlToUse = url;
|
|
184
|
+
if (extension !== "jpg") {
|
|
185
|
+
urlToUse = `${url.substring(0, url.length - extension.length)}jpg`;
|
|
186
|
+
}
|
|
187
|
+
return urlToUse.replace("/uploads/", "/1400/");
|
|
188
|
+
}
|
|
189
|
+
return url;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const get300 = (url) => {
|
|
193
|
+
if (!url) {
|
|
194
|
+
return url;
|
|
195
|
+
}
|
|
196
|
+
if (isStockImage(url) || url.indexOf(Config.env.baseUploadsUrl) !== -1) {
|
|
197
|
+
const extension = getExtension(url);
|
|
198
|
+
let urlToUse = url;
|
|
199
|
+
if (extension !== "jpg") {
|
|
200
|
+
urlToUse = `${url.substring(0, url.length - extension.length)}jpg`;
|
|
201
|
+
}
|
|
202
|
+
return urlToUse.replace("/uploads/", "/300/").replace("/1400/", "/300/");
|
|
203
|
+
}
|
|
204
|
+
return url;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const getMimeType = (url) => {
|
|
208
|
+
const extension = getExtension(url);
|
|
209
|
+
switch (extension) {
|
|
210
|
+
case "mov":
|
|
211
|
+
return "video/quicktime";
|
|
212
|
+
case "mp4":
|
|
213
|
+
return "video/mp4";
|
|
214
|
+
default:
|
|
215
|
+
return "image/jpeg";
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const getCompressed = (url) => {
|
|
220
|
+
if (!url || typeof url !== "string") return "";
|
|
221
|
+
return url.replace("/uploads/", "/compressed/");
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const imageExists = (url) => {
|
|
225
|
+
return new Promise((resolve) => {
|
|
226
|
+
fetch(url, { method: "HEAD", cache: "no-cache" })
|
|
227
|
+
.then((response) => {
|
|
228
|
+
resolve(response.status === 200);
|
|
229
|
+
})
|
|
230
|
+
.catch(() => {
|
|
231
|
+
resolve(false);
|
|
232
|
+
});
|
|
233
|
+
});
|
|
212
234
|
};
|
|
213
235
|
|
|
214
236
|
const formatTime = (hours, minutes) => {
|
|
215
|
-
|
|
237
|
+
const period = hours >= 12 ? "pm" : "am";
|
|
216
238
|
|
|
217
|
-
|
|
218
|
-
|
|
239
|
+
// Convert 24-hour format to 12-hour format
|
|
240
|
+
const adjustedHours = hours > 12 ? hours - 12 : hours === 0 ? 12 : hours;
|
|
219
241
|
|
|
220
|
-
|
|
221
|
-
|
|
242
|
+
// Ensure minutes are two digits
|
|
243
|
+
const adjustedMinutes = String(minutes).padStart(2, "0");
|
|
222
244
|
|
|
223
|
-
|
|
245
|
+
return `${adjustedHours}:${adjustedMinutes}${period}`;
|
|
224
246
|
};
|
|
225
247
|
|
|
226
248
|
const minutesToString = (minutes, isTimeOfDay) => {
|
|
227
|
-
|
|
228
|
-
|
|
249
|
+
const hours = Math.floor(minutes / 60);
|
|
250
|
+
const remainingMinutes = minutes % 60;
|
|
229
251
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
252
|
+
if (isTimeOfDay) {
|
|
253
|
+
return formatTime(hours, remainingMinutes);
|
|
254
|
+
}
|
|
233
255
|
|
|
234
|
-
|
|
235
|
-
|
|
256
|
+
const hoursString = hours > 1 ? `${hours} hours` : `${hours} hour`;
|
|
257
|
+
const minutesString =
|
|
258
|
+
remainingMinutes > 1
|
|
259
|
+
? `${remainingMinutes} minutes`
|
|
260
|
+
: `${remainingMinutes} minute`;
|
|
236
261
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
262
|
+
if (hours && remainingMinutes) {
|
|
263
|
+
return `${hoursString} ${minutesString}`;
|
|
264
|
+
}
|
|
265
|
+
if (hours) {
|
|
266
|
+
return hoursString;
|
|
267
|
+
}
|
|
268
|
+
if (remainingMinutes) {
|
|
269
|
+
return minutesString;
|
|
270
|
+
}
|
|
271
|
+
return "0 minutes";
|
|
247
272
|
};
|
|
248
273
|
|
|
249
|
-
const getPluralS = count => {
|
|
250
|
-
|
|
274
|
+
const getPluralS = (count) => {
|
|
275
|
+
return count === 1 ? "" : "s";
|
|
251
276
|
};
|
|
252
277
|
|
|
253
278
|
const getPluralOptions = (count, singular, plural) => {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
279
|
+
if (count === 1) {
|
|
280
|
+
return singular;
|
|
281
|
+
}
|
|
282
|
+
return plural;
|
|
258
283
|
};
|
|
259
284
|
|
|
260
|
-
const isEmail = email => {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
285
|
+
const isEmail = (email) => {
|
|
286
|
+
if (_.isEmpty(email)) {
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
const atpos = email.indexOf("@");
|
|
290
|
+
const dotpos = email.lastIndexOf(".");
|
|
291
|
+
if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= email.length) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
return true;
|
|
270
295
|
};
|
|
271
296
|
|
|
272
|
-
const randomString = (name =
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
297
|
+
const randomString = (name = "") => {
|
|
298
|
+
return `xxxxxxxx4xxxyxxxxxxxxxxxxx${name}`.replace(/[xy]/g, (c) => {
|
|
299
|
+
// eslint-disable-next-line
|
|
300
|
+
var r = (Math.random() * 16) | 0,
|
|
301
|
+
v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
302
|
+
return v.toString(16);
|
|
303
|
+
});
|
|
279
304
|
};
|
|
280
305
|
|
|
281
306
|
const generateImageName = (name, source) => {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
307
|
+
let result = randomString(name);
|
|
308
|
+
if (source) {
|
|
309
|
+
result += `.${_.last(source.split("."))}`;
|
|
310
|
+
}
|
|
311
|
+
return result;
|
|
287
312
|
};
|
|
288
313
|
|
|
289
|
-
const getSite = site => {
|
|
290
|
-
|
|
314
|
+
const getSite = (site) => {
|
|
315
|
+
return site === "plussSpace" || site === "hq"
|
|
316
|
+
? Config.env.preferredSite
|
|
317
|
+
: site;
|
|
291
318
|
};
|
|
292
319
|
|
|
293
|
-
const getTakeoverThumb = uri => {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
320
|
+
const getTakeoverThumb = (uri) => {
|
|
321
|
+
const filename = uri.split("/").pop();
|
|
322
|
+
switch (filename) {
|
|
323
|
+
default:
|
|
324
|
+
return { uri };
|
|
325
|
+
}
|
|
299
326
|
};
|
|
300
327
|
|
|
301
|
-
const getTakeoverImage = uri => {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
328
|
+
const getTakeoverImage = (uri) => {
|
|
329
|
+
const filename = uri.split("/").pop();
|
|
330
|
+
switch (filename) {
|
|
331
|
+
default:
|
|
332
|
+
return { uri };
|
|
333
|
+
}
|
|
307
334
|
};
|
|
308
335
|
|
|
309
336
|
const getImageSource = (uri, isThumb) => {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
337
|
+
if (uri == null) return null;
|
|
338
|
+
if (isThumb) return getTakeoverThumb(uri);
|
|
339
|
+
return getTakeoverImage(uri);
|
|
313
340
|
};
|
|
314
341
|
|
|
315
|
-
const getFirstName = name => {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
342
|
+
const getFirstName = (name) => {
|
|
343
|
+
if (_.isEmpty(name)) {
|
|
344
|
+
return name;
|
|
345
|
+
}
|
|
346
|
+
return name.split(" ")[0];
|
|
320
347
|
};
|
|
321
348
|
|
|
322
349
|
const usersToSearchResult = (contacts, excludedUserIds) => {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
350
|
+
let result = [];
|
|
351
|
+
contacts.forEach((user) => {
|
|
352
|
+
result.push({
|
|
353
|
+
displayName: user.displayName,
|
|
354
|
+
id: user.objectID || user.id || user.ID || user.userId || user.Id,
|
|
355
|
+
profilePic: user.profilePic || user.photoURL || null,
|
|
356
|
+
unit: user.unit,
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
result = _.reject(result, (contact) => {
|
|
360
|
+
return _.includes(excludedUserIds, contact.id);
|
|
361
|
+
});
|
|
362
|
+
return result;
|
|
336
363
|
};
|
|
337
364
|
|
|
338
365
|
const searchUsers = (source, term) => {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
366
|
+
if (_.isEmpty(term)) {
|
|
367
|
+
return source;
|
|
368
|
+
}
|
|
369
|
+
return _.filter(source, (user) => {
|
|
370
|
+
const split = user.displayName.split(" ");
|
|
371
|
+
return _.some(split, (part) => {
|
|
372
|
+
return part.toLowerCase().indexOf(term.toLowerCase()) === 0;
|
|
373
|
+
});
|
|
374
|
+
});
|
|
348
375
|
};
|
|
349
376
|
|
|
350
|
-
const getTabSettingsFromState = state => {
|
|
351
|
-
|
|
352
|
-
|
|
377
|
+
const getTabSettingsFromState = (state) => {
|
|
378
|
+
const tabSettings =
|
|
379
|
+
(state.user && state.user.interface) ||
|
|
380
|
+
getSiteSettingFromState(state, "TabSettings", null);
|
|
381
|
+
return tabSettings;
|
|
353
382
|
};
|
|
354
383
|
|
|
355
|
-
const getEnabledTabsFromState = state => {
|
|
356
|
-
|
|
357
|
-
|
|
384
|
+
const getEnabledTabsFromState = (state) => {
|
|
385
|
+
const tabSettings = getTabSettingsFromState(state);
|
|
386
|
+
return tabSettings ? tabSettings.filter((tab) => tab.isEnabled) : [];
|
|
358
387
|
};
|
|
359
388
|
|
|
360
389
|
const getReactions = () => {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
390
|
+
return [
|
|
391
|
+
{
|
|
392
|
+
key: "heart",
|
|
393
|
+
icon: require("./assets/icons/reactions/heart.png"),
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
key: "smile",
|
|
397
|
+
icon: require("./assets/icons/reactions/smile.png"),
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
key: "sad",
|
|
401
|
+
icon: require("./assets/icons/reactions/sad.png"),
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
key: "party",
|
|
405
|
+
icon: require("./assets/icons/reactions/party.png"),
|
|
406
|
+
},
|
|
407
|
+
];
|
|
379
408
|
};
|
|
380
409
|
|
|
381
410
|
const hasReacted = (reactions, userId) => {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
411
|
+
return _.some(reactions, (r) => {
|
|
412
|
+
return !!r[userId];
|
|
413
|
+
});
|
|
385
414
|
};
|
|
386
415
|
|
|
387
416
|
const isTablet = () => {
|
|
388
|
-
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
const isVimeo = url => {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
const getVimeoEmbed = url => {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
const isYoutube = url => {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
417
|
+
return Dimensions.get("screen").width > 600;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
const isVimeo = (url) => {
|
|
421
|
+
if (_.isEmpty(url)) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
if (url.indexOf("https://vimeo.com/") === 0) {
|
|
425
|
+
return true;
|
|
426
|
+
}
|
|
427
|
+
if (url.indexOf("https://player.vimeo.com/video/") === 0) {
|
|
428
|
+
return true;
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
const getVimeoEmbed = (url) => {
|
|
433
|
+
if (_.isEmpty(url)) {
|
|
434
|
+
return "";
|
|
435
|
+
}
|
|
436
|
+
if (url.indexOf("https://vimeo.com/") === 0) {
|
|
437
|
+
const vimeoId = "lol"; //TODO
|
|
438
|
+
return `https://player.vimeo.com/video/${vimeoId}`;
|
|
439
|
+
}
|
|
440
|
+
return url; //TODO
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
const isYoutube = (url) => {
|
|
444
|
+
if (_.isUndefined(url) || _.isEmpty(url)) {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
const regExp =
|
|
448
|
+
/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/;
|
|
449
|
+
const match = url.match(regExp);
|
|
450
|
+
if (match && match[2].length === 11) {
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
return false;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
const getYoutubeEmbed = (url) => {
|
|
457
|
+
const regExp =
|
|
458
|
+
/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/;
|
|
459
|
+
const match = url.match(regExp);
|
|
460
|
+
return `https://www.youtube.com/embed/${match[2]}?autoplay=0`;
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
const getValidUrl = (url = "") => {
|
|
464
|
+
let newUrl = decodeURIComponent(url);
|
|
465
|
+
newUrl = newUrl.trim().replace(/\s/g, "");
|
|
466
|
+
|
|
467
|
+
if (/^(:\/\/)/.test(newUrl)) {
|
|
468
|
+
return `https${newUrl}`;
|
|
469
|
+
}
|
|
470
|
+
if (!/^(f|ht)tps?:\/\//i.test(newUrl)) {
|
|
471
|
+
return `https://${newUrl}`;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return newUrl;
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
const getUserPreview = (user) => {
|
|
478
|
+
return {
|
|
479
|
+
id: user.uid,
|
|
480
|
+
displayName: user.displayName,
|
|
481
|
+
profilePic: user.profilePic || null,
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
const allowComments = (canComment) => {
|
|
486
|
+
if (canComment === false) {
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
if (canComment === true) {
|
|
490
|
+
return true;
|
|
491
|
+
}
|
|
492
|
+
return Config.env.defaultAllowComments;
|
|
462
493
|
};
|
|
463
494
|
|
|
464
495
|
const toParagraphed = (text, style) => {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
496
|
+
if (!text) {
|
|
497
|
+
return text;
|
|
498
|
+
}
|
|
499
|
+
const textSplit = text.split("\n");
|
|
500
|
+
return _.map(textSplit, (t, i) => {
|
|
501
|
+
return (
|
|
502
|
+
<Text key={`paragraph_${i}`} style={style}>
|
|
503
|
+
{t}
|
|
504
|
+
</Text>
|
|
505
|
+
);
|
|
506
|
+
});
|
|
476
507
|
};
|
|
477
508
|
|
|
478
509
|
export {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
510
|
+
TIMESTAMP_FORMAT,
|
|
511
|
+
DATE_FORMAT,
|
|
512
|
+
getUrl,
|
|
513
|
+
getAuthTokenHeader,
|
|
514
|
+
getShadowStyle,
|
|
515
|
+
StatusBarHeight,
|
|
516
|
+
getStatusBarHeight,
|
|
517
|
+
getSiteSettingFromState,
|
|
518
|
+
getValueOrDefault,
|
|
519
|
+
getExtension,
|
|
520
|
+
getFileName,
|
|
521
|
+
isVideo,
|
|
522
|
+
get300,
|
|
523
|
+
getThumb300,
|
|
524
|
+
get1400,
|
|
525
|
+
getMimeType,
|
|
526
|
+
getCompressed,
|
|
527
|
+
imageExists,
|
|
528
|
+
getPluralS,
|
|
529
|
+
getPluralOptions,
|
|
530
|
+
isEmail,
|
|
531
|
+
formatTime,
|
|
532
|
+
minutesToString,
|
|
533
|
+
randomString,
|
|
534
|
+
generateImageName,
|
|
535
|
+
getSite,
|
|
536
|
+
getImageSource,
|
|
537
|
+
getFirstName,
|
|
538
|
+
usersToSearchResult,
|
|
539
|
+
searchUsers,
|
|
540
|
+
getEnabledTabsFromState,
|
|
541
|
+
getReactions,
|
|
542
|
+
hasReacted,
|
|
543
|
+
isTablet,
|
|
544
|
+
isYoutube,
|
|
545
|
+
getYoutubeEmbed,
|
|
546
|
+
getValidUrl,
|
|
547
|
+
getUserPreview,
|
|
548
|
+
allowComments,
|
|
549
|
+
toParagraphed,
|
|
550
|
+
isVideoUrl,
|
|
551
|
+
detectFaces,
|
|
552
|
+
findLandmarkRange,
|
|
553
|
+
getScaledOffset,
|
|
554
|
+
getSiteLevelFromState,
|
|
555
|
+
isTVEnabled,
|
|
525
556
|
};
|