From 0c163659913f1d9d02cd8b5e45913846f2039c96 Mon Sep 17 00:00:00 2001 From: Jake Anto <64896514+jake-anto@users.noreply.github.com> Date: Tue, 8 Oct 2024 02:03:14 +0530 Subject: [PATCH] Prefer native apps over PWA (#27254) --- app/serializers/manifest_serializer.rb | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/app/serializers/manifest_serializer.rb b/app/serializers/manifest_serializer.rb index cf0164c24a..3496f329f8 100644 --- a/app/serializers/manifest_serializer.rb +++ b/app/serializers/manifest_serializer.rb @@ -8,7 +8,8 @@ class ManifestSerializer < ActiveModel::Serializer attributes :id, :name, :short_name, :icons, :theme_color, :background_color, :display, :start_url, :scope, - :share_target, :shortcuts + :share_target, :shortcuts, + :prefer_related_applications, :related_applications def id # This is set to `/home` because that was the old value of `start_url` and @@ -89,4 +90,28 @@ class ManifestSerializer < ActiveModel::Serializer }, ] end + + def prefer_related_applications + true + end + + def related_applications + [ + { + platform: 'play', + url: 'https://play.google.com/store/apps/details?id=org.joinmastodon.android', + id: 'org.joinmastodon.android', + }, + { + platform: 'itunes', + url: 'https://apps.apple.com/us/app/mastodon-for-iphone/id1571998974', + id: 'id1571998974', + }, + { + platform: 'f-droid', + url: 'https://f-droid.org/en/packages/org.joinmastodon.android/', + id: 'org.joinmastodon.android', + }, + ] + end end