Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,12 @@ export default [
'src/actions/FioAddressActions.ts',
'src/actions/FirstOpenActions.tsx',
'src/actions/LoanWelcomeActions.tsx',
'src/actions/LocalSettingsActions.ts',

'src/actions/LoginActions.tsx',
'src/actions/NotificationActions.ts',
'src/actions/PaymentProtoActions.tsx',
'src/actions/ReceiveDropdown.tsx',
'src/actions/RecoveryReminderActions.tsx',
'src/actions/RequestReviewActions.tsx',

'src/actions/ScamWarningActions.tsx',
'src/actions/ScanActions.tsx',

Expand Down Expand Up @@ -298,10 +296,9 @@ export default [
'src/components/scenes/OtpSettingsScene.tsx',
'src/components/scenes/PasswordRecoveryScene.tsx',
'src/components/scenes/PromotionSettingsScene.tsx',
'src/components/scenes/ReviewTriggerTestScene.tsx',

'src/components/scenes/SecurityAlertsScene.tsx',

'src/components/scenes/SettingsScene.tsx',
'src/components/scenes/SpendingLimitsScene.tsx',
'src/components/scenes/Staking/EarnScene.tsx',
'src/components/scenes/Staking/StakeOptionsScene.tsx',
Expand All @@ -318,7 +315,7 @@ export default [

'src/components/scenes/TransactionsExportScene.tsx',
'src/components/scenes/UpgradeUsernameScreen.tsx',
'src/components/scenes/WalletListScene.tsx',

'src/components/scenes/WalletRestoreScene.tsx',
'src/components/scenes/WcConnectionsScene.tsx',
'src/components/scenes/WcConnectScene.tsx',
Expand Down Expand Up @@ -494,9 +491,7 @@ export default [
'src/plugins/stake-plugins/util/builder.ts',
'src/reducers/ExchangeInfoReducer.ts',
'src/reducers/NetworkReducer.ts',
'src/reducers/PasswordReminderReducer.ts',

'src/reducers/SpendingLimitsReducer.ts',
'src/selectors/getCreateWalletList.ts',
'src/selectors/SettingsSelectors.ts',
'src/state/createStateProvider.tsx',
Expand All @@ -515,7 +510,7 @@ export default [
'src/util/CurrencyWalletHelpers.ts',

'src/util/exchangeRates.ts',
'src/util/fake/FakeProviders.tsx',

'src/util/FioAddressUtils.ts',
'src/util/getAccountUsername.ts',
'src/util/GuiPluginTools.ts',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ exports[`initialState 1`] = `
"defaultFiat": "USD",
"defaultIsoFiat": "iso:USD",
"denominationSettings": {},
"denominationSettingsOptimized": false,
"developerModeOn": false,
"isAccountBalanceVisible": true,
"isTouchEnabled": false,
"isTouchSupported": false,
"mostRecentWallets": [],
"notifState": {},
"passwordRecoveryRemindersShown": {
Expand All @@ -135,7 +134,6 @@ exports[`initialState 1`] = `
"nonPasswordLoginsLimit": 4,
"passwordUseCount": 0,
},
"pinLoginEnabled": false,
"preferredSwapPluginId": undefined,
"preferredSwapPluginType": undefined,
"rampLastCryptoSelection": undefined,
Expand Down
12 changes: 7 additions & 5 deletions src/__tests__/spendingLimits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ describe('spendingLimits', () => {
describe('when logging in', () => {
it('should update', () => {
const actual = spendingLimits(initialState, {
type: 'ACCOUNT_INIT_COMPLETE',
type: 'LOGIN',
data: {
spendingLimits: {
transaction: {
isEnabled: false,
amount: 150
localSettings: {
spendingLimits: {
transaction: {
isEnabled: false,
amount: 150
}
}
}
} as any
Expand Down
9 changes: 6 additions & 3 deletions src/actions/LocalSettingsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const getLocalAccountSettings = async (
return settings
}

export function useAccountSettings() {
export function useAccountSettings(): LocalAccountSettings {
const [accountSettings, setAccountSettings] =
React.useState(localAccountSettings)
React.useEffect(() => watchAccountSettings(setAccountSettings), [])
Expand Down Expand Up @@ -268,9 +268,12 @@ export const readLocalAccountSettings = async (
emitAccountSettings(settings)
readSettingsFromDisk = true
return settings
} catch (e) {
} catch (error: unknown) {
// If Settings.json doesn't exist yet, return defaults without writing.
// Defaults can be derived from cleaners. Only write when values change.
const defaults = asLocalAccountSettings({})
return await writeLocalAccountSettings(account, defaults)
emitAccountSettings(defaults)
return defaults
}
}

Expand Down
Loading
Loading