Skip to content

Commit

Permalink
fix(ios): handle ios indexedDB preload
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf authored and tiensonqin committed Sep 1, 2022
1 parent fb98531 commit ba0a67a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions public/index.html
Expand Up @@ -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">
Expand Down
10 changes: 7 additions & 3 deletions src/main/frontend/handler.cljs
Expand Up @@ -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)))

Expand Down
1 change: 0 additions & 1 deletion src/main/frontend/handler/web/nfs.cljs
Expand Up @@ -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!
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/idbkv.js
Expand Up @@ -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
Expand Down

0 comments on commit ba0a67a

Please sign in to comment.