Compare commits
No commits in common. "37563b6afd0258f5d4cc0b455f55ce507b1c88b6" and "94c34e03ddc44fe13388f7ad94b054a5665acadf" have entirely different histories.
37563b6afd
...
94c34e03dd
|
@ -321,9 +321,7 @@ class MastodonController: ObservableObject {
|
|||
let request = Client.getCustomEmoji()
|
||||
run(request) { (response) in
|
||||
if case let .success(emojis, _) = response {
|
||||
DispatchQueue.main.async {
|
||||
self.customEmojis = emojis
|
||||
}
|
||||
self.customEmojis = emojis
|
||||
completion(emojis)
|
||||
} else {
|
||||
completion([])
|
||||
|
|
|
@ -38,7 +38,6 @@ class Preferences: Codable, ObservableObject {
|
|||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
self.theme = try container.decode(UIUserInterfaceStyle.self, forKey: .theme)
|
||||
self.accentColor = try container.decodeIfPresent(AccentColor.self, forKey: .accentColor) ?? .default
|
||||
self.avatarStyle = try container.decode(AvatarStyle.self, forKey: .avatarStyle)
|
||||
self.hideCustomEmojiInUsernames = try container.decode(Bool.self, forKey: .hideCustomEmojiInUsernames)
|
||||
self.showIsStatusReplyIcon = try container.decode(Bool.self, forKey: .showIsStatusReplyIcon)
|
||||
|
@ -91,7 +90,6 @@ class Preferences: Codable, ObservableObject {
|
|||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
try container.encode(theme, forKey: .theme)
|
||||
try container.encode(accentColor, forKey: .accentColor)
|
||||
try container.encode(avatarStyle, forKey: .avatarStyle)
|
||||
try container.encode(hideCustomEmojiInUsernames, forKey: .hideCustomEmojiInUsernames)
|
||||
try container.encode(showIsStatusReplyIcon, forKey: .showIsStatusReplyIcon)
|
||||
|
@ -138,7 +136,6 @@ class Preferences: Codable, ObservableObject {
|
|||
|
||||
// MARK: Appearance
|
||||
@Published var theme = UIUserInterfaceStyle.unspecified
|
||||
@Published var accentColor = AccentColor.default
|
||||
@Published var avatarStyle = AvatarStyle.roundRect
|
||||
@Published var hideCustomEmojiInUsernames = false
|
||||
@Published var showIsStatusReplyIcon = false
|
||||
|
@ -199,7 +196,6 @@ class Preferences: Codable, ObservableObject {
|
|||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case theme
|
||||
case accentColor
|
||||
case avatarStyle
|
||||
case hideCustomEmojiInUsernames
|
||||
case showIsStatusReplyIcon
|
||||
|
@ -303,83 +299,3 @@ extension Preferences {
|
|||
}
|
||||
|
||||
extension UIUserInterfaceStyle: Codable {}
|
||||
|
||||
extension Preferences {
|
||||
enum AccentColor: String, Codable, CaseIterable {
|
||||
case `default`
|
||||
case purple
|
||||
case indigo
|
||||
case blue
|
||||
case cyan
|
||||
case teal
|
||||
case mint
|
||||
case green
|
||||
// case yellow
|
||||
case orange
|
||||
case red
|
||||
case pink
|
||||
// case brown
|
||||
|
||||
var color: UIColor? {
|
||||
switch self {
|
||||
case .default:
|
||||
return nil
|
||||
case .blue:
|
||||
return .systemBlue
|
||||
// case .brown:
|
||||
// return .systemBrown
|
||||
case .cyan:
|
||||
return .systemCyan
|
||||
case .green:
|
||||
return .systemGreen
|
||||
case .indigo:
|
||||
return .systemIndigo
|
||||
case .mint:
|
||||
return .systemMint
|
||||
case .orange:
|
||||
return .systemOrange
|
||||
case .pink:
|
||||
return .systemPink
|
||||
case .purple:
|
||||
return .systemPurple
|
||||
case .red:
|
||||
return .systemRed
|
||||
case .teal:
|
||||
return .systemTeal
|
||||
// case .yellow:
|
||||
// return .systemYellow
|
||||
}
|
||||
}
|
||||
|
||||
var name: String {
|
||||
switch self {
|
||||
case .default:
|
||||
return "Default"
|
||||
case .blue:
|
||||
return "Blue"
|
||||
// case .brown:
|
||||
// return "Brown"
|
||||
case .cyan:
|
||||
return "Cyan"
|
||||
case .green:
|
||||
return "Green"
|
||||
case .indigo:
|
||||
return "Indigo"
|
||||
case .mint:
|
||||
return "Mint"
|
||||
case .orange:
|
||||
return "Orange"
|
||||
case .pink:
|
||||
return "Pink"
|
||||
case .purple:
|
||||
return "Purple"
|
||||
case .red:
|
||||
return "Red"
|
||||
case .teal:
|
||||
return "Teal"
|
||||
// case .yellow:
|
||||
// return "Yellow"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,6 +113,5 @@ class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
|
||||
@objc private func themePrefChanged() {
|
||||
window?.overrideUserInterfaceStyle = Preferences.shared.theme
|
||||
window?.tintColor = Preferences.shared.accentColor.color
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,6 @@ class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
|
||||
@objc private func themePrefChanged() {
|
||||
window?.overrideUserInterfaceStyle = Preferences.shared.theme
|
||||
window?.tintColor = Preferences.shared.accentColor.color
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -244,7 +244,6 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate
|
|||
|
||||
@objc func themePrefChanged() {
|
||||
window?.overrideUserInterfaceStyle = Preferences.shared.theme
|
||||
window?.tintColor = Preferences.shared.accentColor.color
|
||||
}
|
||||
|
||||
func showAddAccount() {
|
||||
|
|
|
@ -10,20 +10,14 @@ import SwiftUI
|
|||
struct AppearancePrefsView : View {
|
||||
@ObservedObject var preferences = Preferences.shared
|
||||
|
||||
private var theme: Binding<UIUserInterfaceStyle> = Binding(get: {
|
||||
var theme: Binding<UIUserInterfaceStyle> = Binding(get: {
|
||||
Preferences.shared.theme
|
||||
}, set: {
|
||||
Preferences.shared.theme = $0
|
||||
NotificationCenter.default.post(name: .themePreferenceChanged, object: nil)
|
||||
})
|
||||
private var accentColor: Binding<Preferences.AccentColor> = Binding {
|
||||
Preferences.shared.accentColor
|
||||
} set: {
|
||||
Preferences.shared.accentColor = $0
|
||||
NotificationCenter.default.post(name: .themePreferenceChanged, object: nil)
|
||||
}
|
||||
|
||||
private var useCircularAvatars: Binding<Bool> = Binding(get: {
|
||||
var useCircularAvatars: Binding<Bool> = Binding(get: {
|
||||
Preferences.shared.avatarStyle == .circle
|
||||
}) {
|
||||
Preferences.shared.avatarStyle = $0 ? .circle : .roundRect
|
||||
|
@ -31,35 +25,16 @@ struct AppearancePrefsView : View {
|
|||
|
||||
var body: some View {
|
||||
List {
|
||||
themeSection
|
||||
accountsSection
|
||||
postsSection
|
||||
}
|
||||
.listStyle(InsetGroupedListStyle())
|
||||
.navigationBarTitle(Text("Appearance"))
|
||||
}
|
||||
|
||||
private var themeSection: some View {
|
||||
Section {
|
||||
Picker(selection: theme, label: Text("Theme")) {
|
||||
Text("Use System Theme").tag(UIUserInterfaceStyle.unspecified)
|
||||
Text("Light").tag(UIUserInterfaceStyle.light)
|
||||
Text("Dark").tag(UIUserInterfaceStyle.dark)
|
||||
}
|
||||
|
||||
Picker(selection: accentColor, label: Text("Accent Color")) {
|
||||
ForEach(Preferences.AccentColor.allCases, id: \.rawValue) { color in
|
||||
HStack {
|
||||
Text(color.name)
|
||||
if let color = color.color {
|
||||
Spacer()
|
||||
Image(uiImage: UIImage(systemName: "circle.fill")!.withTintColor(color, renderingMode: .alwaysTemplate).withRenderingMode(.alwaysOriginal))
|
||||
}
|
||||
}
|
||||
.tag(color)
|
||||
}
|
||||
}
|
||||
accountsSection
|
||||
postsSection
|
||||
}
|
||||
.listStyle(InsetGroupedListStyle())
|
||||
.navigationBarTitle(Text("Appearance"))
|
||||
}
|
||||
|
||||
private var accountsSection: some View {
|
||||
|
|
|
@ -48,12 +48,12 @@ class BaseStatusTableViewCell: UITableViewCell {
|
|||
|
||||
private var favorited = false {
|
||||
didSet {
|
||||
favoriteButton.tintColor = favorited ? UIColor(displayP3Red: 1, green: 0.8, blue: 0, alpha: 1) : .tintColor
|
||||
favoriteButton.tintColor = favorited ? UIColor(displayP3Red: 1, green: 0.8, blue: 0, alpha: 1) : tintColor
|
||||
}
|
||||
}
|
||||
private var reblogged = false {
|
||||
didSet {
|
||||
reblogButton.tintColor = reblogged ? UIColor(displayP3Red: 1, green: 0.8, blue: 0, alpha: 1) : .tintColor
|
||||
reblogButton.tintColor = reblogged ? UIColor(displayP3Red: 1, green: 0.8, blue: 0, alpha: 1) : tintColor
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8r8-O8-Agh" customClass="StatusCollapseButton" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="86.5" width="361" height="30"/>
|
||||
<color key="backgroundColor" systemColor="tintColor"/>
|
||||
<color key="backgroundColor" systemColor="systemBlueColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="icD-3q-uJ6"/>
|
||||
</constraints>
|
||||
|
@ -169,7 +169,6 @@
|
|||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2cc-lE-AdG">
|
||||
<rect key="frame" x="0.0" y="0.0" width="90.5" height="26"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Reply"/>
|
||||
<color key="tintColor" systemColor="tintColor"/>
|
||||
<state key="normal">
|
||||
<imageReference key="image" image="arrowshape.turn.up.left.fill" catalog="system" symbolScale="large"/>
|
||||
</state>
|
||||
|
@ -180,7 +179,6 @@
|
|||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DhN-rJ-jdA">
|
||||
<rect key="frame" x="90.5" y="0.0" width="90" height="26"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Favorite"/>
|
||||
<color key="tintColor" systemColor="tintColor"/>
|
||||
<state key="normal">
|
||||
<imageReference key="image" image="star.fill" catalog="system" symbolScale="large"/>
|
||||
</state>
|
||||
|
@ -191,7 +189,6 @@
|
|||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GUG-f7-Hdy">
|
||||
<rect key="frame" x="180.5" y="0.0" width="90.5" height="26"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Reblog"/>
|
||||
<color key="tintColor" systemColor="tintColor"/>
|
||||
<state key="normal">
|
||||
<imageReference key="image" image="repeat" catalog="system" symbolScale="large"/>
|
||||
</state>
|
||||
|
@ -202,7 +199,6 @@
|
|||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ujo-Ap-dmK">
|
||||
<rect key="frame" x="271" y="0.0" width="90" height="26"/>
|
||||
<accessibility key="accessibilityConfiguration" label="More Actions"/>
|
||||
<color key="tintColor" systemColor="tintColor"/>
|
||||
<state key="normal">
|
||||
<imageReference key="image" image="ellipsis" catalog="system" symbolScale="large"/>
|
||||
</state>
|
||||
|
@ -282,7 +278,7 @@
|
|||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
<systemColor name="tintColor">
|
||||
<systemColor name="systemBlueColor">
|
||||
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
|
|
|
@ -46,7 +46,7 @@ class ToastView: UIView {
|
|||
}
|
||||
|
||||
private func setupView() {
|
||||
backgroundColor = .tintColor
|
||||
backgroundColor = .systemBlue
|
||||
layer.shadowColor = UIColor.black.cgColor
|
||||
layer.shadowRadius = 5
|
||||
layer.shadowOffset = CGSize(width: 0, height: 2.5)
|
||||
|
|
Loading…
Reference in New Issue