From f5dd78e415e5bb4488ed0684e48d13b265e045ce Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Mar 2021 10:56:05 +0500 Subject: [PATCH] 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({