Skip to content

Commit

Permalink
chore: remove unused walletConnectV1Enabled remote config (#4924)
Browse files Browse the repository at this point in the history
### Description

As the title

### Test plan

n/a

### Related issues

- Fixes RET-878

### Backwards compatibility

Y

### Network scalability

If a new NetworkId and/or Network are added in the future, the changes
in this PR will:

- [x] Continue to work without code changes, OR trigger a compilation
error (guaranteeing we find it when a new network is added)
  • Loading branch information
kathaypacific committed Feb 16, 2024
1 parent 5d70e8e commit 236d15b
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 20 deletions.
3 changes: 0 additions & 3 deletions src/app/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export interface State {
minVersion: string | null
celoEducationUri: string | null
activeScreen: Screens
walletConnectV1Enabled: boolean
walletConnectV2Enabled: boolean
superchargeApy: number
superchargeTokenConfigByToken: SuperchargeTokenConfigByToken
Expand Down Expand Up @@ -75,7 +74,6 @@ const initialState = {
minVersion: null,
celoEducationUri: null,
activeScreen: Screens.Main,
walletConnectV1Enabled: REMOTE_CONFIG_VALUES_DEFAULTS.walletConnectV1Enabled,
walletConnectV2Enabled: REMOTE_CONFIG_VALUES_DEFAULTS.walletConnectV2Enabled,
superchargeApy: REMOTE_CONFIG_VALUES_DEFAULTS.superchargeApy,
superchargeTokenConfigByToken: JSON.parse(
Expand Down Expand Up @@ -207,7 +205,6 @@ export const appReducer = (
return {
...state,
celoEducationUri: action.configValues.celoEducationUri,
walletConnectV1Enabled: action.configValues.walletConnectV1Enabled,
walletConnectV2Enabled: action.configValues.walletConnectV2Enabled,
superchargeApy: action.configValues.superchargeApy,
superchargeTokenConfigByToken: action.configValues.superchargeTokenConfigByToken,
Expand Down
1 change: 0 additions & 1 deletion src/app/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ export interface RemoteConfigValues {
celoEducationUri: string | null
dappListApiUrl: string | null
inviteRewardsVersion: string
walletConnectV1Enabled: boolean
walletConnectV2Enabled: boolean
logPhoneNumberTypeEnabled: boolean
superchargeApy: number
Expand Down
1 change: 0 additions & 1 deletion src/app/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const numberVerifiedDecentrallySelector = (state: RootState) => state.app

// this can be called with undefined state in the tests
export const walletConnectEnabledSelector = (state?: RootState) => ({
v1: state?.app.walletConnectV1Enabled ?? false,
v2: state?.app.walletConnectV2Enabled ?? false,
})

Expand Down
1 change: 0 additions & 1 deletion src/firebase/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ export async function fetchRemoteConfigValues(): Promise<RemoteConfigValues | nu
celoEducationUri: flags.celoEducationUri?.asString() ?? null,
dappListApiUrl: flags.dappListApiUrl?.asString() ?? null,
inviteRewardsVersion: flags.inviteRewardsVersion.asString(),
walletConnectV1Enabled: flags.walletConnectV1Enabled.asBoolean(),
walletConnectV2Enabled: flags.walletConnectV2Enabled.asBoolean(),
superchargeApy: flags.superchargeApy.asNumber(),
superchargeTokenConfigByToken: superchargeConfigByTokenString
Expand Down
1 change: 0 additions & 1 deletion src/firebase/remoteConfigValuesDefaults.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const REMOTE_CONFIG_VALUES_DEFAULTS: Omit<
superchargeTokenConfigByToken: string
} = {
inviteRewardsVersion: 'none',
walletConnectV1Enabled: true,
walletConnectV2Enabled: true,
superchargeApy: 12,
superchargecUSDMin: 10,
Expand Down
1 change: 0 additions & 1 deletion src/firebase/remoteConfigValuesDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const REMOTE_CONFIG_VALUES_DEFAULTS: Omit<
superchargeTokenConfigByToken: string
} = {
inviteRewardsVersion: 'none',
walletConnectV1Enabled: true,
walletConnectV2Enabled: true,
superchargeApy: 12,
superchargecUSDMin: 10,
Expand Down
4 changes: 4 additions & 0 deletions src/redux/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1576,4 +1576,8 @@ export const migrations = {
},
}
},
191: (state: any) => ({
...state,
app: _.omit(state.app, 'walletConnectV1Enabled'),
}),
}
3 changes: 1 addition & 2 deletions src/redux/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('store state', () => {
{
"_persist": {
"rehydrated": true,
"version": 190,
"version": 191,
},
"account": {
"acceptedTerms": false,
Expand Down Expand Up @@ -176,7 +176,6 @@ describe('store state', () => {
"superchargeTokenConfigByToken": {},
"supportedBiometryType": null,
"visualizeNFTsEnabledInHomeAssetsPage": false,
"walletConnectV1Enabled": true,
"walletConnectV2Enabled": true,
},
"dapps": {
Expand Down
2 changes: 1 addition & 1 deletion src/redux/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const persistConfig: PersistConfig<RootState> = {
key: 'root',
// default is -1, increment as we make migrations
// See https://github.com/valora-inc/wallet/tree/main/WALLET.md#redux-state-migration
version: 190,
version: 191,
keyPrefix: `reduxStore-`, // the redux-persist default is `persist:` which doesn't work with some file systems.
storage: FSStorage(),
blacklist: ['networkInfo', 'alert', 'imports', 'keylessBackup'],
Expand Down
4 changes: 2 additions & 2 deletions src/walletConnect/saga.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ describe('initialiseWalletConnect', () => {
it('initializes v2 if enabled', async () => {
await expectSaga(initialiseWalletConnect, v2ConnectionString, origin)
.provide([
[select(walletConnectEnabledSelector), { v1: true, v2: true }],
[select(walletConnectEnabledSelector), { v2: true }],
[call(initialiseWalletConnectV2, v2ConnectionString, origin), {}],
])
.call(initialiseWalletConnectV2, v2ConnectionString, origin)
Expand All @@ -669,7 +669,7 @@ describe('initialiseWalletConnect', () => {

it('doesnt initialize v2 if disabled', async () => {
await expectSaga(initialiseWalletConnect, v2ConnectionString, origin)
.provide([[select(walletConnectEnabledSelector), { v1: true, v2: false }]])
.provide([[select(walletConnectEnabledSelector), { v2: false }]])
.not.call(initialiseWalletConnectV2, v2ConnectionString, origin)
.run()
})
Expand Down
3 changes: 1 addition & 2 deletions src/walletConnect/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,8 @@ export function* initialiseWalletConnectV2(uri: string, origin: WalletConnectPai

export function* isWalletConnectEnabled(uri: string) {
const { version } = parseUri(uri)
const { v1, v2 }: { v1: boolean; v2: boolean } = yield* select(walletConnectEnabledSelector)
const { v2 } = yield* select(walletConnectEnabledSelector)
const versionEnabled: { [version: string]: boolean | undefined } = {
'1': v1,
'2': v2,
}
return versionEnabled[version] ?? false
Expand Down
4 changes: 0 additions & 4 deletions test/RootStateSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3166,9 +3166,6 @@
"visualizeNFTsEnabledInHomeAssetsPage": {
"type": "boolean"
},
"walletConnectV1Enabled": {
"type": "boolean"
},
"walletConnectV2Enabled": {
"type": "boolean"
}
Expand Down Expand Up @@ -3213,7 +3210,6 @@
"superchargeTokenConfigByToken",
"supportedBiometryType",
"visualizeNFTsEnabledInHomeAssetsPage",
"walletConnectV1Enabled",
"walletConnectV2Enabled"
],
"type": "object"
Expand Down
11 changes: 10 additions & 1 deletion test/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3052,6 +3052,15 @@ export const v190Schema = {
},
}

export const v191Schema = {
...v190Schema,
_persist: {
...v190Schema._persist,
version: 191,
},
app: _.omit(v190Schema.app, 'walletConnectV1Enabled'),
}

export function getLatestSchema(): Partial<RootState> {
return v190Schema as Partial<RootState>
return v191Schema as Partial<RootState>
}

0 comments on commit 236d15b

Please sign in to comment.