@plusscommunities/pluss-core-app 8.0.29 → 8.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/actions/FollowerActions.js +34 -0
- package/dist/module/actions/FollowerActions.js.map +1 -0
- package/dist/module/actions/MediaActions.js +29 -0
- package/dist/module/actions/MediaActions.js.map +1 -0
- package/dist/module/actions/ResidentActions.js +26 -0
- package/dist/module/actions/ResidentActions.js.map +1 -0
- package/dist/module/actions/UserActions.js +223 -0
- package/dist/module/actions/UserActions.js.map +1 -0
- package/dist/module/actions/UserSettingsActions.js +14 -0
- package/dist/module/actions/UserSettingsActions.js.map +1 -0
- package/dist/module/actions/index.js +6 -0
- package/dist/module/actions/index.js.map +1 -0
- package/dist/module/actions/types.js +17 -0
- package/dist/module/actions/types.js.map +1 -0
- package/dist/module/apis/analyticsActions.js +20 -0
- package/dist/module/apis/analyticsActions.js.map +1 -0
- package/dist/module/apis/contactActions.js +27 -0
- package/dist/module/apis/contactActions.js.map +1 -0
- package/dist/module/apis/eventActions.js +161 -0
- package/dist/module/apis/eventActions.js.map +1 -0
- package/dist/module/apis/fileActions.js +93 -0
- package/dist/module/apis/fileActions.js.map +1 -0
- package/dist/module/apis/followerActions.js +38 -0
- package/dist/module/apis/followerActions.js.map +1 -0
- package/dist/module/apis/index.js +13 -0
- package/dist/module/apis/index.js.map +1 -0
- package/dist/module/apis/notificationActions.js +60 -0
- package/dist/module/apis/notificationActions.js.map +1 -0
- package/dist/module/apis/profileActions.js +14 -0
- package/dist/module/apis/profileActions.js.map +1 -0
- package/dist/module/apis/reactionActions.js +76 -0
- package/dist/module/apis/reactionActions.js.map +1 -0
- package/dist/module/apis/settingActions.js +22 -0
- package/dist/module/apis/settingActions.js.map +1 -0
- package/dist/module/apis/stringActions.js +30 -0
- package/dist/module/apis/stringActions.js.map +1 -0
- package/dist/module/apis/typeActions.js +15 -0
- package/dist/module/apis/typeActions.js.map +1 -0
- package/dist/module/apis/userActions.js +104 -0
- package/dist/module/apis/userActions.js.map +1 -0
- package/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/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 +165 -0
- package/dist/module/colours.js.map +1 -0
- package/dist/module/components/AddButton.js +43 -0
- package/dist/module/components/AddButton.js.map +1 -0
- package/dist/module/components/AddToCalendarButton.js +225 -0
- package/dist/module/components/AddToCalendarButton.js.map +1 -0
- package/dist/module/components/Attachment.js +55 -0
- package/dist/module/components/Attachment.js.map +1 -0
- package/dist/module/components/AudienceSelectorLauncher.js +64 -0
- package/dist/module/components/AudienceSelectorLauncher.js.map +1 -0
- package/dist/module/components/AudienceSelectorPage.js +351 -0
- package/dist/module/components/AudienceSelectorPage.js.map +1 -0
- package/dist/module/components/AutoOffsetImage.js +184 -0
- package/dist/module/components/AutoOffsetImage.js.map +1 -0
- package/dist/module/components/BackButton.js +58 -0
- package/dist/module/components/BackButton.js.map +1 -0
- package/dist/module/components/CalendarPopup.js +126 -0
- package/dist/module/components/CalendarPopup.js.map +1 -0
- package/dist/module/components/CategoryTabs.js +155 -0
- package/dist/module/components/CategoryTabs.js.map +1 -0
- package/dist/module/components/CommentReply.js +334 -0
- package/dist/module/components/CommentReply.js.map +1 -0
- package/dist/module/components/CommentSection.js +823 -0
- package/dist/module/components/CommentSection.js.map +1 -0
- package/dist/module/components/ConfirmPopup.js +109 -0
- package/dist/module/components/ConfirmPopup.js.map +1 -0
- package/dist/module/components/ConfirmationPopup.js +72 -0
- package/dist/module/components/ConfirmationPopup.js.map +1 -0
- package/dist/module/components/DocumentUploader.js +253 -0
- package/dist/module/components/DocumentUploader.js.map +1 -0
- package/dist/module/components/DropDownItem.js +75 -0
- package/dist/module/components/DropDownItem.js.map +1 -0
- package/dist/module/components/DropDownMenu.js +41 -0
- package/dist/module/components/DropDownMenu.js.map +1 -0
- package/dist/module/components/EmptyStateMain.js +51 -0
- package/dist/module/components/EmptyStateMain.js.map +1 -0
- package/dist/module/components/EmptyStateWidget.js +48 -0
- package/dist/module/components/EmptyStateWidget.js.map +1 -0
- package/dist/module/components/FontScaleButton.js +37 -0
- package/dist/module/components/FontScaleButton.js.map +1 -0
- package/dist/module/components/FontScalePopup.js +76 -0
- package/dist/module/components/FontScalePopup.js.map +1 -0
- package/dist/module/components/Forbidden.js +58 -0
- package/dist/module/components/Forbidden.js.map +1 -0
- package/dist/module/components/FormCard.js +25 -0
- package/dist/module/components/FormCard.js.map +1 -0
- package/dist/module/components/FormCardSection.js +214 -0
- package/dist/module/components/FormCardSection.js.map +1 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js +73 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -0
- package/dist/module/components/FormattedText.js +133 -0
- package/dist/module/components/FormattedText.js.map +1 -0
- package/dist/module/components/GenericInput.js +151 -0
- package/dist/module/components/GenericInput.js.map +1 -0
- package/dist/module/components/GenericInputSection.js +173 -0
- package/dist/module/components/GenericInputSection.js.map +1 -0
- package/dist/module/components/Header.js +459 -0
- package/dist/module/components/Header.js.map +1 -0
- package/dist/module/components/Icon.js +109 -0
- package/dist/module/components/Icon.js.map +1 -0
- package/dist/module/components/ImagePopup.js +400 -0
- package/dist/module/components/ImagePopup.js.map +1 -0
- package/dist/module/components/ImageUploadProgress.js +69 -0
- package/dist/module/components/ImageUploadProgress.js.map +1 -0
- package/dist/module/components/ImageUploader.js +831 -0
- package/dist/module/components/ImageUploader.js.map +1 -0
- package/dist/module/components/InlineButton.js +66 -0
- package/dist/module/components/InlineButton.js.map +1 -0
- package/dist/module/components/Input.js +156 -0
- package/dist/module/components/Input.js.map +1 -0
- package/dist/module/components/LoadingCircles.js +219 -0
- package/dist/module/components/LoadingCircles.js.map +1 -0
- package/dist/module/components/LoadingIndicator.js +86 -0
- package/dist/module/components/LoadingIndicator.js.map +1 -0
- package/dist/module/components/LoadingStateWidget.js +46 -0
- package/dist/module/components/LoadingStateWidget.js.map +1 -0
- package/dist/module/components/MediaPlayer.js +407 -0
- package/dist/module/components/MediaPlayer.js.map +1 -0
- package/dist/module/components/MiddlePopup.js +49 -0
- package/dist/module/components/MiddlePopup.js.map +1 -0
- package/dist/module/components/PDFPopup.js +296 -0
- package/dist/module/components/PDFPopup.js.map +1 -0
- package/dist/module/components/PlussChat.js +1078 -0
- package/dist/module/components/PlussChat.js.map +1 -0
- package/dist/module/components/PlussChatMessage.js +299 -0
- package/dist/module/components/PlussChatMessage.js.map +1 -0
- package/dist/module/components/PlussChatTime.js +59 -0
- package/dist/module/components/PlussChatTime.js.map +1 -0
- package/dist/module/components/Popup.js +126 -0
- package/dist/module/components/Popup.js.map +1 -0
- package/dist/module/components/PopupMenu.js +120 -0
- package/dist/module/components/PopupMenu.js.map +1 -0
- package/dist/module/components/PositionedImage.js +313 -0
- package/dist/module/components/PositionedImage.js.map +1 -0
- package/dist/module/components/ProfilePic.js +105 -0
- package/dist/module/components/ProfilePic.js.map +1 -0
- package/dist/module/components/RadioButton.js +78 -0
- package/dist/module/components/RadioButton.js.map +1 -0
- package/dist/module/components/Reaction.js +117 -0
- package/dist/module/components/Reaction.js.map +1 -0
- package/dist/module/components/Reactions.js +71 -0
- package/dist/module/components/Reactions.js.map +1 -0
- package/dist/module/components/SharingTools.js +189 -0
- package/dist/module/components/SharingTools.js.map +1 -0
- package/dist/module/components/Spinner.js +22 -0
- package/dist/module/components/Spinner.js.map +1 -0
- package/dist/module/components/StickyFooter.js +34 -0
- package/dist/module/components/StickyFooter.js.map +1 -0
- package/dist/module/components/Text.js +57 -0
- package/dist/module/components/Text.js.map +1 -0
- package/dist/module/components/TickIcon.js +24 -0
- package/dist/module/components/TickIcon.js.map +1 -0
- package/dist/module/components/Toggle.js +66 -0
- package/dist/module/components/Toggle.js.map +1 -0
- package/dist/module/components/TouchableSearchBar.js +68 -0
- package/dist/module/components/TouchableSearchBar.js.map +1 -0
- package/dist/module/components/UserListPopup.js +136 -0
- package/dist/module/components/UserListPopup.js.map +1 -0
- package/dist/module/components/UserListing.js +268 -0
- package/dist/module/components/UserListing.js.map +1 -0
- package/dist/module/components/VideoPopup.js +113 -0
- package/dist/module/components/VideoPopup.js.map +1 -0
- package/dist/module/components/WarningPopup.js +85 -0
- package/dist/module/components/WarningPopup.js.map +1 -0
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +289 -0
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -0
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js +117 -0
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -0
- package/dist/module/components/index.js +60 -0
- package/dist/module/components/index.js.map +1 -0
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +422 -0
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -0
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +387 -0
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -0
- package/dist/module/config.js +27 -0
- package/dist/module/config.js.map +1 -0
- package/dist/module/constants.js +18 -0
- package/dist/module/constants.js.map +1 -0
- package/dist/module/helper.js +424 -0
- package/dist/module/helper.js.map +1 -0
- package/dist/module/index.js +13 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/js/images/detectFaces.js +31 -0
- package/dist/module/js/images/detectFaces.js.map +1 -0
- package/dist/module/js/images/findLandmarkRange.js +93 -0
- package/dist/module/js/images/findLandmarkRange.js.map +1 -0
- package/dist/module/js/images/getScaledOffset.js +81 -0
- package/dist/module/js/images/getScaledOffset.js.map +1 -0
- package/dist/module/js/site/getSiteLevelFromState.js +29 -0
- package/dist/module/js/site/getSiteLevelFromState.js.map +1 -0
- package/dist/module/js/site/isTVEnabled.js +10 -0
- package/dist/module/js/site/isTVEnabled.js.map +1 -0
- package/dist/module/session.js +58 -0
- package/dist/module/session.js.map +1 -0
- package/dist/module/styles.js +67 -0
- package/dist/module/styles.js.map +1 -0
- package/dist/module/withNavigationFocus.js +30 -0
- package/dist/module/withNavigationFocus.js.map +1 -0
- package/package.json +1 -1
- package/src/components/PDFPopup.js +130 -35
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import React, { Component } from "react";
|
|
2
|
+
import _ from "lodash";
|
|
3
|
+
import { TouchableOpacity, View } from "react-native";
|
|
4
|
+
import { Text } from "./Text";
|
|
5
|
+
import { connect } from "react-redux";
|
|
6
|
+
import moment from "moment";
|
|
7
|
+
import { COLOUR_GREEN, TEXT_DARK, TEXT_LIGHT, getMainBrandingColourFromState, getLightBrandingColourFromState } from "../colours";
|
|
8
|
+
import { Services } from "../config";
|
|
9
|
+
import { ProfilePic } from "./ProfilePic";
|
|
10
|
+
import { InlineButton } from "./InlineButton";
|
|
11
|
+
import { Spinner } from "./Spinner";
|
|
12
|
+
import { followerActions } from "../apis";
|
|
13
|
+
import { addFollower } from "../actions";
|
|
14
|
+
class UserListing extends Component {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
this.state = {
|
|
18
|
+
pending: false
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
onPress() {
|
|
22
|
+
const {
|
|
23
|
+
hidden
|
|
24
|
+
} = this.props.me;
|
|
25
|
+
if (hidden && _.includes(hidden, "people")) return;
|
|
26
|
+
if (this.props.onPress) {
|
|
27
|
+
this.props.onPress();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const user = {
|
|
31
|
+
...this.props.user
|
|
32
|
+
};
|
|
33
|
+
if (_.isUndefined(user.key)) {
|
|
34
|
+
user.key = user.userId;
|
|
35
|
+
}
|
|
36
|
+
if (_.isUndefined(user.id)) {
|
|
37
|
+
user.id = user.userId;
|
|
38
|
+
}
|
|
39
|
+
Services.navigation.navigate("profile", {
|
|
40
|
+
user
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
onFollowUser() {
|
|
44
|
+
const userToSave = {
|
|
45
|
+
profilePic: this.props.user.profilePic,
|
|
46
|
+
displayName: this.props.user.displayName,
|
|
47
|
+
id: this.props.user.id
|
|
48
|
+
};
|
|
49
|
+
this.setState({
|
|
50
|
+
pending: true
|
|
51
|
+
});
|
|
52
|
+
followerActions.addFollower(userToSave, this.props.myId).then(() => {
|
|
53
|
+
this.props.addFollower(userToSave);
|
|
54
|
+
}).catch(() => {
|
|
55
|
+
this.setState({
|
|
56
|
+
pending: false
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
getTimeText(input) {
|
|
61
|
+
const gug = moment.unix(input);
|
|
62
|
+
if (gug.isBefore(moment().local().startOf("d"))) {
|
|
63
|
+
return gug.format("D MMM");
|
|
64
|
+
}
|
|
65
|
+
return gug.format("h:mma");
|
|
66
|
+
}
|
|
67
|
+
getProfilePic() {
|
|
68
|
+
if (this.props.user.profilePic == null) return null;
|
|
69
|
+
let profilePic = this.props.user.profilePic;
|
|
70
|
+
if (!_.isUndefined(this.props.user.profilePicThumb) && !_.isEmpty(this.props.user.profilePicThumb)) {
|
|
71
|
+
profilePic = this.props.user.profilePicThumb;
|
|
72
|
+
} else if (this.props.user.profilePic.indexOf(".amazonaws.com/1400/") > -1) {
|
|
73
|
+
profilePic = profilePic.replace("/1400/", "/300/");
|
|
74
|
+
}
|
|
75
|
+
return profilePic;
|
|
76
|
+
}
|
|
77
|
+
getLastMessage(chat) {
|
|
78
|
+
if (typeof chat.lastMessage === "string") {
|
|
79
|
+
return chat.lastMessage;
|
|
80
|
+
}
|
|
81
|
+
// TODO recognise user name of last message
|
|
82
|
+
return chat.lastMessage.text;
|
|
83
|
+
}
|
|
84
|
+
renderFollowButton() {
|
|
85
|
+
if (this.props.user.privateChat) {
|
|
86
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
87
|
+
style: {
|
|
88
|
+
justifyContent: "flex-start"
|
|
89
|
+
}
|
|
90
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
91
|
+
style: [styles.chatTimeStamp, this.props.user.unread > 0 && {
|
|
92
|
+
color: TEXT_DARK,
|
|
93
|
+
fontFamily: "sf-bold"
|
|
94
|
+
}]
|
|
95
|
+
}, this.getTimeText(this.props.user.Changed)), /*#__PURE__*/React.createElement(View, {
|
|
96
|
+
style: [{
|
|
97
|
+
flexDirection: "row-reverse",
|
|
98
|
+
marginTop: 2
|
|
99
|
+
}, this.props.user.unread === 0 && {
|
|
100
|
+
opacity: 0
|
|
101
|
+
}]
|
|
102
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
103
|
+
style: styles.counter
|
|
104
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
105
|
+
style: styles.counterText
|
|
106
|
+
}, this.props.user.unread))));
|
|
107
|
+
}
|
|
108
|
+
if (!this.props.showFriendsButton) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// self
|
|
113
|
+
if (this.props.myId === this.props.user.id) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// already following
|
|
118
|
+
if (this.props.isFollowing) {
|
|
119
|
+
return /*#__PURE__*/React.createElement(InlineButton, {
|
|
120
|
+
color: this.props.colourBrandingLight,
|
|
121
|
+
style: styles.friendsButton,
|
|
122
|
+
textStyle: {
|
|
123
|
+
color: this.props.colourBrandingMain
|
|
124
|
+
},
|
|
125
|
+
disabled: true
|
|
126
|
+
}, "Friends");
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// in process of following
|
|
130
|
+
if (this.state.pending) {
|
|
131
|
+
return /*#__PURE__*/React.createElement(InlineButton, {
|
|
132
|
+
style: [styles.friendsButton, {
|
|
133
|
+
borderColor: this.props.colourBrandingMain,
|
|
134
|
+
borderWidth: 1
|
|
135
|
+
}],
|
|
136
|
+
disabled: true,
|
|
137
|
+
noText: true
|
|
138
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
139
|
+
size: "small",
|
|
140
|
+
color: this.props.colourBrandingMain
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// not following yet
|
|
145
|
+
return /*#__PURE__*/React.createElement(InlineButton, {
|
|
146
|
+
onPress: this.onFollowUser.bind(this),
|
|
147
|
+
color: "#fff",
|
|
148
|
+
style: [styles.friendsButton, {
|
|
149
|
+
borderColor: this.props.colourBrandingMain,
|
|
150
|
+
borderWidth: 1
|
|
151
|
+
}],
|
|
152
|
+
textStyle: {
|
|
153
|
+
color: this.props.colourBrandingMain
|
|
154
|
+
}
|
|
155
|
+
}, "Add friend");
|
|
156
|
+
}
|
|
157
|
+
renderStatusText() {
|
|
158
|
+
if (!this.props.statusText) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
162
|
+
style: styles.statusText
|
|
163
|
+
}, this.props.statusText);
|
|
164
|
+
}
|
|
165
|
+
render() {
|
|
166
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
167
|
+
style: this.props.containerStyle
|
|
168
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
169
|
+
activeOpacity: 0.9,
|
|
170
|
+
onPress: this.onPress.bind(this),
|
|
171
|
+
disabled: this.props.onPressDisabled
|
|
172
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
173
|
+
style: [styles.listItem, this.props.listItemStyle]
|
|
174
|
+
}, this.renderStatusText(), /*#__PURE__*/React.createElement(ProfilePic, {
|
|
175
|
+
ProfilePic: this.getProfilePic(),
|
|
176
|
+
Diameter: 42
|
|
177
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
178
|
+
style: [styles.fill, styles.flexRowReverse, styles.alignCenter]
|
|
179
|
+
}, this.props.rightContent, this.renderFollowButton(), /*#__PURE__*/React.createElement(View, {
|
|
180
|
+
style: styles.fill
|
|
181
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
182
|
+
style: styles.listItemTextContainer
|
|
183
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
184
|
+
style: styles.contactName,
|
|
185
|
+
numberOfLines: 1
|
|
186
|
+
}, this.props.user.displayName), this.props.user.privateChat && /*#__PURE__*/React.createElement(Text, {
|
|
187
|
+
style: styles.chatLastMessage,
|
|
188
|
+
numberOfLines: 1
|
|
189
|
+
}, this.getLastMessage(this.props.user)), this.props.subText))))));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const styles = {
|
|
193
|
+
listItem: {
|
|
194
|
+
paddingVertical: 8,
|
|
195
|
+
paddingHorizontal: 16,
|
|
196
|
+
justifyContent: "flex-start",
|
|
197
|
+
flexDirection: "row",
|
|
198
|
+
position: "relative"
|
|
199
|
+
},
|
|
200
|
+
listItemTextContainer: {
|
|
201
|
+
flex: 1,
|
|
202
|
+
flexDirection: "column",
|
|
203
|
+
justifyContent: "space-around",
|
|
204
|
+
paddingLeft: 16
|
|
205
|
+
},
|
|
206
|
+
contactName: {
|
|
207
|
+
fontSize: 15,
|
|
208
|
+
fontFamily: "sf-semibold",
|
|
209
|
+
backgroundColor: "rgba(255,255,255,0)",
|
|
210
|
+
color: TEXT_DARK
|
|
211
|
+
},
|
|
212
|
+
statusText: {
|
|
213
|
+
position: "absolute",
|
|
214
|
+
top: 0,
|
|
215
|
+
left: 82,
|
|
216
|
+
fontFamily: "sf-semibold",
|
|
217
|
+
fontSize: 12,
|
|
218
|
+
color: TEXT_LIGHT
|
|
219
|
+
},
|
|
220
|
+
fill: {
|
|
221
|
+
flex: 1
|
|
222
|
+
},
|
|
223
|
+
alignCenter: {
|
|
224
|
+
alignItems: "center"
|
|
225
|
+
},
|
|
226
|
+
flexRowReverse: {
|
|
227
|
+
flexDirection: "row-reverse"
|
|
228
|
+
},
|
|
229
|
+
friendsButton: {
|
|
230
|
+
width: 100
|
|
231
|
+
},
|
|
232
|
+
counter: {
|
|
233
|
+
borderRadius: 10,
|
|
234
|
+
height: 20,
|
|
235
|
+
justifyContent: "center",
|
|
236
|
+
minWidth: 20,
|
|
237
|
+
paddingHorizontal: 4,
|
|
238
|
+
backgroundColor: COLOUR_GREEN
|
|
239
|
+
},
|
|
240
|
+
counterText: {
|
|
241
|
+
color: "#fff",
|
|
242
|
+
fontSize: 12,
|
|
243
|
+
fontFamily: "sf-semibold",
|
|
244
|
+
textAlign: "center"
|
|
245
|
+
},
|
|
246
|
+
chatTimeStamp: {
|
|
247
|
+
fontSize: 10,
|
|
248
|
+
fontFamily: "sf-semibold",
|
|
249
|
+
color: TEXT_LIGHT
|
|
250
|
+
},
|
|
251
|
+
chatLastMessage: {
|
|
252
|
+
fontSize: 13,
|
|
253
|
+
fontFamily: "sf-medium",
|
|
254
|
+
color: TEXT_LIGHT,
|
|
255
|
+
marginRight: 5
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
const mapStateToProps = state => {
|
|
259
|
+
return {
|
|
260
|
+
me: state.user,
|
|
261
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
262
|
+
colourBrandingLight: getLightBrandingColourFromState(state)
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
export default connect(mapStateToProps, {
|
|
266
|
+
addFollower
|
|
267
|
+
})(UserListing);
|
|
268
|
+
//# sourceMappingURL=UserListing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Component","_","TouchableOpacity","View","Text","connect","moment","COLOUR_GREEN","TEXT_DARK","TEXT_LIGHT","getMainBrandingColourFromState","getLightBrandingColourFromState","Services","ProfilePic","InlineButton","Spinner","followerActions","addFollower","UserListing","constructor","props","state","pending","onPress","hidden","me","includes","user","isUndefined","key","userId","id","navigation","navigate","onFollowUser","userToSave","profilePic","displayName","setState","myId","then","catch","getTimeText","input","gug","unix","isBefore","local","startOf","format","getProfilePic","profilePicThumb","isEmpty","indexOf","replace","getLastMessage","chat","lastMessage","text","renderFollowButton","privateChat","createElement","style","justifyContent","styles","chatTimeStamp","unread","color","fontFamily","Changed","flexDirection","marginTop","opacity","counter","counterText","showFriendsButton","isFollowing","colourBrandingLight","friendsButton","textStyle","colourBrandingMain","disabled","borderColor","borderWidth","noText","size","bind","renderStatusText","statusText","render","containerStyle","activeOpacity","onPressDisabled","listItem","listItemStyle","Diameter","fill","flexRowReverse","alignCenter","rightContent","listItemTextContainer","contactName","numberOfLines","chatLastMessage","subText","paddingVertical","paddingHorizontal","position","flex","paddingLeft","fontSize","backgroundColor","top","left","alignItems","width","borderRadius","height","minWidth","textAlign","marginRight","mapStateToProps"],"sources":["UserListing.js"],"sourcesContent":["import React, { Component } from \"react\";\nimport _ from \"lodash\";\nimport { TouchableOpacity, View } from \"react-native\";\nimport { Text } from \"./Text\";\nimport { connect } from \"react-redux\";\nimport moment from \"moment\";\nimport {\n\tCOLOUR_GREEN,\n\tTEXT_DARK,\n\tTEXT_LIGHT,\n\tgetMainBrandingColourFromState,\n\tgetLightBrandingColourFromState,\n} from \"../colours\";\nimport { Services } from \"../config\";\nimport { ProfilePic } from \"./ProfilePic\";\nimport { InlineButton } from \"./InlineButton\";\nimport { Spinner } from \"./Spinner\";\nimport { followerActions } from \"../apis\";\nimport { addFollower } from \"../actions\";\n\nclass UserListing extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = { pending: false };\n\t}\n\n\tonPress() {\n\t\tconst { hidden } = this.props.me;\n\t\tif (hidden && _.includes(hidden, \"people\")) return;\n\n\t\tif (this.props.onPress) {\n\t\t\tthis.props.onPress();\n\t\t\treturn;\n\t\t}\n\t\tconst user = { ...this.props.user };\n\t\tif (_.isUndefined(user.key)) {\n\t\t\tuser.key = user.userId;\n\t\t}\n\t\tif (_.isUndefined(user.id)) {\n\t\t\tuser.id = user.userId;\n\t\t}\n\t\tServices.navigation.navigate(\"profile\", { user });\n\t}\n\n\tonFollowUser() {\n\t\tconst userToSave = {\n\t\t\tprofilePic: this.props.user.profilePic,\n\t\t\tdisplayName: this.props.user.displayName,\n\t\t\tid: this.props.user.id,\n\t\t};\n\t\tthis.setState({ pending: true });\n\t\tfollowerActions\n\t\t\t.addFollower(userToSave, this.props.myId)\n\t\t\t.then(() => {\n\t\t\t\tthis.props.addFollower(userToSave);\n\t\t\t})\n\t\t\t.catch(() => {\n\t\t\t\tthis.setState({ pending: false });\n\t\t\t});\n\t}\n\n\tgetTimeText(input) {\n\t\tconst gug = moment.unix(input);\n\t\tif (gug.isBefore(moment().local().startOf(\"d\"))) {\n\t\t\treturn gug.format(\"D MMM\");\n\t\t}\n\t\treturn gug.format(\"h:mma\");\n\t}\n\n\tgetProfilePic() {\n\t\tif (this.props.user.profilePic == null) return null;\n\t\tlet profilePic = this.props.user.profilePic;\n\t\tif (\n\t\t\t!_.isUndefined(this.props.user.profilePicThumb) &&\n\t\t\t!_.isEmpty(this.props.user.profilePicThumb)\n\t\t) {\n\t\t\tprofilePic = this.props.user.profilePicThumb;\n\t\t} else if (\n\t\t\tthis.props.user.profilePic.indexOf(\".amazonaws.com/1400/\") > -1\n\t\t) {\n\t\t\tprofilePic = profilePic.replace(\"/1400/\", \"/300/\");\n\t\t}\n\t\treturn profilePic;\n\t}\n\n\tgetLastMessage(chat) {\n\t\tif (typeof chat.lastMessage === \"string\") {\n\t\t\treturn chat.lastMessage;\n\t\t}\n\t\t// TODO recognise user name of last message\n\t\treturn chat.lastMessage.text;\n\t}\n\n\trenderFollowButton() {\n\t\tif (this.props.user.privateChat) {\n\t\t\treturn (\n\t\t\t\t<View style={{ justifyContent: \"flex-start\" }}>\n\t\t\t\t\t<Text\n\t\t\t\t\t\tstyle={[\n\t\t\t\t\t\t\tstyles.chatTimeStamp,\n\t\t\t\t\t\t\tthis.props.user.unread > 0 && {\n\t\t\t\t\t\t\t\tcolor: TEXT_DARK,\n\t\t\t\t\t\t\t\tfontFamily: \"sf-bold\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]}\n\t\t\t\t\t>\n\t\t\t\t\t\t{this.getTimeText(this.props.user.Changed)}\n\t\t\t\t\t</Text>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={[\n\t\t\t\t\t\t\t{ flexDirection: \"row-reverse\", marginTop: 2 },\n\t\t\t\t\t\t\tthis.props.user.unread === 0 && { opacity: 0 },\n\t\t\t\t\t\t]}\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={styles.counter}>\n\t\t\t\t\t\t\t<Text style={styles.counterText}>{this.props.user.unread}</Text>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\n\t\tif (!this.props.showFriendsButton) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// self\n\t\tif (this.props.myId === this.props.user.id) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// already following\n\t\tif (this.props.isFollowing) {\n\t\t\treturn (\n\t\t\t\t<InlineButton\n\t\t\t\t\tcolor={this.props.colourBrandingLight}\n\t\t\t\t\tstyle={styles.friendsButton}\n\t\t\t\t\ttextStyle={{ color: this.props.colourBrandingMain }}\n\t\t\t\t\tdisabled\n\t\t\t\t>\n\t\t\t\t\tFriends\n\t\t\t\t</InlineButton>\n\t\t\t);\n\t\t}\n\n\t\t// in process of following\n\t\tif (this.state.pending) {\n\t\t\treturn (\n\t\t\t\t<InlineButton\n\t\t\t\t\tstyle={[\n\t\t\t\t\t\tstyles.friendsButton,\n\t\t\t\t\t\t{ borderColor: this.props.colourBrandingMain, borderWidth: 1 },\n\t\t\t\t\t]}\n\t\t\t\t\tdisabled\n\t\t\t\t\tnoText\n\t\t\t\t>\n\t\t\t\t\t<Spinner size=\"small\" color={this.props.colourBrandingMain} />\n\t\t\t\t</InlineButton>\n\t\t\t);\n\t\t}\n\n\t\t// not following yet\n\t\treturn (\n\t\t\t<InlineButton\n\t\t\t\tonPress={this.onFollowUser.bind(this)}\n\t\t\t\tcolor=\"#fff\"\n\t\t\t\tstyle={[\n\t\t\t\t\tstyles.friendsButton,\n\t\t\t\t\t{ borderColor: this.props.colourBrandingMain, borderWidth: 1 },\n\t\t\t\t]}\n\t\t\t\ttextStyle={{ color: this.props.colourBrandingMain }}\n\t\t\t>\n\t\t\t\tAdd friend\n\t\t\t</InlineButton>\n\t\t);\n\t}\n\n\trenderStatusText() {\n\t\tif (!this.props.statusText) {\n\t\t\treturn null;\n\t\t}\n\t\treturn <Text style={styles.statusText}>{this.props.statusText}</Text>;\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<View style={this.props.containerStyle}>\n\t\t\t\t<TouchableOpacity\n\t\t\t\t\tactiveOpacity={0.9}\n\t\t\t\t\tonPress={this.onPress.bind(this)}\n\t\t\t\t\tdisabled={this.props.onPressDisabled}\n\t\t\t\t>\n\t\t\t\t\t<View style={[styles.listItem, this.props.listItemStyle]}>\n\t\t\t\t\t\t{this.renderStatusText()}\n\t\t\t\t\t\t<ProfilePic ProfilePic={this.getProfilePic()} Diameter={42} />\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={[styles.fill, styles.flexRowReverse, styles.alignCenter]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{this.props.rightContent}\n\t\t\t\t\t\t\t{this.renderFollowButton()}\n\t\t\t\t\t\t\t<View style={styles.fill}>\n\t\t\t\t\t\t\t\t<View style={styles.listItemTextContainer}>\n\t\t\t\t\t\t\t\t\t<Text style={styles.contactName} numberOfLines={1}>\n\t\t\t\t\t\t\t\t\t\t{this.props.user.displayName}\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t{this.props.user.privateChat && (\n\t\t\t\t\t\t\t\t\t\t<Text style={styles.chatLastMessage} numberOfLines={1}>\n\t\t\t\t\t\t\t\t\t\t\t{this.getLastMessage(this.props.user)}\n\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t{this.props.subText}\n\t\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t</TouchableOpacity>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nconst styles = {\n\tlistItem: {\n\t\tpaddingVertical: 8,\n\t\tpaddingHorizontal: 16,\n\t\tjustifyContent: \"flex-start\",\n\t\tflexDirection: \"row\",\n\t\tposition: \"relative\",\n\t},\n\tlistItemTextContainer: {\n\t\tflex: 1,\n\t\tflexDirection: \"column\",\n\t\tjustifyContent: \"space-around\",\n\t\tpaddingLeft: 16,\n\t},\n\tcontactName: {\n\t\tfontSize: 15,\n\t\tfontFamily: \"sf-semibold\",\n\t\tbackgroundColor: \"rgba(255,255,255,0)\",\n\t\tcolor: TEXT_DARK,\n\t},\n\tstatusText: {\n\t\tposition: \"absolute\",\n\t\ttop: 0,\n\t\tleft: 82,\n\t\tfontFamily: \"sf-semibold\",\n\t\tfontSize: 12,\n\t\tcolor: TEXT_LIGHT,\n\t},\n\tfill: {\n\t\tflex: 1,\n\t},\n\talignCenter: {\n\t\talignItems: \"center\",\n\t},\n\tflexRowReverse: {\n\t\tflexDirection: \"row-reverse\",\n\t},\n\tfriendsButton: {\n\t\twidth: 100,\n\t},\n\tcounter: {\n\t\tborderRadius: 10,\n\t\theight: 20,\n\t\tjustifyContent: \"center\",\n\t\tminWidth: 20,\n\t\tpaddingHorizontal: 4,\n\t\tbackgroundColor: COLOUR_GREEN,\n\t},\n\tcounterText: {\n\t\tcolor: \"#fff\",\n\t\tfontSize: 12,\n\t\tfontFamily: \"sf-semibold\",\n\t\ttextAlign: \"center\",\n\t},\n\tchatTimeStamp: {\n\t\tfontSize: 10,\n\t\tfontFamily: \"sf-semibold\",\n\t\tcolor: TEXT_LIGHT,\n\t},\n\tchatLastMessage: {\n\t\tfontSize: 13,\n\t\tfontFamily: \"sf-medium\",\n\t\tcolor: TEXT_LIGHT,\n\t\tmarginRight: 5,\n\t},\n};\n\nconst mapStateToProps = (state) => {\n\treturn {\n\t\tme: state.user,\n\t\tcolourBrandingMain: getMainBrandingColourFromState(state),\n\t\tcolourBrandingLight: getLightBrandingColourFromState(state),\n\t};\n};\n\nexport default connect(mapStateToProps, { addFollower })(UserListing);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,OAAOC,CAAC,MAAM,QAAQ;AACtB,SAASC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AACrD,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,OAAO,QAAQ,aAAa;AACrC,OAAOC,MAAM,MAAM,QAAQ;AAC3B,SACCC,YAAY,EACZC,SAAS,EACTC,UAAU,EACVC,8BAA8B,EAC9BC,+BAA+B,QACzB,YAAY;AACnB,SAASC,QAAQ,QAAQ,WAAW;AACpC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,eAAe,QAAQ,SAAS;AACzC,SAASC,WAAW,QAAQ,YAAY;AAExC,MAAMC,WAAW,SAASlB,SAAS,CAAC;EACnCmB,WAAWA,CAACC,KAAK,EAAE;IAClB,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,KAAK,GAAG;MAAEC,OAAO,EAAE;IAAM,CAAC;EAChC;EAEAC,OAAOA,CAAA,EAAG;IACT,MAAM;MAAEC;IAAO,CAAC,GAAG,IAAI,CAACJ,KAAK,CAACK,EAAE;IAChC,IAAID,MAAM,IAAIvB,CAAC,CAACyB,QAAQ,CAACF,MAAM,EAAE,QAAQ,CAAC,EAAE;IAE5C,IAAI,IAAI,CAACJ,KAAK,CAACG,OAAO,EAAE;MACvB,IAAI,CAACH,KAAK,C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WAAW,EAAE;IACZP,KAAK,EAAE,MAAM;IACb2C,QAAQ,EAAE,EAAE;IACZ1C,UAAU,EAAE,aAAa;IACzBmD,SAAS,EAAE;EACZ,CAAC;EACDtD,aAAa,EAAE;IACd6C,QAAQ,EAAE,EAAE;IACZ1C,UAAU,EAAE,aAAa;IACzBD,KAAK,EAAE1D;EACR,CAAC;EACD8F,eAAe,EAAE;IAChBO,QAAQ,EAAE,EAAE;IACZ1C,UAAU,EAAE,WAAW;IACvBD,KAAK,EAAE1D,UAAU;IACjB+G,WAAW,EAAE;EACd;AACD,CAAC;AAED,MAAMC,eAAe,GAAIpG,KAAK,IAAK;EAClC,OAAO;IACNI,EAAE,EAAEJ,KAAK,CAACM,IAAI;IACdqD,kBAAkB,EAAEtE,8BAA8B,CAACW,KAAK,CAAC;IACzDwD,mBAAmB,EAAElE,+BAA+B,CAACU,KAAK;EAC3D,CAAC;AACF,CAAC;AAED,eAAehB,OAAO,CAACoH,eAAe,EAAE;EAAExG;AAAY,CAAC,CAAC,CAACC,WAAW,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
+
import React, { Component } from "react";
|
|
5
|
+
import { Platform, View, Modal, TouchableOpacity, StyleSheet } from "react-native";
|
|
6
|
+
import * as ScreenOrientation from "expo-screen-orientation";
|
|
7
|
+
import { StatusBarHeight, getCompressed, imageExists } from "../helper";
|
|
8
|
+
import { FontAwesome } from "./Icon";
|
|
9
|
+
import { SharingTools } from "./SharingTools";
|
|
10
|
+
import MediaPlayer from "./MediaPlayer";
|
|
11
|
+
class VideoPopup extends Component {
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(props);
|
|
14
|
+
_defineProperty(this, "UNSAFE_componentWillMount", async () => {
|
|
15
|
+
this.checkCompressed(this.props.uri);
|
|
16
|
+
await ScreenOrientation.lockAsync(Platform.OS === "ios" ? ScreenOrientation.OrientationLock.DEFAULT : ScreenOrientation.OrientationLock.ALL);
|
|
17
|
+
});
|
|
18
|
+
_defineProperty(this, "componentWillUnmount", async () => {
|
|
19
|
+
await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP);
|
|
20
|
+
});
|
|
21
|
+
_defineProperty(this, "checkCompressed", url => {
|
|
22
|
+
const compressedUri = getCompressed(url);
|
|
23
|
+
imageExists(compressedUri).then(compressedExists => {
|
|
24
|
+
this.setState({
|
|
25
|
+
uri: compressedExists ? compressedUri : url
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
this.state = {
|
|
30
|
+
uri: "",
|
|
31
|
+
isFullScreen: false
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
35
|
+
if (this.props.uri === nextProps.uri) return;
|
|
36
|
+
this.checkCompressed(nextProps.uri);
|
|
37
|
+
}
|
|
38
|
+
renderClose() {
|
|
39
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
40
|
+
style: styles.menuIconContainer,
|
|
41
|
+
onPress: this.props.onClose,
|
|
42
|
+
activeOpacity: 0.6
|
|
43
|
+
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
44
|
+
name: "x",
|
|
45
|
+
style: styles.menuIcon
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
renderPlayer() {
|
|
49
|
+
const {
|
|
50
|
+
uri
|
|
51
|
+
} = this.state;
|
|
52
|
+
if (!uri) return null;
|
|
53
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
54
|
+
style: styles.playerContainer
|
|
55
|
+
}, /*#__PURE__*/React.createElement(MediaPlayer, {
|
|
56
|
+
source: uri,
|
|
57
|
+
useVideoPlayer: true,
|
|
58
|
+
autoPlay: true,
|
|
59
|
+
orientationChanged: isFullScreen => this.setState({
|
|
60
|
+
isFullScreen
|
|
61
|
+
})
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
const {
|
|
66
|
+
isFullScreen
|
|
67
|
+
} = this.state;
|
|
68
|
+
const {
|
|
69
|
+
visible,
|
|
70
|
+
onClose,
|
|
71
|
+
animationType,
|
|
72
|
+
style
|
|
73
|
+
} = this.props;
|
|
74
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
75
|
+
visible: visible,
|
|
76
|
+
animationType: animationType || "fade",
|
|
77
|
+
onRequestClose: onClose,
|
|
78
|
+
style: [styles.container, style],
|
|
79
|
+
supportedOrientations: ["portrait", "landscape"]
|
|
80
|
+
}, this.renderPlayer(), !isFullScreen && this.renderClose(), !isFullScreen && /*#__PURE__*/React.createElement(SharingTools, {
|
|
81
|
+
uri: this.props.uri
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const styles = StyleSheet.create({
|
|
86
|
+
container: {
|
|
87
|
+
backgroundColor: "#000"
|
|
88
|
+
},
|
|
89
|
+
menuIconContainer: {
|
|
90
|
+
position: "absolute",
|
|
91
|
+
top: StatusBarHeight(0),
|
|
92
|
+
right: 0,
|
|
93
|
+
width: 55,
|
|
94
|
+
height: 55,
|
|
95
|
+
zIndex: 3
|
|
96
|
+
},
|
|
97
|
+
menuIcon: {
|
|
98
|
+
fontSize: 25,
|
|
99
|
+
padding: 15,
|
|
100
|
+
width: 55,
|
|
101
|
+
textAlign: "center",
|
|
102
|
+
color: "#fff",
|
|
103
|
+
zIndex: 3
|
|
104
|
+
},
|
|
105
|
+
playerContainer: {
|
|
106
|
+
flex: 1,
|
|
107
|
+
backgroundColor: "#000",
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
justifyContent: "center"
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
export { VideoPopup };
|
|
113
|
+
//# sourceMappingURL=VideoPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Component","Platform","View","Modal","TouchableOpacity","StyleSheet","ScreenOrientation","StatusBarHeight","getCompressed","imageExists","FontAwesome","SharingTools","MediaPlayer","VideoPopup","constructor","props","_defineProperty","checkCompressed","uri","lockAsync","OS","OrientationLock","DEFAULT","ALL","PORTRAIT_UP","url","compressedUri","then","compressedExists","setState","state","isFullScreen","UNSAFE_componentWillReceiveProps","nextProps","renderClose","createElement","style","styles","menuIconContainer","onPress","onClose","activeOpacity","name","menuIcon","renderPlayer","playerContainer","source","useVideoPlayer","autoPlay","orientationChanged","render","visible","animationType","onRequestClose","container","supportedOrientations","create","backgroundColor","position","top","right","width","height","zIndex","fontSize","padding","textAlign","color","flex","alignItems","justifyContent"],"sources":["VideoPopup.js"],"sourcesContent":["import React, { Component } from \"react\";\nimport {\n\tPlatform,\n\tView,\n\tModal,\n\tTouchableOpacity,\n\tStyleSheet,\n} from \"react-native\";\nimport * as ScreenOrientation from \"expo-screen-orientation\";\nimport { StatusBarHeight, getCompressed, imageExists } from \"../helper\";\nimport { FontAwesome } from \"./Icon\";\nimport { SharingTools } from \"./SharingTools\";\nimport MediaPlayer from \"./MediaPlayer\";\n\nclass VideoPopup extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\n\t\tthis.state = {\n\t\t\turi: \"\",\n\t\t\tisFullScreen: false,\n\t\t};\n\t}\n\n\tUNSAFE_componentWillMount = async () => {\n\t\tthis.checkCompressed(this.props.uri);\n\t\tawait ScreenOrientation.lockAsync(\n\t\t\tPlatform.OS === \"ios\"\n\t\t\t\t? ScreenOrientation.OrientationLock.DEFAULT\n\t\t\t\t: ScreenOrientation.OrientationLock.ALL,\n\t\t);\n\t};\n\n\tUNSAFE_componentWillReceiveProps(nextProps) {\n\t\tif (this.props.uri === nextProps.uri) return;\n\t\tthis.checkCompressed(nextProps.uri);\n\t}\n\n\tcomponentWillUnmount = async () => {\n\t\tawait ScreenOrientation.lockAsync(\n\t\t\tScreenOrientation.OrientationLock.PORTRAIT_UP,\n\t\t);\n\t};\n\n\tcheckCompressed = (url) => {\n\t\tconst compressedUri = getCompressed(url);\n\t\timageExists(compressedUri).then((compressedExists) => {\n\t\t\tthis.setState({ uri: compressedExists ? compressedUri : url });\n\t\t});\n\t};\n\n\trenderClose() {\n\t\treturn (\n\t\t\t<TouchableOpacity\n\t\t\t\tstyle={styles.menuIconContainer}\n\t\t\t\tonPress={this.props.onClose}\n\t\t\t\tactiveOpacity={0.6}\n\t\t\t>\n\t\t\t\t<FontAwesome name=\"x\" style={styles.menuIcon} />\n\t\t\t</TouchableOpacity>\n\t\t);\n\t}\n\n\trenderPlayer() {\n\t\tconst { uri } = this.state;\n\t\tif (!uri) return null;\n\n\t\treturn (\n\t\t\t<View style={styles.playerContainer}>\n\t\t\t\t<MediaPlayer\n\t\t\t\t\tsource={uri}\n\t\t\t\t\tuseVideoPlayer={true}\n\t\t\t\t\tautoPlay={true}\n\t\t\t\t\torientationChanged={(isFullScreen) => this.setState({ isFullScreen })}\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst { isFullScreen } = this.state;\n\t\tconst { visible, onClose, animationType, style } = this.props;\n\n\t\treturn (\n\t\t\t<Modal\n\t\t\t\tvisible={visible}\n\t\t\t\tanimationType={animationType || \"fade\"}\n\t\t\t\tonRequestClose={onClose}\n\t\t\t\tstyle={[styles.container, style]}\n\t\t\t\tsupportedOrientations={[\"portrait\", \"landscape\"]}\n\t\t\t>\n\t\t\t\t{this.renderPlayer()}\n\t\t\t\t{!isFullScreen && this.renderClose()}\n\t\t\t\t{!isFullScreen && <SharingTools uri={this.props.uri} />}\n\t\t\t</Modal>\n\t\t);\n\t}\n}\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tbackgroundColor: \"#000\",\n\t},\n\tmenuIconContainer: {\n\t\tposition: \"absolute\",\n\t\ttop: StatusBarHeight(0),\n\t\tright: 0,\n\t\twidth: 55,\n\t\theight: 55,\n\t\tzIndex: 3,\n\t},\n\tmenuIcon: {\n\t\tfontSize: 25,\n\t\tpadding: 15,\n\t\twidth: 55,\n\t\ttextAlign: \"center\",\n\t\tcolor: \"#fff\",\n\t\tzIndex: 3,\n\t},\n\tplayerContainer: {\n\t\tflex: 1,\n\t\tbackgroundColor: \"#000\",\n\t\talignItems: \"center\",\n\t\tjustifyContent: \"center\",\n\t},\n});\n\nexport { VideoPopup };\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACCC,QAAQ,EACRC,IAAI,EACJC,KAAK,EACLC,gBAAgB,EAChBC,UAAU,QACJ,cAAc;AACrB,OAAO,KAAKC,iBAAiB,MAAM,yBAAyB;AAC5D,SAASC,eAAe,EAAEC,aAAa,EAAEC,WAAW,QAAQ,WAAW;AACvE,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,OAAOC,WAAW,MAAM,eAAe;AAEvC,MAAMC,UAAU,SAASb,SAAS,CAAC;EAClCc,WAAWA,CAACC,KAAK,EAAE;IAClB,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,oCAQc,YAAY;MACvC,IAAI,CAACC,eAAe,CAAC,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC;MACpC,MAAMZ,iBAAiB,CAACa,SAAS,CAChClB,QAAQ,CAACmB,EAAE,KAAK,KAAK,GAClBd,iBAAiB,CAACe,eAAe,CAACC,OAAO,GACzChB,iBAAiB,CAACe,eAAe,CAACE,GACtC,CAAC;IACF,CAAC;IAAAP,eAAA,+BAOsB,YAAY;MAClC,MA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EAAE,EAAE;IACTK,SAAS,EAAE,QAAQ;IACnBC,KAAK,EAAE,MAAM;IACbJ,MAAM,EAAE;EACT,CAAC;EACDlB,eAAe,EAAE;IAChBuB,IAAI,EAAE,CAAC;IACPX,eAAe,EAAE,MAAM;IACvBY,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EACjB;AACD,CAAC,CAAC;AAEF,SAASzD,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { PureComponent } from "react";
|
|
2
|
+
import _ from "lodash";
|
|
3
|
+
import { View, Dimensions } from "react-native";
|
|
4
|
+
import { Text } from "./Text";
|
|
5
|
+
import { connect } from "react-redux";
|
|
6
|
+
import { FontAwesome } from "./Icon";
|
|
7
|
+
import { COLOUR_GREEN, TEXT_DARK, getMainBrandingColourFromState } from "../colours";
|
|
8
|
+
import { MiddlePopup } from "./MiddlePopup";
|
|
9
|
+
import { InlineButton } from "./InlineButton";
|
|
10
|
+
const SCREEN_WIDTH = Dimensions.get("window").width;
|
|
11
|
+
class WarningPopup extends PureComponent {
|
|
12
|
+
render() {
|
|
13
|
+
return /*#__PURE__*/React.createElement(MiddlePopup, {
|
|
14
|
+
visible: this.props.visible,
|
|
15
|
+
onClose: this.props.onClose,
|
|
16
|
+
style: [styles.popup, this.props.padHorizontal && {
|
|
17
|
+
paddingHorizontal: 16
|
|
18
|
+
}]
|
|
19
|
+
}, this.props.isSuccess && /*#__PURE__*/React.createElement(FontAwesome, {
|
|
20
|
+
style: styles.icon,
|
|
21
|
+
name: "circle-check"
|
|
22
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
23
|
+
style: styles.text
|
|
24
|
+
}, this.props.confirmText), /*#__PURE__*/React.createElement(View, {
|
|
25
|
+
style: {
|
|
26
|
+
marginTop: 16,
|
|
27
|
+
paddingHorizontal: 24
|
|
28
|
+
}
|
|
29
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
30
|
+
style: [styles.infoText, this.props.infoTextStyle]
|
|
31
|
+
}, this.props.infoText)), /*#__PURE__*/React.createElement(InlineButton, {
|
|
32
|
+
onPress: this.props.onClose,
|
|
33
|
+
color: this.props.ctaButton ? this.props.colourBrandingMain : "#fff",
|
|
34
|
+
style: styles.button,
|
|
35
|
+
textStyle: [styles.closeText, {
|
|
36
|
+
color: this.props.ctaButton ? "#fff" : this.props.colourBrandingMain
|
|
37
|
+
}],
|
|
38
|
+
large: true
|
|
39
|
+
}, !_.isUndefined(this.props.buttonText) ? this.props.buttonText : "Close"));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const styles = {
|
|
43
|
+
popup: {
|
|
44
|
+
width: "auto",
|
|
45
|
+
maxWidth: SCREEN_WIDTH - 34,
|
|
46
|
+
paddingVertical: 16
|
|
47
|
+
},
|
|
48
|
+
icon: {
|
|
49
|
+
marginTop: 20,
|
|
50
|
+
paddingBottom: 16,
|
|
51
|
+
fontSize: 52,
|
|
52
|
+
color: COLOUR_GREEN
|
|
53
|
+
},
|
|
54
|
+
text: {
|
|
55
|
+
fontFamily: "sf-bold",
|
|
56
|
+
fontSize: 24,
|
|
57
|
+
lineHeight: 24,
|
|
58
|
+
color: TEXT_DARK,
|
|
59
|
+
textAlign: "center",
|
|
60
|
+
marginTop: 8
|
|
61
|
+
},
|
|
62
|
+
infoText: {
|
|
63
|
+
fontFamily: "sf-regular",
|
|
64
|
+
fontSize: 16,
|
|
65
|
+
lineHeight: 22,
|
|
66
|
+
color: TEXT_DARK,
|
|
67
|
+
textAlign: "left"
|
|
68
|
+
},
|
|
69
|
+
button: {
|
|
70
|
+
width: 130,
|
|
71
|
+
marginTop: 20
|
|
72
|
+
},
|
|
73
|
+
closeText: {
|
|
74
|
+
fontFamily: "sf-medium",
|
|
75
|
+
fontSize: 15
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const mapStateToProps = state => {
|
|
79
|
+
return {
|
|
80
|
+
colourBrandingMain: getMainBrandingColourFromState(state)
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const warningPopup = connect(mapStateToProps, {})(WarningPopup);
|
|
84
|
+
export { warningPopup as WarningPopup };
|
|
85
|
+
//# sourceMappingURL=WarningPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","PureComponent","_","View","Dimensions","Text","connect","FontAwesome","COLOUR_GREEN","TEXT_DARK","getMainBrandingColourFromState","MiddlePopup","InlineButton","SCREEN_WIDTH","get","width","WarningPopup","render","createElement","visible","props","onClose","style","styles","popup","padHorizontal","paddingHorizontal","isSuccess","icon","name","text","confirmText","marginTop","infoText","infoTextStyle","onPress","color","ctaButton","colourBrandingMain","button","textStyle","closeText","large","isUndefined","buttonText","maxWidth","paddingVertical","paddingBottom","fontSize","fontFamily","lineHeight","textAlign","mapStateToProps","state","warningPopup"],"sources":["WarningPopup.js"],"sourcesContent":["import React, { PureComponent } from \"react\";\nimport _ from \"lodash\";\nimport { View, Dimensions } from \"react-native\";\nimport { Text } from \"./Text\";\nimport { connect } from \"react-redux\";\nimport { FontAwesome } from \"./Icon\";\nimport {\n\tCOLOUR_GREEN,\n\tTEXT_DARK,\n\tgetMainBrandingColourFromState,\n} from \"../colours\";\nimport { MiddlePopup } from \"./MiddlePopup\";\nimport { InlineButton } from \"./InlineButton\";\n\nconst SCREEN_WIDTH = Dimensions.get(\"window\").width;\n\nclass WarningPopup extends PureComponent {\n\trender() {\n\t\treturn (\n\t\t\t<MiddlePopup\n\t\t\t\tvisible={this.props.visible}\n\t\t\t\tonClose={this.props.onClose}\n\t\t\t\tstyle={[\n\t\t\t\t\tstyles.popup,\n\t\t\t\t\tthis.props.padHorizontal && { paddingHorizontal: 16 },\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{this.props.isSuccess && (\n\t\t\t\t\t<FontAwesome style={styles.icon} name=\"circle-check\" />\n\t\t\t\t)}\n\t\t\t\t<Text style={styles.text}>{this.props.confirmText}</Text>\n\t\t\t\t<View style={{ marginTop: 16, paddingHorizontal: 24 }}>\n\t\t\t\t\t<Text style={[styles.infoText, this.props.infoTextStyle]}>\n\t\t\t\t\t\t{this.props.infoText}\n\t\t\t\t\t</Text>\n\t\t\t\t</View>\n\t\t\t\t<InlineButton\n\t\t\t\t\tonPress={this.props.onClose}\n\t\t\t\t\tcolor={this.props.ctaButton ? this.props.colourBrandingMain : \"#fff\"}\n\t\t\t\t\tstyle={styles.button}\n\t\t\t\t\ttextStyle={[\n\t\t\t\t\t\tstyles.closeText,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcolor: this.props.ctaButton\n\t\t\t\t\t\t\t\t? \"#fff\"\n\t\t\t\t\t\t\t\t: this.props.colourBrandingMain,\n\t\t\t\t\t\t},\n\t\t\t\t\t]}\n\t\t\t\t\tlarge\n\t\t\t\t>\n\t\t\t\t\t{!_.isUndefined(this.props.buttonText)\n\t\t\t\t\t\t? this.props.buttonText\n\t\t\t\t\t\t: \"Close\"}\n\t\t\t\t</InlineButton>\n\t\t\t</MiddlePopup>\n\t\t);\n\t}\n}\n\nconst styles = {\n\tpopup: {\n\t\twidth: \"auto\",\n\t\tmaxWidth: SCREEN_WIDTH - 34,\n\t\tpaddingVertical: 16,\n\t},\n\ticon: {\n\t\tmarginTop: 20,\n\t\tpaddingBottom: 16,\n\t\tfontSize: 52,\n\t\tcolor: COLOUR_GREEN,\n\t},\n\ttext: {\n\t\tfontFamily: \"sf-bold\",\n\t\tfontSize: 24,\n\t\tlineHeight: 24,\n\t\tcolor: TEXT_DARK,\n\t\ttextAlign: \"center\",\n\t\tmarginTop: 8,\n\t},\n\tinfoText: {\n\t\tfontFamily: \"sf-regular\",\n\t\tfontSize: 16,\n\t\tlineHeight: 22,\n\t\tcolor: TEXT_DARK,\n\t\ttextAlign: \"left\",\n\t},\n\tbutton: {\n\t\twidth: 130,\n\t\tmarginTop: 20,\n\t},\n\tcloseText: {\n\t\tfontFamily: \"sf-medium\",\n\t\tfontSize: 15,\n\t},\n};\n\nconst mapStateToProps = (state) => {\n\treturn {\n\t\tcolourBrandingMain: getMainBrandingColourFromState(state),\n\t};\n};\n\nconst warningPopup = connect(mapStateToProps, {})(WarningPopup);\nexport { warningPopup as WarningPopup };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAC5C,OAAOC,CAAC,MAAM,QAAQ;AACtB,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,OAAO,QAAQ,aAAa;AACrC,SAASC,WAAW,QAAQ,QAAQ;AACpC,SACCC,YAAY,EACZC,SAAS,EACTC,8BAA8B,QACxB,YAAY;AACnB,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,YAAY,QAAQ,gBAAgB;AAE7C,MAAMC,YAAY,GAAGT,UAAU,CAACU,GAAG,CAAC,QAAQ,CAAC,CAACC,KAAK;AAEnD,MAAMC,YAAY,SAASf,aAAa,CAAC;EACxCgB,MAAMA,CAAA,EAAG;IACR,oBACCjB,KAAA,CAAAkB,aAAA,CAACP,WAAW;MACXQ,OAAO,EAAE,IAAI,CAACC,KAAK,CAACD,OAAQ;MAC5BE,OAAO,EAAE,IAAI,CAACD,KAAK,CAACC,OAAQ;MAC5BC,KAAK,EAAE,CACNC,MAAM,CAACC,KAAK,EACZ,IAAI,CAACJ,KAAK,CAACK,aAAa,IAAI;QAAEC,iBAAiB,EAAE;MAAG,CAAC;IACpD,GAED,IAAI,CAACN,KAAK,CAACO,SAAS,iBACpB3B,KAAA,CAAAkB,aAAA,CAACX,WAAW;MAACe,KAAK,EAAEC,MAAM,CAACK,IAAK;MAACC,IAAI,EAAC;IAAc,CAAE,CACtD,eACD7B,KAAA,CAAAkB,aAAA,CAACb,IAAI;MAACiB,KAAK,EAAEC,MAAM,CAACO;IAAK,GAAE,IAAI,CAACV,KAAK,CAACW,WAAkB,CAAC,eACzD/B,KAAA,CAAAkB,aAAA,CAACf,IAAI;MAACmB,KAAK,EAAE;QAAE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