A nerdy way to tell time on Android/iOS ๐Ÿ•“
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: Add migration script from DefaultPreference -> AsyncStorage

Runs client-side to move each existing user's settings into AsyncStorage on boot.

After this has been available for a while and people have largely used it, I'll remove `DefaultPreference` entirely in favor of the much more cross-platform/better-maintained `AsyncStorage`.

Eventually, I will have to do a hard cutover since `DefaultPreference` won't keep updating along with the current cadence of React Native updates (I've already had issues on Android as early as 0.81.0), so some users might simply lose their settings. That's not great, but fortunately they are easy to set again, so hopefully it's not a huge problem to reconfigure again.

+21 -1
+3 -1
src/init.js
··· 6 6 7 7 import { initSettings } from './settings/useSettings'; 8 8 import BootSplash from 'react-native-bootsplash'; 9 + import migrate_DefaultPreference_to_AsyncStorage from './migrations/DefaultPreference_to_AsyncStorage'; 9 10 10 11 export async function init() { 12 + await migrate_DefaultPreference_to_AsyncStorage() 11 13 await initSettings(); 12 14 BootSplash.hide({ fade: true }) // Hide the splash screen until after all other initialization is complete 13 - } 15 + }
+18
src/migrations/DefaultPreference_to_AsyncStorage.ts
··· 1 + // Copyright (c) 2025 Joseph Hale 2 + // 3 + // This Source Code Form is subject to the terms of the Mozilla Public 4 + // License, v. 2.0. If a copy of the MPL was not distributed with this 5 + // file, You can obtain one at https://mozilla.org/MPL/2.0/. 6 + 7 + import DefaultPreference from 'react-native-default-preference'; 8 + import AsyncStorage from '@react-native-async-storage/async-storage'; 9 + 10 + export default async function migrate() { 11 + const brightness = (await DefaultPreference.get("brightness")) ?? "1" 12 + const roundness = (await DefaultPreference.get("roundness")) ?? "1" 13 + const showHints = (await DefaultPreference.get("showHints")) ?? "false" 14 + 15 + await AsyncStorage.setItem("brightness", brightness); 16 + await AsyncStorage.setItem("roundness", roundness); 17 + await AsyncStorage.setItem("showHints", showHints); 18 + }