Skip to content

Commit

Permalink
Merge branch 'main' into cs/MTE-2449-TrackingProtection-TestRail
Browse files Browse the repository at this point in the history
  • Loading branch information
clarmso authored Mar 25, 2024
2 parents f92d4c5 + 221f04a commit e41bc28
Show file tree
Hide file tree
Showing 133 changed files with 1,895 additions and 318 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ public class ContextualHintView: UIView, ThemeApplicable {
private var viewModel: ContextualHintViewModel!

struct UX {
static let actionButtonTextSize: CGFloat = 17
static let closeButtonSize = CGSize(width: 35, height: 35)
static let closeButtonTrailing: CGFloat = 5
static let closeButtonTop: CGFloat = 23
static let closeButtonBottom: CGFloat = 12
static let closeButtonInsets = NSDirectionalEdgeInsets(top: 0, leading: 7.5, bottom: 15, trailing: 7.5)
static let actionButtonInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)
static let descriptionTextSize: CGFloat = 17
static let stackViewLeading: CGFloat = 16
static let stackViewTopArrowTopConstraint: CGFloat = 16
static let stackViewBottomArrowTopConstraint: CGFloat = 5
Expand All @@ -37,7 +35,7 @@ public class ContextualHintView: UIView, ThemeApplicable {
}

private lazy var descriptionLabel: UILabel = .build { label in
label.font = DefaultDynamicFontHelper.preferredFont(withTextStyle: .body, size: UX.descriptionTextSize)
label.font = FXFontStyles.Regular.body.scaledFont()
label.textAlignment = .left
label.numberOfLines = 0
}
Expand Down Expand Up @@ -156,7 +154,7 @@ public class ContextualHintView: UIView, ThemeApplicable {

if viewModel.isActionType {
let textAttributes: [NSAttributedString.Key: Any] = [
.font: DefaultDynamicFontHelper.preferredFont(withTextStyle: .body, size: UX.actionButtonTextSize),
.font: FXFontStyles.Regular.body.scaledFont(),
.foregroundColor: theme.colors.textOnDark,
.underlineStyle: NSUnderlineStyle.single.rawValue
]
Expand Down
83 changes: 70 additions & 13 deletions firefox-ios/Client.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/mozilla/rust-components-swift.git",
"state" : {
"revision" : "129615b814e8caee86e828d86b914b61419ba20a",
"version" : "126.0.20240319050319"
"revision" : "5769c43ba931a4ec481c090a6651139a38fdb7a6",
"version" : "126.0.20240323050255"
}
},
{
Expand Down
32 changes: 24 additions & 8 deletions firefox-ios/Client/Application/ImageIdentifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ public struct ImageIdentifiers {
public static let menuBadge = "menuBadge"
public static let menuWarningMask = "warning-mask"
public static let navTabCounter = "nav-tabcounter"
public static let onboardingWelcomev106 = "onboardingWelcome"
public static let onboardingSyncv106 = "onboardingSync"
public static let onboardingNotification = "onboardingNotification"
public static let onboardingNotificationsCTD = "onboardingNotificationsCTD"
public static let onboardingWelcomeCTD = "onboardingWelcomeCTD"
public static let onboardingSyncCTD = "onboardingSyncCTD"
public static let onboardingSearchWidget = "onboardingSearchWidget"
public static let onboardingSetToDock = "onboardingDock"
public static let qrCodeScanBorder = "qrcode-scanBorder"
public static let qrCodeScanLine = "qrcode-scanLine"
public static let qrCodeLight = "qrcode-light"
Expand All @@ -49,4 +41,28 @@ public struct ImageIdentifiers {
public static let starHalf = "starHalf"
public static let subtract = "subtract"
public static let syncOpenTab = "sync_open_tab"

public struct Onboarding {
public struct HeaderImages {
public static let welcomev106 = "onboardingWelcome"
public static let syncv106 = "onboardingSync"
public static let notification = "onboardingNotification"
public static let searchWidget = "onboardingSearchWidget"
public static let setToDock = "onboardingDock"
}

public struct MultipleChoiceButtonImages {
public static let themeSystem = "onboardingDock"
public static let themeDark = "onboardingDock"
public static let themeLight = "onboardingDock"
public static let toolbarTop = "onboardingDock"
public static let toolbarBottom = "onboardingDock"
}

public struct ChallengeTheDefault {
public static let notifications = "onboardingNotificationsCTD"
public static let welcome = "onboardingWelcomeCTD"
public static let sync = "onboardingSyncCTD"
}
}
}
7 changes: 7 additions & 0 deletions firefox-ios/Client/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
_ scene: UIScene,
openURLContexts URLContexts: Set<UIOpenURLContext>
) {
// Configure the route with the latest browsing state.
routeBuilder.configure(
isPrivate: UserDefaults.standard.bool(
forKey: PrefsKeys.LastSessionWasPrivate
),
prefs: profile.prefs
)
guard let url = URLContexts.first?.url,
let route = routeBuilder.makeRoute(url: url) else { return }
handle(route: route)
Expand Down
17 changes: 12 additions & 5 deletions firefox-ios/Client/Application/UITestAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -262,18 +262,25 @@ class UITestAppDelegate: AppDelegate, FeatureFlaggable {

// MARK: - Private
private func loadExperiment() {
let argument = ProcessInfo.processInfo.arguments.first { string in
let argumentExperimentFile = ProcessInfo.processInfo.arguments.first { string in
string.starts(with: LaunchArguments.LoadExperiment)
}

guard let arg = argument else { return }
let argumentFeatureName = ProcessInfo.processInfo.arguments.first { string in
string.starts(with: LaunchArguments.ExperimentFeatureName)
}

guard let argumentExperimentFile, let argumentFeatureName else { return }

let experimentName = arg.replacingOccurrences(of: LaunchArguments.LoadExperiment, with: "")
let fileURL = Bundle.main.url(forResource: experimentName, withExtension: "json")
let experimentFeatureName = argumentFeatureName.replacingOccurrences(of: LaunchArguments.ExperimentFeatureName,
with: "")
let experimentFileName = argumentExperimentFile.replacingOccurrences(of: LaunchArguments.LoadExperiment,
with: "")
let fileURL = Bundle.main.url(forResource: experimentFileName, withExtension: "json")
if let fileURL = fileURL {
do {
let fileContent = try String(contentsOf: fileURL)
let features = HardcodedNimbusFeatures(with: ["messaging": fileContent])
let features = HardcodedNimbusFeatures(with: [experimentFeatureName: fileContent])
features.connect(with: FxNimbus.shared)
} catch {
}
Expand Down
16 changes: 11 additions & 5 deletions firefox-ios/Client/Coordinators/Browser/BrowserCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class BrowserCoordinator: BaseCoordinator,
navigationController.onViewDismissed = { [weak self] in
self?.didFinishSettings(from: settingsCoordinator)
}
router.present(navigationController)
present(navigationController)
}

private func showLibrary(with homepanelSection: Route.HomepanelSection) {
Expand All @@ -365,7 +365,7 @@ class BrowserCoordinator: BaseCoordinator,
add(child: libraryCoordinator)
libraryCoordinator.start(with: homepanelSection)

router.present(navigationController)
present(navigationController)
}
}

Expand Down Expand Up @@ -636,7 +636,6 @@ class BrowserCoordinator: BaseCoordinator,
guard !childCoordinators.contains(where: { $0 is TabTrayCoordinator }) else {
return // flow is already handled
}

let navigationController = DismissableNavigationViewController()
let isPad = UIDevice.current.userInterfaceIdiom == .pad
let modalPresentationStyle: UIModalPresentationStyle = isPad ? .fullScreen: .formSheet
Expand All @@ -652,7 +651,7 @@ class BrowserCoordinator: BaseCoordinator,
add(child: tabTrayCoordinator)
tabTrayCoordinator.start(with: selectedPanel)

router.present(navigationController)
present(navigationController)
}

func showBackForwardList() {
Expand All @@ -662,7 +661,14 @@ class BrowserCoordinator: BaseCoordinator,
backForwardListVC.browserFrameInfoProvider = browserViewController
backForwardListVC.tabManager = tabManager
backForwardListVC.modalPresentationStyle = .overCurrentContext
router.present(backForwardListVC)
present(backForwardListVC)
}

private func present(_ viewController: UIViewController,
animated: Bool = true,
completion: (() -> Void)? = nil) {
browserViewController.willNavigateAway()
router.present(viewController)
}

// MARK: - ParentCoordinatorDelegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import Foundation
import Storage

protocol BookmarksCoordinatorDelegate: AnyObject {
protocol BookmarksCoordinatorDelegate: AnyObject, LibraryPanelCoordinatorDelegate {
func start(from folder: FxBookmarkNode)

/// Shows the bookmark detail to modify a bookmark folder
Expand Down Expand Up @@ -38,6 +38,7 @@ class BookmarksCoordinator: BaseCoordinator, BookmarksCoordinatorDelegate {

private let profile: Profile
private weak var parentCoordinator: LibraryCoordinatorDelegate?
private weak var navigationHandler: LibraryNavigationHandler?
private let windowUUID: WindowUUID

// MARK: - Initializers
Expand All @@ -46,11 +47,13 @@ class BookmarksCoordinator: BaseCoordinator, BookmarksCoordinatorDelegate {
router: Router,
profile: Profile,
windowUUID: WindowUUID,
parentCoordinator: LibraryCoordinatorDelegate?
parentCoordinator: LibraryCoordinatorDelegate?,
navigationHandler: LibraryNavigationHandler?
) {
self.profile = profile
self.windowUUID = windowUUID
self.parentCoordinator = parentCoordinator
self.navigationHandler = navigationHandler
super.init(router: router)
}

Expand Down Expand Up @@ -88,4 +91,8 @@ class BookmarksCoordinator: BaseCoordinator, BookmarksCoordinatorDelegate {
}
router.push(detailController)
}

func shareLibraryItem(url: URL, sourceView: UIView) {
navigationHandler?.shareLibraryItem(url: url, sourceView: sourceView)
}
}
11 changes: 9 additions & 2 deletions firefox-ios/Client/Coordinators/Library/HistoryCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Common
import Shared
import Storage

protocol HistoryCoordinatorDelegate: AnyObject {
protocol HistoryCoordinatorDelegate: AnyObject, LibraryPanelCoordinatorDelegate {
func showRecentlyClosedTab()

/// Shows table view controller with searched sites grouped.
Expand All @@ -21,6 +21,7 @@ class HistoryCoordinator: BaseCoordinator, HistoryCoordinatorDelegate {
private let windowUUID: WindowUUID
private let notificationCenter: NotificationProtocol
private weak var parentCoordinator: LibraryCoordinatorDelegate?
private weak var navigationHandler: LibraryNavigationHandler?

// MARK: - Initializers

Expand All @@ -29,12 +30,14 @@ class HistoryCoordinator: BaseCoordinator, HistoryCoordinatorDelegate {
windowUUID: WindowUUID,
router: Router,
notificationCenter: NotificationProtocol = NotificationCenter.default,
parentCoordinator: LibraryCoordinatorDelegate?
parentCoordinator: LibraryCoordinatorDelegate?,
navigationHandler: LibraryNavigationHandler?
) {
self.profile = profile
self.windowUUID = windowUUID
self.parentCoordinator = parentCoordinator
self.notificationCenter = notificationCenter
self.navigationHandler = navigationHandler
super.init(router: router)
self.notificationCenter.addObserver(
self,
Expand Down Expand Up @@ -68,6 +71,10 @@ class HistoryCoordinator: BaseCoordinator, HistoryCoordinatorDelegate {
router.push(asGroupListVC)
}

func shareLibraryItem(url: URL, sourceView: UIView) {
navigationHandler?.shareLibraryItem(url: url, sourceView: sourceView)
}

deinit {
notificationCenter.removeObserver(self)
}
Expand Down
34 changes: 31 additions & 3 deletions firefox-ios/Client/Coordinators/Library/LibraryCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ protocol LibraryCoordinatorDelegate: AnyObject, LibraryPanelDelegate, RecentlyCl

protocol LibraryNavigationHandler: AnyObject {
func start(panelType: LibraryPanelType, navigationController: UINavigationController)
func shareLibraryItem(url: URL, sourceView: UIView)
}

class LibraryCoordinator: BaseCoordinator, LibraryPanelDelegate, LibraryNavigationHandler {
class LibraryCoordinator: BaseCoordinator, LibraryPanelDelegate, LibraryNavigationHandler, ParentCoordinatorDelegate {
private let profile: Profile
private let tabManager: TabManager
private var libraryViewController: LibraryViewController!
Expand Down Expand Up @@ -75,14 +76,21 @@ class LibraryCoordinator: BaseCoordinator, LibraryPanelDelegate, LibraryNavigati
}
}

func shareLibraryItem(url: URL, sourceView: UIView) {
guard !childCoordinators.contains(where: { $0 is ShareExtensionCoordinator }) else { return }
let coordinator = makeShareExtensionCoordinator()
coordinator.start(url: url, sourceView: sourceView)
}

private func makeBookmarksCoordinator(navigationController: UINavigationController) {
guard !childCoordinators.contains(where: { $0 is BookmarksCoordinator }) else { return }
let router = DefaultRouter(navigationController: navigationController)
let bookmarksCoordinator = BookmarksCoordinator(
router: router,
profile: profile,
windowUUID: windowUUID,
parentCoordinator: parentCoordinator
parentCoordinator: parentCoordinator,
navigationHandler: self
)
add(child: bookmarksCoordinator)
(navigationController.topViewController as? BookmarksPanel)?.bookmarkCoordinatorDelegate = bookmarksCoordinator
Expand All @@ -95,7 +103,8 @@ class LibraryCoordinator: BaseCoordinator, LibraryPanelDelegate, LibraryNavigati
profile: profile,
windowUUID: windowUUID,
router: router,
parentCoordinator: parentCoordinator
parentCoordinator: parentCoordinator,
navigationHandler: self
)
add(child: historyCoordinator)
(navigationController.topViewController as? HistoryPanel)?.historyCoordinatorDelegate = historyCoordinator
Expand All @@ -119,12 +128,31 @@ class LibraryCoordinator: BaseCoordinator, LibraryPanelDelegate, LibraryNavigati
let router = DefaultRouter(navigationController: navigationController)
let readingListCoordinator = ReadingListCoordinator(
parentCoordinator: parentCoordinator,
navigationHandler: self,
router: router
)
add(child: readingListCoordinator)
(navigationController.topViewController as? ReadingListPanel)?.navigationHandler = readingListCoordinator
}

// MARK: - ParentCoordinatorDelegate

func didFinish(from childCoordinator: any Coordinator) {
remove(child: childCoordinator)
}

private func makeShareExtensionCoordinator() -> ShareExtensionCoordinator {
let coordinator = ShareExtensionCoordinator(
alertContainer: UIView(),
router: router,
profile: profile,
parentCoordinator: self,
tabManager: tabManager
)
add(child: coordinator)
return coordinator
}

// MARK: - LibraryPanelDelegate

func libraryPanelDidRequestToOpenInNewTab(_ url: URL, isPrivate: Bool) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import Foundation

/// Share navigation across the library panels
protocol LibraryPanelCoordinatorDelegate: AnyObject {
func shareLibraryItem(url: URL, sourceView: UIView)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
import Foundation
import Storage

protocol ReadingListNavigationHandler: AnyObject {
protocol ReadingListNavigationHandler: AnyObject, LibraryPanelCoordinatorDelegate {
func openUrl(_ url: URL, visitType: VisitType)
}

class ReadingListCoordinator: BaseCoordinator, ReadingListNavigationHandler {
// MARK: - Properties

private weak var parentCoordinator: LibraryCoordinatorDelegate?
private weak var navigationHandler: LibraryNavigationHandler?

// MARK: - Initializers

init(
parentCoordinator: LibraryCoordinatorDelegate?,
navigationHandler: LibraryNavigationHandler?,
router: Router
) {
self.parentCoordinator = parentCoordinator
self.navigationHandler = navigationHandler
super.init(router: router)
}

Expand All @@ -29,4 +32,8 @@ class ReadingListCoordinator: BaseCoordinator, ReadingListNavigationHandler {
func openUrl(_ url: URL, visitType: VisitType) {
parentCoordinator?.libraryPanel(didSelectURL: url, visitType: visitType)
}

func shareLibraryItem(url: URL, sourceView: UIView) {
navigationHandler?.shareLibraryItem(url: url, sourceView: sourceView)
}
}
Loading

0 comments on commit e41bc28

Please sign in to comment.