Skip to content

Commit 3b1b927

Browse files
committed
test: ✅ clear persisted device id
1 parent 4ce01bc commit 3b1b927

File tree

1 file changed

+15
-0
lines changed
  • test/react-native/features/fixtures/scenario-launcher/lib

1 file changed

+15
-0
lines changed

test/react-native/features/fixtures/scenario-launcher/lib/Persistence.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ const PERSISTED_STATE_DIRECTORY = `${Dirs.CacheDir}/bugsnag-performance-react-na
55
const PERSISTED_STATE_PATH = `${PERSISTED_STATE_DIRECTORY}/persisted-state.json`
66
const RETRY_QUEUE_DIRECTORY = `${PERSISTED_STATE_DIRECTORY}/retry-queue`
77

8+
function getNativeDeviceIdFilePath () {
9+
const nativeDeviceIdFilePath = Platform.select({
10+
ios: undefined,
11+
android: `${Dirs.DocumentDir}/device-id`,
12+
default: undefined
13+
})
14+
15+
return nativeDeviceIdFilePath
16+
}
17+
818
async function writePersistedStateFile(contents) {
919
if (!await FileSystem.exists(PERSISTED_STATE_DIRECTORY)) {
1020
console.error(`[BugsnagPerformance] creating persisted state directory: ${PERSISTED_STATE_DIRECTORY}`)
@@ -43,4 +53,9 @@ export async function clearPersistedState() {
4353
await FileSystem.unlink(`${RETRY_QUEUE_DIRECTORY}/${file}`)
4454
}
4555
}
56+
const nativeDeviceIdFilePath = getNativeDeviceIdFilePath()
57+
if (await FileSystem.exists(nativeDeviceIdFilePath)) {
58+
console.error(`[BugsnagPerformance] Clearing persisted data at path: ${nativeDeviceIdFilePath}`)
59+
await FileSystem.unlink(nativeDeviceIdFilePath)
60+
}
4661
}

0 commit comments

Comments
 (0)