Răsfoiți Sursa

fix(mobile): quick add not in editor mode when app was killed

Tienson Qin 3 săptămâni în urmă
părinte
comite
9c49a42095

+ 1 - 0
ios/App/Podfile

@@ -24,6 +24,7 @@ def capacitor_pods
   pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share'
   pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
   pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
+  pod 'CapgoCapacitorNavigationBar', :path => '../../node_modules/@capgo/capacitor-navigation-bar'
   pod 'SendIntent', :path => '../../node_modules/send-intent'
   pod 'JcesarmobileSslSkip', :path => '../../node_modules/@jcesarmobile/ssl-skip'
 end

+ 7 - 1
ios/App/Podfile.lock

@@ -28,6 +28,8 @@ PODS:
     - Capacitor
   - CapacitorStatusBar (7.0.1):
     - Capacitor
+  - CapgoCapacitorNavigationBar (7.1.32):
+    - Capacitor
   - JcesarmobileSslSkip (0.4.0):
     - Capacitor
   - SendIntent (7.0.0):
@@ -49,6 +51,7 @@ DEPENDENCIES:
   - "CapacitorShare (from `../../node_modules/@capacitor/share`)"
   - "CapacitorSplashScreen (from `../../node_modules/@capacitor/splash-screen`)"
   - "CapacitorStatusBar (from `../../node_modules/@capacitor/status-bar`)"
+  - "CapgoCapacitorNavigationBar (from `../../node_modules/@capgo/capacitor-navigation-bar`)"
   - "JcesarmobileSslSkip (from `../../node_modules/@jcesarmobile/ssl-skip`)"
   - SendIntent (from `../../node_modules/send-intent`)
 
@@ -83,6 +86,8 @@ EXTERNAL SOURCES:
     :path: "../../node_modules/@capacitor/splash-screen"
   CapacitorStatusBar:
     :path: "../../node_modules/@capacitor/status-bar"
+  CapgoCapacitorNavigationBar:
+    :path: "../../node_modules/@capgo/capacitor-navigation-bar"
   JcesarmobileSslSkip:
     :path: "../../node_modules/@jcesarmobile/ssl-skip"
   SendIntent:
@@ -104,9 +109,10 @@ SPEC CHECKSUMS:
   CapacitorShare: 58d6c2da63b093e8693287b2d36db92435538435
   CapacitorSplashScreen: 19cd3573e57507e02d6f34597a8c421e00931487
   CapacitorStatusBar: 275cbf2f4dfc00388f519ef80c7ec22edda342c9
+  CapgoCapacitorNavigationBar: 028e6cc0f00357381c46edb7b0d7cd1cda73493b
   JcesarmobileSslSkip: b0f921e9d397a57f7983731209ca1ee244119c1f
   SendIntent: 1f4f65c7103eb423067c566682dfcda973b5fb29
 
-PODFILE CHECKSUM: cb9c70caa3eda97256a3dae9041478673def76cd
+PODFILE CHECKSUM: 00fbb7ba3788966b68cb8a5a6f2abc380d7b7b9a
 
 COCOAPODS: 1.16.2

+ 3 - 6
src/main/mobile/components/popup.cljs

@@ -7,7 +7,6 @@
             [logseq.shui.popup.core :as shui-popup]
             [logseq.shui.silkhq :as silkhq]
             [logseq.shui.ui :as shui]
-            [mobile.init :as init]
             [mobile.state :as mobile-state]
             [rum.core :as rum]))
 
@@ -75,16 +74,14 @@
         default-height (:default-height opts)]
 
     (when open?
-      (state/clear-edit!)
-      (init/keyboard-hide)
-
       (silkhq/bottom-sheet
        (merge
         {:presented (boolean open?)
          :onPresentedChange (fn [v?]
                               (when (false? v?)
-                                (js/setTimeout
-                                 #(mobile-state/set-popup! nil) 300)))}
+                                (state/pub-event! [:mobile/clear-edit])
+                                ;; allows closing animation
+                                (js/setTimeout #(mobile-state/set-popup! nil) 150)))}
         (:modal-props opts))
        (silkhq/bottom-sheet-portal
         (silkhq/bottom-sheet-view

+ 6 - 0
src/main/mobile/events.cljs

@@ -2,9 +2,15 @@
   "Mobile events"
   (:require [frontend.components.quick-add :as quick-add]
             [frontend.handler.events :as events]
+            [frontend.state :as state]
             [mobile.components.recorder :as recorder]
+            [mobile.init :as init]
             [mobile.state :as mobile-state]))
 
+(defmethod events/handle :mobile/clear-edit [_]
+  (state/clear-edit!)
+  (init/keyboard-hide))
+
 (defmethod events/handle :dialog/mobile-quick-add [_]
   (mobile-state/set-popup! {:open? true
                             :content-fn (fn []

+ 5 - 2
src/main/mobile/state.cljs

@@ -1,6 +1,7 @@
 (ns mobile.state
   "Mobile state"
-  (:require [frontend.rum :as r]))
+  (:require [frontend.rum :as r]
+            [frontend.state :as state]))
 
 (defonce *tab (atom "home"))
 (defn set-tab! [tab] (reset! *tab tab))
@@ -31,7 +32,9 @@
 (defonce *popup-data (atom nil))
 (defn set-popup!
   [data]
-  (reset! *popup-data data))
+  (reset! *popup-data data)
+  (when data
+    (state/pub-event! [:mobile/clear-edit])))
 
 (defn close-popup!
   []