diff --git a/Shared/Extensions/RSImage-Extensions.swift b/Shared/Extensions/RSImage-Extensions.swift index 3406a959b..44b1e7fb6 100644 --- a/Shared/Extensions/RSImage-Extensions.swift +++ b/Shared/Extensions/RSImage-Extensions.swift @@ -51,7 +51,7 @@ private extension RSImage { let rect = CGRect(x: 0, y: 0, width: avatarSize, height: avatarSize) UIGraphicsBeginImageContext(rect.size) if let context = UIGraphicsGetCurrentContext() { - context.setFillColor(AppAssets.avatarLightBackgroundColor.cgColor) + context.setFillColor(AppAssets.avatarBackgroundColor.cgColor) context.fill(rect) context.translateBy(x: 0.0, y: CGFloat(integerLiteral: avatarSize)); context.scaleBy(x: 1.0, y: -1.0) diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift index d53da2302..c28c5e0d3 100644 --- a/iOS/AppAssets.swift +++ b/iOS/AppAssets.swift @@ -10,14 +10,10 @@ import RSCore struct AppAssets { - static var avatarDarkBackgroundColor: UIColor { - return UIColor(named: "avatarDarkBackgroundColor")! - } + static var avatarBackgroundColor: UIColor = { + return UIColor(named: "avatarBackgroundColor")! + }() - static var avatarLightBackgroundColor: UIColor { - return UIColor(named: "avatarLightBackgroundColor")! - } - static var circleClosedImage: RSImage = { return RSImage(named: "circleClosedImage")! }() diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index 4d65c3bc3..456f336c7 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -73,6 +73,19 @@ class MasterTimelineViewController: ProgressTableViewController, UndoableCommand } } + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + super.traitCollectionDidChange(previousTraitCollection) + + if traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle { + appDelegate.authorAvatarDownloader.resetCache() + appDelegate.feedIconDownloader.resetCache() + appDelegate.faviconDownloader.resetCache() + performBlockAndRestoreSelection { + tableView.reloadData() + } + } + } + // MARK Actions @IBAction func markAllAsRead(_ sender: Any) { diff --git a/iOS/Resources/Assets.xcassets/avatarBackgroundColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/avatarBackgroundColor.colorset/Contents.json new file mode 100644 index 000000000..518412654 --- /dev/null +++ b/iOS/Resources/Assets.xcassets/avatarBackgroundColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "242", + "alpha" : "1.000", + "blue" : "242", + "green" : "242" + } + } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "56", + "alpha" : "1.000", + "blue" : "56", + "green" : "56" + } + } + } + ] +} \ No newline at end of file diff --git a/iOS/Resources/Assets.xcassets/avatarDarkBackgroundColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/avatarDarkBackgroundColor.colorset/Contents.json deleted file mode 100644 index de7a620f3..000000000 --- a/iOS/Resources/Assets.xcassets/avatarDarkBackgroundColor.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "colors" : [ - { - "idiom" : "universal", - "color" : { - "color-space" : "srgb", - "components" : { - "red" : "56", - "alpha" : "1.000", - "blue" : "56", - "green" : "56" - } - } - } - ] -} \ No newline at end of file diff --git a/iOS/Resources/Assets.xcassets/avatarLightBackgroundColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/avatarLightBackgroundColor.colorset/Contents.json deleted file mode 100644 index 57a5cc49d..000000000 --- a/iOS/Resources/Assets.xcassets/avatarLightBackgroundColor.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "colors" : [ - { - "idiom" : "universal", - "color" : { - "color-space" : "srgb", - "components" : { - "red" : "242", - "alpha" : "1.000", - "blue" : "242", - "green" : "242" - } - } - } - ] -} \ No newline at end of file