about summary refs log tree commit diff
path: root/src/state/models/ui/shell.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/models/ui/shell.ts')
-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
   }