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
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
versionName "3.0.15"
versionName "3.0.16"
resValue "string", "build_config_package", "app.esteem.mobile.android"
multiDexEnabled true
// react-native-image-crop-picker

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,11 +40,15 @@ const PostCardView = ({
imageHeight,
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);
// Component Functions
useEffect(() => {
setActiveVotesCount(activeVotes ? activeVotes.length : 0);
}, [activeVotes]);
// Component Functions
const _handleOnUserPress = () => {
if (handleOnUserPress) {
handleOnUserPress();
@ -66,6 +70,7 @@ const PostCardView = ({
};
const _handleIncrementVoteCount = () => {
//fake increment vote using based on local change
setActiveVotesCount(activeVotesCount + 1);
};

View File

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

View File

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