Skip to content

Commit

Permalink
Fix #6668 - Onboarding card should get built in theme on relaunch (#6673
Browse files Browse the repository at this point in the history
)
  • Loading branch information
nbhasin2 committed May 22, 2020
1 parent 0a05a9f commit d5748a6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Client/Frontend/Intro/IntroScreenSyncViewV2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ to make it center in the top container view.
*/

class IntroScreenSyncViewV2: UIView {
class IntroScreenSyncViewV2: UIView, CardTheme {
// Private vars
private var fxTextThemeColour: UIColor {
// For dark theme we want to show light colours and for light we want to show dark colours
return UpdateViewController.theme == .dark ? .white : .black
return theme == .dark ? .white : .black
}
private var fxBackgroundThemeColour: UIColor {
return UpdateViewController.theme == .dark ? UIColor.Firefox.DarkGrey10 : .white
return theme == .dark ? UIColor.Firefox.DarkGrey10 : .white
}
private lazy var titleImageView: UIImageView = {
let imgView = UIImageView(image: #imageLiteral(resourceName: "tour-sync-v2"))
Expand Down
6 changes: 3 additions & 3 deletions Client/Frontend/Intro/IntroScreenWelcomeViewV2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ in the middle of the screen.
*/

class IntroScreenWelcomeViewV2: UIView {
class IntroScreenWelcomeViewV2: UIView, CardTheme {
// Private vars
private var fxTextThemeColour: UIColor {
// For dark theme we want to show light colours and for light we want to show dark colours
return UpdateViewController.theme == .dark ? .white : .black
return theme == .dark ? .white : .black
}
private var fxBackgroundThemeColour: UIColor {
return UpdateViewController.theme == .dark ? UIColor.Firefox.DarkGrey10 : .white
return theme == .dark ? UIColor.Firefox.DarkGrey10 : .white
}
private lazy var titleImageView: UIImageView = {
let imgView = UIImageView(image: #imageLiteral(resourceName: "splash"))
Expand Down
10 changes: 10 additions & 0 deletions Client/Frontend/Intro/IntroViewModelV2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ struct ViewControllerConsts {
}
}

protocol CardTheme {
var theme: BuiltinThemeName { get }
}

extension CardTheme {
var theme: BuiltinThemeName {
return BuiltinThemeName(rawValue: ThemeManager.instance.current.name) ?? .normal
}
}

// MARK: Requires Work (Currently part of A/B test)
// Intro View Model V2 - This is suppose to be the main view model for the
// IntroView V2 however since we are running an onboarding A/B test
Expand Down
6 changes: 3 additions & 3 deletions Client/Frontend/Intro/IntroWelcomeAndSyncViewV1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ import Shared
*/

class IntroWelcomeAndSyncViewV1: UIView {
class IntroWelcomeAndSyncViewV1: UIView, CardTheme {
// Private vars
private var fxTextThemeColour: UIColor {
// For dark theme we want to show light colours and for light we want to show dark colours
return UpdateViewController.theme == .dark ? .white : .black
return theme == .dark ? .white : .black
}
private var fxBackgroundThemeColour: UIColor {
return UpdateViewController.theme == .dark ? .black : .white
return theme == .dark ? .black : .white
}
// Screen constants
private let screenHeight = UIScreen.main.bounds.size.height
Expand Down

0 comments on commit d5748a6

Please sign in to comment.