Compare commits
2 Commits
b4d41ac9b7
...
c85836eda6
Author | SHA1 | Date |
---|---|---|
Shadowfacts | c85836eda6 | |
Shadowfacts | 5076aec54e |
|
@ -9,7 +9,6 @@
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
0411610022B442870030A9B7 /* AttachmentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041160FE22B442870030A9B7 /* AttachmentViewController.swift */; };
|
0411610022B442870030A9B7 /* AttachmentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041160FE22B442870030A9B7 /* AttachmentViewController.swift */; };
|
||||||
0411610122B442870030A9B7 /* AttachmentViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 041160FF22B442870030A9B7 /* AttachmentViewController.xib */; };
|
0411610122B442870030A9B7 /* AttachmentViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 041160FF22B442870030A9B7 /* AttachmentViewController.xib */; };
|
||||||
0427033622B30B3D000D31B6 /* Preference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0427033522B30B3D000D31B6 /* Preference.swift */; };
|
|
||||||
0427033822B30F5F000D31B6 /* BehaviorPrefsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0427033722B30F5F000D31B6 /* BehaviorPrefsView.swift */; };
|
0427033822B30F5F000D31B6 /* BehaviorPrefsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0427033722B30F5F000D31B6 /* BehaviorPrefsView.swift */; };
|
||||||
0427033A22B31269000D31B6 /* AdvancedPrefsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0427033922B31269000D31B6 /* AdvancedPrefsView.swift */; };
|
0427033A22B31269000D31B6 /* AdvancedPrefsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0427033922B31269000D31B6 /* AdvancedPrefsView.swift */; };
|
||||||
0427037C22B316B9000D31B6 /* SilentActionPrefs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0427037B22B316B9000D31B6 /* SilentActionPrefs.swift */; };
|
0427037C22B316B9000D31B6 /* SilentActionPrefs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0427037B22B316B9000D31B6 /* SilentActionPrefs.swift */; };
|
||||||
|
@ -269,7 +268,6 @@
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
041160FE22B442870030A9B7 /* AttachmentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentViewController.swift; sourceTree = "<group>"; };
|
041160FE22B442870030A9B7 /* AttachmentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentViewController.swift; sourceTree = "<group>"; };
|
||||||
041160FF22B442870030A9B7 /* AttachmentViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AttachmentViewController.xib; sourceTree = "<group>"; };
|
041160FF22B442870030A9B7 /* AttachmentViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AttachmentViewController.xib; sourceTree = "<group>"; };
|
||||||
0427033522B30B3D000D31B6 /* Preference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preference.swift; sourceTree = "<group>"; };
|
|
||||||
0427033722B30F5F000D31B6 /* BehaviorPrefsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BehaviorPrefsView.swift; sourceTree = "<group>"; };
|
0427033722B30F5F000D31B6 /* BehaviorPrefsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BehaviorPrefsView.swift; sourceTree = "<group>"; };
|
||||||
0427033922B31269000D31B6 /* AdvancedPrefsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedPrefsView.swift; sourceTree = "<group>"; };
|
0427033922B31269000D31B6 /* AdvancedPrefsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedPrefsView.swift; sourceTree = "<group>"; };
|
||||||
0427037B22B316B9000D31B6 /* SilentActionPrefs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SilentActionPrefs.swift; sourceTree = "<group>"; };
|
0427037B22B316B9000D31B6 /* SilentActionPrefs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SilentActionPrefs.swift; sourceTree = "<group>"; };
|
||||||
|
@ -876,7 +874,6 @@
|
||||||
children = (
|
children = (
|
||||||
D663626121360B1900C9CBA2 /* Preferences.swift */,
|
D663626121360B1900C9CBA2 /* Preferences.swift */,
|
||||||
D663626321360D2300C9CBA2 /* AvatarStyle.swift */,
|
D663626321360D2300C9CBA2 /* AvatarStyle.swift */,
|
||||||
0427033522B30B3D000D31B6 /* Preference.swift */,
|
|
||||||
D6DD353C22F28CD000A9563A /* ContentWarningCopyMode.swift */,
|
D6DD353C22F28CD000A9563A /* ContentWarningCopyMode.swift */,
|
||||||
D6DD353E22F502EC00A9563A /* Preferences+Notification.swift */,
|
D6DD353E22F502EC00A9563A /* Preferences+Notification.swift */,
|
||||||
D6BC9DB4232D4CE3002CA326 /* NotificationsMode.swift */,
|
D6BC9DB4232D4CE3002CA326 /* NotificationsMode.swift */,
|
||||||
|
@ -1606,7 +1603,6 @@
|
||||||
D6C693EF216192C2007D6A6D /* TuskerNavigationDelegate.swift in Sources */,
|
D6C693EF216192C2007D6A6D /* TuskerNavigationDelegate.swift in Sources */,
|
||||||
D6C94D872139E62700CB5196 /* LargeImageViewController.swift in Sources */,
|
D6C94D872139E62700CB5196 /* LargeImageViewController.swift in Sources */,
|
||||||
D6434EB3215B1856001A919A /* XCBRequest.swift in Sources */,
|
D6434EB3215B1856001A919A /* XCBRequest.swift in Sources */,
|
||||||
0427033622B30B3D000D31B6 /* Preference.swift in Sources */,
|
|
||||||
D663626221360B1900C9CBA2 /* Preferences.swift in Sources */,
|
D663626221360B1900C9CBA2 /* Preferences.swift in Sources */,
|
||||||
D6333B792139AEFD00CE884A /* Date+TimeAgo.swift in Sources */,
|
D6333B792139AEFD00CE884A /* Date+TimeAgo.swift in Sources */,
|
||||||
D641C77F213DC78A004B4513 /* InlineTextAttachment.swift in Sources */,
|
D641C77F213DC78A004B4513 /* InlineTextAttachment.swift in Sources */,
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
// Preference.swift
|
|
||||||
// Tusker
|
|
||||||
//
|
|
||||||
// Created by Shadowfacts on 6/13/19.
|
|
||||||
// Copyright © 2019 Shadowfacts. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
@propertyWrapper
|
|
||||||
struct Preference<Value> {
|
|
||||||
let path: WritableKeyPath<Preferences, Value>
|
|
||||||
let binding: Binding<Value>
|
|
||||||
|
|
||||||
init(_ path: WritableKeyPath<Preferences, Value>) {
|
|
||||||
self.path = path
|
|
||||||
self.binding = Binding(get: {
|
|
||||||
return Preferences.shared[keyPath: path]
|
|
||||||
}, set: { (newValue) in
|
|
||||||
Preferences.shared[keyPath: path] = newValue
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var wrappedValue: Value {
|
|
||||||
get {
|
|
||||||
return Preferences.shared[keyPath: path]
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
Preferences.shared[keyPath: path] = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@propertyWrapper
|
|
||||||
struct MappedPreference<Value, PrefValue> {
|
|
||||||
let path: WritableKeyPath<Preferences, PrefValue>
|
|
||||||
let fromPref: (PrefValue) -> Value
|
|
||||||
let toPref: (Value) -> PrefValue
|
|
||||||
let binding: Binding<Value>
|
|
||||||
|
|
||||||
init(_ path: WritableKeyPath<Preferences, PrefValue>, fromPref: @escaping (PrefValue) -> Value, toPref: @escaping (Value) -> PrefValue) {
|
|
||||||
self.path = path
|
|
||||||
self.fromPref = fromPref
|
|
||||||
self.toPref = toPref
|
|
||||||
self.binding = Binding(get: {
|
|
||||||
return fromPref(Preferences.shared[keyPath: path])
|
|
||||||
}, set: { (newValue) in
|
|
||||||
Preferences.shared[keyPath: path] = toPref(newValue)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var wrappedValue: Value {
|
|
||||||
get {
|
|
||||||
return fromPref(Preferences.shared[keyPath: path])
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
Preferences.shared[keyPath: path] = toPref(newValue)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -46,6 +46,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
self.automaticallySaveDrafts = try container.decode(Bool.self, forKey: .automaticallySaveDrafts)
|
self.automaticallySaveDrafts = try container.decode(Bool.self, forKey: .automaticallySaveDrafts)
|
||||||
self.contentWarningCopyMode = try container.decode(ContentWarningCopyMode.self, forKey: .contentWarningCopyMode)
|
self.contentWarningCopyMode = try container.decode(ContentWarningCopyMode.self, forKey: .contentWarningCopyMode)
|
||||||
self.openLinksInApps = try container.decode(Bool.self, forKey: .openLinksInApps)
|
self.openLinksInApps = try container.decode(Bool.self, forKey: .openLinksInApps)
|
||||||
|
self.useInAppSafari = try container.decode(Bool.self, forKey: .useInAppSafari)
|
||||||
|
self.inAppSafariAutomaticReaderMode = try container.decode(Bool.self, forKey: .inAppSafariAutomaticReaderMode)
|
||||||
|
|
||||||
self.showFavoriteAndReblogCounts = try container.decode(Bool.self, forKey: .showFavoriteAndReblogCounts)
|
self.showFavoriteAndReblogCounts = try container.decode(Bool.self, forKey: .showFavoriteAndReblogCounts)
|
||||||
self.defaultNotificationsMode = try container.decode(NotificationsMode.self, forKey: .defaultNotificationsType)
|
self.defaultNotificationsMode = try container.decode(NotificationsMode.self, forKey: .defaultNotificationsType)
|
||||||
|
@ -65,6 +67,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
try container.encode(automaticallySaveDrafts, forKey: .automaticallySaveDrafts)
|
try container.encode(automaticallySaveDrafts, forKey: .automaticallySaveDrafts)
|
||||||
try container.encode(contentWarningCopyMode, forKey: .contentWarningCopyMode)
|
try container.encode(contentWarningCopyMode, forKey: .contentWarningCopyMode)
|
||||||
try container.encode(openLinksInApps, forKey: .openLinksInApps)
|
try container.encode(openLinksInApps, forKey: .openLinksInApps)
|
||||||
|
try container.encode(useInAppSafari, forKey: .useInAppSafari)
|
||||||
|
try container.encode(inAppSafariAutomaticReaderMode, forKey: .inAppSafariAutomaticReaderMode)
|
||||||
|
|
||||||
try container.encode(showFavoriteAndReblogCounts, forKey: .showFavoriteAndReblogCounts)
|
try container.encode(showFavoriteAndReblogCounts, forKey: .showFavoriteAndReblogCounts)
|
||||||
try container.encode(defaultNotificationsMode, forKey: .defaultNotificationsType)
|
try container.encode(defaultNotificationsMode, forKey: .defaultNotificationsType)
|
||||||
|
@ -73,9 +77,6 @@ class Preferences: Codable, ObservableObject {
|
||||||
try container.encode(statusContentType, forKey: .statusContentType)
|
try container.encode(statusContentType, forKey: .statusContentType)
|
||||||
}
|
}
|
||||||
|
|
||||||
typealias ObjectWillChangePublisher = PassthroughSubject<Preferences, Never>
|
|
||||||
let objectWillChange = PassthroughSubject<Preferences, Never>()
|
|
||||||
|
|
||||||
// MARK: - Appearance
|
// MARK: - Appearance
|
||||||
@Published var showRepliesInProfiles = false
|
@Published var showRepliesInProfiles = false
|
||||||
@Published var avatarStyle = AvatarStyle.roundRect
|
@Published var avatarStyle = AvatarStyle.roundRect
|
||||||
|
@ -86,6 +87,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
@Published var automaticallySaveDrafts = true
|
@Published var automaticallySaveDrafts = true
|
||||||
@Published var contentWarningCopyMode = ContentWarningCopyMode.asIs
|
@Published var contentWarningCopyMode = ContentWarningCopyMode.asIs
|
||||||
@Published var openLinksInApps = true
|
@Published var openLinksInApps = true
|
||||||
|
@Published var useInAppSafari = true
|
||||||
|
@Published var inAppSafariAutomaticReaderMode = false
|
||||||
|
|
||||||
// MARK: - Digital Wellness
|
// MARK: - Digital Wellness
|
||||||
@Published var showFavoriteAndReblogCounts = true
|
@Published var showFavoriteAndReblogCounts = true
|
||||||
|
@ -104,6 +107,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
case automaticallySaveDrafts
|
case automaticallySaveDrafts
|
||||||
case contentWarningCopyMode
|
case contentWarningCopyMode
|
||||||
case openLinksInApps
|
case openLinksInApps
|
||||||
|
case useInAppSafari
|
||||||
|
case inAppSafariAutomaticReaderMode
|
||||||
|
|
||||||
case showFavoriteAndReblogCounts
|
case showFavoriteAndReblogCounts
|
||||||
case defaultNotificationsType
|
case defaultNotificationsType
|
||||||
|
|
|
@ -9,8 +9,8 @@ import SwiftUI
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
|
|
||||||
struct AdvancedPrefsView : View {
|
struct AdvancedPrefsView : View {
|
||||||
@Preference(\.statusContentType) var statusContentType: StatusContentType
|
@ObservedObject var preferences = Preferences.shared
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
formattingSection
|
formattingSection
|
||||||
|
@ -25,7 +25,7 @@ struct AdvancedPrefsView : View {
|
||||||
|
|
||||||
var formattingSection: some View {
|
var formattingSection: some View {
|
||||||
Section(footer: formattingFooter) {
|
Section(footer: formattingFooter) {
|
||||||
Picker(selection: _statusContentType.binding, label: Text("Post Content Type")) {
|
Picker(selection: $preferences.statusContentType, label: Text("Post Content Type")) {
|
||||||
ForEach(StatusContentType.allCases, id: \.self) { type in
|
ForEach(StatusContentType.allCases, id: \.self) { type in
|
||||||
Text(type.displayName).tag(type)
|
Text(type.displayName).tag(type)
|
||||||
}//.navigationBarTitle("Post Content Type")
|
}//.navigationBarTitle("Post Content Type")
|
||||||
|
|
|
@ -8,21 +8,23 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct AppearancePrefsView : View {
|
struct AppearancePrefsView : View {
|
||||||
@Preference(\.showRepliesInProfiles) var showRepliesInProfiles: Bool
|
@ObservedObject var preferences = Preferences.shared
|
||||||
@Preference(\.hideCustomEmojiInUsernames) var hideCustomEmojiInUsernames: Bool
|
|
||||||
|
var useCircularAvatars: Binding<Bool> = Binding(get: {
|
||||||
@MappedPreference(\.avatarStyle, fromPref: { $0 == .circle }, toPref: { $0 ? .circle : .roundRect })
|
Preferences.shared.avatarStyle == .circle
|
||||||
var useCircularAvatars: Bool
|
}) {
|
||||||
|
Preferences.shared.avatarStyle = $0 ? .circle : .roundRect
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
Toggle(isOn: _showRepliesInProfiles.binding) {
|
Toggle(isOn: $preferences.showRepliesInProfiles) {
|
||||||
Text("Show Replies in Profiles")
|
Text("Show Replies in Profiles")
|
||||||
}
|
}
|
||||||
Toggle(isOn: _useCircularAvatars.binding) {
|
Toggle(isOn: useCircularAvatars) {
|
||||||
Text("Use Circular Avatars")
|
Text("Use Circular Avatars")
|
||||||
}
|
}
|
||||||
Toggle(isOn: _hideCustomEmojiInUsernames.binding) {
|
Toggle(isOn: $preferences.hideCustomEmojiInUsernames) {
|
||||||
Text("Hide Custom Emoji in Usernames")
|
Text("Hide Custom Emoji in Usernames")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,9 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
|
|
||||||
struct BehaviorPrefsView : View {
|
struct BehaviorPrefsView: View {
|
||||||
@Preference(\.defaultPostVisibility) var defaultPostVisibility: Status.Visibility
|
@ObservedObject var preferences = Preferences.shared
|
||||||
@Preference(\.automaticallySaveDrafts) var automaticallySaveDrafts: Bool
|
|
||||||
@Preference(\.contentWarningCopyMode) var contentWarningCopyMode: ContentWarningCopyMode
|
|
||||||
@Preference(\.openLinksInApps) var openLinksInApps: Bool
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
section1
|
section1
|
||||||
|
@ -24,7 +21,7 @@ struct BehaviorPrefsView : View {
|
||||||
|
|
||||||
var section1: some View {
|
var section1: some View {
|
||||||
Section(header: Text("COMPOSING")) {
|
Section(header: Text("COMPOSING")) {
|
||||||
Picker(selection: _defaultPostVisibility.binding, label: Text("Default Post Visibility")) {
|
Picker(selection: $preferences.defaultPostVisibility, label: Text("Default Post Visibility")) {
|
||||||
ForEach(Status.Visibility.allCases, id: \.self) { visibility in
|
ForEach(Status.Visibility.allCases, id: \.self) { visibility in
|
||||||
HStack {
|
HStack {
|
||||||
Image(systemName: visibility.imageName)
|
Image(systemName: visibility.imageName)
|
||||||
|
@ -34,10 +31,10 @@ struct BehaviorPrefsView : View {
|
||||||
}//.navigationBarTitle("Default Post Visibility")
|
}//.navigationBarTitle("Default Post Visibility")
|
||||||
// navbar title on the ForEach is currently incorrectly applied when the picker is not expanded, see FB6838291
|
// navbar title on the ForEach is currently incorrectly applied when the picker is not expanded, see FB6838291
|
||||||
}
|
}
|
||||||
Toggle(isOn: _automaticallySaveDrafts.binding) {
|
Toggle(isOn: $preferences.automaticallySaveDrafts) {
|
||||||
Text("Automatically Save Drafts")
|
Text("Automatically Save Drafts")
|
||||||
}
|
}
|
||||||
Picker(selection: _contentWarningCopyMode.binding, label: Text("Content Warning Copy Style")) {
|
Picker(selection: $preferences.contentWarningCopyMode, label: Text("Content Warning Copy Style")) {
|
||||||
Text("As-is").tag(ContentWarningCopyMode.asIs)
|
Text("As-is").tag(ContentWarningCopyMode.asIs)
|
||||||
Text("Prepend 're: '").tag(ContentWarningCopyMode.prependRe)
|
Text("Prepend 're: '").tag(ContentWarningCopyMode.prependRe)
|
||||||
Text("Don't copy").tag(ContentWarningCopyMode.doNotCopy)
|
Text("Don't copy").tag(ContentWarningCopyMode.doNotCopy)
|
||||||
|
@ -47,9 +44,15 @@ struct BehaviorPrefsView : View {
|
||||||
|
|
||||||
var section2: some View {
|
var section2: some View {
|
||||||
Section(header: Text("READING")) {
|
Section(header: Text("READING")) {
|
||||||
Toggle(isOn: _openLinksInApps.binding) {
|
Toggle(isOn: $preferences.openLinksInApps) {
|
||||||
Text("Open Links in Apps")
|
Text("Open Links in Apps")
|
||||||
}
|
}
|
||||||
|
Toggle(isOn: $preferences.useInAppSafari) {
|
||||||
|
Text("Use In-App Safari")
|
||||||
|
}
|
||||||
|
Toggle(isOn: $preferences.inAppSafariAutomaticReaderMode) {
|
||||||
|
Text("Always Use Reader Mode in In-App Safari")
|
||||||
|
}.disabled(!preferences.useInAppSafari)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,8 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct WellnessPrefsView: View {
|
struct WellnessPrefsView: View {
|
||||||
@Preference(\.showFavoriteAndReblogCounts) var showFavoriteAndReblogCounts: Bool
|
@ObservedObject var preferences = Preferences.shared
|
||||||
@Preference(\.defaultNotificationsMode) var defaultNotificationsMode: NotificationsMode
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
showFavAndReblogCountSection
|
showFavAndReblogCountSection
|
||||||
|
@ -22,7 +21,7 @@ struct WellnessPrefsView: View {
|
||||||
|
|
||||||
var showFavAndReblogCountSection: some View {
|
var showFavAndReblogCountSection: some View {
|
||||||
Section(footer: showFavAndReblogCountFooter) {
|
Section(footer: showFavAndReblogCountFooter) {
|
||||||
Toggle(isOn: _showFavoriteAndReblogCounts.binding) {
|
Toggle(isOn: $preferences.showFavoriteAndReblogCounts) {
|
||||||
Text("Show Favorite and Reblog Counts")
|
Text("Show Favorite and Reblog Counts")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +33,7 @@ struct WellnessPrefsView: View {
|
||||||
|
|
||||||
var notificationsModeSection: some View {
|
var notificationsModeSection: some View {
|
||||||
Section(footer: notificationsModeFooter) {
|
Section(footer: notificationsModeFooter) {
|
||||||
Picker(selection: _defaultNotificationsMode.binding, label: Text("Default Notifications Mode")) {
|
Picker(selection: $preferences.defaultNotificationsMode, label: Text("Default Notifications Mode")) {
|
||||||
ForEach(NotificationsMode.allCases, id: \.self) { type in
|
ForEach(NotificationsMode.allCases, id: \.self) { type in
|
||||||
Text(type.displayName).tag(type)
|
Text(type.displayName).tag(type)
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,14 +74,24 @@ extension TuskerNavigationDelegate where Self: UIViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
func selected(url: URL) {
|
func selected(url: URL) {
|
||||||
|
func openSafari() {
|
||||||
|
if Preferences.shared.useInAppSafari {
|
||||||
|
let config = SFSafariViewController.Configuration()
|
||||||
|
config.entersReaderIfAvailable = Preferences.shared.inAppSafariAutomaticReaderMode
|
||||||
|
present(SFSafariViewController(url: url, configuration: config), animated: true)
|
||||||
|
} else {
|
||||||
|
UIApplication.shared.open(url, options: [:])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Preferences.shared.openLinksInApps) {
|
if (Preferences.shared.openLinksInApps) {
|
||||||
UIApplication.shared.open(url, options: [.universalLinksOnly: true]) { (success) in
|
UIApplication.shared.open(url, options: [.universalLinksOnly: true]) { (success) in
|
||||||
if (!success) {
|
if (!success) {
|
||||||
self.present(SFSafariViewController(url: url), animated: true)
|
openSafari()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
present(SFSafariViewController(url: url), animated: true)
|
openSafari()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue