From d32c5c004c687f153a9de0e1d507a74af7709c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Clouet?= Date: Sun, 1 Oct 2023 09:24:37 +0200 Subject: [PATCH] Added the ability to display the Pending/Unread button at bottom of the screen for bigger displays or smaller hands (#1595) --- IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift | 2 +- .../Resources/Localization/be.lproj/Localizable.strings | 1 + .../Resources/Localization/ca.lproj/Localizable.strings | 1 + .../Resources/Localization/de.lproj/Localizable.strings | 1 + .../Resources/Localization/en-GB.lproj/Localizable.strings | 1 + .../Resources/Localization/en.lproj/Localizable.strings | 1 + .../Resources/Localization/es.lproj/Localizable.strings | 1 + .../Resources/Localization/eu.lproj/Localizable.strings | 1 + .../Resources/Localization/fr.lproj/Localizable.strings | 1 + .../Resources/Localization/it.lproj/Localizable.strings | 1 + .../Resources/Localization/ja.lproj/Localizable.strings | 1 + .../Resources/Localization/ko.lproj/Localizable.strings | 1 + .../Resources/Localization/nb.lproj/Localizable.strings | 1 + .../Resources/Localization/nl.lproj/Localizable.strings | 1 + .../Resources/Localization/pl.lproj/Localizable.strings | 1 + .../Resources/Localization/pt-BR.lproj/Localizable.strings | 1 + .../Resources/Localization/tr.lproj/Localizable.strings | 1 + .../Resources/Localization/uk.lproj/Localizable.strings | 1 + .../Localization/zh-Hans.lproj/Localizable.strings | 1 + .../Localization/zh-Hant.lproj/Localizable.strings | 1 + Packages/Env/Sources/Env/UserPreferences.swift | 7 +++++++ .../Sources/Timeline/PendingStatusesObserver.swift | 3 ++- 22 files changed, 29 insertions(+), 2 deletions(-) diff --git a/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift b/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift index 260e0535..dee6ead0 100644 --- a/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift +++ b/IceCubesApp/App/Tabs/Settings/DisplaySettingsView.swift @@ -197,13 +197,13 @@ struct DisplaySettingsView: View { Text(buttonStyle.description).tag(buttonStyle) } } - Picker("settings.display.status.media-style", selection: $theme.statusDisplayStyle) { ForEach(Theme.StatusDisplayStyle.allCases, id: \.rawValue) { buttonStyle in Text(buttonStyle.description).tag(buttonStyle) } } Toggle("settings.display.translate-button", isOn: $userPreferences.showTranslateButton) + Toggle("settings.display.pending-at-bottom", isOn: $userPreferences.pendingShownAtBottom) } .listRowBackground(theme.primaryBackgroundColor) } diff --git a/IceCubesApp/Resources/Localization/be.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/be.lproj/Localizable.strings index 3ce1bb70..9f4ca2e6 100644 --- a/IceCubesApp/Resources/Localization/be.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/be.lproj/Localizable.strings @@ -91,6 +91,7 @@ "settings.display.status.action-buttons" = "Кнопкі дзеянняў стану"; "settings.display.status.media-style" = "Медыястыль статусу"; "settings.display.translate-button" = "Паказаць кнопку перакладу"; +"settings.display.pending-at-bottom" = "Кнопка «Паказаць непрачытаныя» ўнізе экрана"; "settings.display.theme.background" = "Колер фону"; "settings.display.theme.secondary-background" = "Другасны колер фону"; "settings.display.theme.text-color" = "Text Color"; diff --git a/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings index 408b7eda..c4c5fffd 100644 --- a/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ca.lproj/Localizable.strings @@ -85,6 +85,7 @@ "settings.display.status.action-buttons" = "Botons d'acció"; "settings.display.status.media-style" = "Estil del contingut multimèdia"; "settings.display.translate-button" = "Mostra el botó de traducció"; +"settings.display.pending-at-bottom" = "Mostra el botó no llegit a la part inferior de la pantalla"; "settings.display.theme.background" = "Color de fons"; "settings.display.theme.secondary-background" = "Color de fons secundari"; "settings.display.theme.text-color" = "Text Color"; diff --git a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings index c36cd927..4a2764bd 100644 --- a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings @@ -86,6 +86,7 @@ "settings.display.status.action-buttons" = "Status Aktions-Buttons"; "settings.display.status.media-style" = "Status Medien"; "settings.display.translate-button" = "Übersetzen-Button anzeigen"; +"settings.display.pending-at-bottom" = "Ungelesene-Button am unteren Rand anzeigen"; "settings.display.theme.background" = "Hintergrundfarbe"; "settings.display.theme.secondary-background" = "Sekundäre Hintergrundfarbe"; "settings.display.theme.text-color" = "Textfarbe"; diff --git a/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings index 4569f855..f53c3daf 100644 --- a/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/en-GB.lproj/Localizable.strings @@ -91,6 +91,7 @@ "settings.display.status.action-buttons" = "Status Action Buttons"; "settings.display.status.media-style" = "Status Media Style"; "settings.display.translate-button" = "Show Translate Button"; +"settings.display.pending-at-bottom" = "Show Pending Button at Bottom"; "settings.display.theme.background" = "Background Colour"; "settings.display.theme.secondary-background" = "Secondary Background Colour"; "settings.display.theme.text-color" = "Text Color"; diff --git a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings index cfdb1433..76ec3861 100644 --- a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings @@ -91,6 +91,7 @@ "settings.display.status.action-buttons" = "Status Action Buttons"; "settings.display.status.media-style" = "Status Media Style"; "settings.display.translate-button" = "Show Translate Button"; +"settings.display.pending-at-bottom" = "Show Pending Button at Bottom"; "settings.display.theme.background" = "Background Color"; "settings.display.theme.secondary-background" = "Secondary Background Color"; "settings.display.theme.text-color" = "Text Color"; diff --git a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings index b96d2ff4..19c75c78 100644 --- a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings @@ -86,6 +86,7 @@ "settings.display.status.action-buttons" = "Botones de acción"; "settings.display.status.media-style" = "Estilo del contenido multimedia"; "settings.display.translate-button" = "Mostrar botón para traducir"; +"settings.display.pending-at-bottom" = "Mostrar el botón de no leído en la parte inferior de la pantalla"; "settings.display.theme.background" = "Color de fondo"; "settings.display.theme.secondary-background" = "Color de fondo secundario"; "settings.display.theme.text-color" = "Color del texto"; diff --git a/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings index 7dce35d9..acac3638 100644 --- a/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/eu.lproj/Localizable.strings @@ -86,6 +86,7 @@ "settings.display.status.action-buttons" = "Bidalketen ekintza botoiak"; "settings.display.status.media-style" = "Bidalketen multimediaren itxura"; "settings.display.translate-button" = "Erakutsi itzulpen botoia"; +"settings.display.pending-at-bottom" = "Erakutsi irakurri gabeko botoia pantailaren behealdean"; "settings.display.theme.background" = "Hondoaren kolorea"; "settings.display.theme.secondary-background" = "Bigarren mailako hondoaren kolorea"; "settings.display.theme.text-color" = "Testuaren kolorea"; diff --git a/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings index 80241a6a..6f71ce2c 100644 --- a/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/fr.lproj/Localizable.strings @@ -86,6 +86,7 @@ "settings.display.status.action-buttons" = "Boutons d'action de statut"; "settings.display.status.media-style" = "Style de média de statut"; "settings.display.translate-button" = "Afficher le bouton de traduction"; +"settings.display.pending-at-bottom" = "Afficher le bouton des toots non lus en bas de l'écran"; "settings.display.theme.background" = "Couleur de fond"; "settings.display.theme.secondary-background" = "Couleur de fond secondaire"; "settings.display.theme.text-color" = "Couleur du texte"; diff --git a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings index d3b6adc0..8b4af5cd 100644 --- a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings @@ -85,6 +85,7 @@ "settings.display.status.action-buttons" = "Pulsanti di azione"; "settings.display.status.media-style" = "Stile dei media"; "settings.display.translate-button" = "Mostra pulsante per la traduzione"; +"settings.display.pending-at-bottom" = "Visualizzare non letto nella parte inferiore dello schermo"; "settings.display.theme.background" = "Colore sfondo principale"; "settings.display.theme.secondary-background" = "Colore sfondo secondario"; "settings.display.theme.text-color" = "Colore del testo"; diff --git a/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings index 3d4ea991..615c35bf 100644 --- a/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ja.lproj/Localizable.strings @@ -91,6 +91,7 @@ "settings.display.status.action-buttons" = "アクションボタン"; "settings.display.status.media-style" = "メディアスタイル"; "settings.display.translate-button" = "翻訳ボタンの表示"; +"settings.display.pending-at-bottom" = "画面下に未読ボタンを表示する"; "settings.display.theme.background" = "バックグラウンドカラー"; "settings.display.theme.secondary-background" = "アクセントカラー"; "settings.display.theme.text-color" = "テキストカラー"; diff --git a/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings index 0db2e360..c7360f5c 100644 --- a/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/ko.lproj/Localizable.strings @@ -86,6 +86,7 @@ "settings.display.status.action-buttons" = "글 동작 버튼"; "settings.display.status.media-style" = "글 미디어 크기"; "settings.display.translate-button" = "번역 버튼 표시"; +"settings.display.pending-at-bottom" = "화면 하단에 읽지 않은 버튼 표시"; "settings.display.theme.background" = "배경 색상"; "settings.display.theme.secondary-background" = "보조 배경 색상"; "settings.display.theme.text-color" = "글자 색상"; diff --git a/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings index 7d8087e5..cef02c0b 100644 --- a/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/nb.lproj/Localizable.strings @@ -91,6 +91,7 @@ "settings.display.status.action-buttons" = "Status handlingsknapper"; "settings.display.status.media-style" = "Status mediestil"; "settings.display.translate-button" = "Vis oversettelsesknapp"; +"settings.display.pending-at-bottom" = "Vis ulest-knappen nederst på skjermen"; "settings.display.theme.background" = "Bakgrunnsfarge"; "settings.display.theme.secondary-background" = "Sekundær bakgrunnsfarge"; "settings.display.theme.text-color" = "Tekstfarge"; diff --git a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings index 33516c4a..3b2ed51f 100644 --- a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings @@ -86,6 +86,7 @@ "settings.display.status.action-buttons" = "Actieknoppen"; "settings.display.status.media-style" = "Mediastijl"; "settings.display.translate-button" = "Toon vertaalknop"; +"settings.display.pending-at-bottom" = "De knop Ongelezen onder aan het scherm weergeven"; "settings.display.theme.background" = "Achtergrondkleur"; "settings.display.theme.secondary-background" = "Secundaire achtergrondkleur"; "settings.display.theme.text-color" = "Tekstkleur"; diff --git a/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings index a1a342dc..5155d1bf 100644 --- a/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/pl.lproj/Localizable.strings @@ -86,6 +86,7 @@ "settings.display.status.action-buttons" = "Przyciski akcji"; "settings.display.status.media-style" = "Treści multimedialne"; "settings.display.translate-button" = "Pokazuj przycisk tłumaczenia"; +"settings.display.pending-at-bottom" = "Wyświetlanie przycisku nieprzeczytanych u dołu ekranu"; "settings.display.theme.background" = "Kolor tła"; "settings.display.theme.secondary-background" = "Dodatkowy kolor tła"; "settings.display.theme.text-color" = "Kolor tekstu"; diff --git a/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings index 36ba7247..0083f827 100644 --- a/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/pt-BR.lproj/Localizable.strings @@ -86,6 +86,7 @@ "settings.display.status.action-buttons" = "Botões de ação de status"; "settings.display.status.media-style" = "Estilo de mídia de status"; "settings.display.translate-button" = "Exibir botão de tradução"; +"settings.display.pending-at-bottom" = "Exibir o botão não lido na parte inferior da tela"; "settings.display.theme.background" = "Cor de fundo"; "settings.display.theme.secondary-background" = "Cor de fundo secundária"; "settings.display.theme.text-color" = "Cor do texto"; diff --git a/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings index 5a57f493..14d3b959 100644 --- a/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/tr.lproj/Localizable.strings @@ -86,6 +86,7 @@ "settings.display.status.action-buttons" = "Durum Aksiyon Butonları"; "settings.display.status.media-style" = "Durum Medya Stili"; "settings.display.translate-button" = "Çeviri Butonunu Göster"; +"settings.display.pending-at-bottom" = "Ekranın alt kısmında okunmamış düğmesini görüntüleyin"; "settings.display.theme.background" = "Arka Plan Rengi"; "settings.display.theme.secondary-background" = "İkincil Arka Plan Rengi"; "settings.display.theme.text-color" = "Text Color"; diff --git a/IceCubesApp/Resources/Localization/uk.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/uk.lproj/Localizable.strings index 77924f03..cc03f250 100644 --- a/IceCubesApp/Resources/Localization/uk.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/uk.lproj/Localizable.strings @@ -91,6 +91,7 @@ "settings.display.status.action-buttons" = "Кнопки дій статуса"; "settings.display.status.media-style" = "Стиль медія статуса"; "settings.display.translate-button" = "Відображати кнопку перекладу"; +"settings.display.pending-at-bottom" = "Показати непрочитану кнопку внизу екрана"; "settings.display.theme.background" = "Колір фону"; "settings.display.theme.secondary-background" = "Додатковий колір фону"; "settings.display.theme.text-color" = "Колір тексту"; diff --git a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings index 697e8c05..25566bc6 100644 --- a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings @@ -86,6 +86,7 @@ "settings.display.status.action-buttons" = "操作栏样式"; "settings.display.status.media-style" = "媒体内容排列"; "settings.display.translate-button" = "显示翻译按钮"; +"settings.display.pending-at-bottom" = "在屏幕底部显示未读按钮"; "settings.display.theme.background" = "背景颜色"; "settings.display.theme.secondary-background" = "二级背景颜色"; "settings.display.theme.text-color" = "文本颜色"; diff --git a/IceCubesApp/Resources/Localization/zh-Hant.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/zh-Hant.lproj/Localizable.strings index 1609e6cb..98a508cb 100644 --- a/IceCubesApp/Resources/Localization/zh-Hant.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/zh-Hant.lproj/Localizable.strings @@ -91,6 +91,7 @@ "settings.display.status.action-buttons" = "狀態列按鈕"; "settings.display.status.media-style" = "狀態媒體式樣"; "settings.display.translate-button" = "顯示翻譯按紐"; +"settings.display.pending-at-bottom" = "在螢幕底部顯示未讀按鈕"; "settings.display.theme.background" = "背景顏色"; "settings.display.theme.secondary-background" = "第二背景顏色"; "settings.display.theme.text-color" = "本文顏色"; diff --git a/Packages/Env/Sources/Env/UserPreferences.swift b/Packages/Env/Sources/Env/UserPreferences.swift index 8987cb3b..b300bcb9 100644 --- a/Packages/Env/Sources/Env/UserPreferences.swift +++ b/Packages/Env/Sources/Env/UserPreferences.swift @@ -9,6 +9,7 @@ import SwiftUI class Storage { @AppStorage("preferred_browser") public var preferredBrowser: PreferredBrowser = .inAppSafari @AppStorage("show_translate_button_inline") public var showTranslateButton: Bool = true + @AppStorage("show_pending_at_bottom") public var pendingShownAtBottom: Bool = false @AppStorage("is_open_ai_enabled") public var isOpenAIEnabled: Bool = true @AppStorage("recently_used_languages") public var recentlyUsedLanguages: [String] = [] @@ -72,6 +73,11 @@ import SwiftUI storage.showTranslateButton = showTranslateButton } } + public var pendingShownAtBottom : Bool { + didSet { + storage.pendingShownAtBottom = pendingShownAtBottom + } + } public var isOpenAIEnabled: Bool { didSet { storage.isOpenAIEnabled = isOpenAIEnabled @@ -392,5 +398,6 @@ import SwiftUI requestedReview = storage.requestedReview collapseLongPosts = storage.collapseLongPosts shareButtonBehavior = storage.shareButtonBehavior + pendingShownAtBottom = storage.pendingShownAtBottom } } diff --git a/Packages/Timeline/Sources/Timeline/PendingStatusesObserver.swift b/Packages/Timeline/Sources/Timeline/PendingStatusesObserver.swift index c358672e..e64a8ebb 100644 --- a/Packages/Timeline/Sources/Timeline/PendingStatusesObserver.swift +++ b/Packages/Timeline/Sources/Timeline/PendingStatusesObserver.swift @@ -29,7 +29,7 @@ import SwiftUI struct PendingStatusesObserverView: View { @State var observer: PendingStatusesObserver - + @Environment(UserPreferences.self) private var preferences var body: some View { if observer.pendingStatusesCount > 0 { HStack(spacing: 6) { @@ -48,6 +48,7 @@ struct PendingStatusesObserverView: View { .cornerRadius(8) } .padding(12) + .frame(maxHeight: .infinity, alignment: preferences.pendingShownAtBottom ? .bottom : .top ) } } }