@plusscommunities/pluss-core-app 2.0.0 → 3.0.1
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/MediaActions.js +10 -1
- package/dist/module/actions/MediaActions.js.map +1 -1
- package/dist/module/actions/types.js +1 -0
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/index.js +1 -0
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/stringActions.js +30 -0
- package/dist/module/apis/stringActions.js.map +1 -0
- package/dist/module/components/AutoOffsetImage.js +202 -0
- package/dist/module/components/AutoOffsetImage.js.map +1 -0
- package/dist/module/components/CommentSection.js +7 -5
- package/dist/module/components/CommentSection.js.map +1 -1
- package/dist/module/components/GenericInput.js +1 -0
- package/dist/module/components/GenericInput.js.map +1 -1
- package/dist/module/components/ImagePopup.js +4 -2
- package/dist/module/components/ImagePopup.js.map +1 -1
- package/dist/module/components/MediaPlayer.js +5 -1
- package/dist/module/components/MediaPlayer.js.map +1 -1
- package/dist/module/components/PDFPopup.js +19 -4
- package/dist/module/components/PDFPopup.js.map +1 -1
- package/dist/module/components/PlussChat.js +88 -15
- package/dist/module/components/PlussChat.js.map +1 -1
- package/dist/module/components/PlussChatMessage.js +84 -4
- package/dist/module/components/PlussChatMessage.js.map +1 -1
- package/dist/module/components/TextStyle.js +5 -0
- package/dist/module/components/TextStyle.js.map +1 -1
- package/dist/module/components/index.js +1 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/helper.js +27 -2
- package/dist/module/helper.js.map +1 -1
- package/dist/module/js/images/detectFaces.js +28 -0
- package/dist/module/js/images/detectFaces.js.map +1 -0
- package/dist/module/js/images/findLandmarkRange.js +113 -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 +35 -0
- package/dist/module/js/site/getSiteLevelFromState.js.map +1 -0
- package/dist/module/js/site/isTVEnabled.js +12 -0
- package/dist/module/js/site/isTVEnabled.js.map +1 -0
- package/package.json +18 -17
- package/src/actions/MediaActions.js +8 -1
- package/src/actions/types.js +1 -0
- package/src/apis/index.js +1 -0
- package/src/apis/stringActions.js +28 -0
- package/src/components/AutoOffsetImage.js +206 -0
- package/src/components/CommentSection.js +1 -1
- package/src/components/GenericInput.js +1 -0
- package/src/components/ImagePopup.js +2 -2
- package/src/components/MediaPlayer.js +3 -0
- package/src/components/PDFPopup.js +11 -2
- package/src/components/PlussChat.js +109 -43
- package/src/components/PlussChatMessage.js +88 -4
- package/src/components/TextStyle.js +5 -0
- package/src/components/index.js +1 -0
- package/src/helper.js +29 -0
- package/src/js/images/detectFaces.js +30 -0
- package/src/js/images/findLandmarkRange.js +105 -0
- package/src/js/images/getScaledOffset.js +83 -0
- package/src/js/site/getSiteLevelFromState.js +30 -0
- package/src/js/site/isTVEnabled.js +15 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMAGE_LIBRARY_LOADED, STOCK_IMAGES_LOADED, IMAGE_FOLDER_UPDATED } from './types';
|
|
1
|
+
import { IMAGE_LIBRARY_LOADED, STOCK_IMAGES_LOADED, IMAGE_FOLDER_UPDATED, SAVE_IMAGE_POSITION } from './types';
|
|
2
2
|
export const stockImagesLoaded = images => {
|
|
3
3
|
return {
|
|
4
4
|
type: STOCK_IMAGES_LOADED,
|
|
@@ -17,4 +17,13 @@ export const imageFolderUpdated = folder => {
|
|
|
17
17
|
payload: folder
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
+
export const saveImagePosition = (uri, positions) => {
|
|
21
|
+
return {
|
|
22
|
+
type: SAVE_IMAGE_POSITION,
|
|
23
|
+
payload: {
|
|
24
|
+
uri,
|
|
25
|
+
positions
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
20
29
|
//# sourceMappingURL=MediaActions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MediaActions.js"],"names":["IMAGE_LIBRARY_LOADED","STOCK_IMAGES_LOADED","IMAGE_FOLDER_UPDATED","stockImagesLoaded","images","type","payload","imageLibraryLoaded","library","imageFolderUpdated","folder"],"mappings":"AAAA,SAASA,oBAAT,EAA+BC,mBAA/B,EAAoDC,oBAApD,
|
|
1
|
+
{"version":3,"sources":["MediaActions.js"],"names":["IMAGE_LIBRARY_LOADED","STOCK_IMAGES_LOADED","IMAGE_FOLDER_UPDATED","SAVE_IMAGE_POSITION","stockImagesLoaded","images","type","payload","imageLibraryLoaded","library","imageFolderUpdated","folder","saveImagePosition","uri","positions"],"mappings":"AAAA,SAASA,oBAAT,EAA+BC,mBAA/B,EAAoDC,oBAApD,EAA0EC,mBAA1E,QAAqG,SAArG;AAEA,OAAO,MAAMC,iBAAiB,GAAGC,MAAM,IAAI;AACzC,SAAO;AACLC,IAAAA,IAAI,EAAEL,mBADD;AAELM,IAAAA,OAAO,EAAEF;AAFJ,GAAP;AAID,CALM;AAOP,OAAO,MAAMG,kBAAkB,GAAGC,OAAO,IAAI;AAC3C,SAAO;AACLH,IAAAA,IAAI,EAAEN,oBADD;AAELO,IAAAA,OAAO,EAAEE;AAFJ,GAAP;AAID,CALM;AAOP,OAAO,MAAMC,kBAAkB,GAAGC,MAAM,IAAI;AAC1C,SAAO;AACLL,IAAAA,IAAI,EAAEJ,oBADD;AAELK,IAAAA,OAAO,EAAEI;AAFJ,GAAP;AAID,CALM;AAOP,OAAO,MAAMC,iBAAiB,GAAG,CAACC,GAAD,EAAMC,SAAN,KAAoB;AACnD,SAAO;AACLR,IAAAA,IAAI,EAAEH,mBADD;AAELI,IAAAA,OAAO,EAAE;AAAEM,MAAAA,GAAF;AAAOC,MAAAA;AAAP;AAFJ,GAAP;AAID,CALM","sourcesContent":["import { IMAGE_LIBRARY_LOADED, STOCK_IMAGES_LOADED, IMAGE_FOLDER_UPDATED, SAVE_IMAGE_POSITION } from './types';\n\nexport const stockImagesLoaded = images => {\n return {\n type: STOCK_IMAGES_LOADED,\n payload: images,\n };\n};\n\nexport const imageLibraryLoaded = library => {\n return {\n type: IMAGE_LIBRARY_LOADED,\n payload: library,\n };\n};\n\nexport const imageFolderUpdated = folder => {\n return {\n type: IMAGE_FOLDER_UPDATED,\n payload: folder,\n };\n};\n\nexport const saveImagePosition = (uri, positions) => {\n return {\n type: SAVE_IMAGE_POSITION,\n payload: { uri, positions },\n };\n};\n"]}
|
|
@@ -3,6 +3,7 @@ export const CHANGE_ROLE = 'CHANGE_ROLE';
|
|
|
3
3
|
export const IMAGE_LIBRARY_LOADED = 'IMAGE_LIBRARY_LOADED';
|
|
4
4
|
export const STOCK_IMAGES_LOADED = 'STOCK_IMAGES_LOADED';
|
|
5
5
|
export const IMAGE_FOLDER_UPDATED = 'IMAGE_FOLDER_UPDATED';
|
|
6
|
+
export const SAVE_IMAGE_POSITION = 'SAVE_IMAGE_POSITION';
|
|
6
7
|
export const LOAD_FOLLOWERS = 'LOAD_FOLLOWERS';
|
|
7
8
|
export const ADD_FOLLOWER = 'ADD_FOLLOWER';
|
|
8
9
|
export const REMOVE_FOLLOWER = 'REMOVE_FOLLOWER';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["types.js"],"names":["LOGOUT","CHANGE_ROLE","IMAGE_LIBRARY_LOADED","STOCK_IMAGES_LOADED","IMAGE_FOLDER_UPDATED","LOAD_FOLLOWERS","ADD_FOLLOWER","REMOVE_FOLLOWER","UPDATE_RESIDENTS","LOADED_RESIDENTS","LOADED_LINKED_USERS","LOADED_LINKED_TO_USERS","UPDATE_USER_STATE","BLOCK_USER","UNBLOCK_USER"],"mappings":"AAAA,OAAO,MAAMA,MAAM,GAAG,QAAf;AACP,OAAO,MAAMC,WAAW,GAAG,aAApB;AACP,OAAO,MAAMC,oBAAoB,GAAG,sBAA7B;AACP,OAAO,MAAMC,mBAAmB,GAAG,qBAA5B;AACP,OAAO,MAAMC,oBAAoB,GAAG,sBAA7B;AACP,OAAO,MAAMC,cAAc,GAAG,gBAAvB;AACP,OAAO,MAAMC,YAAY,GAAG,cAArB;AACP,OAAO,MAAMC,eAAe,GAAG,iBAAxB;AACP,OAAO,MAAMC,gBAAgB,GAAG,kBAAzB;AACP,OAAO,MAAMC,gBAAgB,GAAG,kBAAzB;AACP,OAAO,MAAMC,mBAAmB,GAAG,qBAA5B;AACP,OAAO,MAAMC,sBAAsB,GAAG,wBAA/B;AACP,OAAO,MAAMC,iBAAiB,GAAG,mBAA1B;AACP,OAAO,MAAMC,UAAU,GAAG,YAAnB;AACP,OAAO,MAAMC,YAAY,GAAG,cAArB","sourcesContent":["export const LOGOUT = 'LOGOUT';\nexport const CHANGE_ROLE = 'CHANGE_ROLE';\nexport const IMAGE_LIBRARY_LOADED = 'IMAGE_LIBRARY_LOADED';\nexport const STOCK_IMAGES_LOADED = 'STOCK_IMAGES_LOADED';\nexport const IMAGE_FOLDER_UPDATED = 'IMAGE_FOLDER_UPDATED';\nexport const LOAD_FOLLOWERS = 'LOAD_FOLLOWERS';\nexport const ADD_FOLLOWER = 'ADD_FOLLOWER';\nexport const REMOVE_FOLLOWER = 'REMOVE_FOLLOWER';\nexport const UPDATE_RESIDENTS = 'UPDATE_RESIDENTS';\nexport const LOADED_RESIDENTS = 'LOADED_RESIDENTS';\nexport const LOADED_LINKED_USERS = 'LOADED_LINKED_USERS';\nexport const LOADED_LINKED_TO_USERS = 'LOADED_LINKED_TO_USERS';\nexport const UPDATE_USER_STATE = 'UPDATE_USER_STATE';\nexport const BLOCK_USER = 'BLOCK_USER';\nexport const UNBLOCK_USER = 'UNBLOCK_USER';\n"]}
|
|
1
|
+
{"version":3,"sources":["types.js"],"names":["LOGOUT","CHANGE_ROLE","IMAGE_LIBRARY_LOADED","STOCK_IMAGES_LOADED","IMAGE_FOLDER_UPDATED","SAVE_IMAGE_POSITION","LOAD_FOLLOWERS","ADD_FOLLOWER","REMOVE_FOLLOWER","UPDATE_RESIDENTS","LOADED_RESIDENTS","LOADED_LINKED_USERS","LOADED_LINKED_TO_USERS","UPDATE_USER_STATE","BLOCK_USER","UNBLOCK_USER"],"mappings":"AAAA,OAAO,MAAMA,MAAM,GAAG,QAAf;AACP,OAAO,MAAMC,WAAW,GAAG,aAApB;AACP,OAAO,MAAMC,oBAAoB,GAAG,sBAA7B;AACP,OAAO,MAAMC,mBAAmB,GAAG,qBAA5B;AACP,OAAO,MAAMC,oBAAoB,GAAG,sBAA7B;AACP,OAAO,MAAMC,mBAAmB,GAAG,qBAA5B;AACP,OAAO,MAAMC,cAAc,GAAG,gBAAvB;AACP,OAAO,MAAMC,YAAY,GAAG,cAArB;AACP,OAAO,MAAMC,eAAe,GAAG,iBAAxB;AACP,OAAO,MAAMC,gBAAgB,GAAG,kBAAzB;AACP,OAAO,MAAMC,gBAAgB,GAAG,kBAAzB;AACP,OAAO,MAAMC,mBAAmB,GAAG,qBAA5B;AACP,OAAO,MAAMC,sBAAsB,GAAG,wBAA/B;AACP,OAAO,MAAMC,iBAAiB,GAAG,mBAA1B;AACP,OAAO,MAAMC,UAAU,GAAG,YAAnB;AACP,OAAO,MAAMC,YAAY,GAAG,cAArB","sourcesContent":["export const LOGOUT = 'LOGOUT';\nexport const CHANGE_ROLE = 'CHANGE_ROLE';\nexport const IMAGE_LIBRARY_LOADED = 'IMAGE_LIBRARY_LOADED';\nexport const STOCK_IMAGES_LOADED = 'STOCK_IMAGES_LOADED';\nexport const IMAGE_FOLDER_UPDATED = 'IMAGE_FOLDER_UPDATED';\nexport const SAVE_IMAGE_POSITION = 'SAVE_IMAGE_POSITION';\nexport const LOAD_FOLLOWERS = 'LOAD_FOLLOWERS';\nexport const ADD_FOLLOWER = 'ADD_FOLLOWER';\nexport const REMOVE_FOLLOWER = 'REMOVE_FOLLOWER';\nexport const UPDATE_RESIDENTS = 'UPDATE_RESIDENTS';\nexport const LOADED_RESIDENTS = 'LOADED_RESIDENTS';\nexport const LOADED_LINKED_USERS = 'LOADED_LINKED_USERS';\nexport const LOADED_LINKED_TO_USERS = 'LOADED_LINKED_TO_USERS';\nexport const UPDATE_USER_STATE = 'UPDATE_USER_STATE';\nexport const BLOCK_USER = 'BLOCK_USER';\nexport const UNBLOCK_USER = 'UNBLOCK_USER';\n"]}
|
|
@@ -5,6 +5,7 @@ export * from './contactActions';
|
|
|
5
5
|
export * from './eventActions';
|
|
6
6
|
export * from './analyticsActions';
|
|
7
7
|
export * from './notificationActions';
|
|
8
|
+
export * from './stringActions';
|
|
8
9
|
export * from './typeActions';
|
|
9
10
|
export { default as userActions } from './userActions';
|
|
10
11
|
export { default as profileActions } from './profileActions';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.js"],"names":["default","userActions","profileActions"],"mappings":"AAAA,cAAc,mBAAd;AACA,cAAc,eAAd;AACA,cAAc,mBAAd;AACA,cAAc,kBAAd;AACA,cAAc,gBAAd;AACA,cAAc,oBAAd;AACA,cAAc,uBAAd;AACA,cAAc,eAAd;AACA,SAASA,OAAO,IAAIC,WAApB,QAAuC,eAAvC;AACA,SAASD,OAAO,IAAIE,cAApB,QAA0C,kBAA1C","sourcesContent":["export * from './reactionActions';\nexport * from './fileActions';\nexport * from './followerActions';\nexport * from './contactActions';\nexport * from './eventActions';\nexport * from './analyticsActions';\nexport * from './notificationActions';\nexport * from './typeActions';\nexport { default as userActions } from './userActions';\nexport { default as profileActions } from './profileActions';\n"]}
|
|
1
|
+
{"version":3,"sources":["index.js"],"names":["default","userActions","profileActions"],"mappings":"AAAA,cAAc,mBAAd;AACA,cAAc,eAAd;AACA,cAAc,mBAAd;AACA,cAAc,kBAAd;AACA,cAAc,gBAAd;AACA,cAAc,oBAAd;AACA,cAAc,uBAAd;AACA,cAAc,iBAAd;AACA,cAAc,eAAd;AACA,SAASA,OAAO,IAAIC,WAApB,QAAuC,eAAvC;AACA,SAASD,OAAO,IAAIE,cAApB,QAA0C,kBAA1C","sourcesContent":["export * from './reactionActions';\nexport * from './fileActions';\nexport * from './followerActions';\nexport * from './contactActions';\nexport * from './eventActions';\nexport * from './analyticsActions';\nexport * from './notificationActions';\nexport * from './stringActions';\nexport * from './typeActions';\nexport { default as userActions } from './userActions';\nexport { default as profileActions } from './profileActions';\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { authedFunction } from '../session';
|
|
3
|
+
import { getUrl } from '../helper';
|
|
4
|
+
export const stringActions = {
|
|
5
|
+
getString: (site, id, useDefault) => {
|
|
6
|
+
const url = getUrl('strings', `get/${site}_${id}`, useDefault ? {
|
|
7
|
+
useDefault
|
|
8
|
+
} : undefined);
|
|
9
|
+
return axios({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
url
|
|
12
|
+
}).catch(error => {
|
|
13
|
+
console.log('getString error', error);
|
|
14
|
+
throw error;
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
setString: (site, key, value) => {
|
|
18
|
+
const url = getUrl('strings', 'set');
|
|
19
|
+
return authedFunction({
|
|
20
|
+
method: 'POST',
|
|
21
|
+
url,
|
|
22
|
+
data: {
|
|
23
|
+
site,
|
|
24
|
+
key,
|
|
25
|
+
value
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=stringActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["stringActions.js"],"names":["axios","authedFunction","getUrl","stringActions","getString","site","id","useDefault","url","undefined","method","catch","error","console","log","setString","key","value","data"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,cAAT,QAA+B,YAA/B;AACA,SAASC,MAAT,QAAuB,WAAvB;AAEA,OAAO,MAAMC,aAAa,GAAG;AAC3BC,EAAAA,SAAS,EAAE,CAACC,IAAD,EAAOC,EAAP,EAAWC,UAAX,KAA0B;AACnC,UAAMC,GAAG,GAAGN,MAAM,CAAC,SAAD,EAAa,OAAMG,IAAK,IAAGC,EAAG,EAA9B,EAAiCC,UAAU,GAAG;AAAEA,MAAAA;AAAF,KAAH,GAAoBE,SAA/D,CAAlB;AACA,WAAOT,KAAK,CAAC;AACXU,MAAAA,MAAM,EAAE,KADG;AAEXF,MAAAA;AAFW,KAAD,CAAL,CAGJG,KAHI,CAGEC,KAAK,IAAI;AAChBC,MAAAA,OAAO,CAACC,GAAR,CAAY,iBAAZ,EAA+BF,KAA/B;AACA,YAAMA,KAAN;AACD,KANM,CAAP;AAOD,GAV0B;AAW3BG,EAAAA,SAAS,EAAE,CAACV,IAAD,EAAOW,GAAP,EAAYC,KAAZ,KAAsB;AAC/B,UAAMT,GAAG,GAAGN,MAAM,CAAC,SAAD,EAAY,KAAZ,CAAlB;AACA,WAAOD,cAAc,CAAC;AACpBS,MAAAA,MAAM,EAAE,MADY;AAEpBF,MAAAA,GAFoB;AAGpBU,MAAAA,IAAI,EAAE;AACJb,QAAAA,IADI;AAEJW,QAAAA,GAFI;AAGJC,QAAAA;AAHI;AAHc,KAAD,CAArB;AASD;AAtB0B,CAAtB","sourcesContent":["import axios from 'axios';\nimport { authedFunction } from '../session';\nimport { getUrl } from '../helper';\n\nexport const stringActions = {\n getString: (site, id, useDefault) => {\n const url = getUrl('strings', `get/${site}_${id}`, useDefault ? { useDefault } : undefined);\n return axios({\n method: 'GET',\n url,\n }).catch(error => {\n console.log('getString error', error);\n throw error;\n });\n },\n setString: (site, key, value) => {\n const url = getUrl('strings', 'set');\n return authedFunction({\n method: 'POST',\n url,\n data: {\n site,\n key,\n value,\n },\n });\n },\n};\n"]}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import { View, Image, Animated, StyleSheet } from 'react-native';
|
|
5
|
+
import { connect } from 'react-redux';
|
|
6
|
+
import moment from 'moment';
|
|
7
|
+
import { findLandmarkRange, getScaledOffset, get300, detectFaces } from '../helper';
|
|
8
|
+
import { saveImagePosition } from '../actions';
|
|
9
|
+
|
|
10
|
+
class AutoOffsetImage extends Component {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
|
|
14
|
+
_defineProperty(this, "onLoad", event => {
|
|
15
|
+
if (event.nativeEvent.source.uri !== this.props.uri) {
|
|
16
|
+
this.setState({
|
|
17
|
+
imageSource: this.props.uri
|
|
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
|
+
});
|
|
35
|
+
|
|
36
|
+
_defineProperty(this, "positionImage", async () => {
|
|
37
|
+
if (this.state.disabled) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const startTime = moment().valueOf();
|
|
43
|
+
let cachedValues; // check local cache
|
|
44
|
+
|
|
45
|
+
if (this.props.imagePositions && this.props.imagePositions[this.props.uri]) {
|
|
46
|
+
cachedValues = this.props.imagePositions[this.props.uri];
|
|
47
|
+
} // check remote cache
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if (!cachedValues) {
|
|
51
|
+
try {
|
|
52
|
+
const response = await stringActions.getString('plussSpace', `imagefaces_${encodeURIComponent(this.props.uri)}`);
|
|
53
|
+
cachedValues = response.data;
|
|
54
|
+
} catch (e) {
|
|
55
|
+
console.log('errored from cache');
|
|
56
|
+
} // run face detection locally
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if (!cachedValues || !cachedValues.faces || !cachedValues.image || _.isEmpty(cachedValues.faces) && moment().add(-1, 'w').valueOf() > moment(cachedValues.timestamp).valueOf()) {
|
|
60
|
+
cachedValues = await detectFaces(this.props.uri);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this.props.saveImagePosition(this.props.uri, cachedValues);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const image = await findLandmarkRange(this.props.uri, {
|
|
67
|
+
targetWidth: this.props.width,
|
|
68
|
+
targetHeight: this.props.height,
|
|
69
|
+
cachedValues
|
|
70
|
+
});
|
|
71
|
+
const scaledOffset = getScaledOffset(image.width, image.height, this.props.width, this.props.height);
|
|
72
|
+
const {
|
|
73
|
+
start: landmarkStart,
|
|
74
|
+
end: landmarkEnd
|
|
75
|
+
} = image;
|
|
76
|
+
const {
|
|
77
|
+
bounds: imageBounds,
|
|
78
|
+
offset,
|
|
79
|
+
width,
|
|
80
|
+
height
|
|
81
|
+
} = scaledOffset;
|
|
82
|
+
|
|
83
|
+
if (landmarkStart.y < imageBounds.start.y) {
|
|
84
|
+
// move up
|
|
85
|
+
offset.y = -Math.max(landmarkStart.y - this.props.height * this.paddingFactor, 0); // move top to 5% above start of landmark
|
|
86
|
+
} else if (landmarkEnd.y > imageBounds.end.y) {
|
|
87
|
+
// move down
|
|
88
|
+
offset.y = -Math.max(landmarkEnd.y + this.props.height * this.paddingFactor - this.props.height, 0); // move bottom to 5% below end of landmark
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (landmarkStart.x < imageBounds.start.x) {
|
|
92
|
+
// move right
|
|
93
|
+
offset.x = -Math.max(landmarkStart.x - this.props.width * this.paddingFactor, 0); // move left edge to 5% left of start of landmark
|
|
94
|
+
} else if (landmarkEnd.x > imageBounds.end.x) {
|
|
95
|
+
// move left
|
|
96
|
+
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
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this.setState({
|
|
100
|
+
imageStyle: {
|
|
101
|
+
width,
|
|
102
|
+
height,
|
|
103
|
+
top: offset.y,
|
|
104
|
+
left: offset.x
|
|
105
|
+
},
|
|
106
|
+
imageSource: this.props.uri
|
|
107
|
+
});
|
|
108
|
+
const endTime = moment().valueOf();
|
|
109
|
+
|
|
110
|
+
if (endTime - startTime < 500) {
|
|
111
|
+
Animated.timing(this.state.blurRadius, {
|
|
112
|
+
toValue: 0,
|
|
113
|
+
duration: 0,
|
|
114
|
+
useNativeDriver: false
|
|
115
|
+
}).start();
|
|
116
|
+
}
|
|
117
|
+
} catch (e) {
|
|
118
|
+
this.setState({
|
|
119
|
+
imageSource: this.props.uri
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
this.paddingFactor = this.props.paddingFactor || 0.1;
|
|
125
|
+
this.state = {
|
|
126
|
+
imageStyle: {
|
|
127
|
+
width: this.props.width,
|
|
128
|
+
height: this.props.height
|
|
129
|
+
},
|
|
130
|
+
blurRadius: new Animated.Value(100),
|
|
131
|
+
imageSource: get300(this.props.uri),
|
|
132
|
+
disabled: true
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
componentDidMount() {
|
|
137
|
+
this.positionImage();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
componentDidUpdate(prevProps) {
|
|
141
|
+
if (prevProps.uri !== this.props.uri || prevProps.height !== this.props.height || prevProps.width !== this.props.width) {
|
|
142
|
+
this.positionImage();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
render() {
|
|
147
|
+
if (this.state.disabled) {
|
|
148
|
+
return /*#__PURE__*/React.createElement(Image, {
|
|
149
|
+
source: {
|
|
150
|
+
uri: this.state.imageSource
|
|
151
|
+
},
|
|
152
|
+
style: [styles.container, styles.staticImage, {
|
|
153
|
+
width: this.props.width,
|
|
154
|
+
height: this.props.height
|
|
155
|
+
}, this.props.style],
|
|
156
|
+
onLoad: this.onLoad
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
161
|
+
style: [styles.container, {
|
|
162
|
+
width: this.props.width,
|
|
163
|
+
height: this.props.height
|
|
164
|
+
}, this.props.style]
|
|
165
|
+
}, /*#__PURE__*/React.createElement(Animated.Image, {
|
|
166
|
+
blurRadius: this.state.blurRadius,
|
|
167
|
+
source: {
|
|
168
|
+
uri: this.state.imageSource
|
|
169
|
+
},
|
|
170
|
+
style: [styles.image, this.state.imageStyle],
|
|
171
|
+
onLoad: this.onLoad
|
|
172
|
+
}), this.props.children);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const styles = StyleSheet.create({
|
|
178
|
+
container: {
|
|
179
|
+
overflow: 'hidden'
|
|
180
|
+
},
|
|
181
|
+
image: {
|
|
182
|
+
position: 'absolute',
|
|
183
|
+
top: 0,
|
|
184
|
+
left: 0,
|
|
185
|
+
resizeMode: 'cover'
|
|
186
|
+
},
|
|
187
|
+
staticImage: {
|
|
188
|
+
resizeMode: 'cover'
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
const mapStateToProps = state => {
|
|
193
|
+
return {
|
|
194
|
+
imagePositions: state.media.positions
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const autoOffsetImage = connect(mapStateToProps, {
|
|
199
|
+
saveImagePosition
|
|
200
|
+
})(AutoOffsetImage);
|
|
201
|
+
export { autoOffsetImage as AutoOffsetImage };
|
|
202
|
+
//# sourceMappingURL=AutoOffsetImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["AutoOffsetImage.js"],"names":["React","Component","View","Image","Animated","StyleSheet","connect","moment","findLandmarkRange","getScaledOffset","get300","detectFaces","saveImagePosition","AutoOffsetImage","constructor","props","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","styles","container","staticImage","style","onLoad","children","create","overflow","position","resizeMode","mapStateToProps","media","positions","autoOffsetImage"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,IAAT,EAAeC,KAAf,EAAsBC,QAAtB,EAAgCC,UAAhC,QAAkD,cAAlD;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,OAAOC,MAAP,MAAmB,QAAnB;AACA,SAASC,iBAAT,EAA4BC,eAA5B,EAA6CC,MAA7C,EAAqDC,WAArD,QAAwE,WAAxE;AACA,SAASC,iBAAT,QAAkC,YAAlC;;AAEA,MAAMC,eAAN,SAA8BZ,SAA9B,CAAwC;AACtCa,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,UAAMA,KAAN;;AADiB,oCA0BVC,KAAK,IAAI;AAChB,UAAIA,KAAK,CAACC,WAAN,CAAkBC,MAAlB,CAAyBC,GAAzB,KAAiC,KAAKJ,KAAL,CAAWI,GAAhD,EAAqD;AACnD,aAAKC,QAAL,CAAc;AACZC,UAAAA,WAAW,EAAE,KAAKN,KAAL,CAAWI;AADZ,SAAd;AAGD,OALe,CAMhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD,KA9CkB;;AAAA,2CAgDH,YAAY;AAC1B,UAAI,KAAKG,KAAL,CAAWC,QAAf,EAAyB;AACvB;AACD;;AACD,UAAI;AACF,cAAMC,SAAS,GAAGjB,MA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C,QAAAA,KAAK,EAAE,KAAK5B,KAAL,CAAW4B,KADpB;AAEEE,QAAAA,MAAM,EAAE,KAAK9B,KAAL,CAAW8B;AAFrB,OAFK,EAML,KAAK9B,KAAL,CAAW8D,KANN;AADT,oBAUE,oBAAC,QAAD,CAAU,KAAV;AACE,MAAA,UAAU,EAAE,KAAKvD,KAAL,CAAW0C,UADzB;AAEE,MAAA,MAAM,EAAE;AAAE7C,QAAAA,GAAG,EAAE,KAAKG,KAAL,CAAWD;AAAlB,OAFV;AAGE,MAAA,KAAK,EAAE,CAACqD,MAAM,CAACrC,KAAR,EAAe,KAAKf,KAAL,CAAWqC,UAA1B,CAHT;AAIE,MAAA,MAAM,EAAE,KAAKmB;AAJf,MAVF,EAgBG,KAAK/D,KAAL,CAAWgE,QAhBd,CADF;AAoBD;;AA7KqC;;AAgLxC,MAAML,MAAM,GAAGrE,UAAU,CAAC2E,MAAX,CAAkB;AAC/BL,EAAAA,SAAS,EAAE;AACTM,IAAAA,QAAQ,EAAE;AADD,GADoB;AAI/B5C,EAAAA,KAAK,EAAE;AACL6C,IAAAA,QAAQ,EAAE,UADL;AAELtB,IAAAA,GAAG,EAAE,CAFA;AAGLC,IAAAA,IAAI,EAAE,CAHD;AAILsB,IAAAA,UAAU,EAAE;AAJP,GAJwB;AAU/BP,EAAAA,WAAW,EAAE;AACXO,IAAAA,UAAU,EAAE;AADD;AAVkB,CAAlB,CAAf;;AAeA,MAAMC,eAAe,GAAG9D,KAAK,IAAI;AAC/B,SAAO;AACLK,IAAAA,cAAc,EAAEL,KAAK,CAAC+D,KAAN,CAAYC;AADvB,GAAP;AAGD,CAJD;;AAMA,MAAMC,eAAe,GAAGjF,OAAO,CAAC8E,eAAD,EAAkB;AAAExE,EAAAA;AAAF,CAAlB,CAAP,CAAgDC,eAAhD,CAAxB;AACA,SAAS0E,eAAe,IAAI1E,eAA5B","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 <Image\n source={{ uri: this.state.imageSource }}\n style={[\n styles.container,\n styles.staticImage,\n {\n width: this.props.width,\n height: this.props.height,\n },\n this.props.style,\n ]}\n onLoad={this.onLoad}\n />\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"]}
|
|
@@ -331,7 +331,9 @@ class CommentSection extends Component {
|
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
onGoToAdd() {
|
|
334
|
-
|
|
334
|
+
var _this$props$commentRe, _this$props$commentRe2;
|
|
335
|
+
|
|
336
|
+
(_this$props$commentRe = this.props.commentReply) === null || _this$props$commentRe === void 0 ? void 0 : (_this$props$commentRe2 = _this$props$commentRe.current) === null || _this$props$commentRe2 === void 0 ? void 0 : _this$props$commentRe2.focusInput();
|
|
335
337
|
}
|
|
336
338
|
|
|
337
339
|
getAdjustedSize(size) {
|
|
@@ -344,13 +346,13 @@ class CommentSection extends Component {
|
|
|
344
346
|
|
|
345
347
|
getComments() {
|
|
346
348
|
if (!this.state.commentsLoadStarted) {
|
|
347
|
-
var _this$props$
|
|
349
|
+
var _this$props$commentRe3, _this$props$commentRe4;
|
|
348
350
|
|
|
349
351
|
this.setState({
|
|
350
352
|
commentsLoadStarted: true,
|
|
351
353
|
commentsLoading: true
|
|
352
354
|
});
|
|
353
|
-
(_this$props$
|
|
355
|
+
(_this$props$commentRe3 = this.props.commentReply) === null || _this$props$commentRe3 === void 0 ? void 0 : (_this$props$commentRe4 = _this$props$commentRe3.current) === null || _this$props$commentRe4 === void 0 ? void 0 : _this$props$commentRe4.loadingStarted();
|
|
354
356
|
this.loadComments();
|
|
355
357
|
}
|
|
356
358
|
}
|
|
@@ -364,7 +366,7 @@ class CommentSection extends Component {
|
|
|
364
366
|
return c.Timestamp;
|
|
365
367
|
}).Timestamp;
|
|
366
368
|
reactionActions.getComments(this.props.entityId, this.props.entityType, minTime).then(res => {
|
|
367
|
-
var _this$props$
|
|
369
|
+
var _this$props$commentRe5, _this$props$commentRe6;
|
|
368
370
|
|
|
369
371
|
this.setState({
|
|
370
372
|
comments: _.sortBy(_.uniqBy(_.filter(_.concat(this.state.comments, res.data), c => {
|
|
@@ -383,7 +385,7 @@ class CommentSection extends Component {
|
|
|
383
385
|
}
|
|
384
386
|
}); //if (this.props.commentReply) {
|
|
385
387
|
|
|
386
|
-
(_this$props$
|
|
388
|
+
(_this$props$commentRe5 = this.props.commentReply) === null || _this$props$commentRe5 === void 0 ? void 0 : (_this$props$commentRe6 = _this$props$commentRe5.current) === null || _this$props$commentRe6 === void 0 ? void 0 : _this$props$commentRe6.loadingCompleted(); //}
|
|
387
389
|
|
|
388
390
|
if (this.props.live) {
|
|
389
391
|
this.loadTimer = setTimeout(() => {
|