Add setting to control share button default behavior (#1421)

* Add setting to control share button default behavior

This adds a setting to control the behavior of the share button on the status row actions view.
Currently, it always shares the link to the post as well as the post text.
In iOS 16.4, Apple added iMessage unfurling for Mastodon URLs.
When sharing posts from Ice Cubes via iMessage, this leads to the recipient seeing two copies of the post: one from the unfurled link and one from Ice Cubes including the post text.
Users will now have the option to exclude the post text from their sharing.
This is easier than tapping the 3-dots button on the post (which is kind of small) and then expanding the Share menu in the context menu, which is the other way to access this functionality at the
moment.

The default value for the new option will be "Link and Text", which is the current behavior - so we won't change the behavior on existing users.

* Add new strings to other language localizations
This commit is contained in:
Nathan Reed 2023-06-26 05:45:14 -04:00 committed by GitHub
parent eb2222cc11
commit ffe9e7a714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 122 additions and 8 deletions

View File

@ -27,6 +27,16 @@ struct ContentSettingsView: View {
Text("settings.content.media.show.alt")
}
}.listRowBackground(theme.primaryBackgroundColor)
Section("settings.content.sharing") {
Picker("settings.content.sharing.share-button-behavior", selection: $userPreferences.shareButtonBehavior) {
ForEach(PreferredShareButtonBehavior.allCases, id: \.rawValue) { option in
Text(option.title)
.tag(option)
}
}
}
.listRowBackground(theme.primaryBackgroundColor)
Section("settings.content.instance-settings") {
Toggle(isOn: $userPreferences.useInstanceContentSettings) {

View File

@ -130,6 +130,10 @@
"settings.content.media.show.alt" = "Паказваць альт. тэкст";
"settings.content.reading" = "Чытанне";
"settings.content.posting" = "Размяшчэнне допісаў";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "Паказаць усе";
"enum.expand-media.hide" = "Схаваць усе";
"enum.expand-media.hide-sensitive" = "Хаваць уражлівыя допісы";

View File

@ -124,6 +124,10 @@
"settings.content.media.show.alt" = "Show ALT texts";
"settings.content.reading" = "Llegint";
"settings.content.posting" = "Publicant";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "Mostra-ho tot";
"enum.expand-media.hide" = "Oculta-ho tot";
"enum.expand-media.hide-sensitive" = "Amaga el contingut sensible";

View File

@ -164,6 +164,10 @@
"settings.content.media.show.alt" = "ALT-Texte zeigen";
"settings.content.reading" = "Lesen";
"settings.content.posting" = "Schreiben";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"settings.push.duplicate.title" = "Doppelte-Mitteilungen-Korrigierer";
"settings.push.duplicate.footer" = "Bekommst du doppelte Mitteilungen? Probier diesen magischen Knopf aus";
"settings.push.duplicate.button.fix" = "🪄 Beheben";

View File

@ -131,6 +131,10 @@
"settings.content.media.show.alt" = "Show ALT Texts";
"settings.content.reading" = "Reading";
"settings.content.posting" = "Posting";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "Show All";
"enum.expand-media.hide" = "Hide All";
"enum.expand-media.hide-sensitive" = "Hide Sensitive";

View File

@ -130,6 +130,10 @@
"settings.content.media.show.alt" = "Show ALT Texts";
"settings.content.reading" = "Reading";
"settings.content.posting" = "Posting";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "Show All";
"enum.expand-media.hide" = "Hide All";
"enum.expand-media.hide-sensitive" = "Hide Sensitive";

View File

@ -164,6 +164,10 @@
"settings.content.media.show.alt" = "Mostrar texto ALT";
"settings.content.reading" = "Leyendo";
"settings.content.posting" = "Publicando";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"settings.push.duplicate.title" = "Arreglar notificaciones duplicadas";
"settings.push.duplicate.footer" = "¿Recibes notificaciones por duplicado? Usa este botón mágico para arreglarlo";
"settings.push.duplicate.button.fix" = "🪄 Arréglalo";

View File

@ -164,6 +164,10 @@
"settings.content.media.show.alt" = "Erakutsi deskribapenak";
"settings.content.reading" = "Irakurtzean";
"settings.content.posting" = "Bidaltzean";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"settings.push.duplicate.title" = "Bikoiztutako jakinarazpenen konpontzailea";
"settings.push.duplicate.footer" = "Jakinarazpenak birritan jasotzen al dituzu? Sakatu botoi magikoa arazoa konpontzeko";
"settings.push.duplicate.button.fix" = "🪄 Konpondu";

View File

@ -125,6 +125,10 @@
"settings.content.media.show.alt" = "Montrer les textes ALT";
"settings.content.reading" = "Lecture";
"settings.content.posting" = "Publication";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "Afficher tout";
"enum.expand-media.hide" = "Masquer tout";
"enum.expand-media.hide-sensitive" = "Masquer sensible";

View File

@ -163,6 +163,10 @@
"settings.content.media.show.alt" = "Mostra i testi alternativi";
"settings.content.reading" = "Lettura";
"settings.content.posting" = "Composizione";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "Mostra tutti";
"enum.expand-media.hide" = "Nascondi tutti";
"enum.expand-media.hide-sensitive" = "Nascondi sensibili";

View File

@ -130,6 +130,10 @@
"settings.content.media.show.alt" = "注釈を表示";
"settings.content.reading" = "リーディング";
"settings.content.posting" = "ポスティング";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "全て表示";
"enum.expand-media.hide" = "全て隠す";
"enum.expand-media.hide-sensitive" = "センシティブなものは隠す";

View File

@ -125,6 +125,10 @@
"settings.content.media.show.alt" = "미디어 설명 버튼 표시";
"settings.content.reading" = "읽을 때";
"settings.content.posting" = "올릴 때";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "모두 표시하기";
"enum.expand-media.hide" = "모두 가리기";
"enum.expand-media.hide-sensitive" = "민감한 미디어만 가리기";

View File

@ -130,6 +130,10 @@
"settings.content.media.show.alt" = "Show ALT texts";
"settings.content.reading" = "Lesing";
"settings.content.posting" = "Innlegg";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "Vis alle";
"enum.expand-media.hide" = "Skjul alle";
"enum.expand-media.hide-sensitive" = "Skjul sensitive";

View File

@ -164,6 +164,10 @@
"settings.content.media.show.alt" = "Toon ALT-teksten";
"settings.content.reading" = "Lezen";
"settings.content.posting" = "Posten";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"settings.push.duplicate.title" = "Dubbele meldingen";
"settings.push.duplicate.footer" = "Ontvang je dubbele meldingen? Gebruik deze magische knop om dit probleem te verhelpen";
"settings.push.duplicate.button.fix" = "🪄 Los op";

View File

@ -125,6 +125,10 @@
"settings.content.media.show.alt" = "Pokazuj alternatywny tekst";
"settings.content.reading" = "Czytanie postów";
"settings.content.posting" = "Wysyłanie postów";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "Pokazuj wszystkie";
"enum.expand-media.hide" = "Ukryj wszystkie";
"enum.expand-media.hide-sensitive" = "Ukryj wrażliwe";

View File

@ -125,6 +125,10 @@
"settings.content.media.show.alt" = "Mostrar textos ALT";
"settings.content.reading" = "Lendo";
"settings.content.posting" = "Postagem";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "Exibir Todas";
"enum.expand-media.hide" = "Esconder Todas";
"enum.expand-media.hide-sensitive" = "Ocultar Sensível";

View File

@ -125,6 +125,10 @@
"settings.content.media.show.alt" = "Show ALT texts";
"settings.content.reading" = "Reading";
"settings.content.posting" = "Posting";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "Show All";
"enum.expand-media.hide" = "Hide All";
"enum.expand-media.hide-sensitive" = "Hide Sensitive";

View File

@ -130,6 +130,10 @@
"settings.content.media.show.alt" = "Показати ALT тексти";
"settings.content.reading" = "Читання";
"settings.content.posting" = "Публікація";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "Відобразити все";
"enum.expand-media.hide" = "Приховати все";
"enum.expand-media.hide-sensitive" = "Приховувати вміст, позначений як делікатний";

View File

@ -165,6 +165,10 @@
"settings.content.media.show.alt" = "显示图片描述";
"settings.content.reading" = "阅读设置";
"settings.content.posting" = "发布设置";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"settings.push.duplicate.title" = "重复推送通知修复器";
"settings.push.duplicate.footer" = "有收到重复的推送通知?试试用这个魔法按钮去修复吧";

View File

@ -130,6 +130,10 @@
"settings.content.media.show.alt" = "顯示圖片描述";
"settings.content.reading" = "閱讀";
"settings.content.posting" = "發表";
"settings.content.sharing" = "Sharing";
"settings.content.sharing.share-button-behavior" = "Share Button Behavior";
"settings.content.sharing.share-behavior.link-only" = "Link Only";
"settings.content.sharing.share-behavior.link-and-text" = "Link and Text";
"enum.expand-media.show" = "全部顯示";
"enum.expand-media.hide" = "全部隱藏";
"enum.expand-media.hide-sensitive" = "隱藏敏感題材";

View File

@ -0,0 +1,14 @@
import Foundation
import SwiftUI
public enum PreferredShareButtonBehavior: Int, CaseIterable, Codable {
case linkOnly
case linkAndText
public var title: LocalizedStringKey {
switch self {
case .linkOnly: return "settings.content.sharing.share-behavior.link-only"
case .linkAndText: return "settings.content.sharing.share-behavior.link-and-text"
}
}
}

View File

@ -53,6 +53,8 @@ public class UserPreferences: ObservableObject {
@AppStorage("requested_review") public var requestedReview = false
@AppStorage("collapse-long-posts") public var collapseLongPosts = true
@AppStorage("share-button-behavior") public var shareButtonBehavior: PreferredShareButtonBehavior = .linkAndText
public enum SwipeActionsIconStyle: String, CaseIterable {
case iconWithText, iconOnly

View File

@ -8,6 +8,7 @@ struct StatusRowActionsView: View {
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var currentAccount: CurrentAccount
@EnvironmentObject private var statusDataController: StatusDataController
@EnvironmentObject private var userPreferences: UserPreferences
@ObservedObject var viewModel: StatusRowViewModel
func privateBoost() -> Bool {
@ -121,15 +122,26 @@ struct StatusRowActionsView: View {
if let urlString = viewModel.finalStatus.url,
let url = URL(string: urlString)
{
ShareLink(item: url,
subject: Text(viewModel.finalStatus.account.safeDisplayName),
message: Text(viewModel.finalStatus.content.asRawText))
{
action.image(dataController: statusDataController)
switch userPreferences.shareButtonBehavior {
case .linkOnly:
ShareLink(item: url)
{
action.image(dataController: statusDataController)
}
.buttonStyle(.statusAction())
.accessibilityElement(children: .combine)
.accessibilityLabel("status.action.share-link")
case .linkAndText:
ShareLink(item: url,
subject: Text(viewModel.finalStatus.account.safeDisplayName),
message: Text(viewModel.finalStatus.content.asRawText))
{
action.image(dataController: statusDataController)
}
.buttonStyle(.statusAction())
.accessibilityElement(children: .combine)
.accessibilityLabel("status.action.share-link")
}
.buttonStyle(.statusAction())
.accessibilityElement(children: .combine)
.accessibilityLabel("status.action.share-link")
}
} else {
actionButton(action: action)