fix(ios): handle ios indexedDB preload

This commit is contained in:
Andelf
2022-09-01 23:54:37 +08:00
committed by Tienson Qin
parent fb98531c1c
commit ba0a67ae05
4 changed files with 12 additions and 5 deletions

View File

@@ -2,6 +2,10 @@
<html>
<head>
<meta charset="utf-8">
<!-- Handle iOS indexedDB preloading. Ref: https://developer.apple.com/forums/thread/681201 -->
<script type="text/javascript">
window.indexedDB;
</script>
<meta content="minimum-scale=1, initial-scale=1, maximum-scale=1, width=device-width, shrink-to-fit=no" name="viewport">
<link rel="stylesheet" href="/static/css/tabler-icons.min.css">
<link href="/static/css/style.css" rel="stylesheet" type="text/css">

View File

@@ -210,9 +210,13 @@
(events/run!)
(p/let [repos (get-repos)]
(state/set-repos! repos)
(restore-and-setup! repos db-schema))
(-> (p/let [repos (get-repos)]
(state/set-repos! repos)
(restore-and-setup! repos db-schema))
(p/catch (fn [e]
(js/console.error "Errow while restoring repos: " e)))
(p/finally (fn []
(state/set-db-restoring! false))))
(when (mobile-util/native-platform?)
(p/do! (mobile-util/hide-splash)))

View File

@@ -217,7 +217,6 @@
(throw error))))
(p/finally
(fn []
(state/set-db-restoring! false)
(state/set-loading-files! @*repo false)))))))
(defn ls-dir-files-with-path!

View File

@@ -16,7 +16,7 @@ class Store {
return;
}
this._dbp = new Promise((resolve, reject) => {
const openreq = indexedDB.open(this._dbName, this._version);
const openreq = window.indexedDB.open(this._dbName, this._version);
openreq.onerror = () => reject(openreq.error);
openreq.onsuccess = () => resolve(openreq.result);
// First time setup: create an empty object store