update capacitor dependencies

This commit is contained in:
Tim Gröger 2023-05-05 07:53:12 +02:00
parent e07df08822
commit 857d07040b
6 changed files with 29 additions and 30 deletions

View File

@ -1,35 +1,35 @@
import { LocalStorage, Platform } from 'quasar';
import { Storage } from '@capacitor/storage';
import { Preferences } from '@capacitor/preferences';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type PersitentTypes = Date | RegExp | number | boolean | string | object;
export class PersistentStorage {
static clear() {
if (Platform.is.capacitor) return Storage.clear();
if (Platform.is.capacitor) return Preferences.clear();
else return Promise.resolve(LocalStorage.clear());
}
static remove(key: string) {
if (Platform.is.capacitor) return Storage.remove({ key: key });
if (Platform.is.capacitor) return Preferences.remove({ key: key });
else return Promise.resolve(LocalStorage.remove(key));
}
static set(key: string, value: PersitentTypes) {
if (Platform.is.capacitor) return Storage.set({ key, value: JSON.stringify(value) });
if (Platform.is.capacitor) return Preferences.set({ key, value: JSON.stringify(value) });
else return Promise.resolve(LocalStorage.set(key, value));
}
static get<T extends PersitentTypes>(key: string) {
if (Platform.is.capacitor)
return Storage.get({ key }).then((v) =>
return Preferences.get({ key }).then((v) =>
v.value === null ? null : (JSON.parse(v.value) as T)
);
else return Promise.resolve(LocalStorage.getItem<T>(key));
}
static keys() {
if (Platform.is.capacitor) return Storage.keys().then((v) => v.keys);
if (Platform.is.capacitor) return Preferences.keys().then((v) => v.keys);
else return Promise.resolve(LocalStorage.getAllKeys());
}
}

View File

@ -3,14 +3,7 @@
"target": "esnext",
"compilerOptions": {
"baseUrl": "./",
"lib": [
"es2020",
"dom"
],
"types": [
"@flaschengeist/types",
"@quasar/app",
"node"
]
"lib": ["es2020", "dom"],
"types": ["@flaschengeist/types", "@quasar/app", "node"]
}
}

View File

@ -16,23 +16,26 @@
},
"dependencies": {
"@flaschengeist/api": "file:./api",
"@flaschengeist/users": "^1.0.0-alpha.3",
"@flaschengeist/schedule": "^1.0.0-alpha.6",
"@flaschengeist/users": "^1.0.0-alpha.3",
"axios": "^0.24.0",
"pinia": "^2.0.8",
"quasar": "^2.3.4"
"quasar": "^2.11.10",
"vue": "^3.0.0",
"vue-router": "^4.0.0"
},
"devDependencies": {
"@capacitor/core": "^3.3.3",
"@capacitor/storage": "^1.2.3",
"@capacitor/core": "^5.0.0",
"@capacitor/preferences": "^5.0.0",
"@flaschengeist/types": "^1.0.0-alpha.10",
"@quasar/app": "^3.2.5",
"@quasar/extras": "^1.12.2",
"@quasar/app-webpack": "^3.7.2",
"@quasar/extras": "^1.16.3",
"@types/node": "^14.18.0",
"@types/webpack": "^5.28.0",
"@types/webpack-env": "^1.16.3",
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "^5.8.0",
"@vue/devtools": "^6.5.0",
"eslint": "^8.5.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",

View File

@ -4,6 +4,9 @@
"bundledWebRuntime": false,
"npmClient": "yarn",
"webDir": "www",
"android": {
"minWebViewVersion": 71
},
"ios": {
"allowsLinkPreview": false
}

View File

@ -5,12 +5,12 @@
"author": "Tim Gröger <flaschengeist@wu5.de>",
"private": true,
"dependencies": {
"@capacitor/android": "^3.3.2",
"@capacitor/app": "^1.0.0",
"@capacitor/cli": "^3.0.0",
"@capacitor/core": "^3.0.0",
"@capacitor/ios": "^3.0.0-beta.0",
"@capacitor/splash-screen": "^1.0.0",
"@capacitor/storage": "^1.2.3"
"@capacitor/android": "^5.0.0-beta.0",
"@capacitor/app": "^5.0.0",
"@capacitor/cli": "^5.0.0",
"@capacitor/core": "^5.0.0",
"@capacitor/ios": "^5.0.0",
"@capacitor/preferences": "^5.0.0",
"@capacitor/splash-screen": "^5.0.0"
}
}

View File

@ -1,5 +1,5 @@
{
"extends": "@quasar/app/tsconfig-preset",
"extends": "@quasar/app-webpack/tsconfig-preset",
"target": "esnext",
"compilerOptions": {
"baseUrl": ".",