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

View File

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

View File

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

View File

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

View File

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