Skip to content

Commit

Permalink
Revert "Fix #6708 : [Today Widget] Update current widget strings/colo…
Browse files Browse the repository at this point in the history
…urs (#6750)"

This reverts commit c40801a.
  • Loading branch information
garvankeeley committed Jun 12, 2020
1 parent ff702d5 commit cb66dd6
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 89 deletions.
3 changes: 0 additions & 3 deletions Client/Configuration/Fennec.enterprise.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ LEANPLUM_KEY =

ENABLE_BITCODE = NO
CLANG_MODULES_AUTOLINK = NO

// Today Widget - Search
MOZ_TODAY_WIDGET_SEARCH_DISPLAY_NAME = Firefox - Search
3 changes: 0 additions & 3 deletions Client/Configuration/Fennec.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ LEANPLUM_KEY =

ENABLE_BITCODE = NO
CLANG_MODULES_AUTOLINK = NO

// Today Widget - Search
MOZ_TODAY_WIDGET_SEARCH_DISPLAY_NAME = Firefox - Search
3 changes: 0 additions & 3 deletions Client/Configuration/Firefox.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ LEANPLUM_KEY =

ENABLE_BITCODE = NO
CLANG_MODULES_AUTOLINK = NO

// Today Widget - Search
MOZ_TODAY_WIDGET_SEARCH_DISPLAY_NAME = Firefox - Search
6 changes: 0 additions & 6 deletions Extensions/Today/Images.xcassets/Contents.json

This file was deleted.

This file was deleted.

Binary file not shown.
15 changes: 0 additions & 15 deletions Extensions/Today/Images.xcassets/search.imageset/Contents.json

This file was deleted.

Binary file not shown.
2 changes: 1 addition & 1 deletion Extensions/Today/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>$(MOZ_TODAY_WIDGET_SEARCH_DISPLAY_NAME)</string>
<string>$(MOZ_BUNDLE_DISPLAY_NAME)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down
58 changes: 16 additions & 42 deletions Extensions/Today/TodayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import XCGLogger
private let log = Logger.browserLogger

struct TodayStrings {
static let NewPrivateTabButtonLabel = NSLocalizedString("TodayWidget.NewPrivateTabButtonLabel", tableName: "Today", value: "Private Search", comment: "New Private Tab button label")
static let NewTabButtonLabel = NSLocalizedString("TodayWidget.NewTabButtonLabel", tableName: "Today", value: "New Search", comment: "New Tab button label")
static let NewPrivateTabButtonLabel = NSLocalizedString("TodayWidget.NewPrivateTabButtonLabel", tableName: "Today", value: "New Private Tab", comment: "New Private Tab button label")
static let NewTabButtonLabel = NSLocalizedString("TodayWidget.NewTabButtonLabel", tableName: "Today", value: "New Tab", comment: "New Tab button label")
static let GoToCopiedLinkLabel = NSLocalizedString("TodayWidget.GoToCopiedLinkLabel", tableName: "Today", value: "Go to copied link", comment: "Go to link on clipboard")
}

Expand All @@ -25,9 +25,6 @@ private struct TodayUX {
static let copyLinkImageWidth: CGFloat = 23
static let margin: CGFloat = 8
static let buttonsHorizontalMarginPercentage: CGFloat = 0.1
static let privateSearchButtonColorBrightPurple = UIColor(red: 117.0/255.0, green: 41.0/255.0, blue: 167.0/255.0, alpha: 1.0)
static let privateSearchButtonColorDarkPurple = UIColor(red: 73.0/255.0, green: 46.0/255.0, blue: 133.0/255.0, alpha: 1.0)
static let privateSearchButtonColorFaintDarkPurple = UIColor(red: 56.0/255.0, green: 51.0/255.0, blue: 114.0/255.0, alpha: 1.0)
}

@objc (TodayViewController)
Expand All @@ -41,14 +38,11 @@ class TodayViewController: UIViewController, NCWidgetProviding {
imageButton.label.text = TodayStrings.NewTabButtonLabel

let button = imageButton.button
button.frame = CGRect(width: 60.0, height: 60.0)
button.backgroundColor = UIColor.white
button.layer.cornerRadius = button.frame.size.width/2
button.clipsToBounds = true
button.setImage(UIImage(named: "search"), for: .normal)

button.setImage(UIImage(named: "new_tab_button_normal")?.withRenderingMode(.alwaysTemplate), for: .normal)
button.setImage(UIImage(named: "new_tab_button_highlight")?.withRenderingMode(.alwaysTemplate), for: .highlighted)

let label = imageButton.label
label.tintColor = UIColor(named: "widgetLabelColors")
label.textColor = UIColor(named: "widgetLabelColors")
label.font = UIFont.systemFont(ofSize: TodayUX.imageButtonTextSize)

imageButton.sizeToFit()
Expand All @@ -59,17 +53,14 @@ class TodayViewController: UIViewController, NCWidgetProviding {
let imageButton = ImageButtonWithLabel()
imageButton.addTarget(self, action: #selector(onPressNewPrivateTab), forControlEvents: .touchUpInside)
imageButton.label.text = TodayStrings.NewPrivateTabButtonLabel

let button = imageButton.button
button.frame = CGRect(width: 60.0, height: 60.0)
button.performGradient(colorOne: TodayUX.privateSearchButtonColorFaintDarkPurple, colorTwo: TodayUX.privateSearchButtonColorDarkPurple, colorThree: TodayUX.privateSearchButtonColorBrightPurple)
button.layer.cornerRadius = button.frame.size.width/2
button.clipsToBounds = true
button.setImage(UIImage(named: "quick_action_new_private_tab")?.withRenderingMode(.alwaysTemplate), for: .normal)
button.tintColor = UIColor.white
button.setImage(UIImage(named: "new_private_tab_button_normal"), for: .normal)
button.setImage(UIImage(named: "new_private_tab_button_highlight"), for: .highlighted)

let label = imageButton.label
label.tintColor = UIColor(named: "widgetLabelColors")
label.textColor = UIColor(named: "widgetLabelColors")
label.tintColor = TodayUX.privateBrowsingColor
label.textColor = TodayUX.privateBrowsingColor
label.font = UIFont.systemFont(ofSize: TodayUX.imageButtonTextSize)
imageButton.sizeToFit()
return imageButton
Expand Down Expand Up @@ -106,8 +97,8 @@ class TodayViewController: UIViewController, NCWidgetProviding {
fileprivate lazy var buttonStackView: UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.alignment = .center
stackView.spacing = 30
stackView.alignment = .fill
stackView.spacing = 0
stackView.distribution = UIStackView.Distribution.fillEqually
return stackView
}()
Expand Down Expand Up @@ -217,20 +208,6 @@ extension UIButton {
}
}

extension UIButton {
func performGradient(colorOne: UIColor, colorTwo: UIColor, colorThree: UIColor) {
let gradientLayer = CAGradientLayer()
gradientLayer.frame = self.frame
gradientLayer.colors = [colorOne.cgColor, colorTwo.cgColor, colorThree.cgColor]
gradientLayer.startPoint = CGPoint(x: 1.0, y: 0.0)
gradientLayer.endPoint = CGPoint(x: 0.0, y: 1.0)
gradientLayer.locations = [0.0, 0.5, 1.0]
gradientLayer.cornerRadius = self.frame.size.width/2
layer.masksToBounds = true
layer.insertSublayer(gradientLayer, below: self.imageView?.layer)
}
}

class ImageButtonWithLabel: UIView {

lazy var button = UIButton()
Expand All @@ -250,21 +227,18 @@ class ImageButtonWithLabel: UIView {
addSubview(label)

button.snp.makeConstraints { make in
make.centerX.equalTo(self)
make.top.equalTo(self.safeAreaLayoutGuide)
make.right.greaterThanOrEqualTo(self.safeAreaLayoutGuide).offset(30)
make.left.greaterThanOrEqualTo(self.safeAreaLayoutGuide).inset(30)
make.height.width.equalTo(60)
make.top.left.centerX.equalTo(self)
}

label.snp.makeConstraints { make in
make.top.equalTo(button.snp.bottom).offset(10)
make.top.equalTo(button.snp.bottom)
make.leading.trailing.bottom.equalTo(self)
}

label.numberOfLines = 1
label.lineBreakMode = .byWordWrapping
label.textAlignment = .center
label.textColor = UIColor.white
}

func addTarget(_ target: AnyObject?, action: Selector, forControlEvents events: UIControl.Event) {
Expand Down

0 comments on commit cb66dd6

Please sign in to comment.