From 104a6bfb3d9047c34c6d399af64b7593be566318 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Mon, 26 Jun 2023 16:51:57 +0500 Subject: [PATCH] lint --- .../container/accountsBottomSheetContainer.tsx | 10 ++++++++-- src/redux/reducers/accountReducer.ts | 1 - .../application/container/applicationContainer.tsx | 14 ++++++-------- src/utils/migrationHelpers.ts | 7 +++---- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/components/accountsBottomSheet/container/accountsBottomSheetContainer.tsx b/src/components/accountsBottomSheet/container/accountsBottomSheetContainer.tsx index 374ed1cb8..a33206a1b 100644 --- a/src/components/accountsBottomSheet/container/accountsBottomSheetContainer.tsx +++ b/src/components/accountsBottomSheet/container/accountsBottomSheetContainer.tsx @@ -96,8 +96,14 @@ const AccountsBottomSheetContainer = () => { _currentAccount.username = _currentAccount.name; if (!realmData[0]) { - realmData = await repairUserAccountData(_currentAccount.username, dispatch, intl, accounts, pinHash); - if(!realmData[0]){ + realmData = await repairUserAccountData( + _currentAccount.username, + dispatch, + intl, + accounts, + pinHash, + ); + if (!realmData[0]) { return; } } diff --git a/src/redux/reducers/accountReducer.ts b/src/redux/reducers/accountReducer.ts index 6743ff6be..a6632db20 100644 --- a/src/redux/reducers/accountReducer.ts +++ b/src/redux/reducers/accountReducer.ts @@ -77,7 +77,6 @@ export default function (state = initialState, action) { ...state.otherAccounts.filter((item) => item.username !== action.payload.username), action.payload, ] - : // add new account entry if it does not already exist [...state.otherAccounts, action.payload], isFetching: false, diff --git a/src/screens/application/container/applicationContainer.tsx b/src/screens/application/container/applicationContainer.tsx index d3567a31d..08ef20754 100644 --- a/src/screens/application/container/applicationContainer.tsx +++ b/src/screens/application/container/applicationContainer.tsx @@ -83,7 +83,6 @@ import MigrationHelpers, { import { deepLinkParser } from '../../../utils/deepLinkParser'; import bugsnapInstance from '../../../config/bugsnag'; - let firebaseOnMessageListener: any = null; let appStateSub: NativeEventSubscription | null = null; let linkingEventSub: EventSubscription | null = null; @@ -106,7 +105,6 @@ class ApplicationContainer extends Component { this._setNetworkListener(); - linkingEventSub = Linking.addEventListener('url', this._handleOpenURL); // TOOD: read initial URL Linking.getInitialURL().then((url) => { @@ -401,7 +399,7 @@ class ApplicationContainer extends Component { }); } - let realmObject:any[] = realmData.filter((data) => data.username === username); + let realmObject: any[] = realmData.filter((data) => data.username === username); // reapir otherAccouts data is needed // this repair must be done because code above makes sure every entry is realmData is a valid one @@ -410,9 +408,9 @@ class ApplicationContainer extends Component { if (!realmObject[0]) { // means current logged in user keys data not present, re-verify required realmObject = await this._repairUserAccountData(username); - - //disrupt routine if repair helper fails - if(!realmObject[0]){ + + // disrupt routine if repair helper fails + if (!realmObject[0]) { return null; } } @@ -681,8 +679,8 @@ class ApplicationContainer extends Component { if (!realmData[0]) { realmData = await this._repairUserAccountData(targetAccount.username); - //disrupt routine if repair helper fails - if(!realmData[0]) { + // disrupt routine if repair helper fails + if (!realmData[0]) { return; } } diff --git a/src/utils/migrationHelpers.ts b/src/utils/migrationHelpers.ts index f2e407a92..878f2a4a5 100644 --- a/src/utils/migrationHelpers.ts +++ b/src/utils/migrationHelpers.ts @@ -169,7 +169,7 @@ export const migrateUserEncryption = async (dispatch, currentAccount, encUserPin }; export const repairUserAccountData = async (username, dispatch, intl, accounts, pinHash) => { - let authData:any[] = []; + let authData: any[] = []; try { // clean realm data just in case, to avoid already logged error await removeUserData(username); @@ -200,9 +200,8 @@ export const repairUserAccountData = async (username, dispatch, intl, accounts, dispatch(updateCurrentAccount({ ..._userAccount })); - //compile authData for return; + // compile authData for return; authData = [_userAccount.local]; - } catch (err) { // keys data corrupted, ask user to verify login await delay(500); @@ -230,7 +229,7 @@ export const repairUserAccountData = async (username, dispatch, intl, accounts, ); } - return authData + return authData; }; export const repairOtherAccountsData = (accounts, realmAuthData, dispatch) => {