diff --git a/Mastodon/Scene/Settings/General Settings/GeneralSettingToggleTableViewCell.swift b/Mastodon/Scene/Settings/General Settings/GeneralSettingToggleTableViewCell.swift index 061e68661..fd431b23b 100644 --- a/Mastodon/Scene/Settings/General Settings/GeneralSettingToggleTableViewCell.swift +++ b/Mastodon/Scene/Settings/General Settings/GeneralSettingToggleTableViewCell.swift @@ -3,7 +3,7 @@ import UIKit import MastodonAsset -protocol GeneralSettingToggleCellDelegate: AnyObject { +protocol GeneralSettingToggleTableViewCellDelegate: AnyObject { func toggle(_ cell: GeneralSettingToggleTableViewCell, setting: GeneralSetting, isOn: Bool) } @@ -12,7 +12,7 @@ class GeneralSettingToggleTableViewCell: ToggleTableViewCell { return "GeneralSettingToggleCell" } - weak var delegate: GeneralSettingToggleCellDelegate? + weak var delegate: GeneralSettingToggleTableViewCellDelegate? var setting: GeneralSetting? override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { diff --git a/Mastodon/Scene/Settings/General Settings/GeneralSettings.swift b/Mastodon/Scene/Settings/General Settings/GeneralSettings.swift index b3eb3ed13..5e0c4b466 100644 --- a/Mastodon/Scene/Settings/General Settings/GeneralSettings.swift +++ b/Mastodon/Scene/Settings/General Settings/GeneralSettings.swift @@ -15,7 +15,6 @@ enum GeneralSettingsSectionType: Hashable { var sectionTitle: String { switch self { - //TODO: @zeitschlag Localization case .appearance: return L10n.Scene.Settings.General.Appearance.sectionTitle case .design: diff --git a/Mastodon/Scene/Settings/General Settings/GeneralSettingsViewController.swift b/Mastodon/Scene/Settings/General Settings/GeneralSettingsViewController.swift index 824cbab3a..0f5b13626 100644 --- a/Mastodon/Scene/Settings/General Settings/GeneralSettingsViewController.swift +++ b/Mastodon/Scene/Settings/General Settings/GeneralSettingsViewController.swift @@ -144,7 +144,7 @@ extension GeneralSettingsViewController: UITableViewDelegate { } } -extension GeneralSettingsViewController: GeneralSettingToggleCellDelegate { +extension GeneralSettingsViewController: GeneralSettingToggleTableViewCellDelegate { func toggle(_ cell: GeneralSettingToggleTableViewCell, setting: GeneralSetting, isOn: Bool) { switch setting { case .appearance(_), .openLinksIn(_): diff --git a/MastodonSDK/Sources/CoreDataStack/Entity/App/Setting.swift b/MastodonSDK/Sources/CoreDataStack/Entity/App/Setting.swift index 3950bd2c6..e42be0ffd 100644 --- a/MastodonSDK/Sources/CoreDataStack/Entity/App/Setting.swift +++ b/MastodonSDK/Sources/CoreDataStack/Entity/App/Setting.swift @@ -55,17 +55,10 @@ extension Setting { property: Property ) -> Setting { let setting: Setting = context.insertObject() -// setting.appearanceRaw = property.appearanceRaw setting.domain = property.domain setting.userID = property.userID return setting } - -// public func update(appearanceRaw: String) { -// guard appearanceRaw != self.appearanceRaw else { return } -// self.appearanceRaw = appearanceRaw -// didUpdate(at: Date()) -// } public func update(preferredStaticAvatar: Bool) { guard preferredStaticAvatar != self.preferredStaticAvatar else { return } @@ -95,16 +88,13 @@ extension Setting { public struct Property { public let domain: String public let userID: String -// public let appearanceRaw: String public init( domain: String, userID: String -// appearanceRaw: String ) { self.domain = domain self.userID = userID -// self.appearanceRaw = appearanceRaw } } } @@ -122,5 +112,13 @@ extension Setting { #keyPath(Setting.userID), userID ) } - + +} + +extension Setting { + public var activeSubscription: Subscription? { + return (subscriptions ?? Set()) + .sorted(by: { $0.activedAt > $1.activedAt }) + .first + } } diff --git a/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Setting.swift b/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Setting.swift deleted file mode 100644 index bb76b69fb..000000000 --- a/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Setting.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// Setting.swift -// Mastodon -// -// Created by MainasuK Cirno on 2021-4-25. -// - -import Foundation -import CoreDataStack -import MastodonSDK - -extension Setting { - -// var appearance: SettingsItem.AppearanceMode { -// return SettingsItem.AppearanceMode(rawValue: appearanceRaw) ?? .automatic -// } - - public var activeSubscription: Subscription? { - return (subscriptions ?? Set()) - .sorted(by: { $0.activedAt > $1.activedAt }) - .first - } - -}