mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
enhance(mobile): add ns frontend.mobile.flows
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"main": "static/electron.js",
|
||||
"engines" : {
|
||||
"node" : ">=20.19.1"
|
||||
"engines": {
|
||||
"node": ">=20.19.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@axe-core/playwright": "=4.4.4",
|
||||
@@ -108,6 +108,7 @@
|
||||
"@capacitor/haptics": "7.0.1",
|
||||
"@capacitor/ios": "7.2.0",
|
||||
"@capacitor/keyboard": "7.0.1",
|
||||
"@capacitor/network": "^7.0.1",
|
||||
"@capacitor/share": "7.0.1",
|
||||
"@capacitor/splash-screen": "7.0.1",
|
||||
"@capacitor/status-bar": "7.0.1",
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
"Main ns for handling mobile start"
|
||||
(:require ["@capacitor/app" :refer [^js App]]
|
||||
["@capacitor/keyboard" :refer [^js Keyboard]]
|
||||
["@capacitor/network" :refer [^js Network]]
|
||||
[frontend.handler.editor :as editor-handler]
|
||||
[frontend.mobile.deeplink :as deeplink]
|
||||
[frontend.mobile.flows :as mobile-flows]
|
||||
[frontend.mobile.intent :as intent]
|
||||
[frontend.mobile.util :as mobile-util]
|
||||
[frontend.state :as state]
|
||||
@@ -36,8 +38,10 @@
|
||||
#(intent/handle-received)))
|
||||
|
||||
(defn- app-state-change-handler
|
||||
"NOTE: don't add more logic in this listener, use mobile-flows instead"
|
||||
[^js state]
|
||||
(println :debug :app-state-change-handler state (js/Date.))
|
||||
(reset! mobile-flows/*mobile-app-state (.-isActive state))
|
||||
(when (state/get-current-repo)
|
||||
(let [is-active? (.-isActive state)]
|
||||
(when-not is-active?
|
||||
@@ -69,7 +73,8 @@
|
||||
(.addEventListener js/window "statusTap"
|
||||
#(util/scroll-to-top true))
|
||||
|
||||
(.addListener App "appStateChange" app-state-change-handler))
|
||||
(.addListener App "appStateChange" app-state-change-handler)
|
||||
(.addListener Network "networkStatusChange" #(reset! mobile-flows/*mobile-network-status %)))
|
||||
|
||||
(defn init! []
|
||||
(when (mobile-util/native-android?)
|
||||
|
||||
12
src/main/frontend/mobile/flows.cljs
Normal file
12
src/main/frontend/mobile/flows.cljs
Normal file
@@ -0,0 +1,12 @@
|
||||
(ns frontend.mobile.flows
|
||||
"common flows for mobile"
|
||||
(:require [missionary.core :as m]))
|
||||
|
||||
(def *mobile-network-status (atom nil))
|
||||
(def *mobile-app-state (atom nil))
|
||||
|
||||
(def mobile-network-status-flow
|
||||
(m/watch *mobile-network-status))
|
||||
|
||||
(def mobile-app-state
|
||||
(m/watch *mobile-app-state))
|
||||
@@ -274,6 +274,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@capacitor/keyboard/-/keyboard-7.0.1.tgz#edf212528cd1587494ceb1d260868c1a9540aed1"
|
||||
integrity sha512-Gi064vOARMac+x9/DmEFeywN9oAETMf3OYsMuYm9gA8SvdsDJ3QJqMoFnSEIORYXe21Jzt2SIEdLlpT65P/b2g==
|
||||
|
||||
"@capacitor/network@^7.0.1":
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@capacitor/network/-/network-7.0.1.tgz#8241ce6b6b5bbddc3157e218f31dd4ec04f1c4f0"
|
||||
integrity sha512-jKyhTUqegKHjHKkK8e3t0TgwAYpKb3ocYpZkJrB3uXL5figkG06UEhQE4Cp25Dfb4LIjDxTSDLLsDEteKarmyg==
|
||||
|
||||
"@capacitor/share@7.0.1":
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@capacitor/share/-/share-7.0.1.tgz#1d1e6d312504703c1f34fa0de94bed14af4bcbf8"
|
||||
|
||||
Reference in New Issue
Block a user