Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove old hack for DefaultRedirectionUrl migration #1272

Merged
merged 1 commit into from
Jan 17, 2025
Merged
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
16 changes: 1 addition & 15 deletions src/libs/localStore/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const log = logger('storage.ts')

export const storage = new MMKV()

const { getItem, removeItem, clear } = AsyncStorage
const { removeItem, clear } = AsyncStorage

export type StorageKey = CozyPersistedStorageKeys | DevicePersistedStorageKeys

Expand Down Expand Up @@ -103,20 +103,6 @@ export const getData = async <T>(name: StorageKey): Promise<T | null> => {
? (JSON.parse(value) as T)
: null
} catch (error) {
/*
If we tried to parse the default redirection url and it failed, we return it as is
because previously it was stored as a string where as now it is stored as a stringified string.

Default redirection url is written often, so active users
will automatically remove the old format from their local storage.

In some weeks we will be able to remove this compatibility code.
*/
if (name === CozyPersistedStorageKeys.DefaultRedirectionUrl) {
const value = await getItem(name)
return value as T
}

log.error(`Failed to get key "${name}" from persistent storage`, error)
return null
}
Expand Down
Loading