From cb5488dcaa313b329a43c1e7f65246bd972005fc Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 15 Apr 2024 09:50:49 -0400 Subject: [PATCH] Reorganize preference keys to match Preferences --- .../Keys/AppearanceKeys.swift | 12 +++++++++++ .../TuskerPreferences/Keys/MediaKeys.swift | 20 ------------------- .../TuskerPreferences/PreferenceStore.swift | 16 +++++++-------- 3 files changed, 19 insertions(+), 29 deletions(-) delete mode 100644 Packages/TuskerPreferences/Sources/TuskerPreferences/Keys/MediaKeys.swift diff --git a/Packages/TuskerPreferences/Sources/TuskerPreferences/Keys/AppearanceKeys.swift b/Packages/TuskerPreferences/Sources/TuskerPreferences/Keys/AppearanceKeys.swift index d84a53f9..a535fcd2 100644 --- a/Packages/TuskerPreferences/Sources/TuskerPreferences/Keys/AppearanceKeys.swift +++ b/Packages/TuskerPreferences/Sources/TuskerPreferences/Keys/AppearanceKeys.swift @@ -31,3 +31,15 @@ struct TrailingSwipeActionsKey: PreferenceKey { struct WidescreenNavigationModeKey: PreferenceKey { static var defaultValue: WidescreenNavigationMode { .splitScreen } } + +struct AttachmentBlurModeKey: PreferenceKey { + static var defaultValue: AttachmentBlurMode { .useStatusSetting } + + static func didSet(in store: PreferenceStore, newValue: AttachmentBlurMode) { + if newValue == .always { + store.blurMediaBehindContentWarning = true + } else if newValue == .never { + store.blurMediaBehindContentWarning = false + } + } +} diff --git a/Packages/TuskerPreferences/Sources/TuskerPreferences/Keys/MediaKeys.swift b/Packages/TuskerPreferences/Sources/TuskerPreferences/Keys/MediaKeys.swift deleted file mode 100644 index f7c3d548..00000000 --- a/Packages/TuskerPreferences/Sources/TuskerPreferences/Keys/MediaKeys.swift +++ /dev/null @@ -1,20 +0,0 @@ -// -// MediaKeys.swift -// TuskerPreferences -// -// Created by Shadowfacts on 4/13/24. -// - -import Foundation - -struct AttachmentBlurModeKey: PreferenceKey { - static var defaultValue: AttachmentBlurMode { .useStatusSetting } - - static func didSet(in store: PreferenceStore, newValue: AttachmentBlurMode) { - if newValue == .always { - store.blurMediaBehindContentWarning = true - } else if newValue == .never { - store.blurMediaBehindContentWarning = false - } - } -} diff --git a/Packages/TuskerPreferences/Sources/TuskerPreferences/PreferenceStore.swift b/Packages/TuskerPreferences/Sources/TuskerPreferences/PreferenceStore.swift index fd74cc3a..a3a52f06 100644 --- a/Packages/TuskerPreferences/Sources/TuskerPreferences/PreferenceStore.swift +++ b/Packages/TuskerPreferences/Sources/TuskerPreferences/PreferenceStore.swift @@ -25,7 +25,13 @@ public final class PreferenceStore: ObservableObject, Codable { @Preference public var widescreenNavigationMode @Preference public var underlineTextLinks @Preference public var showAttachmentsInTimeline - + @Preference public var attachmentBlurMode + @Preference public var blurMediaBehindContentWarning + @Preference public var automaticallyPlayGifs + @Preference public var showUncroppedMediaInline + @Preference public var showAttachmentBadges + @Preference public var attachmentAltBadgeInverted + // MARK: Composing @Preference public var defaultPostVisibility @Preference public var defaultReplyVisibility @@ -34,14 +40,6 @@ public final class PreferenceStore: ObservableObject, Codable { @Preference public var mentionReblogger @Preference public var useTwitterKeyboard - // MARK: Media - @Preference public var attachmentBlurMode - @Preference public var blurMediaBehindContentWarning - @Preference public var automaticallyPlayGifs - @Preference public var showUncroppedMediaInline - @Preference public var showAttachmentBadges - @Preference public var attachmentAltBadgeInverted - // MARK: Behavior @Preference public var openLinksInApps @Preference public var useInAppSafari