diff --git a/Packages/TuskerPreferences/Sources/TuskerPreferences/Preferences.swift b/Packages/TuskerPreferences/Sources/TuskerPreferences/Preferences.swift index fe8422b9..5328bdb9 100644 --- a/Packages/TuskerPreferences/Sources/TuskerPreferences/Preferences.swift +++ b/Packages/TuskerPreferences/Sources/TuskerPreferences/Preferences.swift @@ -10,7 +10,7 @@ import UIKit import Pachyderm import Combine -public class Preferences: Codable, ObservableObject { +public final class Preferences: Codable, ObservableObject { public static var shared: Preferences = load() @@ -60,6 +60,7 @@ public class Preferences: Codable, ObservableObject { self.showLinkPreviews = try container.decodeIfPresent(Bool.self, forKey: .showLinkPreviews) ?? true self.leadingStatusSwipeActions = try container.decodeIfPresent([StatusSwipeAction].self, forKey: .leadingStatusSwipeActions) ?? leadingStatusSwipeActions self.trailingStatusSwipeActions = try container.decodeIfPresent([StatusSwipeAction].self, forKey: .trailingStatusSwipeActions) ?? trailingStatusSwipeActions + self.widescreenNavigationMode = try container.decodeIfPresent(WidescreenNavigationMode.self, forKey: .widescreenNavigationMode) ?? Self.defaultWidescreenNavigationMode self.defaultPostVisibility = try container.decode(Visibility.self, forKey: .defaultPostVisibility) self.defaultReplyVisibility = try container.decodeIfPresent(ReplyVisibility.self, forKey: .defaultReplyVisibility) ?? .sameAsPost @@ -119,6 +120,7 @@ public class Preferences: Codable, ObservableObject { try container.encode(showLinkPreviews, forKey: .showLinkPreviews) try container.encode(leadingStatusSwipeActions, forKey: .leadingStatusSwipeActions) try container.encode(trailingStatusSwipeActions, forKey: .trailingStatusSwipeActions) + try container.encode(widescreenNavigationMode, forKey: .widescreenNavigationMode) try container.encode(defaultPostVisibility, forKey: .defaultPostVisibility) try container.encode(defaultReplyVisibility, forKey: .defaultReplyVisibility) @@ -171,7 +173,8 @@ public class Preferences: Codable, ObservableObject { @Published public var showLinkPreviews = true @Published public var leadingStatusSwipeActions: [StatusSwipeAction] = [.favorite, .reblog] @Published public var trailingStatusSwipeActions: [StatusSwipeAction] = [.reply, .share] - @Published public var widescreenNavigationMode = WidescreenNavigationMode.multiColumn + private static var defaultWidescreenNavigationMode = WidescreenNavigationMode.splitScreen + @Published public var widescreenNavigationMode = Preferences.defaultWidescreenNavigationMode // MARK: Composing @Published public var defaultPostVisibility = Visibility.public @@ -241,6 +244,7 @@ public class Preferences: Codable, ObservableObject { case showLinkPreviews case leadingStatusSwipeActions case trailingStatusSwipeActions + case widescreenNavigationMode case defaultPostVisibility case defaultReplyVisibility