remove old icon picker

This commit is contained in:
Jon Staab
2025-11-11 17:49:22 -08:00
parent 2390599e8f
commit c05d7e99e2
10 changed files with 435 additions and 1643 deletions
+4 -4
View File
@@ -93,7 +93,8 @@ import {
userBlossomServers,
shouldUnwrap,
} from "@welshman/app"
import {compressFile} from "@src/lib/html"
import {compressFile} from "@lib/html"
import {kv, db} from "@app/core/storage"
import type {SettingsValues, Alert} from "@app/core/state"
import {
SETTINGS,
@@ -111,7 +112,6 @@ import {
} from "@app/core/state"
import {loadAlertStatuses} from "@app/core/requests"
import {platform, platformName, getPushInfo} from "@app/util/push"
import {preferencesStorageProvider, Collection} from "@src/lib/storage"
// Utils
@@ -156,8 +156,8 @@ export const logout = async () => {
localStorage.clear()
await preferencesStorageProvider.clear()
await Collection.clearAll()
await kv.clear()
await db.clear()
}
// Synchronization
+52
View File
@@ -0,0 +1,52 @@
import {reject, call, identity} from "@welshman/lib"
import {Preferences} from "@capacitor/preferences"
import {Encoding, Filesystem, Directory} from "@capacitor/filesystem"
import {IDB} from "@lib/indexeddb"
export const kv = call(() => {
let p = Promise.resolve()
const get = async <T>(key: string): Promise<T | undefined> => {
const result = await Preferences.get({key})
if (!result.value) return undefined
try {
return JSON.parse(result.value)
} catch (e) {
return undefined
}
}
const set = async <T>(key: string, value: T): Promise<void> => {
p = p.then(() => Preferences.set({key, value: JSON.stringify(value)}))
await p
}
const clear = async () => {
p = p.then(() => Preferences.clear())
await p
}
return {get, set, clear}
})
export const db = new IDB({name: "flotilla-9gl", version: 1})
// Migration - we used to use capacitor's filesystem for storage, clear it out since we're
// going back to indexeddb
call(async () => {
const res = await Filesystem.readdir({
path: "",
directory: Directory.Data,
})
await Promise.all(
res.files.map(file =>
Filesystem.deleteFile({
path: file.name,
directory: Directory.Data,
}),
),
)
})