Compare commits
No commits in common. "04deb08bcf980e4aa131249a7a78d6d14d494a63" and "297af7b9053fc3c462e3c4ac101c008e1521e8ae" have entirely different histories.
04deb08bcf
...
297af7b905
|
@ -97,9 +97,6 @@ public class Preferences: Codable, ObservableObject {
|
|||
self.hideTrends = try container.decodeIfPresent(Bool.self, forKey: .hideTrends) ?? false
|
||||
|
||||
self.statusContentType = try container.decode(StatusContentType.self, forKey: .statusContentType)
|
||||
self.reportErrorsAutomatically = try container.decodeIfPresent(Bool.self, forKey: .reportErrorsAutomatically) ?? true
|
||||
let featureFlagNames = (try? container.decodeIfPresent([String].self, forKey: .enabledFeatureFlags)) ?? []
|
||||
self.enabledFeatureFlags = Set(featureFlagNames.compactMap(FeatureFlag.init))
|
||||
|
||||
self.hasShownLocalTimelineDescription = try container.decodeIfPresent(Bool.self, forKey: .hasShownLocalTimelineDescription) ?? false
|
||||
self.hasShownFederatedTimelineDescription = try container.decodeIfPresent(Bool.self, forKey: .hasShownFederatedTimelineDescription) ?? false
|
||||
|
@ -152,8 +149,6 @@ public class Preferences: Codable, ObservableObject {
|
|||
try container.encode(hideTrends, forKey: .hideTrends)
|
||||
|
||||
try container.encode(statusContentType, forKey: .statusContentType)
|
||||
try container.encode(reportErrorsAutomatically, forKey: .reportErrorsAutomatically)
|
||||
try container.encode(enabledFeatureFlags, forKey: .enabledFeatureFlags)
|
||||
|
||||
try container.encode(hasShownLocalTimelineDescription, forKey: .hasShownLocalTimelineDescription)
|
||||
try container.encode(hasShownFederatedTimelineDescription, forKey: .hasShownFederatedTimelineDescription)
|
||||
|
@ -218,7 +213,6 @@ public class Preferences: Codable, ObservableObject {
|
|||
// MARK: Advanced
|
||||
@Published public var statusContentType: StatusContentType = .plain
|
||||
@Published public var reportErrorsAutomatically = true
|
||||
@Published public var enabledFeatureFlags: Set<FeatureFlag> = []
|
||||
|
||||
// MARK:
|
||||
@Published public var hasShownLocalTimelineDescription = false
|
||||
|
@ -270,8 +264,6 @@ public class Preferences: Codable, ObservableObject {
|
|||
case hideTrends = "hideDiscover"
|
||||
|
||||
case statusContentType
|
||||
case reportErrorsAutomatically
|
||||
case enabledFeatureFlags
|
||||
|
||||
case hasShownLocalTimelineDescription
|
||||
case hasShownFederatedTimelineDescription
|
||||
|
@ -422,9 +414,3 @@ extension Preferences {
|
|||
case icloud
|
||||
}
|
||||
}
|
||||
|
||||
extension Preferences {
|
||||
public enum FeatureFlag: String, Codable {
|
||||
case test
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@ struct AdvancedPrefsView : View {
|
|||
@State private var imageCacheSize: Int64 = 0
|
||||
@State private var mastodonCacheSize: Int64 = 0
|
||||
@State private var cloudKitStatus: CKAccountStatus?
|
||||
@State private var isShowingFeatureFlagAlert = false
|
||||
@State private var featureFlagName = ""
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
|
@ -25,27 +23,9 @@ struct AdvancedPrefsView : View {
|
|||
cloudKitSection
|
||||
errorReportingSection
|
||||
cachingSection
|
||||
featureFlagSection
|
||||
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
||||
.onTapGesture(count: 3) {
|
||||
featureFlagName = ""
|
||||
isShowingFeatureFlagAlert = true
|
||||
}
|
||||
.alert("Enable Feature Flag", isPresented: $isShowingFeatureFlagAlert) {
|
||||
TextField("Name", text: $featureFlagName)
|
||||
.textInputAutocapitalization(.never)
|
||||
.autocorrectionDisabled()
|
||||
|
||||
Button("Cancel", role: .cancel) {}
|
||||
Button("Enable") {
|
||||
if let flag = Preferences.FeatureFlag(rawValue: featureFlagName) {
|
||||
preferences.enabledFeatureFlags.insert(flag)
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationBarTitle(Text("Advanced"))
|
||||
}
|
||||
|
||||
|
@ -168,31 +148,6 @@ struct AdvancedPrefsView : View {
|
|||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
var featureFlagSection: some View {
|
||||
if !preferences.enabledFeatureFlags.isEmpty {
|
||||
Section {
|
||||
ForEach(preferences.enabledFeatureFlags.map(\.rawValue).sorted(), id: \.self) { name in
|
||||
Text(verbatim: name)
|
||||
.contextMenu {
|
||||
Button(role: .destructive) {
|
||||
preferences.enabledFeatureFlags.remove(.init(rawValue: name)!)
|
||||
} label: {
|
||||
Label("Remove", systemImage: "trash")
|
||||
}
|
||||
}
|
||||
}
|
||||
.onDelete { indices in
|
||||
let sortedFlags = preferences.enabledFeatureFlags.sorted(by: { $0.rawValue < $1.rawValue })
|
||||
let removed = indices.map { sortedFlags[$0] }
|
||||
preferences.enabledFeatureFlags.subtract(removed)
|
||||
}
|
||||
} header: {
|
||||
Text("Feature Flags")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func clearCache() {
|
||||
for account in UserAccountsManager.shared.accounts {
|
||||
let controller = MastodonController.getForAccount(account)
|
||||
|
|
|
@ -21,7 +21,6 @@ enum UserActivityType: String {
|
|||
}
|
||||
|
||||
extension UserActivityType {
|
||||
@MainActor
|
||||
var handle: (UserActivityManager) -> @MainActor (NSUserActivity) -> Void {
|
||||
switch self {
|
||||
case .mainScene:
|
||||
|
|
Loading…
Reference in New Issue