Merge remote-tracking branch 'upstream/development' into nt/post-draft-master

# Conflicts:
#	src/screens/editor/container/editorContainer.js
This commit is contained in:
Nouman Tahir 2021-03-30 21:42:01 +05:00
commit 506e48c7f3
12 changed files with 60 additions and 69 deletions

View File

@ -143,7 +143,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
versionName "3.0.15" versionName "3.0.16"
resValue "string", "build_config_package", "app.esteem.mobile.android" resValue "string", "build_config_package", "app.esteem.mobile.android"
multiDexEnabled true multiDexEnabled true
// react-native-image-crop-picker // react-native-image-crop-picker

View File

@ -15,11 +15,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>3.0.15</string> <string>3.0.16</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2794</string> <string>2795</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true /> <true />
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>BNDL</string> <string>BNDL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>3.0.15</string> <string>3.0.16</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2794</string> <string>2795</string>
</dict> </dict>
</plist> </plist>

View File

@ -1122,7 +1122,7 @@
CODE_SIGN_IDENTITY = "iPhone Distribution"; CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2794; CURRENT_PROJECT_VERSION = 2795;
DEAD_CODE_STRIPPING = NO; DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 75B6RXTKGT; DEVELOPMENT_TEAM = 75B6RXTKGT;
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
@ -1198,7 +1198,7 @@
CODE_SIGN_ENTITLEMENTS = Ecency/Ecency.entitlements; CODE_SIGN_ENTITLEMENTS = Ecency/Ecency.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2794; CURRENT_PROJECT_VERSION = 2795;
DEAD_CODE_STRIPPING = NO; DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 75B6RXTKGT; DEVELOPMENT_TEAM = 75B6RXTKGT;
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (

View File

@ -19,7 +19,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>3.0.15</string> <string>3.0.16</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@ -40,6 +40,8 @@
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>$(CURRENT_PROJECT_VERSION)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
@ -118,7 +120,5 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict> </dict>
</plist> </plist>

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>BNDL</string> <string>BNDL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>3.0.15</string> <string>3.0.16</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2794</string> <string>2795</string>
</dict> </dict>
</plist> </plist>

View File

@ -17,9 +17,9 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>3.0.15</string> <string>3.0.16</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2794</string> <string>2795</string>
<key>NSExtension</key> <key>NSExtension</key>
<dict> <dict>
<key>NSExtensionAttributes</key> <key>NSExtensionAttributes</key>

View File

@ -1,6 +1,6 @@
{ {
"name": "ecency", "name": "ecency",
"version": "3.0.15", "version": "3.0.16",
"displayName": "Ecency", "displayName": "Ecency",
"private": true, "private": true,
"rnpm": { "rnpm": {

View File

@ -30,16 +30,8 @@ const PostCardContainer = ({
imageHeight, imageHeight,
setImageHeight, setImageHeight,
}) => { }) => {
const [_content, setContent] = useState(content);
const [reblogs, setReblogs] = useState([]); const [reblogs, setReblogs] = useState([]);
const [activeVotes, setActiveVotes] = useState(get(_content, 'active_votes', [])); const activeVotes = get(content, 'active_votes', []);
//NOTE: potentially unnessacry fetch
// useEffect(() => {
// if (isRefresh) {
// _fetchPost();
// }
// }, [isRefresh]);
useEffect(() => { useEffect(() => {
let isCancelled = false; let isCancelled = false;
@ -59,24 +51,24 @@ const PostCardContainer = ({
} }
}; };
if (_content) { if (content) {
fetchData(_content); fetchData(content);
} }
return () => { return () => {
isCancelled = true; isCancelled = true;
}; };
}, [_content]); }, [content]);
const _handleOnUserPress = () => { const _handleOnUserPress = () => {
if (_content && get(currentAccount, 'name') !== get(_content, 'author')) { if (content && get(currentAccount, 'name') !== get(content, 'author')) {
navigation.navigate({ navigation.navigate({
routeName: ROUTES.SCREENS.PROFILE, routeName: ROUTES.SCREENS.PROFILE,
params: { params: {
username: get(_content, 'author'), username: get(content, 'author'),
reputation: get(_content, 'author_reputation'), reputation: get(content, 'author_reputation'),
}, },
key: get(_content, 'author'), key: get(content, 'author'),
}); });
} }
}; };
@ -98,9 +90,9 @@ const PostCardContainer = ({
routeName: ROUTES.SCREENS.VOTERS, routeName: ROUTES.SCREENS.VOTERS,
params: { params: {
activeVotes, activeVotes,
content: _content, content: content,
}, },
key: get(_content, 'permlink'), key: get(content, 'permlink'),
}); });
}; };
@ -110,33 +102,17 @@ const PostCardContainer = ({
params: { params: {
reblogs, reblogs,
}, },
key: get(_content, 'permlink', get(_content, 'author', '')), key: get(content, 'permlink', get(content, 'author', '')),
}); });
}; };
const _fetchPost = async () => {
await getPost(
get(_content, 'author'),
get(_content, 'permlink'),
get(currentAccount, 'username'),
)
.then((result) => {
if (result) {
setContent(result);
setActiveVotes(get(result, 'active_votes', []));
}
})
.catch(() => {});
};
return ( return (
<PostCardView <PostCardView
handleOnUserPress={_handleOnUserPress} handleOnUserPress={_handleOnUserPress}
handleOnContentPress={_handleOnContentPress} handleOnContentPress={_handleOnContentPress}
handleOnVotersPress={_handleOnVotersPress} handleOnVotersPress={_handleOnVotersPress}
handleOnReblogsPress={_handleOnReblogsPress} handleOnReblogsPress={_handleOnReblogsPress}
fetchPost={_fetchPost} content={content}
content={_content || content}
isHideImage={isHideImage} isHideImage={isHideImage}
isNsfwPost={nsfw || '1'} isNsfwPost={nsfw || '1'}
reblogs={reblogs} reblogs={reblogs}

View File

@ -40,11 +40,15 @@ const PostCardView = ({
imageHeight, imageHeight,
setImageHeight, setImageHeight,
}) => { }) => {
const [activeVotesCount, setActiveVotesCount] = useState(activeVotes.length || 0); //local state to manage fake upvote if available
const [activeVotesCount, setActiveVotesCount] = useState(0);
const [calcImgHeight, setCalcImgHeight] = useState(imageHeight || 300); const [calcImgHeight, setCalcImgHeight] = useState(imageHeight || 300);
// Component Functions useEffect(() => {
setActiveVotesCount(activeVotes ? activeVotes.length : 0);
}, [activeVotes]);
// Component Functions
const _handleOnUserPress = () => { const _handleOnUserPress = () => {
if (handleOnUserPress) { if (handleOnUserPress) {
handleOnUserPress(); handleOnUserPress();
@ -66,6 +70,7 @@ const PostCardView = ({
}; };
const _handleIncrementVoteCount = () => { const _handleIncrementVoteCount = () => {
//fake increment vote using based on local change
setActiveVotesCount(activeVotesCount + 1); setActiveVotesCount(activeVotesCount + 1);
}; };

View File

@ -31,6 +31,7 @@ const PostBody = ({
handleOnUserPress, handleOnUserPress,
handleOnPostPress, handleOnPostPress,
dispatch, dispatch,
onLoadEnd,
}) => { }) => {
const [isImageModalOpen, setIsImageModalOpen] = useState(false); const [isImageModalOpen, setIsImageModalOpen] = useState(false);
const [postImages, setPostImages] = useState([]); const [postImages, setPostImages] = useState([]);
@ -41,7 +42,7 @@ const PostBody = ({
const intl = useIntl(); const intl = useIntl();
const actionImage = useRef(null); const actionImage = useRef(null);
const actionLink = useRef(null); const actionLink = useRef(null);
const [isLoading, setIsLoading] = useState(true); // const [isLoading, setIsLoading] = useState(true);
useEffect(() => { useEffect(() => {
if (selectedLink) { if (selectedLink) {
@ -294,9 +295,9 @@ const PostBody = ({
}; };
const _handleLoadEnd = () => { const _handleLoadEnd = () => {
setTimeout(() => { if (onLoadEnd) {
setIsLoading(false); onLoadEnd();
}, 200); }
}; };
const customStyle = ` const customStyle = `
@ -461,7 +462,7 @@ const PostBody = ({
handleLinkPress(index); handleLinkPress(index);
}} }}
/> />
{isLoading && (isComment ? <CommentPlaceHolder /> : <PostPlaceHolder />)} {/* {isLoading && (isComment ? <CommentPlaceHolder /> : <PostPlaceHolder />)} */}
<AutoHeightWebView <AutoHeightWebView
source={{ html }} source={{ html }}
allowsFullscreenVideo={true} allowsFullscreenVideo={true}
@ -470,6 +471,7 @@ const PostBody = ({
onMessage={_handleOnLinkPress} onMessage={_handleOnLinkPress}
customScript={customBodyScript} customScript={customBodyScript}
startInLoadingState={true} startInLoadingState={true}
renderLoading={() => (isComment ? <CommentPlaceHolder /> : <PostPlaceHolder />)}
onShouldStartLoadWithRequest={false} onShouldStartLoadWithRequest={false}
scrollEnabled={false} scrollEnabled={false}
scalesPageToFit={false} scalesPageToFit={false}

View File

@ -48,6 +48,7 @@ const PostDisplayView = ({
const [isLoadedComments, setIsLoadedComments] = useState(false); const [isLoadedComments, setIsLoadedComments] = useState(false);
const actionSheet = useRef(null); const actionSheet = useRef(null);
const [refreshing, setRefreshing] = useState(false); const [refreshing, setRefreshing] = useState(false);
const [postBodyLoading, setPostBodyLoading] = useState(false);
// Component Life Cycles // Component Life Cycles
useEffect(() => { useEffect(() => {
@ -59,6 +60,7 @@ const PostDisplayView = ({
// Component Functions // Component Functions
const onRefresh = useCallback(() => { const onRefresh = useCallback(() => {
setRefreshing(true); setRefreshing(true);
setPostBodyLoading(true);
fetchPost().then(() => setRefreshing(false)); fetchPost().then(() => setRefreshing(false));
}, [refreshing]); }, [refreshing]);
@ -183,6 +185,10 @@ const PostDisplayView = ({
); );
} }
const _handleOnPostBodyLoad = () => {
setPostBodyLoading(false);
};
return ( return (
<View style={styles.container}> <View style={styles.container}>
<ScrollView <ScrollView
@ -207,20 +213,22 @@ const PostDisplayView = ({
content={post} content={post}
size={36} size={36}
/> />
<PostBody body={post.body} /> <PostBody body={post.body} onLoadEnd={_handleOnPostBodyLoad} />
<View style={styles.footer}> {!postBodyLoading && (
<Tags tags={post.json_metadata && post.json_metadata.tags} /> <View style={styles.footer}>
<Text style={styles.footerText}> <Tags tags={post.json_metadata && post.json_metadata.tags} />
Posted by <Text style={styles.footerText}>
<Text style={styles.footerName}>{` ${author || post.author} `}</Text> Posted by
{formatedTime} <Text style={styles.footerName}>{` ${author || post.author} `}</Text>
</Text> {formatedTime}
{/* {isPostEnd && this._getTabBar()} */} </Text>
</View> {/* {isPostEnd && this._getTabBar()} */}
</View>
)}
</View> </View>
)} )}
</View> </View>
{post && (isGetComment || isLoadedComments) && ( {post && !postBodyLoading && (isGetComment || isLoadedComments) && (
<CommentsDisplay <CommentsDisplay
author={author || post.author} author={author || post.author}
mainAuthor={author || post.author} mainAuthor={author || post.author}