From b43309f0c3932e76703ef5c4c839c34a786110f7 Mon Sep 17 00:00:00 2001 From: Gaurav Chaudhary Date: Mon, 21 Sep 2026 19:51:15 +0000 Subject: [PATCH] Add native app shortcuts for common features (#604) --- android/app/src/main/AndroidManifest.xml | 4 ++ .../src/main/res/drawable/shortcut_inbox.xml | 27 +++++++++++ .../main/res/drawable/shortcut_messages.xml | 27 +++++++++++ .../src/main/res/drawable/shortcut_search.xml | 27 +++++++++++ .../src/main/res/drawable/shortcut_spaces.xml | 31 ++++++++++++ android/app/src/main/res/values/strings.xml | 4 ++ android/app/src/main/res/xml/shortcuts.xml | 47 +++++++++++++++++++ fdroid/prepare.mjs | 10 +++- ios/App/App/AppDelegate.swift | 39 +++++++++++++++ ios/App/App/Info.plist | 35 ++++++++++++++ src/routes/+layout.svelte | 31 +++++++++++- 11 files changed, 279 insertions(+), 3 deletions(-) create mode 100644 android/app/src/main/res/drawable/shortcut_inbox.xml create mode 100644 android/app/src/main/res/drawable/shortcut_messages.xml create mode 100644 android/app/src/main/res/drawable/shortcut_search.xml create mode 100644 android/app/src/main/res/drawable/shortcut_spaces.xml create mode 100644 android/app/src/main/res/xml/shortcuts.xml diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 257a04ad..b144b94b 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -38,6 +38,10 @@ + + + + + + + + + diff --git a/android/app/src/main/res/drawable/shortcut_messages.xml b/android/app/src/main/res/drawable/shortcut_messages.xml new file mode 100644 index 00000000..2655acb6 --- /dev/null +++ b/android/app/src/main/res/drawable/shortcut_messages.xml @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/shortcut_search.xml b/android/app/src/main/res/drawable/shortcut_search.xml new file mode 100644 index 00000000..8a38b863 --- /dev/null +++ b/android/app/src/main/res/drawable/shortcut_search.xml @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/shortcut_spaces.xml b/android/app/src/main/res/drawable/shortcut_spaces.xml new file mode 100644 index 00000000..04cad331 --- /dev/null +++ b/android/app/src/main/res/drawable/shortcut_spaces.xml @@ -0,0 +1,31 @@ + + + + + + + + + diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 088e07bf..0e50ef1d 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -5,4 +5,8 @@ social.flotilla social.flotilla flotilla_push + Messages + Search + Spaces + Inbox diff --git a/android/app/src/main/res/xml/shortcuts.xml b/android/app/src/main/res/xml/shortcuts.xml new file mode 100644 index 00000000..a32c9b6a --- /dev/null +++ b/android/app/src/main/res/xml/shortcuts.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + diff --git a/fdroid/prepare.mjs b/fdroid/prepare.mjs index e0258530..b6985d2b 100644 --- a/fdroid/prepare.mjs +++ b/fdroid/prepare.mjs @@ -1,9 +1,9 @@ import assert from "node:assert/strict" import {appendFile, cp, readFile, rm, writeFile} from "node:fs/promises" -const replace = async (file, pattern, replacement) => { +const replace = async (file, pattern, replacement, count = 1) => { const source = await readFile(file, "utf8") - assert.equal([...source.matchAll(pattern)].length, 1, `Expected one match in ${file}`) + assert.equal([...source.matchAll(pattern)].length, count, `Expected ${count} matches in ${file}`) await writeFile(file, source.replace(pattern, replacement)) } @@ -59,6 +59,12 @@ await replace( /\n {8}