about summary refs log tree commit diff
path: root/src/state/models/ui
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-04-22 17:14:20 -0500
committerGitHub <noreply@github.com>2023-04-22 17:14:20 -0500
commitd35f7c1f1a9f35958ff3f6dacd002e31b0a824b0 (patch)
tree6d69c883ef34fb3593d42641d25e421222e21635 /src/state/models/ui
parenteb6b36be61b38d2dab799d8f82b6f65645b9e3f6 (diff)
downloadvoidsky-d35f7c1f1a9f35958ff3f6dacd002e31b0a824b0.tar.zst
Android fixes (#515)
* Fix profile screen performance on android and remove dead code

* Correctly handle android hardware back btn

* Fix EditProfile modal for android

* Fix lint
Diffstat (limited to 'src/state/models/ui')
-rw-r--r--src/state/models/ui/shell.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/state/models/ui/shell.ts b/src/state/models/ui/shell.ts
index 6c58262d8..a2891d9bb 100644
--- a/src/state/models/ui/shell.ts
+++ b/src/state/models/ui/shell.ts
@@ -194,6 +194,30 @@ export class ShellUiModel {
     this.minimalShellMode = v
   }
 
+  /**
+   * returns true if something was closed
+   * (used by the android hardware back btn)
+   */
+  closeAnyActiveElement(): boolean {
+    if (this.isLightboxActive) {
+      this.closeLightbox()
+      return true
+    }
+    if (this.isModalActive) {
+      this.closeModal()
+      return true
+    }
+    if (this.isComposerActive) {
+      this.closeComposer()
+      return true
+    }
+    if (this.isDrawerOpen) {
+      this.closeDrawer()
+      return true
+    }
+    return false
+  }
+
   openDrawer() {
     this.isDrawerOpen = true
   }