Skip to content

Commit

Permalink
feat: Remove old hack for DefaultRedirectionUrl migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Ldoppea committed Jan 16, 2025
1 parent 9dfa917 commit b87dafb
Showing 1 changed file with 1 addition and 15 deletions.
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

0 comments on commit b87dafb

Please sign in to comment.