Skip to content

Commit

Permalink
Merge branch 'main' into rgb/10318_accountHeaderHookupz
Browse files Browse the repository at this point in the history
  • Loading branch information
dicarobinho committed Oct 28, 2024
2 parents e524db7 + 93fe6c8 commit 0d3b713
Show file tree
Hide file tree
Showing 188 changed files with 1,948 additions and 404 deletions.
18 changes: 9 additions & 9 deletions BrowserKit/Sources/Common/Theming/DarkTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ private struct DarkColourPalette: ThemeColourPalette {
FXColors.DarkGrey60.withAlphaComponent(1),
FXColors.DarkGrey60.withAlphaComponent(1)
])
var layerInfo: UIColor = FXColors.Blue50
var layerConfirmation: UIColor = FXColors.Green80
var layerInformation: UIColor = FXColors.Blue50
var layerSuccess: UIColor = FXColors.Green80
var layerWarning: UIColor = FXColors.Yellow70.withAlphaComponent(0.77)
var layerError: UIColor = FXColors.Pink80
var layerCritical: UIColor = FXColors.Pink80
var layerSelectedText: UIColor = FXColors.Blue40
var layerAutofillText: UIColor = FXColors.LightGrey05.withAlphaComponent(0.34)
var layerSearch: UIColor = FXColors.DarkGrey80
Expand Down Expand Up @@ -77,18 +77,18 @@ private struct DarkColourPalette: ThemeColourPalette {
var formKnob: UIColor = FXColors.White
var indicatorActive: UIColor = FXColors.LightGrey90
var indicatorInactive: UIColor = FXColors.DarkGrey05
var actionConfirmation: UIColor = FXColors.Green70
var actionSuccess: UIColor = FXColors.Green70
var actionWarning: UIColor = FXColors.Yellow40.withAlphaComponent(0.41)
var actionError: UIColor = FXColors.Pink70.withAlphaComponent(0.69)
var actionInfo: UIColor = FXColors.Blue60
var actionCritical: UIColor = FXColors.Pink70.withAlphaComponent(0.69)
var actionInformation: UIColor = FXColors.Blue60
var actionTabActive: UIColor = FXColors.DarkGrey30
var actionTabInactive: UIColor = FXColors.DarkGrey80

// MARK: - Text
var textPrimary: UIColor = FXColors.LightGrey05
var textSecondary: UIColor = FXColors.LightGrey40
var textDisabled: UIColor = FXColors.LightGrey05.withAlphaComponent(0.4)
var textWarning: UIColor = FXColors.Red20
var textCritical: UIColor = FXColors.Red20
var textAccent: UIColor = FXColors.Blue30
var textOnDark: UIColor = FXColors.LightGrey05
var textOnLight: UIColor = FXColors.DarkGrey90
Expand All @@ -99,9 +99,9 @@ private struct DarkColourPalette: ThemeColourPalette {
var iconPrimary: UIColor = FXColors.LightGrey05
var iconSecondary: UIColor = FXColors.LightGrey40
var iconDisabled: UIColor = FXColors.LightGrey05.withAlphaComponent(0.4)
var iconAction: UIColor = FXColors.Blue30
var iconAccent: UIColor = FXColors.Blue30
var iconOnColor: UIColor = FXColors.LightGrey05
var iconWarning: UIColor = FXColors.Red20
var iconCritical: UIColor = FXColors.Red20
var iconSpinner: UIColor = FXColors.White
var iconAccentViolet: UIColor = FXColors.Violet20
var iconAccentBlue: UIColor = FXColors.Blue30
Expand Down
18 changes: 9 additions & 9 deletions BrowserKit/Sources/Common/Theming/LightTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ private struct LightColourPalette: ThemeColourPalette {
FXColors.LightGrey10.withAlphaComponent(1),
FXColors.LightGrey10.withAlphaComponent(1)
])
var layerInfo: UIColor = FXColors.Blue50.withAlphaComponent(0.44)
var layerConfirmation: UIColor = FXColors.Green20
var layerInformation: UIColor = FXColors.Blue50.withAlphaComponent(0.44)
var layerSuccess: UIColor = FXColors.Green20
var layerWarning: UIColor = FXColors.Yellow20
var layerError: UIColor = FXColors.Red10
var layerCritical: UIColor = FXColors.Red10
var layerSelectedText: UIColor = FXColors.Blue50
var layerAutofillText: UIColor = FXColors.DarkGrey05.withAlphaComponent(0.73)
var layerSearch: UIColor = FXColors.LightGrey30
Expand Down Expand Up @@ -66,18 +66,18 @@ private struct LightColourPalette: ThemeColourPalette {
var formKnob: UIColor = FXColors.White
var indicatorActive: UIColor = FXColors.LightGrey50
var indicatorInactive: UIColor = FXColors.LightGrey30
var actionConfirmation: UIColor = FXColors.Green60
var actionSuccess: UIColor = FXColors.Green60
var actionWarning: UIColor = FXColors.Yellow60.withAlphaComponent(0.4)
var actionError: UIColor = FXColors.Red30
var actionInfo: UIColor = FXColors.Blue50
var actionCritical: UIColor = FXColors.Red30
var actionInformation: UIColor = FXColors.Blue50
var actionTabActive: UIColor = FXColors.White
var actionTabInactive: UIColor = FXColors.LightGrey20

// MARK: - Text
var textPrimary: UIColor = FXColors.DarkGrey90
var textSecondary: UIColor = FXColors.DarkGrey05
var textDisabled: UIColor = FXColors.DarkGrey90.withAlphaComponent(0.4)
var textWarning: UIColor = FXColors.Red70
var textCritical: UIColor = FXColors.Red70
var textAccent: UIColor = FXColors.Blue50
var textOnDark: UIColor = FXColors.LightGrey05
var textOnLight: UIColor = FXColors.DarkGrey90
Expand All @@ -88,9 +88,9 @@ private struct LightColourPalette: ThemeColourPalette {
var iconPrimary: UIColor = FXColors.DarkGrey90
var iconSecondary: UIColor = FXColors.DarkGrey05
var iconDisabled: UIColor = FXColors.DarkGrey90.withAlphaComponent(0.4)
var iconAction: UIColor = FXColors.Blue50
var iconAccent: UIColor = FXColors.Blue50
var iconOnColor: UIColor = FXColors.LightGrey05
var iconWarning: UIColor = FXColors.Red70
var iconCritical: UIColor = FXColors.Red70
var iconSpinner: UIColor = FXColors.LightGrey80
var iconAccentViolet: UIColor = FXColors.Violet60
var iconAccentBlue: UIColor = FXColors.Blue60
Expand Down
18 changes: 9 additions & 9 deletions BrowserKit/Sources/Common/Theming/PrivateModeTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ private struct PrivateModeColorPalette: ThemeColourPalette {
FXColors.Violet80,
FXColors.Purple70
])
var layerInfo: UIColor = FXColors.Blue50
var layerConfirmation: UIColor = FXColors.Green80
var layerInformation: UIColor = FXColors.Blue50
var layerSuccess: UIColor = FXColors.Green80
var layerWarning: UIColor = FXColors.Yellow70.withAlphaComponent(0.77)
var layerError: UIColor = FXColors.Pink80
var layerCritical: UIColor = FXColors.Pink80
var layerSelectedText: UIColor = FXColors.Blue40
var layerAutofillText: UIColor = FXColors.Violet60
var layerSearch: UIColor = FXColors.Ink90
Expand Down Expand Up @@ -68,18 +68,18 @@ private struct PrivateModeColorPalette: ThemeColourPalette {
var formKnob: UIColor = FXColors.White
var indicatorActive: UIColor = FXColors.LightGrey90
var indicatorInactive: UIColor = FXColors.DarkGrey05
var actionConfirmation: UIColor = FXColors.Green70
var actionSuccess: UIColor = FXColors.Green70
var actionWarning: UIColor = FXColors.Yellow40.withAlphaComponent(0.41)
var actionError: UIColor = FXColors.Pink70.withAlphaComponent(0.69)
var actionInfo: UIColor = FXColors.Blue60
var actionCritical: UIColor = FXColors.Pink70.withAlphaComponent(0.69)
var actionInformation: UIColor = FXColors.Blue60
var actionTabActive: UIColor = FXColors.Purple60
var actionTabInactive: UIColor = FXColors.Ink90

// MARK: - Text
var textPrimary: UIColor = FXColors.LightGrey05
var textSecondary: UIColor = FXColors.LightGrey40
var textDisabled: UIColor = FXColors.LightGrey05.withAlphaComponent(0.4)
var textWarning: UIColor = FXColors.Red20
var textCritical: UIColor = FXColors.Red20
var textAccent: UIColor = FXColors.Blue30
var textOnDark: UIColor = FXColors.LightGrey05
var textOnLight: UIColor = FXColors.DarkGrey90
Expand All @@ -90,9 +90,9 @@ private struct PrivateModeColorPalette: ThemeColourPalette {
var iconPrimary: UIColor = FXColors.LightGrey05
var iconSecondary: UIColor = FXColors.LightGrey40
var iconDisabled: UIColor = FXColors.LightGrey05.withAlphaComponent(0.4)
var iconAction: UIColor = FXColors.Blue30
var iconAccent: UIColor = FXColors.Blue30
var iconOnColor: UIColor = FXColors.LightGrey05
var iconWarning: UIColor = FXColors.Red20
var iconCritical: UIColor = FXColors.Red20
var iconSpinner: UIColor = FXColors.White
var iconAccentViolet: UIColor = FXColors.Violet20
var iconAccentBlue: UIColor = FXColors.Blue30
Expand Down
18 changes: 9 additions & 9 deletions BrowserKit/Sources/Common/Theming/ThemeColourPalette.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public protocol ThemeColourPalette {
var layerAccentPrivateNonOpaque: UIColor { get }
var layerSepia: UIColor { get }
var layerHomepage: Gradient { get }
var layerInfo: UIColor { get }
var layerConfirmation: UIColor { get }
var layerInformation: UIColor { get }
var layerSuccess: UIColor { get }
var layerWarning: UIColor { get }
var layerError: UIColor { get }
var layerCritical: UIColor { get }
var layerSelectedText: UIColor { get }
var layerAutofillText: UIColor { get }
var layerSearch: UIColor { get }
Expand Down Expand Up @@ -54,18 +54,18 @@ public protocol ThemeColourPalette {
var formKnob: UIColor { get }
var indicatorActive: UIColor { get }
var indicatorInactive: UIColor { get }
var actionConfirmation: UIColor { get }
var actionSuccess: UIColor { get }
var actionWarning: UIColor { get }
var actionError: UIColor { get }
var actionInfo: UIColor { get }
var actionCritical: UIColor { get }
var actionInformation: UIColor { get }
var actionTabActive: UIColor { get }
var actionTabInactive: UIColor { get }

// MARK: - Text
var textPrimary: UIColor { get }
var textSecondary: UIColor { get }
var textDisabled: UIColor { get }
var textWarning: UIColor { get }
var textCritical: UIColor { get }
var textAccent: UIColor { get }
var textOnDark: UIColor { get }
var textOnLight: UIColor { get }
Expand All @@ -76,9 +76,9 @@ public protocol ThemeColourPalette {
var iconPrimary: UIColor { get }
var iconSecondary: UIColor { get }
var iconDisabled: UIColor { get }
var iconAction: UIColor { get }
var iconAccent: UIColor { get }
var iconOnColor: UIColor { get }
var iconWarning: UIColor { get }
var iconCritical: UIColor { get }
var iconSpinner: UIColor { get }
var iconAccentViolet: UIColor { get }
var iconAccentBlue: UIColor { get }
Expand Down
4 changes: 2 additions & 2 deletions BrowserKit/Sources/ComponentLibrary/Headers/HeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ public final class HeaderView: UIView, ThemeApplicable {
public func setupDetails(subtitle: String, title: String, icon: UIImage?, warningIcon: String?, theme: Theme) {
titleLabel.text = title
subtitleLabel.text = subtitle
subtitleLabel.textColor = theme.colors.textWarning
subtitleLabel.textColor = theme.colors.textCritical
if let icon {
favicon.manuallySetImage(icon)
let isAccessibilityCategory = UIApplication.shared.preferredContentSizeCategory.isAccessibilityCategory
let maskButtonSizes = isAccessibilityCategory ? UX.largeFaviconImageSize : UX.smallFaviconImageSize
favicon.layer.cornerRadius = 0.5 * maskButtonSizes
}
if let warningIcon {
warningIconView.tintColor = theme.colors.iconWarning
warningIconView.tintColor = theme.colors.iconCritical
warningIconView.isHidden = false
warningIconView.image = UIImage(named: warningIcon)?.withRenderingMode(.alwaysTemplate)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public final class NavigationHeaderView: UIView {
.withTintColor(theme.colors.iconSecondary)
closeButton.setImage(buttonImage, for: .normal)
closeButton.backgroundColor = theme.colors.layer2
backButton.tintColor = theme.colors.iconAction
backButton.tintColor = theme.colors.iconAccent
backButton.setTitleColor(theme.colors.textAccent, for: .normal)
horizontalLine.backgroundColor = theme.colors.borderPrimary
titleLabel.textColor = theme.colors.textPrimary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import Foundation
public protocol AddressToolbar {
func configure(state: AddressToolbarState,
toolbarDelegate: AddressToolbarDelegate,
leadingSpace: CGFloat?,
trailingSpace: CGFloat?,
leadingSpace: CGFloat,
trailingSpace: CGFloat,
isUnifiedSearchEnabled: Bool)

func setAutocompleteSuggestion(_ suggestion: String?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public class BrowserAddressToolbar: UIView,

public func configure(state: AddressToolbarState,
toolbarDelegate: any AddressToolbarDelegate,
leadingSpace: CGFloat? = nil,
trailingSpace: CGFloat? = nil,
leadingSpace: CGFloat,
trailingSpace: CGFloat,
isUnifiedSearchEnabled: Bool) {
self.toolbarDelegate = toolbarDelegate
configure(state: state, isUnifiedSearchEnabled: isUnifiedSearchEnabled)
Expand Down Expand Up @@ -142,25 +142,23 @@ public class BrowserAddressToolbar: UIView,
toolbarBottomBorderHeightConstraint?.isActive = true

leadingNavigationActionStackConstraint = navigationActionStack.leadingAnchor.constraint(
equalTo: toolbarContainerView.leadingAnchor,
constant: UX.horizontalEdgeSpace)
equalTo: toolbarContainerView.leadingAnchor)
leadingNavigationActionStackConstraint?.isActive = true

trailingBrowserActionStackConstraint = browserActionStack.trailingAnchor.constraint(
equalTo: toolbarContainerView.trailingAnchor,
constant: -UX.horizontalEdgeSpace)
equalTo: toolbarContainerView.trailingAnchor)
trailingBrowserActionStackConstraint?.isActive = true

locationContainerHeightConstraint = locationContainer.heightAnchor.constraint(equalToConstant: UX.locationHeight)
locationContainerHeightConstraint?.isActive = true

NSLayoutConstraint.activate([
toolbarContainerView.leadingAnchor.constraint(equalTo: leadingAnchor),
toolbarContainerView.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor),
toolbarContainerView.topAnchor.constraint(equalTo: toolbarTopBorderView.topAnchor,
constant: UX.verticalEdgeSpace),
toolbarContainerView.bottomAnchor.constraint(equalTo: toolbarBottomBorderView.bottomAnchor,
constant: -UX.verticalEdgeSpace),
toolbarContainerView.trailingAnchor.constraint(equalTo: trailingAnchor),
toolbarContainerView.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor),

toolbarTopBorderView.leadingAnchor.constraint(equalTo: leadingAnchor),
toolbarTopBorderView.topAnchor.constraint(equalTo: topAnchor),
Expand Down Expand Up @@ -236,9 +234,9 @@ public class BrowserAddressToolbar: UIView,
updateActionSpacing()
}

private func updateSpacing(leading: CGFloat?, trailing: CGFloat?) {
leadingNavigationActionStackConstraint?.constant = leading ?? UX.horizontalEdgeSpace
trailingBrowserActionStackConstraint?.constant = trailing ?? -UX.horizontalEdgeSpace
private func updateSpacing(leading: CGFloat, trailing: CGFloat) {
leadingNavigationActionStackConstraint?.constant = leading
trailingBrowserActionStackConstraint?.constant = -trailing
}

private func setZeroWidthConstraint(_ stackView: UIStackView) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
import UIKit
import Common

final class LocationView: UIView, LocationTextFieldDelegate, ThemeApplicable, AccessibilityActionsSource {
final class LocationView: UIView,
LocationTextFieldDelegate,
ThemeApplicable,
AccessibilityActionsSource,
MenuHelperURLBarInterface {
// MARK: - Properties
private enum UX {
static let horizontalSpace: CGFloat = 8
Expand Down Expand Up @@ -363,6 +367,21 @@ final class LocationView: UIView, LocationTextFieldDelegate, ThemeApplicable, Ac
}
}

// MARK: - MenuHelperURLBarInterface
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
if action == MenuHelperURLBarModel.selectorPasteAndGo {
return UIPasteboard.general.hasStrings
}

return super.canPerformAction(action, withSender: sender)
}

func menuHelperPasteAndGo() {
guard let pasteboardContents = UIPasteboard.general.string else { return }
delegate?.locationViewDidSubmitText(pasteboardContents)
urlTextField.text = pasteboardContents
}

// MARK: - LocationTextFieldDelegate
func locationTextField(_ textField: LocationTextField, didEnterText text: String) {
delegate?.locationViewDidEnterText(text)
Expand Down
2 changes: 1 addition & 1 deletion BrowserKit/Sources/ToolbarKit/ToolbarButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class ToolbarButton: UIButton, ThemeApplicable {

badgeImageView?.layer.borderColor = colors.layer1.cgColor
badgeImageView?.backgroundColor = maskImageView == nil ? colors.layer1 : .clear
badgeImageView?.tintColor = maskImageView == nil ? .clear : colors.actionInfo
badgeImageView?.tintColor = maskImageView == nil ? .clear : colors.actionInformation
maskImageView?.tintColor = colors.layer1

setNeedsUpdateConfiguration()
Expand Down
Loading

0 comments on commit 0d3b713

Please sign in to comment.