mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
made some changes
This commit is contained in:
@@ -1,20 +1,33 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugins } from '@capacitor/core';
|
||||
|
||||
const { Storage } = Plugins;
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class StorageService {
|
||||
})
|
||||
export class StorageService {
|
||||
constructor() {}
|
||||
|
||||
constructor() {
|
||||
/* async store(storageKey: String, value: any){
|
||||
await Storage.set({
|
||||
key: storageKey,
|
||||
value: value
|
||||
})
|
||||
// Store the value
|
||||
async store(storageKey: string, value: any) {
|
||||
const encryptedValue = btoa(escape(JSON.stringify(value)));
|
||||
await Storage.set({
|
||||
key: storageKey,
|
||||
value: encryptedValue
|
||||
});
|
||||
}
|
||||
|
||||
} */
|
||||
// Get the value
|
||||
async get(storageKey: string) {
|
||||
const ret = await Storage.get({ key: storageKey });
|
||||
return JSON.parse(unescape(atob(ret.value)));
|
||||
}
|
||||
|
||||
async removeStorageItem(storageKey: string) {
|
||||
await Storage.remove({ key: storageKey });
|
||||
}
|
||||
|
||||
// Clear storage
|
||||
async clear() {
|
||||
await Storage.clear();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user