From 1734b28d35bde84cb87b2b61ab4e8a12b871b367 Mon Sep 17 00:00:00 2001 From: MaximeE Date: Mon, 25 Apr 2022 17:21:27 +0200 Subject: [PATCH] 6029: Modify color for dark mode --- .../Location/RoomTimelineLocationView.swift | 30 ++++++++++--------- .../Location/RoomTimelineLocationView.xib | 12 +++++++- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Riot/Modules/Room/Location/RoomTimelineLocationView.swift b/Riot/Modules/Room/Location/RoomTimelineLocationView.swift index 4665fbc18..0c7fcf3cf 100644 --- a/Riot/Modules/Room/Location/RoomTimelineLocationView.swift +++ b/Riot/Modules/Room/Location/RoomTimelineLocationView.swift @@ -108,6 +108,7 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat private var mapView: MGLMapView! private var annotationView: LocationMarkerView? private static var usernameColorGenerator = UserNameColorGenerator() + private static var theme = ThemeService.shared().theme private lazy var incomingTimerFormatter: DateFormatter = { let dateFormatter = DateFormatter() @@ -189,6 +190,7 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat } liveLocationContainerView.isHidden = false + liveLocationContainerView.backgroundColor = Self.theme.colors.background.withAlphaComponent(0.85) liveLocationImageView.image = Asset.Images.locationLiveCellIcon.image liveLocationImageView.tintColor = bannerViewData.iconTint @@ -197,6 +199,7 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat liveLocationStatusLabel.textColor = bannerViewData.titleColor liveLocationTimerLabel.text = bannerViewData.timeLeftString + liveLocationTimerLabel.textColor = Self.theme.colors.tertiaryContent liveLocationTimerLabel.isHidden = !bannerViewData.showTimer rightButton.setTitle(bannerViewData.rightButtonTitle, for: .normal) @@ -209,11 +212,10 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat } private func liveLocationBannerViewData(from viewState: TimelineLiveLocationViewState) -> LiveLocationBannerViewData { - let theme = ThemeService.shared().theme let iconTint: UIColor let title: String - var titleColor: UIColor = theme.roomCellLocalisationTextColor + var titleColor: UIColor = Self.theme.colors.primaryContent var placeholderImage: UIImage? var timeLeftString: String? var rightButtonTitle: String? @@ -223,42 +225,42 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat case .incoming(let liveLocationSharingStatus): switch liveLocationSharingStatus { case .starting: - iconTint = theme.roomCellLocalisationEndedColor + iconTint = Self.theme.roomCellLocalisationEndedColor title = VectorL10n.locationSharingLiveLoading - titleColor = theme.roomCellLocalisationEndedColor + titleColor = Self.theme.roomCellLocalisationEndedColor placeholderImage = Asset.Images.locationLiveCellLoadingImage.image case .started(let timeLeft): - iconTint = theme.roomCellLocalisationIconStartedColor + iconTint = Self.theme.roomCellLocalisationIconStartedColor title = VectorL10n.liveLocationSharingBannerTitle timeLeftString = generateTimerString(for: timeLeft, isIncomingLocation: true) case .stopped: - iconTint = theme.roomCellLocalisationEndedColor + iconTint = Self.theme.roomCellLocalisationEndedColor title = VectorL10n.liveLocationSharingEnded - titleColor = theme.roomCellLocalisationEndedColor + titleColor = Self.theme.roomCellLocalisationEndedColor placeholderImage = Asset.Images.locationLiveCellEndedImage.image } case .outgoing(let liveLocationSharingStatus): switch liveLocationSharingStatus { case .starting: - iconTint = theme.roomCellLocalisationEndedColor + iconTint = Self.theme.roomCellLocalisationEndedColor title = VectorL10n.locationSharingLiveLoading - titleColor = theme.roomCellLocalisationEndedColor + titleColor = Self.theme.roomCellLocalisationEndedColor placeholderImage = Asset.Images.locationLiveCellLoadingImage.image case .started(let timeLeft): - iconTint = theme.roomCellLocalisationIconStartedColor + iconTint = Self.theme.roomCellLocalisationIconStartedColor title = VectorL10n.liveLocationSharingBannerTitle timeLeftString = generateTimerString(for: timeLeft, isIncomingLocation: false) rightButtonTitle = VectorL10n.stop case .failure: - iconTint = theme.roomCellLocalisationErrorColor + iconTint = Self.theme.roomCellLocalisationErrorColor title = VectorL10n.locationSharingLiveError - titleColor = theme.roomCellLocalisationEndedColor + titleColor = Self.theme.roomCellLocalisationEndedColor rightButtonTitle = VectorL10n.retry rightButtonTag = .retrySharing case .stopped: - iconTint = theme.roomCellLocalisationEndedColor + iconTint = Self.theme.roomCellLocalisationEndedColor title = VectorL10n.liveLocationSharingEnded - titleColor = theme.roomCellLocalisationEndedColor + titleColor = Self.theme.roomCellLocalisationEndedColor placeholderImage = Asset.Images.locationLiveCellEndedImage.image } } diff --git a/Riot/Modules/Room/Location/RoomTimelineLocationView.xib b/Riot/Modules/Room/Location/RoomTimelineLocationView.xib index a149fcead..0954a24b6 100644 --- a/Riot/Modules/Room/Location/RoomTimelineLocationView.xib +++ b/Riot/Modules/Room/Location/RoomTimelineLocationView.xib @@ -40,9 +40,13 @@ - + + + + + @@ -90,12 +94,18 @@ + + + + + +