@fto-consult/expo-ui 8.20.3 → 8.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/session/index.native.js +17 -13
package/package.json
CHANGED
@@ -34,23 +34,27 @@ export class SQLiteSession {
|
|
34
34
|
}
|
35
35
|
async init () {
|
36
36
|
if (!this.db || !this.hasInit) {
|
37
|
-
const dbName = this.getDBName();
|
38
|
-
debug(`Opening sqlite database ${dbName} for session storage`);
|
39
37
|
if(!this.openingPromise){
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
const dbName = this.getDBName();
|
39
|
+
debug(`Opening sqlite database ${dbName} for session storage`);
|
40
|
+
this.openingPromise = new Promise((resolve,reject)=>{
|
41
|
+
return SQLite.openDatabaseAsync(dbName).then((db)=>{
|
42
|
+
return db.execAsync(`
|
43
|
+
CREATE TABLE IF NOT EXISTS ${SESSION_TABLE} (id INTEGER PRIMARY KEY NOT NULL, key TEXT, value TEXT);
|
44
|
+
`).then((d)=>{
|
44
45
|
this.db = db;
|
45
46
|
this.hasInit = true;
|
46
|
-
|
47
|
+
return this.getAll().then((()=>{
|
48
|
+
resolve(db);
|
49
|
+
}));
|
50
|
+
})
|
47
51
|
}).catch((e)=>{
|
48
|
-
|
49
|
-
|
50
|
-
})
|
51
|
-
|
52
|
-
|
53
|
-
})
|
52
|
+
debug(e," error when initializing sqlite session");
|
53
|
+
reject(e);
|
54
|
+
}).finally(()=>{
|
55
|
+
delete this.openingPromise;
|
56
|
+
});;
|
57
|
+
});
|
54
58
|
}
|
55
59
|
return this.openingPromise;
|
56
60
|
}
|