Add option to start in-app browser in reader view. (#619)

* Add option to start in-app browser in reader view

localizations

* Disable toggle instead of hiding it
This commit is contained in:
Peter-Josef Meisch 2023-02-03 07:04:00 +01:00 committed by GitHub
parent 5621b243a0
commit e79b39f952
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 28 additions and 5 deletions

View file

@ -46,23 +46,25 @@ private struct SafariRouter: ViewModifier {
return .systemAction
}
presentedURL = url
return .handled
}
}
.sheet(item: $presentedURL, content: { url in
SafariView(url: url)
SafariView(url: url, inAppBrowserReaderView: preferences.inAppBrowserReaderView)
.edgesIgnoringSafeArea(.all)
})
}
struct SafariView: UIViewControllerRepresentable {
let url: URL
let inAppBrowserReaderView: Bool
func makeUIViewController(context _: UIViewControllerRepresentableContext<SafariView>) -> SFSafariViewController {
let safari = SFSafariViewController(url: url)
let configuration = SFSafariViewController.Configuration()
configuration.entersReaderIfAvailable = inAppBrowserReaderView
let safari = SFSafariViewController(url: url, configuration: configuration)
safari.preferredBarTintColor = UIColor(Theme.shared.primaryBackgroundColor)
safari.preferredControlTintColor = UIColor(Theme.shared.tintColor)
return safari

View file

@ -129,6 +129,10 @@ struct SettingsTabs: View {
} label: {
Label("settings.general.browser", systemImage: "network")
}
Toggle(isOn: $preferences.inAppBrowserReaderView) {
Label("settings.general.browser.in-app.readerview", systemImage: "doc.plaintext")
}
.disabled(preferences.preferredBrowser != PreferredBrowser.inAppSafari)
}
Toggle(isOn: $preferences.isOpenAIEnabled) {
Label("settings.other.hide-openai", systemImage: "faxmachine")

View file

@ -74,6 +74,7 @@
"settings.general.browser" = "Navegador";
"settings.general.browser.in-app" = "Navegador integrat";
"settings.general.browser.system" = "Navegador del sistema";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.display" = "Configuració d'aparença";
"settings.general.instance" = "Informació de la instància";
"settings.general.push-notifications" = "Notificacions emergents";

View file

@ -74,6 +74,7 @@
"settings.display.theme.systemColor" = "Systemeinstellung verwenden";
"settings.general.browser" = "Browser";
"settings.general.browser.in-app" = "In-App-Browser";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "Systembrowser";
"settings.general.display" = "Anzeigeeinstellungen";
"settings.general.instance" = "Instanz-Informationen";

View file

@ -78,6 +78,7 @@
"settings.display.theme.systemColor" = "Match System";
"settings.general.browser" = "Browser";
"settings.general.browser.in-app" = "In-App Browser";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "System Browser";
"settings.general.display" = "Display Settings";
"settings.general.instance" = "Instance Information";

View file

@ -78,6 +78,7 @@
"settings.display.theme.systemColor" = "Match System";
"settings.general.browser" = "Browser";
"settings.general.browser.in-app" = "In-App Browser";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "System Browser";
"settings.general.display" = "Display Settings";
"settings.general.instance" = "Instance Information";

View file

@ -74,6 +74,7 @@
"settings.display.theme.systemColor" = "Sistema de coincidencia";
"settings.general.browser" = "Navegador";
"settings.general.browser.in-app" = "Interno";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "Sistema";
"settings.general.display" = "Ajustes de apariencia";
"settings.general.instance" = "Información de la instancia";

View file

@ -74,6 +74,7 @@
"settings.display.theme.systemColor" = "Correspondre au système";
"settings.general.browser" = "Navigateur";
"settings.general.browser.in-app" = "Navigateur intégré";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "Navigateur système";
"settings.general.display" = "Paramètres d'affichage";
"settings.general.instance" = "Information sur l'instance";

View file

@ -75,6 +75,7 @@
"settings.general.browser" = "Browser";
"settings.general.browser.in-app" = "In-App Browser";
"settings.general.browser.system" = "Browser di sistema";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.display" = "Impostazioni di visualizzazione";
"settings.general.instance" = "Informazioni sull'istanza";
"settings.general.push-notifications" = "Notifiche";

View file

@ -78,6 +78,7 @@
"settings.display.theme.systemColor" = "システムに合わせる";
"settings.general.browser" = "ブラウザ";
"settings.general.browser.in-app" = "アプリ内ブラウザ";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "システムブラウザ";
"settings.general.display" = "表示設定";
"settings.general.instance" = "インスタンス情報";

View file

@ -74,6 +74,7 @@
"settings.display.theme.systemColor" = "시스템 설정에 맞추기";
"settings.general.browser" = "브라우저";
"settings.general.browser.in-app" = "인 앱 브라우저";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "시스템 기본 브라우저";
"settings.general.display" = "화면 설정";
"settings.general.instance" = "인스턴스 정보";

View file

@ -78,6 +78,7 @@
"settings.display.theme.systemColor" = "Match system";
"settings.general.browser" = "Nettleser";
"settings.general.browser.in-app" = "Nettleser i appen";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "Systemnettleser";
"settings.general.display" = "Visningsinnstillinger";
"settings.general.instance" = "Instansinformasjon";

View file

@ -74,6 +74,7 @@
"settings.display.theme.systemColor" = "Automatisch";
"settings.general.browser" = "Browser";
"settings.general.browser.in-app" = "In-app";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "Systeem";
"settings.general.display" = "Weergaveopties";
"settings.general.instance" = "Instantie-informatie";

View file

@ -74,6 +74,7 @@
"settings.display.theme.systemColor" = "Zgodny z systemowym";
"settings.general.browser" = "Przeglądarka";
"settings.general.browser.in-app" = "W aplikacji";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "Systemowa";
"settings.general.display" = "Ustawienia ekranu";
"settings.general.instance" = "Informacja o serwerze";

View file

@ -74,6 +74,7 @@
"settings.display.theme.systemColor" = "Padrão do Sistema";
"settings.general.browser" = "Navegador";
"settings.general.browser.in-app" = "Navegador do App";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "Navegador do sistema";
"settings.general.display" = "Exibir configurações";
"settings.general.instance" = "Informação da Instância";

View file

@ -75,6 +75,7 @@
"settings.general.browser" = "Tarayıcı";
"settings.general.browser.in-app" = "Uygulama İçi Tarayıcı";
"settings.general.browser.system" = "Sistem Tarayıcısı";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.display" = "Gösterim Ayarları";
"settings.general.instance" = "Oluşum Bilgisi";
"settings.general.push-notifications" = "İleti Bildirimleri";

View file

@ -74,6 +74,7 @@
"settings.display.theme.systemColor" = "匹配系统";
"settings.general.browser" = "默认浏览器";
"settings.general.browser.in-app" = "应用内浏览器";
"settings.general.browser.in-app.readerview" = "In-App Browser Reader View";
"settings.general.browser.system" = "系统浏览器";
"settings.general.display" = "显示设置";
"settings.general.instance" = "服务器设置";

View file

@ -30,6 +30,8 @@ public class UserPreferences: ObservableObject {
@AppStorage("suppress_dupe_reblogs") public var suppressDupeReblogs: Bool = false
@AppStorage("inAppBrowserReaderView") public var inAppBrowserReaderView = false
public var postVisibility: Models.Visibility {
if useInstanceContentSettings {
return serverPreferences?.postVisibility ?? .pub