Skip to content

Commit 2367b91

Browse files
authored
fix(deps): use @divvi/[email protected] (#258)
### Description Use latest version of `@divvi/react-native-keychain` which contains oblador/react-native-keychain#773 It's published from https://github.com/mobilestack-xyz/react-native-keychain/commits/divvi-fork/ Note: I've chosen this versioning scheme to denote it's react-native-keychain version 10.0.0 + divvi changes ### Test plan - See oblador/react-native-keychain#773 ### Related issues - Part of ENG-636 ### Backwards compatibility Yes ### 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)
1 parent 2b05df9 commit 2367b91

File tree

10 files changed

+8
-81
lines changed

10 files changed

+8
-81
lines changed

apps/example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@divvi/cookies": "^6.2.3",
2424
"@divvi/mobile": "*",
2525
"@divvi/react-native-fs": "^2.20.1",
26-
"@divvi/react-native-keychain": "^10.0.0",
26+
"@divvi/react-native-keychain": "^10.0.0-divvi.1",
2727
"@interaxyz/react-native-webview": "^13.13.4",
2828
"@react-native-async-storage/async-storage": "^2.2.0",
2929
"@react-native-clipboard/clipboard": "^1.16.3",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"resolutions": {
5656
"@divvi/cookies": "^6.2.3",
5757
"@divvi/react-native-fs": "^2.20.1",
58-
"@divvi/react-native-keychain": "^10.0.0",
58+
"@divvi/react-native-keychain": "^10.0.0-divvi.1",
5959
"@interaxyz/react-native-webview": "^13.13.4",
6060
"@react-native-async-storage/async-storage": "^2.2.0",
6161
"@react-native-clipboard/clipboard": "^1.16.3",

packages/@divvi/mobile/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"peerDependencies": {
6363
"@divvi/cookies": "^6.2.3",
6464
"@divvi/react-native-fs": "^2.20.1",
65-
"@divvi/react-native-keychain": "^10.0.0",
65+
"@divvi/react-native-keychain": "^10.0.0-divvi.1",
6666
"@interaxyz/react-native-webview": "^13.13.4",
6767
"@react-native-async-storage/async-storage": "^2.2.0",
6868
"@react-native-clipboard/clipboard": "^1.16.3",

packages/@divvi/mobile/src/account/saga.test.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as matchers from 'redux-saga-test-plan/matchers'
55
import { throwError } from 'redux-saga-test-plan/providers'
66
import { call, select } from 'redux-saga/effects'
77
import {
8-
clearStoredItemsSaga,
98
generateSignedMessage,
109
handleUpdateAccountRegistration,
1110
initializeAccountSaga,
@@ -18,7 +17,6 @@ import { Actions as AccountActions, phoneNumberVerificationCompleted } from 'src
1817
import { currentLanguageSelector } from 'src/i18n/selectors'
1918
import { userLocationDataSelector } from 'src/networkInfo/selectors'
2019
import { retrieveSignedMessage, storeSignedMessage } from 'src/pincode/authentication'
21-
import { clearStoredItems } from 'src/storage/keychain'
2220
import Logger from 'src/utils/Logger'
2321
import { ViemKeychainAccount } from 'src/viem/keychainAccountToAccount'
2422
import { getKeychainAccounts } from 'src/web3/contracts'
@@ -209,31 +207,3 @@ describe('initializeAccount', () => {
209207
expect(mockFetch).toHaveBeenCalledTimes(1)
210208
})
211209
})
212-
213-
describe('clearStoredItemsSaga', () => {
214-
it('should call clearStoredItems and track analytics event', async () => {
215-
const mockStaleItems = ['item1', 'item2']
216-
await expectSaga(clearStoredItemsSaga)
217-
.provide([[call(clearStoredItems), mockStaleItems]])
218-
.call(clearStoredItems)
219-
.call([AppAnalytics, 'track'], OnboardingEvents.stale_keychain_items_cleared, {
220-
staleItems: mockStaleItems,
221-
staleItemsCount: mockStaleItems.length,
222-
})
223-
.run()
224-
})
225-
226-
it('should log error if clearStoredItems fails', async () => {
227-
const error = new Error('Failed to clear items')
228-
await expectSaga(clearStoredItemsSaga)
229-
.provide([[call(clearStoredItems), throwError(error)]])
230-
.call(clearStoredItems)
231-
.run()
232-
233-
expect(loggerErrorSpy).toHaveBeenCalledWith(
234-
'account/saga@clearKeychainItems',
235-
'Failed to clear keychain items',
236-
error
237-
)
238-
})
239-
})

packages/@divvi/mobile/src/account/saga.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import {
3232
} from 'src/pincode/authentication'
3333
import { persistor } from 'src/redux/store'
3434
import { patchUpdateStatsigUser } from 'src/statsig'
35-
import { clearStoredItems } from 'src/storage/keychain'
3635
import { restartApp } from 'src/utils/AppRestart'
3736
import Logger from 'src/utils/Logger'
3837
import { ensureError } from 'src/utils/ensureError'
@@ -95,20 +94,6 @@ export function* initializeAccountSaga() {
9594
}
9695
}
9796

98-
export function* clearStoredItemsSaga() {
99-
Logger.debug(TAG + '@clearKeychainItems', 'Clearing keychain items')
100-
try {
101-
const staleItems = yield* call(clearStoredItems)
102-
yield* call([AppAnalytics, 'track'], OnboardingEvents.stale_keychain_items_cleared, {
103-
staleItems,
104-
staleItemsCount: staleItems.length,
105-
})
106-
} catch (err) {
107-
const error = ensureError(err)
108-
Logger.error(TAG + '@clearKeychainItems', 'Failed to clear keychain items', error)
109-
}
110-
}
111-
11297
function* handlePreviouslyVerifiedPhoneNumber() {
11398
const address = yield* select(walletAddressSelector)
11499

@@ -256,17 +241,9 @@ export function* watchSignedMessage() {
256241
yield* call(handleUpdateAccountRegistration)
257242
}
258243

259-
function* watchOnboardingStart() {
260-
yield* takeLeading(
261-
[Actions.CHOOSE_CREATE_ACCOUNT, Actions.CHOOSE_RESTORE_ACCOUNT],
262-
safely(clearStoredItemsSaga)
263-
)
264-
}
265-
266244
export function* accountSaga() {
267245
yield* spawn(watchUpdateStatsigAndNavigate)
268246
yield* spawn(watchClearStoredAccount)
269247
yield* spawn(watchInitializeAccount)
270248
yield* spawn(watchSignedMessage)
271-
yield* spawn(watchOnboardingStart)
272249
}

packages/@divvi/mobile/src/analytics/Events.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ export enum OnboardingEvents {
203203

204204
link_phone_number = 'link_phone_number',
205205
link_phone_number_later = 'link_phone_number_later',
206-
207-
stale_keychain_items_cleared = 'stale_keychain_items_cleared',
208206
}
209207

210208
// Events emitted in the CPV flow

packages/@divvi/mobile/src/analytics/Properties.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,6 @@ interface OnboardingEventsProperties {
406406
[OnboardingEvents.protect_wallet_complete]: undefined
407407
[OnboardingEvents.link_phone_number]: undefined
408408
[OnboardingEvents.link_phone_number_later]: undefined
409-
[OnboardingEvents.stale_keychain_items_cleared]: {
410-
staleItems: string[]
411-
staleItemsCount: number
412-
}
413409
}
414410

415411
interface PhoneVerificationEventsProperties {

packages/@divvi/mobile/src/analytics/docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ export const eventDocs: Record<AnalyticsEventType, string> = {
215215
[OnboardingEvents.protect_wallet_complete]: ``,
216216
[OnboardingEvents.link_phone_number]: `User chooses to link phone number for CPV after recovery flow`,
217217
[OnboardingEvents.link_phone_number_later]: `User chooses not to link phone number for CPV after recovery flow`,
218-
[OnboardingEvents.stale_keychain_items_cleared]: `Stale keychain items where found during onboarding and cleared`,
219218

220219
// Events emitted in the CPV flow
221220
[PhoneVerificationEvents.phone_verification_skip_confirm]: `when skip is confirmed from the dialog in the phone number input screen`,
@@ -669,4 +668,5 @@ export const eventDocs: Record<AnalyticsEventType, string> = {
669668
// [JumpstartEvents.jumpstart_add_assets_show_actions]: 'When user taps the CTA to show ways to add assets',
670669
// [JumpstartEvents.jumpstart_add_assets_action_press]: 'When user selects an add assets action from the available options',
671670
// [JumpstartEvents.jumpstart_intro_seen]: `when jumpstart intro is seen by the user`,
671+
// [OnboardingEvents.stale_keychain_items_cleared]: `Stale keychain items where found during onboarding and cleared`,
672672
}

packages/@divvi/mobile/src/storage/keychain.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,3 @@ export async function listStoredItems() {
9090
throw error
9191
}
9292
}
93-
94-
export async function clearStoredItems(): Promise<string[]> {
95-
const items = await listStoredItems()
96-
const promises = items.map((item) => removeStoredItem(item))
97-
const results = await Promise.allSettled(promises)
98-
99-
results.forEach((result, index) => {
100-
if (result.status === 'rejected') {
101-
Logger.error(TAG, `Failed to remove stored item: ${items[index]}`, result.reason)
102-
}
103-
})
104-
105-
return items
106-
}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,10 +1110,10 @@
11101110
base-64 "^0.1.0"
11111111
utf8 "^3.0.0"
11121112

1113-
"@divvi/react-native-keychain@^10.0.0":
1114-
version "10.0.0"
1115-
resolved "https://registry.yarnpkg.com/@divvi/react-native-keychain/-/react-native-keychain-10.0.0.tgz#607e6a6170b1a73740c18d8dc66b45293f28dcd0"
1116-
integrity sha512-S6+NgTO8d9P6jEPo2T2V9N1iX98XOBG9+gznOuexuvIcGZ4j1CsaM1s8Gede0CqTTHnBgkox12Z2d0/JCm7EoA==
1113+
"@divvi/react-native-keychain@^10.0.0-divvi.1":
1114+
version "10.0.0-divvi.1"
1115+
resolved "https://registry.yarnpkg.com/@divvi/react-native-keychain/-/react-native-keychain-10.0.0-divvi.1.tgz#33c0464880d248af0bc69f44b0f2e6f95b032ff3"
1116+
integrity sha512-3UuNLwnsNuDUm5N5318a/B1MBpyCdoJl9ZR7ehqEQukGRMvGvd3jAjisWSF1H6pnc96ly5fC/H0Z7gbjIdudlg==
11171117

11181118
"@divvi/referral-sdk@^2.2.0":
11191119
version "2.2.0"

0 commit comments

Comments
 (0)