From 10b9cefc7e69bea2904dfdacaf8edfa90d03e1d6 Mon Sep 17 00:00:00 2001 From: GOVINDDIXIT Date: Wed, 29 Jul 2020 18:03:19 +0530 Subject: [PATCH] fix lint issues --- app/constants/environment.js | 4 ++-- app/constants/links.js | 2 +- app/sagas/init.js | 15 ++++++++------- app/sagas/selectServer.js | 4 ++-- app/share.js | 2 +- config.js | 4 ++-- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/constants/environment.js b/app/constants/environment.js index 758659ec6..4bb4b2866 100644 --- a/app/constants/environment.js +++ b/app/constants/environment.js @@ -1,8 +1,8 @@ import RNConfigReader from 'react-native-config-reader'; // Checks for undefined values -let fDroidBuild = RNConfigReader.FDROID_BUILD || false; -let officialBuild = RNConfigReader.OFFICIAL_BUILD || false; +const fDroidBuild = RNConfigReader.FDROID_BUILD || false; +const officialBuild = RNConfigReader.OFFICIAL_BUILD || false; export const isOfficialBuild = officialBuild; export const isFDroidBuild = fDroidBuild; diff --git a/app/constants/links.js b/app/constants/links.js index 9d05fea30..c6d78a1e6 100644 --- a/app/constants/links.js +++ b/app/constants/links.js @@ -1,7 +1,7 @@ import { getBundleId, isIOS } from '../utils/deviceInfo'; import { isOfficialBuild } from './environment'; -let appStoreID = (isOfficialBuild) ? '1148741252' :'1272915472'; +const appStoreID = (isOfficialBuild) ? '1148741252' : '1272915472'; const APP_STORE_ID = appStoreID; export const PLAY_MARKET_LINK = `https://play.google.com/store/apps/details?id=${ getBundleId }`; diff --git a/app/sagas/init.js b/app/sagas/init.js index dab31139c..f7135b0c7 100644 --- a/app/sagas/init.js +++ b/app/sagas/init.js @@ -31,12 +31,8 @@ export const initLocalSettings = function* initLocalSettings() { const restore = function* restore() { let hasMigration; try { - if (isOfficialBuild) { + if (isOfficialBuild || isIOS) { hasMigration = yield AsyncStorage.getItem('hasMigration'); - } else { - if (isIOS) { - hasMigration = yield AsyncStorage.getItem('hasMigration'); - } } let { token, server } = yield all({ @@ -44,12 +40,17 @@ const restore = function* restore() { server: RNUserDefaults.get('currentServer') }); - if (!hasMigration && isIOS) { + if (!hasMigration && (isIOS || isOfficialBuild)) { let servers = yield RNUserDefaults.objectForKey(SERVERS); // if not have current if (servers && servers.length !== 0 && (!token || !server)) { server = servers[0][SERVER_URL]; - token = servers[0][TOKEN]; + if (isIOS) { + token = servers[0][TOKEN]; + } + if(isOfficialBuild) { + token = servers[0][USER_ID].length > servers[0][TOKEN].length ? servers[0][USER_ID] : servers[0][TOKEN]; + } } // get native credentials diff --git a/app/sagas/selectServer.js b/app/sagas/selectServer.js index f9177dbf9..b7fa29383 100644 --- a/app/sagas/selectServer.js +++ b/app/sagas/selectServer.js @@ -97,9 +97,9 @@ const handleSelectServer = function* handleSelectServer({ server, version, fetch } else { // We only run it if not has user on DB const servers = yield RNUserDefaults.objectForKey('kServers'); - const userCredentials = servers && servers.find(srv => srv['kAuthServerURL'] === server); + const userCredentials = servers && servers.find(srv => srv.kAuthServerURL === server); user = userCredentials && { - token: userCredentials['kAuthToken'] + token: userCredentials.kAuthToken }; } } diff --git a/app/share.js b/app/share.js index 8efc0eb3d..173feb717 100644 --- a/app/share.js +++ b/app/share.js @@ -15,7 +15,7 @@ import { } from './utils/theme'; import Navigation from './lib/ShareNavigation'; import store from './lib/createStore'; -import { supportSystemTheme } from './utils/deviceInfo'; +import { supportSystemTheme, isAndroid } from './utils/deviceInfo'; import { defaultHeader, themedHeader, getActiveRouteName, navigationTheme } from './utils/navigation'; diff --git a/config.js b/config.js index a2b242292..74b014a2e 100644 --- a/config.js +++ b/config.js @@ -1,6 +1,6 @@ -import { isOfficialBuild } from "./app/constants/environment"; +import { isOfficialBuild } from './app/constants/environment'; -let BugSnagApiKey = (isOfficialBuild) ? '0e62781637138bc11e6ad3ca14c03899' : ''; +const BugSnagApiKey = (isOfficialBuild) ? '0e62781637138bc11e6ad3ca14c03899' : ''; export default { BUGSNAG_API_KEY: BugSnagApiKey