From 84d01b217084b41dbfd53e500133bd7b56067d43 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Mar 2021 00:03:28 +0500 Subject: [PATCH 1/7] removed upvote status calculator for testing --- .../upvote/container/upvoteContainer.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/upvote/container/upvoteContainer.js b/src/components/upvote/container/upvoteContainer.js index 14e818100..bb3973e08 100644 --- a/src/components/upvote/container/upvoteContainer.js +++ b/src/components/upvote/container/upvoteContainer.js @@ -46,21 +46,21 @@ const UpvoteContainer = (props) => { useEffect(() => { let _isMounted = true; - const _calculateVoteStatus = async () => { - const _isVoted = await isVotedFunc(activeVotes, get(currentAccount, 'name')); - const _isDownVoted = await isDownVotedFunc(activeVotes, get(currentAccount, 'name')); + // const _calculateVoteStatus = async () => { + // const _isVoted = await isVotedFunc(activeVotes, get(currentAccount, 'name')); + // const _isDownVoted = await isDownVotedFunc(activeVotes, get(currentAccount, 'name')); - if (_isMounted) { - setIsVoted(_isVoted && parseInt(_isVoted, 10) / 10000); - setIsDownVoted(_isDownVoted && (parseInt(_isDownVoted, 10) / 10000) * -1); + // if (_isMounted) { + // setIsVoted(_isVoted && parseInt(_isVoted, 10) / 10000); + // setIsDownVoted(_isDownVoted && (parseInt(_isDownVoted, 10) / 10000) * -1); - if (localVoteMap) { - _handleLocalVote(); - } - } - }; + // if (localVoteMap) { + // _handleLocalVote(); + // } + // } + // }; - _calculateVoteStatus(); + // _calculateVoteStatus(); return () => (_isMounted = false); }, [activeVotes]); From 211616224a511da7d1ff7adf9e7d651c1fc644d7 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Mar 2021 01:49:08 +0500 Subject: [PATCH 2/7] removed logger and some major console statements --- src/components/posts/container/postsContainer.js | 14 +++++++------- src/providers/hive/dhive.js | 14 +++++++------- src/redux/store/store.js | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/components/posts/container/postsContainer.js b/src/components/posts/container/postsContainer.js index 3a41d9c41..a4c904448 100644 --- a/src/components/posts/container/postsContainer.js +++ b/src/components/posts/container/postsContainer.js @@ -109,7 +109,7 @@ const PostsContainer = ({ }; const _scheduleLatestPostsCheck = (firstPost) => { - const refetchTime = __DEV__ ? 5000 : 600000; + const refetchTime = __DEV__ ? 50000 : 600000; if (_postFetchTimer) { clearTimeout(_postFetchTimer); } @@ -168,14 +168,14 @@ const PostsContainer = ({ }; const cacheReducer = (state, action) => { - console.log('reducer action:', state, action); + // console.log('reducer action:', state, action); switch (action.type) { case 'is-filter-loading': { const filter = action.payload.filter; const loading = action.payload.isLoading; state.cachedData[filter].isLoading = loading; - console.log('New state:', state); + // console.log('New state:', state); return state; } @@ -215,7 +215,7 @@ const PostsContainer = ({ cachedEntry.posts = _posts; state.cachedData[filter] = cachedEntry; - console.log('New state:', state); + // console.log('New state:', state); //dispatch to redux if ( @@ -237,7 +237,7 @@ const PostsContainer = ({ cachedEntry.posts = []; state.cachedData[filter] = cachedEntry; - console.log('New state:', state); + // console.log('New state:', state); //dispatch to redux _setFeedPosts([]); @@ -248,7 +248,7 @@ const PostsContainer = ({ case 'change-filter': { const filter = action.payload.currentFilter; state.currentFilter = filter; - console.log('New state:', state); + // console.log('New state:', state); const data = state.cachedData[filter !== 'feed' ? filter : state.currentSubFilter]; _setFeedPosts(data.posts, data.scrollPosition); @@ -264,7 +264,7 @@ const PostsContainer = ({ case 'change-sub-filter': { const filter = action.payload.currentSubFilter; state.currentSubFilter = filter; - console.log('New state:', state); + // console.log('New state:', state); //dispatch to redux; const data = state.cachedData[filter]; _setFeedPosts(data.posts, data.scrollPosition); diff --git a/src/providers/hive/dhive.js b/src/providers/hive/dhive.js index e3f75ee5f..8a862f493 100644 --- a/src/providers/hive/dhive.js +++ b/src/providers/hive/dhive.js @@ -458,7 +458,7 @@ export const getActiveVotes = (author, permlink) => export const getRankedPosts = async (query, currentUserName, filterNsfw) => { try { - console.log('Getting ranked posts:', query); + // console.log('Getting ranked posts:', query); let posts = await client.call('bridge', 'get_ranked_posts', query); if (posts) { @@ -471,7 +471,7 @@ export const getRankedPosts = async (query, currentUserName, filterNsfw) => { return updatedPosts; } } - console.log('Returning fetched posts: ' + posts ? posts.length : null); + // console.log('Returning fetched posts: ' + posts ? posts.length : null); return posts; } catch (error) { return error; @@ -480,7 +480,7 @@ export const getRankedPosts = async (query, currentUserName, filterNsfw) => { export const getAccountPosts = async (query, currentUserName, filterNsfw) => { try { - console.log('Getting account posts: ', query); + // console.log('Getting account posts: ', query); let posts = await client.call('bridge', 'get_account_posts', query); if (posts) { @@ -493,7 +493,7 @@ export const getAccountPosts = async (query, currentUserName, filterNsfw) => { return updatedPosts; } } - console.log('Returning fetched posts: ' + posts ? posts.length : null); + // console.log('Returning fetched posts: ' + posts ? posts.length : null); return posts; } catch (error) { return error; @@ -502,7 +502,7 @@ export const getAccountPosts = async (query, currentUserName, filterNsfw) => { export const getRepliesByLastUpdate = async (query) => { try { - console.log('Getting replies: ', query); + // console.log('Getting replies: ', query); const replies = await client.database.call('get_replies_by_last_update', [ query.start_author, query.start_permlink, @@ -517,7 +517,7 @@ export const getRepliesByLastUpdate = async (query) => { export const getPost = async (author, permlink, currentUserName = null, isPromoted = false) => { try { - console.log('Getting post: ', author, permlink); + // console.log('Getting post: ', author, permlink); const post = await client.database.call('get_content', [author, permlink]); return post ? parsePost(post, currentUserName, isPromoted) : null; } catch (error) { @@ -654,7 +654,7 @@ export const signImage = async (file, currentAccount, pin) => { export const vote = (account, pin, author, permlink, weight) => _vote(account, pin, author, permlink, weight).then((resp) => { userActivity(account.username, 120, resp.block_num, resp.id); - console.log('Returning vote response'); + // console.log('Returning vote response'); return resp; }); diff --git a/src/redux/store/store.js b/src/redux/store/store.js index b05b44d48..4c387f633 100644 --- a/src/redux/store/store.js +++ b/src/redux/store/store.js @@ -22,7 +22,7 @@ const persistedReducer = persistReducer(persistConfig, reducer); const middleware = [thunk]; if (process.env.NODE_ENV === 'development') { - middleware.push(logger); + // middleware.push(logger); } const store = createStore(persistedReducer, applyMiddleware(...middleware)); From 23b3129d9b89442ae19c58e871785c07f497c9d6 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Mar 2021 01:51:09 +0500 Subject: [PATCH 3/7] put back upvote status calculator --- .../upvote/container/upvoteContainer.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/upvote/container/upvoteContainer.js b/src/components/upvote/container/upvoteContainer.js index bb3973e08..14e818100 100644 --- a/src/components/upvote/container/upvoteContainer.js +++ b/src/components/upvote/container/upvoteContainer.js @@ -46,21 +46,21 @@ const UpvoteContainer = (props) => { useEffect(() => { let _isMounted = true; - // const _calculateVoteStatus = async () => { - // const _isVoted = await isVotedFunc(activeVotes, get(currentAccount, 'name')); - // const _isDownVoted = await isDownVotedFunc(activeVotes, get(currentAccount, 'name')); + const _calculateVoteStatus = async () => { + const _isVoted = await isVotedFunc(activeVotes, get(currentAccount, 'name')); + const _isDownVoted = await isDownVotedFunc(activeVotes, get(currentAccount, 'name')); - // if (_isMounted) { - // setIsVoted(_isVoted && parseInt(_isVoted, 10) / 10000); - // setIsDownVoted(_isDownVoted && (parseInt(_isDownVoted, 10) / 10000) * -1); + if (_isMounted) { + setIsVoted(_isVoted && parseInt(_isVoted, 10) / 10000); + setIsDownVoted(_isDownVoted && (parseInt(_isDownVoted, 10) / 10000) * -1); - // if (localVoteMap) { - // _handleLocalVote(); - // } - // } - // }; + if (localVoteMap) { + _handleLocalVote(); + } + } + }; - // _calculateVoteStatus(); + _calculateVoteStatus(); return () => (_isMounted = false); }, [activeVotes]); From ba13c13a1b3d2241944486d49c59d5e091ce9240 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Mar 2021 09:43:28 +0500 Subject: [PATCH 4/7] updated info.plist with compliance flag --- ios/Ecency/Info.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ios/Ecency/Info.plist b/ios/Ecency/Info.plist index 3f12a4ad6..039b376f0 100644 --- a/ios/Ecency/Info.plist +++ b/ios/Ecency/Info.plist @@ -118,5 +118,7 @@ UIViewControllerBasedStatusBarAppearance + ITSAppUsesNonExemptEncryption + From f5dd78e415e5bb4488ed0684e48d13b265e045ce Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Mar 2021 10:56:05 +0500 Subject: [PATCH 5/7] imporved babel script, put back important logs and redux logger --- babel.config.js | 15 ++++++++++++--- ios/Ecency.xcodeproj/project.pbxproj | 18 +++++++++--------- .../posts/container/postsContainer.js | 9 +++------ src/containers/transferContainer.js | 2 +- src/providers/hive/dhive.js | 14 +++++++------- src/redux/store/store.js | 2 +- .../editor/container/editorContainer.js | 2 +- 7 files changed, 34 insertions(+), 28 deletions(-) diff --git a/babel.config.js b/babel.config.js index 03a76d1ee..2b8ca7616 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,4 +1,13 @@ -module.exports = { - presets: ['module:metro-react-native-babel-preset'], - sourceMaps: true, +module.exports = (api) => { + const babelEnv = api.env(); + const plugins = []; + //change to 'production' to check if this is working in 'development' mode + if (babelEnv !== 'development') { + plugins.push(['transform-remove-console', { exclude: ['error', 'warn'] }]); + } + return { + presets: ['module:metro-react-native-babel-preset'], + sourceMaps: true, + plugins, + }; }; diff --git a/ios/Ecency.xcodeproj/project.pbxproj b/ios/Ecency.xcodeproj/project.pbxproj index 9d834dafb..e3027d282 100644 --- a/ios/Ecency.xcodeproj/project.pbxproj +++ b/ios/Ecency.xcodeproj/project.pbxproj @@ -43,7 +43,7 @@ 05B6C4B024C306CE00B7FA60 /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 980BC9BC0D3B4AC69645C842 /* Zocial.ttf */; }; 0A1D279E0D3CD306C889592E /* libPods-Ecency-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7093E51BBC0EE2F41AB19EBA /* libPods-Ecency-tvOS.a */; }; 1CD0B89E258019B600A7D78E /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1CD0B89B258019B600A7D78E /* GoogleService-Info.plist */; }; - 2B3CF3607B7CB9B7296FD5EF /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; + 2B3CF3607B7CB9B7296FD5EF /* (null) in Frameworks */ = {isa = PBXBuildFile; }; 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; @@ -55,7 +55,7 @@ CFAA2A599FD65F360D9B3E1E /* libPods-EcencyTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B344CAA24725C973F48BE81E /* libPods-EcencyTests.a */; }; D71EB20EDB9B987C0574BAFE /* libPods-EcencyTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C97456BE898C00B5EDA21C2E /* libPods-EcencyTests.a */; }; DC0E25610BB5F49AFF4514AD /* libPods-Ecency.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 388DF3FF85F08109F722083B /* libPods-Ecency.a */; }; - F77F6C7E54F3C783A2773E9D /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; + F77F6C7E54F3C783A2773E9D /* (null) in Frameworks */ = {isa = PBXBuildFile; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -204,8 +204,8 @@ buildActionMask = 2147483647; files = ( 05B6C49424C306CE00B7FA60 /* StoreKit.framework in Frameworks */, - F77F6C7E54F3C783A2773E9D /* BuildFile in Frameworks */, - 2B3CF3607B7CB9B7296FD5EF /* BuildFile in Frameworks */, + F77F6C7E54F3C783A2773E9D /* (null) in Frameworks */, + 2B3CF3607B7CB9B7296FD5EF /* (null) in Frameworks */, DC0E25610BB5F49AFF4514AD /* libPods-Ecency.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1071,7 +1071,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = app.esteem.mobile.ios.eshare; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ios_dev_group; + PROVISIONING_PROFILE_SPECIFIER = "extension-dev"; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -1090,7 +1090,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = eshare/eshare.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; + CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -1103,7 +1103,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = app.esteem.mobile.ios.eshare; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "extension-dist"; + PROVISIONING_PROFILE_SPECIFIER = "extension-dev"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 5.0; @@ -1196,7 +1196,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Ecency/Ecency.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; + CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 2794; DEAD_CODE_STRIPPING = NO; @@ -1255,7 +1255,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = app.esteem.mobile.ios; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ios_dist_app; + PROVISIONING_PROFILE_SPECIFIER = ios_dev_app; SWIFT_OBJC_BRIDGING_HEADER = "Ecency-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/src/components/posts/container/postsContainer.js b/src/components/posts/container/postsContainer.js index a4c904448..75f01bae8 100644 --- a/src/components/posts/container/postsContainer.js +++ b/src/components/posts/container/postsContainer.js @@ -168,14 +168,14 @@ const PostsContainer = ({ }; const cacheReducer = (state, action) => { - // console.log('reducer action:', state, action); + console.log('reducer action:', action); switch (action.type) { case 'is-filter-loading': { const filter = action.payload.filter; const loading = action.payload.isLoading; state.cachedData[filter].isLoading = loading; - // console.log('New state:', state); + return state; } @@ -215,7 +215,6 @@ const PostsContainer = ({ cachedEntry.posts = _posts; state.cachedData[filter] = cachedEntry; - // console.log('New state:', state); //dispatch to redux if ( @@ -237,7 +236,6 @@ const PostsContainer = ({ cachedEntry.posts = []; state.cachedData[filter] = cachedEntry; - // console.log('New state:', state); //dispatch to redux _setFeedPosts([]); @@ -248,7 +246,6 @@ const PostsContainer = ({ case 'change-filter': { const filter = action.payload.currentFilter; state.currentFilter = filter; - // console.log('New state:', state); const data = state.cachedData[filter !== 'feed' ? filter : state.currentSubFilter]; _setFeedPosts(data.posts, data.scrollPosition); @@ -264,7 +261,7 @@ const PostsContainer = ({ case 'change-sub-filter': { const filter = action.payload.currentSubFilter; state.currentSubFilter = filter; - // console.log('New state:', state); + //dispatch to redux; const data = state.cachedData[filter]; _setFeedPosts(data.posts, data.scrollPosition); diff --git a/src/containers/transferContainer.js b/src/containers/transferContainer.js index 35b319a93..ab9411530 100644 --- a/src/containers/transferContainer.js +++ b/src/containers/transferContainer.js @@ -101,7 +101,7 @@ class TransferContainer extends Component { } if (transferType === 'address_view' && fundType === 'BTC') { //TODO implement transfer of custom tokens - // console.log(tokenAddress); + console.log(tokenAddress); } const local = await getUserDataWithUsername(username); diff --git a/src/providers/hive/dhive.js b/src/providers/hive/dhive.js index 8a862f493..e3f75ee5f 100644 --- a/src/providers/hive/dhive.js +++ b/src/providers/hive/dhive.js @@ -458,7 +458,7 @@ export const getActiveVotes = (author, permlink) => export const getRankedPosts = async (query, currentUserName, filterNsfw) => { try { - // console.log('Getting ranked posts:', query); + console.log('Getting ranked posts:', query); let posts = await client.call('bridge', 'get_ranked_posts', query); if (posts) { @@ -471,7 +471,7 @@ export const getRankedPosts = async (query, currentUserName, filterNsfw) => { return updatedPosts; } } - // console.log('Returning fetched posts: ' + posts ? posts.length : null); + console.log('Returning fetched posts: ' + posts ? posts.length : null); return posts; } catch (error) { return error; @@ -480,7 +480,7 @@ export const getRankedPosts = async (query, currentUserName, filterNsfw) => { export const getAccountPosts = async (query, currentUserName, filterNsfw) => { try { - // console.log('Getting account posts: ', query); + console.log('Getting account posts: ', query); let posts = await client.call('bridge', 'get_account_posts', query); if (posts) { @@ -493,7 +493,7 @@ export const getAccountPosts = async (query, currentUserName, filterNsfw) => { return updatedPosts; } } - // console.log('Returning fetched posts: ' + posts ? posts.length : null); + console.log('Returning fetched posts: ' + posts ? posts.length : null); return posts; } catch (error) { return error; @@ -502,7 +502,7 @@ export const getAccountPosts = async (query, currentUserName, filterNsfw) => { export const getRepliesByLastUpdate = async (query) => { try { - // console.log('Getting replies: ', query); + console.log('Getting replies: ', query); const replies = await client.database.call('get_replies_by_last_update', [ query.start_author, query.start_permlink, @@ -517,7 +517,7 @@ export const getRepliesByLastUpdate = async (query) => { export const getPost = async (author, permlink, currentUserName = null, isPromoted = false) => { try { - // console.log('Getting post: ', author, permlink); + console.log('Getting post: ', author, permlink); const post = await client.database.call('get_content', [author, permlink]); return post ? parsePost(post, currentUserName, isPromoted) : null; } catch (error) { @@ -654,7 +654,7 @@ export const signImage = async (file, currentAccount, pin) => { export const vote = (account, pin, author, permlink, weight) => _vote(account, pin, author, permlink, weight).then((resp) => { userActivity(account.username, 120, resp.block_num, resp.id); - // console.log('Returning vote response'); + console.log('Returning vote response'); return resp; }); diff --git a/src/redux/store/store.js b/src/redux/store/store.js index 4c387f633..b05b44d48 100644 --- a/src/redux/store/store.js +++ b/src/redux/store/store.js @@ -22,7 +22,7 @@ const persistedReducer = persistReducer(persistConfig, reducer); const middleware = [thunk]; if (process.env.NODE_ENV === 'development') { - // middleware.push(logger); + middleware.push(logger); } const store = createStore(persistedReducer, applyMiddleware(...middleware)); diff --git a/src/screens/editor/container/editorContainer.js b/src/screens/editor/container/editorContainer.js index 3b1b0991c..e7f7c3994 100644 --- a/src/screens/editor/container/editorContainer.js +++ b/src/screens/editor/container/editorContainer.js @@ -164,7 +164,7 @@ class EditorContainer extends Component { } }) .catch((error) => { - // console.log(error, error.message); + console.log(error, error.message); if (error.toString().includes('code 413')) { Alert.alert( intl.formatMessage({ From ca5437baccd899e6f2f61f0e37a0985f14a107c4 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Mar 2021 11:23:39 +0500 Subject: [PATCH 6/7] discarding body after extracting summary --- src/utils/postParser.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/postParser.js b/src/utils/postParser.js index 2802093e8..7dffd58be 100644 --- a/src/utils/postParser.js +++ b/src/utils/postParser.js @@ -47,8 +47,6 @@ export const parsePost = (post, currentUserName, isPromoted, isList = false) => post.avatar = getResizedAvatar(get(post, 'author')); if (!isList) { post.body = renderPostBody(post, true, webp); - } else { - post.body = ''; } post.summary = postBodySummary(post, 150); post.is_declined_payout = parseAsset(post.max_accepted_payout).amount === 0; @@ -63,6 +61,11 @@ export const parsePost = (post, currentUserName, isPromoted, isList = false) => //stamp posts with fetched time; post.post_fetched_at = new Date().getTime(); + //discard post body if list + if (isList) { + post.body = ''; + } + //cache image if (post.image) { FastImage.preload([{ uri: post.image }]); From e0dd6f8ed3a03e5c7ee8596e1e0e5948bb2df30a Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Mar 2021 12:17:26 +0500 Subject: [PATCH 7/7] defaulting nsfw to warn, fixed modal not appearing issue --- src/realm/realm.js | 6 +++--- src/redux/reducers/applicationReducer.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/realm/realm.js b/src/realm/realm.js index c66359ac5..e323963c8 100644 --- a/src/realm/realm.js +++ b/src/realm/realm.js @@ -501,7 +501,7 @@ export const getSettings = async () => { notification: true, server: '', upvotePercent: '1', - nsfw: '0', + nsfw: '1', followNotification: true, voteNotification: true, commentNotification: true, @@ -668,8 +668,8 @@ export const getStorageType = async () => { export const getVersionForWelcomeModal = async () => { try { const application = await getItemFromStorage(APPLICATION_SCHEMA); - if (application.versionForWelcomeModal) { - return parseFloat(application.versionForWelcomeModal); + if (application && application.versionForWelcomeModal) { + return parseFloat(application.versionForWelcomeModal) || 0; } return 0; } catch (error) { diff --git a/src/redux/reducers/applicationReducer.js b/src/redux/reducers/applicationReducer.js index cbeeaae8f..4384fb72a 100644 --- a/src/redux/reducers/applicationReducer.js +++ b/src/redux/reducers/applicationReducer.js @@ -57,7 +57,7 @@ const initialState = { voteNotification: true, }, upvotePercent: 1, - nsfw: 'Always show', + nsfw: '1', pin: null, isPinCodeOpen: true, isRenderRequired: false,