@plusscommunities/pluss-core-app 4.0.4-auth.0 → 6.0.0-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 +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 +86 -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 +12 -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/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/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 +168 -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 +54 -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 +350 -0
- package/dist/module/components/AudienceSelectorPage.js.map +1 -0
- package/dist/module/components/AutoOffsetImage.js +186 -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/CategoryTabs.js +154 -0
- package/dist/module/components/CategoryTabs.js.map +1 -0
- package/dist/module/components/CommentReply.js +328 -0
- package/dist/module/components/CommentReply.js.map +1 -0
- package/dist/module/components/CommentSection.js +822 -0
- package/dist/module/components/CommentSection.js.map +1 -0
- package/dist/module/components/ConfirmPopup.js +108 -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/DropDownItem.js +74 -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 +50 -0
- package/dist/module/components/EmptyStateMain.js.map +1 -0
- package/dist/module/components/EmptyStateWidget.js +47 -0
- package/dist/module/components/EmptyStateWidget.js.map +1 -0
- package/dist/module/components/FontScaleButton.js +36 -0
- package/dist/module/components/FontScaleButton.js.map +1 -0
- package/dist/module/components/FontScalePopup.js +75 -0
- package/dist/module/components/FontScalePopup.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 +212 -0
- package/dist/module/components/FormCardSection.js.map +1 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js +72 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -0
- package/dist/module/components/FormattedText.js +131 -0
- package/dist/module/components/FormattedText.js.map +1 -0
- package/dist/module/components/GenericInput.js +148 -0
- package/dist/module/components/GenericInput.js.map +1 -0
- package/dist/module/components/GenericInputSection.js +158 -0
- package/dist/module/components/GenericInputSection.js.map +1 -0
- package/dist/module/components/Header.js +458 -0
- package/dist/module/components/Header.js.map +1 -0
- package/dist/module/components/ImagePopup.js +240 -0
- package/dist/module/components/ImagePopup.js.map +1 -0
- package/dist/module/components/ImageUploadProgress.js +68 -0
- package/dist/module/components/ImageUploadProgress.js.map +1 -0
- package/dist/module/components/ImageUploader.js +795 -0
- package/dist/module/components/ImageUploader.js.map +1 -0
- package/dist/module/components/InlineButton.js +65 -0
- package/dist/module/components/InlineButton.js.map +1 -0
- package/dist/module/components/Input.js +154 -0
- package/dist/module/components/Input.js.map +1 -0
- package/dist/module/components/LoadingCircles.js +220 -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 +418 -0
- package/dist/module/components/MediaPlayer.js.map +1 -0
- package/dist/module/components/MiddlePopup.js +43 -0
- package/dist/module/components/MiddlePopup.js.map +1 -0
- package/dist/module/components/PDFPopup.js +191 -0
- package/dist/module/components/PDFPopup.js.map +1 -0
- package/dist/module/components/PlussChat.js +986 -0
- package/dist/module/components/PlussChat.js.map +1 -0
- package/dist/module/components/PlussChatMessage.js +262 -0
- package/dist/module/components/PlussChatMessage.js.map +1 -0
- package/dist/module/components/PlussChatTime.js +58 -0
- package/dist/module/components/PlussChatTime.js.map +1 -0
- package/dist/module/components/Popup.js +125 -0
- package/dist/module/components/Popup.js.map +1 -0
- package/dist/module/components/PopupMenu.js +119 -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 +106 -0
- package/dist/module/components/ProfilePic.js.map +1 -0
- package/dist/module/components/RadioButton.js +77 -0
- package/dist/module/components/RadioButton.js.map +1 -0
- package/dist/module/components/Reaction.js +116 -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 +154 -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/TextStyle.js +45 -0
- package/dist/module/components/TextStyle.js.map +1 -0
- package/dist/module/components/Toggle.js +65 -0
- package/dist/module/components/Toggle.js.map +1 -0
- package/dist/module/components/TouchableSearchBar.js +67 -0
- package/dist/module/components/TouchableSearchBar.js.map +1 -0
- package/dist/module/components/UserListPopup.js +135 -0
- package/dist/module/components/UserListPopup.js.map +1 -0
- package/dist/module/components/UserListing.js +267 -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 +82 -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 +116 -0
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -0
- package/dist/module/components/index.js +55 -0
- package/dist/module/components/index.js.map +1 -0
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +385 -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 +32 -0
- package/dist/module/config.js.map +1 -0
- package/dist/module/constants.js +19 -0
- package/dist/module/constants.js.map +1 -0
- package/dist/module/fonts/index.js +2 -0
- package/dist/module/fonts/index.js.map +1 -0
- package/dist/module/fonts/pluss60-icons.js +5 -0
- package/dist/module/fonts/pluss60-icons.js.map +1 -0
- package/dist/module/fonts/pluss60-icons.json +1097 -0
- package/dist/module/helper.js +397 -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 +30 -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/package.json +20 -24
- package/src/js/images/detectFaces.js +8 -4
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
import React, { Component } from 'react';
|
|
5
|
+
import { connect } from 'react-redux';
|
|
6
|
+
import _ from 'lodash';
|
|
7
|
+
import { TouchableOpacity, View, ScrollView, Text, StyleSheet } from 'react-native';
|
|
8
|
+
import { Icon } from 'react-native-elements';
|
|
9
|
+
import { Services } from '../config';
|
|
10
|
+
import { FormCard } from './FormCard';
|
|
11
|
+
import { FormCardSection } from './FormCardSection';
|
|
12
|
+
import { InlineButton } from './InlineButton';
|
|
13
|
+
import Header from './Header';
|
|
14
|
+
import { Spinner } from './Spinner';
|
|
15
|
+
import { TEXT_DARK, COLOUR_GREEN, BG_GREY, INACTIVE_BUTTON, TEXT_LIGHT, getMainBrandingColourFromState } from '../colours';
|
|
16
|
+
import { typeActions, profileActions } from '../apis';
|
|
17
|
+
class AudienceSelectorPage extends Component {
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
20
|
+
_defineProperty(this, "componentDidMount", async () => {
|
|
21
|
+
try {
|
|
22
|
+
this.setState({
|
|
23
|
+
loading: true
|
|
24
|
+
});
|
|
25
|
+
await this.getUserTypes();
|
|
26
|
+
await this.getUserTags();
|
|
27
|
+
this.setState({
|
|
28
|
+
loading: false,
|
|
29
|
+
combinedList: this.getAvailableAudienceTags()
|
|
30
|
+
});
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error('loading types error', error);
|
|
33
|
+
this.setState({
|
|
34
|
+
loading: false
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
_defineProperty(this, "getUserTypes", async () => {
|
|
39
|
+
const {
|
|
40
|
+
data
|
|
41
|
+
} = await typeActions.getUserTypes(this.props.site);
|
|
42
|
+
data.forEach(e => {
|
|
43
|
+
e.name = e.category ? `(${e.category[0].toUpperCase() + e.category.substring(1)}) ${e.displayName}` : e.displayName;
|
|
44
|
+
e.key = e.typeName;
|
|
45
|
+
});
|
|
46
|
+
// console.log('getUserTypes', data);
|
|
47
|
+
this.setState({
|
|
48
|
+
types: data
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
_defineProperty(this, "getUserTags", async () => {
|
|
52
|
+
const {
|
|
53
|
+
data
|
|
54
|
+
} = await profileActions.getUserTagsBySite(this.props.site);
|
|
55
|
+
data.forEach(e => {
|
|
56
|
+
e.name = e.Title;
|
|
57
|
+
e.key = e.Id;
|
|
58
|
+
});
|
|
59
|
+
// console.log('getUserTags', data);
|
|
60
|
+
this.setState({
|
|
61
|
+
tags: data
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
_defineProperty(this, "getAvailableAudienceTags", () => {
|
|
65
|
+
const {
|
|
66
|
+
categories,
|
|
67
|
+
types,
|
|
68
|
+
tags
|
|
69
|
+
} = this.state;
|
|
70
|
+
const {
|
|
71
|
+
audienceTypeSelection
|
|
72
|
+
} = this.props;
|
|
73
|
+
const categoryTags = categories.map(c => {
|
|
74
|
+
const Id = `category_${c.key}`;
|
|
75
|
+
return {
|
|
76
|
+
AudienceType: 'Category',
|
|
77
|
+
AudienceTypeSelection: c.key,
|
|
78
|
+
Id,
|
|
79
|
+
Title: c.name,
|
|
80
|
+
Selected: audienceTypeSelection.some(i => i.Id === Id)
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
const userTypeTags = types.map(t => {
|
|
84
|
+
const Id = `userType_${t.typeName}`;
|
|
85
|
+
return {
|
|
86
|
+
AudienceType: 'UserType',
|
|
87
|
+
AudienceTypeSelection: t.typeName,
|
|
88
|
+
Id,
|
|
89
|
+
Title: `User Type: ${t.displayName}`,
|
|
90
|
+
Selected: audienceTypeSelection.some(i => i.Id === Id)
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
const userTagTags = tags.map(t => {
|
|
94
|
+
const Id = `userTag_${t.Id}`;
|
|
95
|
+
return {
|
|
96
|
+
AudienceType: 'UserTags',
|
|
97
|
+
AudienceTypeSelection: t.Id,
|
|
98
|
+
Id,
|
|
99
|
+
Title: `User Tag: ${t.Title}`,
|
|
100
|
+
Selected: audienceTypeSelection.some(i => i.Id === Id)
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
return [...categoryTags, ...userTypeTags, ...userTagTags];
|
|
104
|
+
});
|
|
105
|
+
_defineProperty(this, "onPressBack", () => {
|
|
106
|
+
Services.navigation.goBack();
|
|
107
|
+
});
|
|
108
|
+
_defineProperty(this, "onSelectAll", () => {
|
|
109
|
+
const newList = [...this.state.combinedList];
|
|
110
|
+
newList.forEach(i => i.Selected = false);
|
|
111
|
+
this.setState({
|
|
112
|
+
combinedList: newList
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
_defineProperty(this, "onSeeAll", () => {
|
|
116
|
+
this.setState({
|
|
117
|
+
seeAll: !this.state.seeAll
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
_defineProperty(this, "onToggleAudienceOption", option => {
|
|
121
|
+
const newList = [...this.state.combinedList];
|
|
122
|
+
const selected = newList.find(i => i.Id === option.Id);
|
|
123
|
+
if (selected) {
|
|
124
|
+
selected.Selected = !selected.Selected;
|
|
125
|
+
this.setState({
|
|
126
|
+
combinedList: newList
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
_defineProperty(this, "onDone", () => {
|
|
131
|
+
if (this.props.onChange) {
|
|
132
|
+
const {
|
|
133
|
+
combinedList
|
|
134
|
+
} = this.state;
|
|
135
|
+
const selected = combinedList.filter(i => i.Selected);
|
|
136
|
+
if (selected && selected.length > 0) {
|
|
137
|
+
this.props.onChange('Custom', selected);
|
|
138
|
+
} else {
|
|
139
|
+
this.props.onChange(null, null);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
Services.navigation.goBack();
|
|
143
|
+
});
|
|
144
|
+
this.state = {
|
|
145
|
+
loading: false,
|
|
146
|
+
categories: [{
|
|
147
|
+
name: 'All Primary Users',
|
|
148
|
+
key: 'resident'
|
|
149
|
+
}, {
|
|
150
|
+
name: 'All Staff Users',
|
|
151
|
+
key: 'staff'
|
|
152
|
+
}, {
|
|
153
|
+
name: 'All Linked Users',
|
|
154
|
+
key: 'family'
|
|
155
|
+
}],
|
|
156
|
+
types: [],
|
|
157
|
+
tags: [],
|
|
158
|
+
combinedList: [],
|
|
159
|
+
seeAll: false
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
renderOption(label, selected, onSelect, key = null, hasUnderline = true) {
|
|
163
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
164
|
+
key: key,
|
|
165
|
+
onPress: onSelect
|
|
166
|
+
}, /*#__PURE__*/React.createElement(FormCardSection, {
|
|
167
|
+
hasUnderline: hasUnderline,
|
|
168
|
+
hasContent: true
|
|
169
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
170
|
+
style: styles.labelContainer
|
|
171
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
172
|
+
style: styles.labelText
|
|
173
|
+
}, label), /*#__PURE__*/React.createElement(Icon, {
|
|
174
|
+
name: "check-circle",
|
|
175
|
+
type: "font-awesome",
|
|
176
|
+
iconStyle: [{
|
|
177
|
+
color: INACTIVE_BUTTON,
|
|
178
|
+
fontSize: 20
|
|
179
|
+
}, selected && {
|
|
180
|
+
color: COLOUR_GREEN
|
|
181
|
+
}]
|
|
182
|
+
}))));
|
|
183
|
+
}
|
|
184
|
+
renderSelectAll() {
|
|
185
|
+
const {
|
|
186
|
+
combinedList,
|
|
187
|
+
loading
|
|
188
|
+
} = this.state;
|
|
189
|
+
const allSelected = !combinedList.find(i => i.Selected);
|
|
190
|
+
if (loading) return null;
|
|
191
|
+
return /*#__PURE__*/React.createElement(FormCard, {
|
|
192
|
+
style: styles.selectAllContainer
|
|
193
|
+
}, this.renderOption('All Users', allSelected, this.onSelectAll, null, false));
|
|
194
|
+
}
|
|
195
|
+
renderSelection() {
|
|
196
|
+
const {
|
|
197
|
+
loading,
|
|
198
|
+
combinedList,
|
|
199
|
+
seeAll
|
|
200
|
+
} = this.state;
|
|
201
|
+
if (loading) return null;
|
|
202
|
+
const selectedText = combinedList.filter(i => i.Selected).map(i => i.Title).join(', ');
|
|
203
|
+
const hasSelected = !_.isEmpty(selectedText);
|
|
204
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
205
|
+
style: styles.selectionContainer
|
|
206
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
207
|
+
style: styles.selectionContainerInner
|
|
208
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
209
|
+
style: styles.selectionTitle
|
|
210
|
+
}, "or select from below"), hasSelected ? /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
211
|
+
onPress: this.onSeeAll
|
|
212
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
213
|
+
style: styles.seeAllButton
|
|
214
|
+
}, seeAll ? 'See less' : 'See all')) : null), hasSelected ? /*#__PURE__*/React.createElement(Text, {
|
|
215
|
+
style: styles.selectionText,
|
|
216
|
+
numberOfLines: seeAll ? null : 1
|
|
217
|
+
}, `Current selection: ${selectedText}`) : null);
|
|
218
|
+
}
|
|
219
|
+
renderTips() {
|
|
220
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
221
|
+
style: styles.tipContainer
|
|
222
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
223
|
+
style: styles.tipText
|
|
224
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
225
|
+
style: {
|
|
226
|
+
fontFamily: 'sf-semibold'
|
|
227
|
+
}
|
|
228
|
+
}, "Tip: "), "Group your users using User Tags from your website Community Manager"));
|
|
229
|
+
}
|
|
230
|
+
renderAvailableAudiences() {
|
|
231
|
+
const {
|
|
232
|
+
loading,
|
|
233
|
+
combinedList
|
|
234
|
+
} = this.state;
|
|
235
|
+
return /*#__PURE__*/React.createElement(ScrollView, {
|
|
236
|
+
style: styles.availableScrollContainer,
|
|
237
|
+
contentContainerStyle: styles.availabelScrollContent
|
|
238
|
+
}, /*#__PURE__*/React.createElement(FormCard, null, combinedList.map((option, index) => {
|
|
239
|
+
const notLast = index < combinedList.length - 1;
|
|
240
|
+
return this.renderOption(option.Title, option.Selected, () => this.onToggleAudienceOption(option), index, notLast);
|
|
241
|
+
})), loading ? /*#__PURE__*/React.createElement(Spinner, null) : null, this.renderTips());
|
|
242
|
+
}
|
|
243
|
+
renderButtons() {
|
|
244
|
+
const {
|
|
245
|
+
loading
|
|
246
|
+
} = this.state;
|
|
247
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
248
|
+
style: styles.doneButtonContainer
|
|
249
|
+
}, /*#__PURE__*/React.createElement(InlineButton, {
|
|
250
|
+
color: loading ? INACTIVE_BUTTON : this.props.colourBrandingMain,
|
|
251
|
+
onPress: this.onDone,
|
|
252
|
+
touchableStyle: styles.doneButton,
|
|
253
|
+
fillTouchable: true,
|
|
254
|
+
large: true,
|
|
255
|
+
disabled: loading
|
|
256
|
+
}, "Done"));
|
|
257
|
+
}
|
|
258
|
+
render() {
|
|
259
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
260
|
+
style: styles.container
|
|
261
|
+
}, /*#__PURE__*/React.createElement(Header, {
|
|
262
|
+
leftIcon: "angle-left",
|
|
263
|
+
onPressLeft: this.onPressBack,
|
|
264
|
+
text: 'Select Audience'
|
|
265
|
+
}), this.renderSelectAll(), this.renderSelection(), this.renderAvailableAudiences(), this.renderButtons());
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
const styles = StyleSheet.create({
|
|
269
|
+
container: {
|
|
270
|
+
flex: 1,
|
|
271
|
+
position: 'relative',
|
|
272
|
+
backgroundColor: BG_GREY
|
|
273
|
+
},
|
|
274
|
+
selectAllContainer: {
|
|
275
|
+
marginTop: 20
|
|
276
|
+
},
|
|
277
|
+
selectionContainer: {
|
|
278
|
+
padding: 20
|
|
279
|
+
},
|
|
280
|
+
selectionContainerInner: {
|
|
281
|
+
flexDirection: 'row',
|
|
282
|
+
justifyContent: 'space-between'
|
|
283
|
+
},
|
|
284
|
+
selectionTitle: {
|
|
285
|
+
fontFamily: 'sf-bold',
|
|
286
|
+
fontSize: 14,
|
|
287
|
+
color: TEXT_DARK
|
|
288
|
+
},
|
|
289
|
+
selectionText: {
|
|
290
|
+
fontFamily: 'sf-bold',
|
|
291
|
+
fontSize: 14,
|
|
292
|
+
color: TEXT_DARK,
|
|
293
|
+
marginTop: 10
|
|
294
|
+
},
|
|
295
|
+
seeAllButton: {
|
|
296
|
+
marginLeft: 10,
|
|
297
|
+
fontFamily: 'sf-bold',
|
|
298
|
+
fontSize: 14,
|
|
299
|
+
color: TEXT_LIGHT
|
|
300
|
+
},
|
|
301
|
+
availableScrollContainer: {
|
|
302
|
+
flex: 1
|
|
303
|
+
},
|
|
304
|
+
availabelScrollContent: {
|
|
305
|
+
flexGrow: 1,
|
|
306
|
+
justifyContent: 'space-between',
|
|
307
|
+
flexDirection: 'column'
|
|
308
|
+
},
|
|
309
|
+
tipContainer: {
|
|
310
|
+
padding: 10
|
|
311
|
+
},
|
|
312
|
+
tipText: {
|
|
313
|
+
fontSize: 14,
|
|
314
|
+
fontFamily: 'sf-regular',
|
|
315
|
+
color: TEXT_DARK
|
|
316
|
+
},
|
|
317
|
+
labelContainer: {
|
|
318
|
+
flexDirection: 'row',
|
|
319
|
+
justifyContent: 'space-between'
|
|
320
|
+
},
|
|
321
|
+
labelText: {
|
|
322
|
+
fontFamily: 'sf-medium',
|
|
323
|
+
fontSize: 16,
|
|
324
|
+
color: TEXT_DARK
|
|
325
|
+
},
|
|
326
|
+
description: {
|
|
327
|
+
marginTop: 5,
|
|
328
|
+
fontSize: 14,
|
|
329
|
+
fontFamily: 'sf-regular',
|
|
330
|
+
color: TEXT_DARK
|
|
331
|
+
},
|
|
332
|
+
doneButtonContainer: {
|
|
333
|
+
backgroundColor: '#fff',
|
|
334
|
+
marginTop: 1,
|
|
335
|
+
flexDirection: 'row',
|
|
336
|
+
paddingTop: 10,
|
|
337
|
+
paddingBottom: 20
|
|
338
|
+
},
|
|
339
|
+
doneButton: {
|
|
340
|
+
flex: 1,
|
|
341
|
+
marginHorizontal: 6
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
const mapStateToProps = state => {
|
|
345
|
+
return {
|
|
346
|
+
colourBrandingMain: getMainBrandingColourFromState(state)
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
export default connect(mapStateToProps, {})(AudienceSelectorPage);
|
|
350
|
+
//# sourceMappingURL=AudienceSelectorPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Component","connect","_","TouchableOpacity","View","ScrollView","Text","StyleSheet","Icon","Services","FormCard","FormCardSection","InlineButton","Header","Spinner","TEXT_DARK","COLOUR_GREEN","BG_GREY","INACTIVE_BUTTON","TEXT_LIGHT","getMainBrandingColourFromState","typeActions","profileActions","AudienceSelectorPage","constructor","props","_defineProperty","setState","loading","getUserTypes","getUserTags","combinedList","getAvailableAudienceTags","error","console","data","site","forEach","e","name","category","toUpperCase","substring","displayName","key","typeName","types","getUserTagsBySite","Title","Id","tags","categories","state","audienceTypeSelection","categoryTags","map","c","AudienceType","AudienceTypeSelection","Selected","some","i","userTypeTags","t","userTagTags","navigation","goBack","newList","seeAll","option","selected","find","onChange","filter","length","renderOption","label","onSelect","hasUnderline","createElement","onPress","hasContent","style","styles","labelContainer","labelText","type","iconStyle","color","fontSize","renderSelectAll","allSelected","selectAllContainer","onSelectAll","renderSelection","selectedText","join","hasSelected","isEmpty","selectionContainer","selectionContainerInner","selectionTitle","onSeeAll","seeAllButton","selectionText","numberOfLines","renderTips","tipContainer","tipText","fontFamily","renderAvailableAudiences","availableScrollContainer","contentContainerStyle","availabelScrollContent","index","notLast","onToggleAudienceOption","renderButtons","doneButtonContainer","colourBrandingMain","onDone","touchableStyle","doneButton","fillTouchable","large","disabled","render","container","leftIcon","onPressLeft","onPressBack","text","create","flex","position","backgroundColor","marginTop","padding","flexDirection","justifyContent","marginLeft","flexGrow","description","paddingTop","paddingBottom","marginHorizontal","mapStateToProps"],"sources":["AudienceSelectorPage.js"],"sourcesContent":["import React, { Component } from 'react';\nimport { connect } from 'react-redux';\nimport _ from 'lodash';\nimport { TouchableOpacity, View, ScrollView, Text, StyleSheet } from 'react-native';\nimport { Icon } from 'react-native-elements';\nimport { Services } from '../config';\nimport { FormCard } from './FormCard';\nimport { FormCardSection } from './FormCardSection';\nimport { InlineButton } from './InlineButton';\nimport Header from './Header';\nimport { Spinner } from './Spinner';\nimport { TEXT_DARK, COLOUR_GREEN, BG_GREY, INACTIVE_BUTTON, TEXT_LIGHT, getMainBrandingColourFromState } from '../colours';\nimport { typeActions, profileActions } from '../apis';\n\nclass AudienceSelectorPage extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n loading: false,\n categories: [\n {\n name: 'All Primary Users',\n key: 'resident',\n },\n {\n name: 'All Staff Users',\n key: 'staff',\n },\n {\n name: 'All Linked Users',\n key: 'family',\n },\n ],\n types: [],\n tags: [],\n combinedList: [],\n seeAll: false,\n };\n }\n\n componentDidMount = async () => {\n try {\n this.setState({ loading: true });\n await this.getUserTypes();\n await this.getUserTags();\n this.setState({ loading: false, combinedList: this.getAvailableAudienceTags() });\n } catch (error) {\n console.error('loading types error', error);\n this.setState({ loading: false });\n }\n };\n\n getUserTypes = async () => {\n const { data } = await typeActions.getUserTypes(this.props.site);\n data.forEach(e => {\n e.name = e.category ? `(${e.category[0].toUpperCase() + e.category.substring(1)}) ${e.displayName}` : e.displayName;\n e.key = e.typeName;\n });\n // console.log('getUserTypes', data);\n this.setState({ types: data });\n };\n\n getUserTags = async () => {\n const { data } = await profileActions.getUserTagsBySite(this.props.site);\n data.forEach(e => {\n e.name = e.Title;\n e.key = e.Id;\n });\n // console.log('getUserTags', data);\n this.setState({ tags: data });\n };\n\n getAvailableAudienceTags = () => {\n const { categories, types, tags } = this.state;\n const { audienceTypeSelection } = this.props;\n\n const categoryTags = categories.map(c => {\n const Id = `category_${c.key}`;\n return {\n AudienceType: 'Category',\n AudienceTypeSelection: c.key,\n Id,\n Title: c.name,\n Selected: audienceTypeSelection.some(i => i.Id === Id),\n };\n });\n const userTypeTags = types.map(t => {\n const Id = `userType_${t.typeName}`;\n return {\n AudienceType: 'UserType',\n AudienceTypeSelection: t.typeName,\n Id,\n Title: `User Type: ${t.displayName}`,\n Selected: audienceTypeSelection.some(i => i.Id === Id),\n };\n });\n const userTagTags = tags.map(t => {\n const Id = `userTag_${t.Id}`;\n return {\n AudienceType: 'UserTags',\n AudienceTypeSelection: t.Id,\n Id,\n Title: `User Tag: ${t.Title}`,\n Selected: audienceTypeSelection.some(i => i.Id === Id),\n };\n });\n return [...categoryTags, ...userTypeTags, ...userTagTags];\n };\n\n onPressBack = () => {\n Services.navigation.goBack();\n };\n\n onSelectAll = () => {\n const newList = [...this.state.combinedList];\n newList.forEach(i => (i.Selected = false));\n this.setState({ combinedList: newList });\n };\n\n onSeeAll = () => {\n this.setState({ seeAll: !this.state.seeAll });\n };\n\n onToggleAudienceOption = option => {\n const newList = [...this.state.combinedList];\n const selected = newList.find(i => i.Id === option.Id);\n if (selected) {\n selected.Selected = !selected.Selected;\n this.setState({ combinedList: newList });\n }\n };\n\n onDone = () => {\n if (this.props.onChange) {\n const { combinedList } = this.state;\n const selected = combinedList.filter(i => i.Selected);\n if (selected && selected.length > 0) {\n this.props.onChange('Custom', selected);\n } else {\n this.props.onChange(null, null);\n }\n }\n Services.navigation.goBack();\n };\n\n renderOption(label, selected, onSelect, key = null, hasUnderline = true) {\n return (\n <TouchableOpacity key={key} onPress={onSelect}>\n <FormCardSection hasUnderline={hasUnderline} hasContent>\n <View style={styles.labelContainer}>\n <Text style={styles.labelText}>{label}</Text>\n <Icon\n name=\"check-circle\"\n type=\"font-awesome\"\n iconStyle={[{ color: INACTIVE_BUTTON, fontSize: 20 }, selected && { color: COLOUR_GREEN }]}\n />\n </View>\n </FormCardSection>\n </TouchableOpacity>\n );\n }\n\n renderSelectAll() {\n const { combinedList, loading } = this.state;\n const allSelected = !combinedList.find(i => i.Selected);\n if (loading) return null;\n\n return (\n <FormCard style={styles.selectAllContainer}>{this.renderOption('All Users', allSelected, this.onSelectAll, null, false)}</FormCard>\n );\n }\n\n renderSelection() {\n const { loading, combinedList, seeAll } = this.state;\n if (loading) return null;\n\n const selectedText = combinedList\n .filter(i => i.Selected)\n .map(i => i.Title)\n .join(', ');\n const hasSelected = !_.isEmpty(selectedText);\n\n return (\n <View style={styles.selectionContainer}>\n <View style={styles.selectionContainerInner}>\n <Text style={styles.selectionTitle}>or select from below</Text>\n {hasSelected ? (\n <TouchableOpacity onPress={this.onSeeAll}>\n <Text style={styles.seeAllButton}>{seeAll ? 'See less' : 'See all'}</Text>\n </TouchableOpacity>\n ) : null}\n </View>\n {hasSelected ? (\n <Text style={styles.selectionText} numberOfLines={seeAll ? null : 1}>{`Current selection: ${selectedText}`}</Text>\n ) : null}\n </View>\n );\n }\n\n renderTips() {\n return (\n <View style={styles.tipContainer}>\n <Text style={styles.tipText}>\n <Text style={{ fontFamily: 'sf-semibold' }}>Tip: </Text>\n Group your users using User Tags from your website Community Manager\n </Text>\n </View>\n );\n }\n\n renderAvailableAudiences() {\n const { loading, combinedList } = this.state;\n\n return (\n <ScrollView style={styles.availableScrollContainer} contentContainerStyle={styles.availabelScrollContent}>\n <FormCard>\n {combinedList.map((option, index) => {\n const notLast = index < combinedList.length - 1;\n return this.renderOption(option.Title, option.Selected, () => this.onToggleAudienceOption(option), index, notLast);\n })}\n </FormCard>\n {loading ? <Spinner /> : null}\n {this.renderTips()}\n </ScrollView>\n );\n }\n\n renderButtons() {\n const { loading } = this.state;\n\n return (\n <View style={styles.doneButtonContainer}>\n <InlineButton\n color={loading ? INACTIVE_BUTTON : this.props.colourBrandingMain}\n onPress={this.onDone}\n touchableStyle={styles.doneButton}\n fillTouchable\n large\n disabled={loading}\n >\n Done\n </InlineButton>\n </View>\n );\n }\n\n render() {\n return (\n <View style={styles.container}>\n <Header leftIcon=\"angle-left\" onPressLeft={this.onPressBack} text={'Select Audience'} />\n {this.renderSelectAll()}\n {this.renderSelection()}\n {this.renderAvailableAudiences()}\n {this.renderButtons()}\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n position: 'relative',\n backgroundColor: BG_GREY,\n },\n selectAllContainer: {\n marginTop: 20,\n },\n selectionContainer: {\n padding: 20,\n },\n selectionContainerInner: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n selectionTitle: {\n fontFamily: 'sf-bold',\n fontSize: 14,\n color: TEXT_DARK,\n },\n selectionText: {\n fontFamily: 'sf-bold',\n fontSize: 14,\n color: TEXT_DARK,\n marginTop: 10,\n },\n seeAllButton: {\n marginLeft: 10,\n fontFamily: 'sf-bold',\n fontSize: 14,\n color: TEXT_LIGHT,\n },\n availableScrollContainer: {\n flex: 1,\n },\n availabelScrollContent: {\n flexGrow: 1,\n justifyContent: 'space-between',\n flexDirection: 'column',\n },\n tipContainer: {\n padding: 10,\n },\n tipText: {\n fontSize: 14,\n fontFamily: 'sf-regular',\n color: TEXT_DARK,\n },\n labelContainer: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n labelText: {\n fontFamily: 'sf-medium',\n fontSize: 16,\n color: TEXT_DARK,\n },\n description: {\n marginTop: 5,\n fontSize: 14,\n fontFamily: 'sf-regular',\n color: TEXT_DARK,\n },\n doneButtonContainer: {\n backgroundColor: '#fff',\n marginTop: 1,\n flexDirection: 'row',\n paddingTop: 10,\n paddingBottom: 20,\n },\n doneButton: {\n flex: 1,\n marginHorizontal: 6,\n },\n});\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nexport default connect(mapStateToProps, {})(AudienceSelectorPage);\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,OAAO,QAAQ,aAAa;AACrC,OAAOC,CAAC,MAAM,QAAQ;AACtB,SAASC,gBAAgB,EAAEC,IAAI,EAAEC,UAAU,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AACnF,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,QAAQ,QAAQ,WAAW;AACpC,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,SAAS,EAAEC,YAAY,EAAEC,OAAO,EAAEC,eAAe,EAAEC,UAAU,EAAEC,8BAA8B,QAAQ,YAAY;AAC1H,SAASC,WAAW,EAAEC,cAAc,QAAQ,SAAS;AAErD,MAAMC,oBAAoB,SAASvB,SAAS,CAAC;EAC3CwB,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,4BAyBK,YAAY;MAC9B,IAAI;QACF,IAAI,CAACC,QAAQ,CAAC;UAAEC,OAAO,EAAE;QAAK,CAAC,CAAC;QAChC,MAAM,IAAI,CAACC,YAAY,CAAC,CAAC;QACzB,MAAM,IAAI,CAACC,WAAW,CAAC,CAAC;QACxB,IAAI,CAACH,QAAQ,CAAC;UAAEC,OAAO,EAAE,KAAK;UAAEG,YAAY,EAAE,IAAI,CAACC,wBAAwB,CAAC;QAAE,CAAC,CAAC;MAClF,CAAC,CAAC,OAAOC,KAAK,EAAE;QACdC,OAAO,CAACD,KAAK,CAAC,qBAAqB,EAAEA,KAAK,CAAC;QAC3C,IAAI,CAACN,QAAQ,CAAC;UAAEC,OAAO,EAA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EAAE;IACZoB,UAAU,EAAE,YAAY;IACxBrB,KAAK,EAAEzE;EACT,CAAC;EACDuG,mBAAmB,EAAE;IACnBiB,eAAe,EAAE,MAAM;IACvBC,SAAS,EAAE,CAAC;IACZE,aAAa,EAAE,KAAK;IACpBK,UAAU,EAAE,EAAE;IACdC,aAAa,EAAE;EACjB,CAAC;EACDtB,UAAU,EAAE;IACVW,IAAI,EAAE,CAAC;IACPY,gBAAgB,EAAE;EACpB;AACF,CAAC,CAAC;AAEF,MAAMC,eAAe,GAAG9F,KAAK,IAAI;EAC/B,OAAO;IACLmE,kBAAkB,EAAEnG,8BAA8B,CAACgC,KAAK;EAC1D,CAAC;AACH,CAAC;AAED,eAAenD,OAAO,CAACiJ,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC3H,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
import React, { Component } from 'react';
|
|
5
|
+
import { View, Image, Animated, StyleSheet } from 'react-native';
|
|
6
|
+
import { connect } from 'react-redux';
|
|
7
|
+
import moment from 'moment';
|
|
8
|
+
import { findLandmarkRange, getScaledOffset, get300, detectFaces } from '../helper';
|
|
9
|
+
import { saveImagePosition } from '../actions';
|
|
10
|
+
class AutoOffsetImage extends Component {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
_defineProperty(this, "onLoad", event => {
|
|
14
|
+
if (event.nativeEvent.source.uri !== this.props.uri) {
|
|
15
|
+
this.setState({
|
|
16
|
+
imageSource: this.props.uri
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
// if (event.nativeEvent.source.uri === this.props.uri && !this.state.imageLoaded) {
|
|
20
|
+
// //unblur
|
|
21
|
+
// this.setState({
|
|
22
|
+
// imageLoaded: true,
|
|
23
|
+
// });
|
|
24
|
+
// Animated.sequence([
|
|
25
|
+
// Animated.delay(200),
|
|
26
|
+
// Animated.timing(this.state.blurRadius, {
|
|
27
|
+
// toValue: 0,
|
|
28
|
+
// duration: 500,
|
|
29
|
+
// useNativeDriver: false,
|
|
30
|
+
// }),
|
|
31
|
+
// ]).start();
|
|
32
|
+
// }
|
|
33
|
+
});
|
|
34
|
+
_defineProperty(this, "positionImage", async () => {
|
|
35
|
+
if (this.state.disabled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const startTime = moment().valueOf();
|
|
40
|
+
let cachedValues;
|
|
41
|
+
// check local cache
|
|
42
|
+
if (this.props.imagePositions && this.props.imagePositions[this.props.uri]) {
|
|
43
|
+
cachedValues = this.props.imagePositions[this.props.uri];
|
|
44
|
+
}
|
|
45
|
+
// check remote cache
|
|
46
|
+
if (!cachedValues) {
|
|
47
|
+
try {
|
|
48
|
+
const response = await stringActions.getString('plussSpace', `imagefaces_${encodeURIComponent(this.props.uri)}`);
|
|
49
|
+
cachedValues = response.data;
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.log('errored from cache');
|
|
52
|
+
}
|
|
53
|
+
// run face detection locally
|
|
54
|
+
if (!cachedValues || !cachedValues.faces || !cachedValues.image || _.isEmpty(cachedValues.faces) && moment().add(-1, 'w').valueOf() > moment(cachedValues.timestamp).valueOf()) {
|
|
55
|
+
cachedValues = await detectFaces(this.props.uri);
|
|
56
|
+
}
|
|
57
|
+
this.props.saveImagePosition(this.props.uri, cachedValues);
|
|
58
|
+
}
|
|
59
|
+
const image = await findLandmarkRange(this.props.uri, {
|
|
60
|
+
targetWidth: this.props.width,
|
|
61
|
+
targetHeight: this.props.height,
|
|
62
|
+
cachedValues
|
|
63
|
+
});
|
|
64
|
+
const scaledOffset = getScaledOffset(image.width, image.height, this.props.width, this.props.height);
|
|
65
|
+
const {
|
|
66
|
+
start: landmarkStart,
|
|
67
|
+
end: landmarkEnd
|
|
68
|
+
} = image;
|
|
69
|
+
const {
|
|
70
|
+
bounds: imageBounds,
|
|
71
|
+
offset,
|
|
72
|
+
width,
|
|
73
|
+
height
|
|
74
|
+
} = scaledOffset;
|
|
75
|
+
if (landmarkStart.y < imageBounds.start.y) {
|
|
76
|
+
// move up
|
|
77
|
+
offset.y = -Math.max(landmarkStart.y - this.props.height * this.paddingFactor, 0); // move top to 5% above start of landmark
|
|
78
|
+
} else if (landmarkEnd.y > imageBounds.end.y) {
|
|
79
|
+
// move down
|
|
80
|
+
offset.y = -Math.max(landmarkEnd.y + this.props.height * this.paddingFactor - this.props.height, 0); // move bottom to 5% below end of landmark
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (landmarkStart.x < imageBounds.start.x) {
|
|
84
|
+
// move right
|
|
85
|
+
offset.x = -Math.max(landmarkStart.x - this.props.width * this.paddingFactor, 0); // move left edge to 5% left of start of landmark
|
|
86
|
+
} else if (landmarkEnd.x > imageBounds.end.x) {
|
|
87
|
+
// move left
|
|
88
|
+
offset.x = -Math.max(landmarkEnd.x + this.props.width * this.paddingFactor - this.props.width, 0); // move right edge to 5% left of end of landmark
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
this.setState({
|
|
92
|
+
imageStyle: {
|
|
93
|
+
width,
|
|
94
|
+
height,
|
|
95
|
+
top: offset.y,
|
|
96
|
+
left: offset.x
|
|
97
|
+
},
|
|
98
|
+
imageSource: this.props.uri
|
|
99
|
+
});
|
|
100
|
+
const endTime = moment().valueOf();
|
|
101
|
+
if (endTime - startTime < 500) {
|
|
102
|
+
Animated.timing(this.state.blurRadius, {
|
|
103
|
+
toValue: 0,
|
|
104
|
+
duration: 0,
|
|
105
|
+
useNativeDriver: false
|
|
106
|
+
}).start();
|
|
107
|
+
}
|
|
108
|
+
} catch (e) {
|
|
109
|
+
this.setState({
|
|
110
|
+
imageSource: this.props.uri
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
this.paddingFactor = this.props.paddingFactor || 0.1;
|
|
115
|
+
this.state = {
|
|
116
|
+
imageStyle: {
|
|
117
|
+
width: this.props.width,
|
|
118
|
+
height: this.props.height
|
|
119
|
+
},
|
|
120
|
+
blurRadius: new Animated.Value(100),
|
|
121
|
+
imageSource: get300(this.props.uri),
|
|
122
|
+
disabled: true
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
componentDidMount() {
|
|
126
|
+
this.positionImage();
|
|
127
|
+
}
|
|
128
|
+
componentDidUpdate(prevProps) {
|
|
129
|
+
if (prevProps.uri !== this.props.uri || prevProps.height !== this.props.height || prevProps.width !== this.props.width) {
|
|
130
|
+
this.positionImage();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
render() {
|
|
134
|
+
if (this.state.disabled) {
|
|
135
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
136
|
+
style: [styles.container, {
|
|
137
|
+
width: this.props.width,
|
|
138
|
+
height: this.props.height
|
|
139
|
+
}, this.props.style]
|
|
140
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
141
|
+
source: {
|
|
142
|
+
uri: this.state.imageSource
|
|
143
|
+
},
|
|
144
|
+
style: [styles.image, this.state.imageStyle],
|
|
145
|
+
onLoad: this.onLoad
|
|
146
|
+
}), this.props.children);
|
|
147
|
+
}
|
|
148
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
149
|
+
style: [styles.container, {
|
|
150
|
+
width: this.props.width,
|
|
151
|
+
height: this.props.height
|
|
152
|
+
}, this.props.style]
|
|
153
|
+
}, /*#__PURE__*/React.createElement(Animated.Image, {
|
|
154
|
+
blurRadius: this.state.blurRadius,
|
|
155
|
+
source: {
|
|
156
|
+
uri: this.state.imageSource
|
|
157
|
+
},
|
|
158
|
+
style: [styles.image, this.state.imageStyle],
|
|
159
|
+
onLoad: this.onLoad
|
|
160
|
+
}), this.props.children);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const styles = StyleSheet.create({
|
|
164
|
+
container: {
|
|
165
|
+
overflow: 'hidden'
|
|
166
|
+
},
|
|
167
|
+
image: {
|
|
168
|
+
position: 'absolute',
|
|
169
|
+
top: 0,
|
|
170
|
+
left: 0,
|
|
171
|
+
resizeMode: 'cover'
|
|
172
|
+
},
|
|
173
|
+
staticImage: {
|
|
174
|
+
resizeMode: 'cover'
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
const mapStateToProps = state => {
|
|
178
|
+
return {
|
|
179
|
+
imagePositions: state.media.positions
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
const autoOffsetImage = connect(mapStateToProps, {
|
|
183
|
+
saveImagePosition
|
|
184
|
+
})(AutoOffsetImage);
|
|
185
|
+
export { autoOffsetImage as AutoOffsetImage };
|
|
186
|
+
//# sourceMappingURL=AutoOffsetImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Component","View","Image","Animated","StyleSheet","connect","moment","findLandmarkRange","getScaledOffset","get300","detectFaces","saveImagePosition","AutoOffsetImage","constructor","props","_defineProperty","event","nativeEvent","source","uri","setState","imageSource","state","disabled","startTime","valueOf","cachedValues","imagePositions","response","stringActions","getString","encodeURIComponent","data","e","console","log","faces","image","_","isEmpty","add","timestamp","targetWidth","width","targetHeight","height","scaledOffset","start","landmarkStart","end","landmarkEnd","bounds","imageBounds","offset","y","Math","max","paddingFactor","x","imageStyle","top","left","endTime","timing","blurRadius","toValue","duration","useNativeDriver","Value","componentDidMount","positionImage","componentDidUpdate","prevProps","render","createElement","style","styles","container","onLoad","children","create","overflow","position","resizeMode","staticImage","mapStateToProps","media","positions","autoOffsetImage"],"sources":["AutoOffsetImage.js"],"sourcesContent":["import React, { Component } from 'react';\nimport { View, Image, Animated, StyleSheet } from 'react-native';\nimport { connect } from 'react-redux';\nimport moment from 'moment';\nimport { findLandmarkRange, getScaledOffset, get300, detectFaces } from '../helper';\nimport { saveImagePosition } from '../actions';\n\nclass AutoOffsetImage extends Component {\n constructor(props) {\n super(props);\n\n this.paddingFactor = this.props.paddingFactor || 0.1;\n\n this.state = {\n imageStyle: {\n width: this.props.width,\n height: this.props.height,\n },\n blurRadius: new Animated.Value(100),\n imageSource: get300(this.props.uri),\n disabled: true,\n };\n }\n\n componentDidMount() {\n this.positionImage();\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.uri !== this.props.uri || prevProps.height !== this.props.height || prevProps.width !== this.props.width) {\n this.positionImage();\n }\n }\n\n onLoad = event => {\n if (event.nativeEvent.source.uri !== this.props.uri) {\n this.setState({\n imageSource: this.props.uri,\n });\n }\n // if (event.nativeEvent.source.uri === this.props.uri && !this.state.imageLoaded) {\n // //unblur\n // this.setState({\n // imageLoaded: true,\n // });\n // Animated.sequence([\n // Animated.delay(200),\n // Animated.timing(this.state.blurRadius, {\n // toValue: 0,\n // duration: 500,\n // useNativeDriver: false,\n // }),\n // ]).start();\n // }\n };\n\n positionImage = async () => {\n if (this.state.disabled) {\n return;\n }\n try {\n const startTime = moment().valueOf();\n\n let cachedValues;\n // check local cache\n if (this.props.imagePositions && this.props.imagePositions[this.props.uri]) {\n cachedValues = this.props.imagePositions[this.props.uri];\n }\n // check remote cache\n if (!cachedValues) {\n try {\n const response = await stringActions.getString('plussSpace', `imagefaces_${encodeURIComponent(this.props.uri)}`);\n cachedValues = response.data;\n } catch (e) {\n console.log('errored from cache');\n }\n // run face detection locally\n if (\n !cachedValues ||\n !cachedValues.faces ||\n !cachedValues.image ||\n (_.isEmpty(cachedValues.faces) &&\n moment()\n .add(-1, 'w')\n .valueOf() > moment(cachedValues.timestamp).valueOf())\n ) {\n cachedValues = await detectFaces(this.props.uri);\n }\n this.props.saveImagePosition(this.props.uri, cachedValues);\n }\n\n const image = await findLandmarkRange(this.props.uri, {\n targetWidth: this.props.width,\n targetHeight: this.props.height,\n cachedValues,\n });\n const scaledOffset = getScaledOffset(image.width, image.height, this.props.width, this.props.height);\n\n const { start: landmarkStart, end: landmarkEnd } = image;\n const { bounds: imageBounds, offset, width, height } = scaledOffset;\n\n if (landmarkStart.y < imageBounds.start.y) {\n // move up\n offset.y = -Math.max(landmarkStart.y - this.props.height * this.paddingFactor, 0); // move top to 5% above start of landmark\n } else if (landmarkEnd.y > imageBounds.end.y) {\n // move down\n offset.y = -Math.max(landmarkEnd.y + this.props.height * this.paddingFactor - this.props.height, 0); // move bottom to 5% below end of landmark\n }\n\n if (landmarkStart.x < imageBounds.start.x) {\n // move right\n offset.x = -Math.max(landmarkStart.x - this.props.width * this.paddingFactor, 0); // move left edge to 5% left of start of landmark\n } else if (landmarkEnd.x > imageBounds.end.x) {\n // move left\n offset.x = -Math.max(landmarkEnd.x + this.props.width * this.paddingFactor - this.props.width, 0); // move right edge to 5% left of end of landmark\n }\n\n this.setState({\n imageStyle: {\n width,\n height,\n top: offset.y,\n left: offset.x,\n },\n imageSource: this.props.uri,\n });\n\n const endTime = moment().valueOf();\n if (endTime - startTime < 500) {\n Animated.timing(this.state.blurRadius, {\n toValue: 0,\n duration: 0,\n useNativeDriver: false,\n }).start();\n }\n } catch (e) {\n this.setState({\n imageSource: this.props.uri,\n });\n }\n };\n\n render() {\n if (this.state.disabled) {\n return (\n <View\n style={[\n styles.container,\n {\n width: this.props.width,\n height: this.props.height,\n },\n this.props.style,\n ]}\n >\n <Image source={{ uri: this.state.imageSource }} style={[styles.image, this.state.imageStyle]} onLoad={this.onLoad} />\n {this.props.children}\n </View>\n );\n }\n return (\n <View\n style={[\n styles.container,\n {\n width: this.props.width,\n height: this.props.height,\n },\n this.props.style,\n ]}\n >\n <Animated.Image\n blurRadius={this.state.blurRadius}\n source={{ uri: this.state.imageSource }}\n style={[styles.image, this.state.imageStyle]}\n onLoad={this.onLoad}\n />\n {this.props.children}\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n overflow: 'hidden',\n },\n image: {\n position: 'absolute',\n top: 0,\n left: 0,\n resizeMode: 'cover',\n },\n staticImage: {\n resizeMode: 'cover',\n },\n});\n\nconst mapStateToProps = state => {\n return {\n imagePositions: state.media.positions,\n };\n};\n\nconst autoOffsetImage = connect(mapStateToProps, { saveImagePosition })(AutoOffsetImage);\nexport { autoOffsetImage as AutoOffsetImage };\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,IAAI,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAChE,SAASC,OAAO,QAAQ,aAAa;AACrC,OAAOC,MAAM,MAAM,QAAQ;AAC3B,SAASC,iBAAiB,EAAEC,eAAe,EAAEC,MAAM,EAAEC,WAAW,QAAQ,WAAW;AACnF,SAASC,iBAAiB,QAAQ,YAAY;AAE9C,MAAMC,eAAe,SAASZ,SAAS,CAAC;EACtCa,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,iBAyBNC,KAAK,IAAI;MAChB,IAAIA,KAAK,CAACC,WAAW,CAACC,MAAM,CAACC,GAAG,KAAK,IAAI,CAACL,KAAK,CAACK,GAAG,EAAE;QACnD,IAAI,CAACC,QAAQ,CAAC;UACZC,WAAW,EAAE,IAAI,CAACP,KAAK,CAACK;QAC1B,CAAC,CAAC;MACJ;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;IACF,CAAC;IAAAJ,eAAA,wBAEe,YAAY;MAC1B,IAAI,IAAI,CAACO,KAAK,CAACC,QAAQ,EAAE;QACvB;MACF;MACA,IAAI;QACF,MAAMC,SAAS,GAAGlB,MAAM,CAAC,CAAC,CAACmB,OAAO,CA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TouchableOpacity } from 'react-native';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import stylez from '../styles';
|
|
5
|
+
import { Pl60Icon } from '../fonts';
|
|
6
|
+
import { getMainBrandingColourFromState } from '../colours';
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
Props-
|
|
10
|
+
onPress - onPress action
|
|
11
|
+
diameter - size of button
|
|
12
|
+
color - default will be aveoMain
|
|
13
|
+
style - custom style for container
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
class BackButton extends PureComponent {
|
|
17
|
+
render() {
|
|
18
|
+
const size = this.props.diameter || 32;
|
|
19
|
+
const radius = size / 2;
|
|
20
|
+
if (this.props.noClick) {
|
|
21
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
22
|
+
style: [stylez.backButton, {
|
|
23
|
+
backgroundColor: this.props.colourBrandingMain,
|
|
24
|
+
height: size,
|
|
25
|
+
width: size,
|
|
26
|
+
borderRadius: radius
|
|
27
|
+
}, this.props.color && {
|
|
28
|
+
backgroundColor: this.props.color
|
|
29
|
+
}, this.props.style]
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Pl60Icon, {
|
|
31
|
+
name: this.props.flipped ? 'chevron_right' : 'chevron_left',
|
|
32
|
+
style: [stylez.backButtonIcon, this.props.iconStyle]
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
36
|
+
style: [stylez.backButton, {
|
|
37
|
+
backgroundColor: this.props.colourBrandingMain,
|
|
38
|
+
height: size,
|
|
39
|
+
width: size,
|
|
40
|
+
borderRadius: radius
|
|
41
|
+
}, this.props.color && {
|
|
42
|
+
backgroundColor: this.props.color
|
|
43
|
+
}, this.props.style],
|
|
44
|
+
onPress: this.props.onPress
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Pl60Icon, {
|
|
46
|
+
name: this.props.flipped ? 'chevron_right' : 'chevron_left',
|
|
47
|
+
style: [stylez.backButtonIcon, this.props.iconStyle]
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const mapStateToProps = state => {
|
|
52
|
+
return {
|
|
53
|
+
colourBrandingMain: getMainBrandingColourFromState(state)
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const backButton = connect(mapStateToProps, {})(BackButton);
|
|
57
|
+
export { backButton as BackButton };
|
|
58
|
+
//# sourceMappingURL=BackButton.js.map
|