From 6f7acc01738405f56dd377d1b7ed048d4041f265 Mon Sep 17 00:00:00 2001 From: CMK Date: Wed, 7 Jul 2021 17:52:06 +0800 Subject: [PATCH] fix: content warning overlay and setting separator line not using theme color issue --- .../Contents.json | 6 +++--- .../Contents.json | 6 +++--- .../Scene/Settings/SettingsViewController.swift | 2 ++ .../View/Content/ContentWarningOverlayView.swift | 14 +++++++++++++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Mastodon/Resources/Assets.xcassets/Theme/Mastodon/Background/content.warning.overlay.background.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Theme/Mastodon/Background/content.warning.overlay.background.colorset/Contents.json index 485b4813a..54427c610 100644 --- a/Mastodon/Resources/Assets.xcassets/Theme/Mastodon/Background/content.warning.overlay.background.colorset/Contents.json +++ b/Mastodon/Resources/Assets.xcassets/Theme/Mastodon/Background/content.warning.overlay.background.colorset/Contents.json @@ -23,9 +23,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "0.263", - "green" : "0.208", - "red" : "0.192" + "blue" : "0x6E", + "green" : "0x57", + "red" : "0x4F" } }, "idiom" : "universal" diff --git a/Mastodon/Resources/Assets.xcassets/Theme/system/Background/content.warning.overlay.background.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Theme/system/Background/content.warning.overlay.background.colorset/Contents.json index 485b4813a..d211d7df9 100644 --- a/Mastodon/Resources/Assets.xcassets/Theme/system/Background/content.warning.overlay.background.colorset/Contents.json +++ b/Mastodon/Resources/Assets.xcassets/Theme/system/Background/content.warning.overlay.background.colorset/Contents.json @@ -23,9 +23,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "0.263", - "green" : "0.208", - "red" : "0.192" + "blue" : "60", + "green" : "58", + "red" : "58" } }, "idiom" : "universal" diff --git a/Mastodon/Scene/Settings/SettingsViewController.swift b/Mastodon/Scene/Settings/SettingsViewController.swift index 8915a44d5..6a08bd45d 100644 --- a/Mastodon/Scene/Settings/SettingsViewController.swift +++ b/Mastodon/Scene/Settings/SettingsViewController.swift @@ -236,6 +236,8 @@ class SettingsViewController: UIViewController, NeedsDependency { return theme.secondarySystemBackgroundColor } }) + + tableView.separatorColor = theme.separator } private func setupNavigation() { diff --git a/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift b/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift index 931932060..d5a457a26 100644 --- a/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift +++ b/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift @@ -17,6 +17,7 @@ protocol ContentWarningOverlayViewDelegate: AnyObject { class ContentWarningOverlayView: UIView { var disposeBag = Set() + private var _disposeBag = Set() static let cornerRadius: CGFloat = 4 static let blurVisualEffect = UIBlurEffect(style: .systemUltraThinMaterial) @@ -36,7 +37,6 @@ class ContentWarningOverlayView: UIView { // for status style overlay let contentOverlayView: UIView = { let view = UIView() - view.backgroundColor = ThemeService.shared.currentTheme.value.contentWarningOverlayBackgroundColor view.applyCornerRadius(radius: ContentWarningOverlayView.cornerRadius) return view }() @@ -156,6 +156,18 @@ extension ContentWarningOverlayView { addGestureRecognizer(tapGestureRecognizer) configure(style: .media) + setupBackgroundColor(theme: ThemeService.shared.currentTheme.value) + ThemeService.shared.currentTheme + .receive(on: RunLoop.main) + .sink { [weak self] theme in + guard let self = self else { return } + self.setupBackgroundColor(theme: theme) + } + .store(in: &_disposeBag) + } + + private func setupBackgroundColor(theme: Theme) { + contentOverlayView.backgroundColor = theme.contentWarningOverlayBackgroundColor } }