Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor MTE-3854 WIP: Menu Refactor Cherry Pick (Smoke Test only) #23239

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
eff2f41
Cherry pick from an earlier branch
clarmso Nov 19, 2024
dbcaa93
Disable some unit tests
clarmso Nov 19, 2024
b582b8f
Yes, we need call bookmark() twice
clarmso Nov 21, 2024
5b43557
Bugfix FXIOS-10335 Fix audio/video leak after closing tab (#23213)
mattreaganmozilla Nov 19, 2024
598d7cb
Refactor FXIOS-10467 - Remove force_cast violations from Storage and …
bmihai23 Nov 19, 2024
8ca398c
Bugfix FXIOS-10595 Settings screen: "Learn More" links in Send Usage …
ih-codes Nov 19, 2024
b1f177c
Refactor - Update bookmark folder strings (#23250)
dataports Nov 20, 2024
67167cb
Bugfix FXIOS-10600 Nimbus github action (#23219)
isabelrios Nov 20, 2024
63acf1c
Add FXIOS-10605 [ToS] Firefox iOS: Nimbus Flag for ToS (#23251)
dicarobinho Nov 20, 2024
13e6ef2
Bugfix FXIOS-10584 - [Toolbar Redesign] 20+ new homepage tabs are ope…
PARAIPAN9 Nov 20, 2024
25dd674
Fixes MTE-3869 - for flaky addresses smoke tests (#23257)
dragosb01 Nov 20, 2024
7316f81
Fix FXIOS-10626 - Use separate string for sites without a domain in …
issammani Nov 20, 2024
cd3128f
Remove FXIOS-9085 Inactive tab legacy code (#23237)
lmarceau Nov 20, 2024
04d447d
Refactor [v134] Auto update SPM with latest rust-component 134.0.2024…
github-actions[bot] Nov 20, 2024
6ab0f4c
Bugfix FXIOS-10566 - Password Generator: Incorrect Announcement of "U…
DanielDervishi Nov 20, 2024
7cb6c31
Add FXIOS-10460 [Homepage] Context Menu Navigation (#23246)
cyndichin Nov 20, 2024
38c3b57
Document FXIOS-10335 Code comments (#23270)
mattreaganmozilla Nov 20, 2024
263c8fb
Add FXIOS-10603 Telemetry for pull refresh easter egg (#23252)
FilippoZazzeroni Nov 21, 2024
0810123
Refactor Contributing Guideline doc (#23264)
FilippoZazzeroni Nov 21, 2024
f035ccb
Refactor FXIOS-10467 - Remove force_cast violations from CrashManager…
bmihai23 Nov 21, 2024
59351e5
Preliminary Automated test changes for toolbar redesign (#23086)
dragosb01 Nov 21, 2024
4af995e
Refactor FXIOS-10467 - Remove force_cast violations from MenuKit and …
bmihai23 Nov 21, 2024
a4aabf6
Refactor FXIOS-9085 #20125 Remove legacy inactive tab code (#23273)
lmarceau Nov 21, 2024
ddf8c27
Update FXIOS-9851 [Native Error Page] tab tray screenshot for new err…
tusharC95 Nov 21, 2024
98dbb79
Fix MTE-3888 Update testUpdateAllAddressFields test (#23290)
mdotb-moz Nov 21, 2024
6daa82a
Refactor MTE-3882 Update Credit Cards XCUITests (#23287)
mdotb-moz Nov 21, 2024
c77fea4
Refactor [v134] Auto update SPM with latest rust-component 134.0.2024…
github-actions[bot] Nov 21, 2024
b380173
Add FXIOS-10609 [Native Error Page] Added flag to show no internet co…
tusharC95 Nov 21, 2024
503e615
Add FXIOS-9746 Bookmarks panel empty states (#23267)
MattLichtenstein Nov 21, 2024
3563d3c
Add FXIOS-10594 - Add attachments support to RS and pull `tracking-pr…
issammani Nov 21, 2024
a443209
Bugfix FXIOS-10643 - Password Generator: Adjust Background Color (#23…
DanielDervishi Nov 22, 2024
9c5f781
Bugfix FXIOS-10552 - Odd behavior when using Privacy Window in Stage …
PARAIPAN9 Nov 22, 2024
f83ae33
Add FXIOS-10606 [ToS] Firefox iOS: ToS Card in Onboarding - UI Creati…
dicarobinho Nov 22, 2024
2ea2250
Bugfix FXIOS-10569 ⁃ [Menu] Fix the margin and Padding for the sectio…
dicarobinho Nov 22, 2024
0b37396
Refactor - auto update credential provider script (#23304)
github-actions[bot] Nov 22, 2024
ac30a17
Refactor FXIOS-9085 #20125 Rename legacy class to top tabs (#23289)
lmarceau Nov 22, 2024
504273c
Bugfix FXIOS-10646 Ensure we do not change Menu > Share behaviour to …
ih-codes Nov 22, 2024
f4507c4
Bugfix FXIOS-10537 - Password Generator: Hide Strong Password in App …
DanielDervishi Nov 22, 2024
4d7cc3a
Refactor FXIOS-10647 Remove crash alert (#23300)
OrlaM Nov 22, 2024
1c517a4
Fix MTE-3889 Remove updateAddress test from smoketest plan2 (#23330)
mdotb-moz Nov 22, 2024
bf4caa4
Refactor FXIOS-10645 Update Bitrise to use XCode 16.1 (#23211)
OrlaM Nov 22, 2024
0affa85
Add FXIOS-10362 - Enable address autofill edit by default on US and C…
issammani Nov 22, 2024
b49cb53
Bugfix FXIOS-10500 - [Toolbar Redesign] Menu not displayed after tapp…
PARAIPAN9 Nov 22, 2024
dcc80e8
Update Firefox icons from Acorn repo (#23348)
github-actions[bot] Nov 25, 2024
2fdc874
Bug 1929832 - Mark dau-reporting ping as deprecated (#23281)
badboy Nov 25, 2024
e9e8999
Add FXIOS-10568 [ToS] Firefox iOS: Show Onboarding Links in Modal Bro…
dicarobinho Nov 25, 2024
f7c114b
Firefox Localize [v134] String import 2024-11-25 (#23357)
github-actions[bot] Nov 25, 2024
65ddcb5
Update README with recent tech stack (#23347)
github-actions[bot] Nov 25, 2024
88273fd
Add FXiOS-10521 [Homescreen Rebuild] Add wallpaper to new homescreen …
Cramsden Nov 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 8 additions & 8 deletions .github/workflows/firefox-ios-ui-tests-previous-os.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: "Firefox UI Tests for iOS 15 & 16"
name: "Firefox UI Tests for iOS 15, 16 & 17"

on:
workflow_dispatch: {}
env:
browser: firefox-ios
xcode_version: 15.4
ios_version: 17.5
ios_simulator_default: iPhone 15
xcode_version: 16.1
ios_version: 18.1
ios_simulator_default: iPhone 16
xcodebuild_scheme: Fennec
xcodebuild_target: Client
test_results_directory: /Users/runner/tmp

jobs:
compile:
name: Compile
runs-on: macos-14
runs-on: macos-15
steps:
- name: Check out source code
uses: actions/[email protected]
Expand Down Expand Up @@ -54,13 +54,15 @@ jobs:

run-smoketests:
name: Run smoke tests
runs-on: macos-14
runs-on: macos-15
needs: compile
strategy:
fail-fast: false
max-parallel: 1
matrix:
include:
- ios_version: 17.5
ios_simulator: iPhone 15
- ios_version: 16.4
ios_simulator: iPhone 14
- ios_version: 15.5
Expand All @@ -78,8 +80,6 @@ jobs:
id: xcode
run: |
sudo rm -rf /Applications/Xcode.app
sudo rm -fr /Applications/Xcode_16*
sudo rm -fr /Applications/Xcode_14*
sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer
xcodebuild -version
./checkout.sh
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/firefox-ios-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ on:

env:
browser: firefox-ios
xcode_version: 15.4
ios_version: 17.5
ios_simulator_default: iPhone 15
xcode_version: 16.1
ios_version: 18.1
ios_simulator_default: iPhone 16
xcodebuild_scheme: Fennec
xcodebuild_target: Client
test_results_directory: /Users/runner/tmp

jobs:
compile:
name: Compile
runs-on: macos-14
runs-on: macos-15
steps:
- name: Check out source code
uses: actions/[email protected]
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
fail-fast: false
max-parallel: 1
matrix:
ios_simulator: ['iPhone 15 Plus', 'iPad Pro 13-inch (M4)']
ios_simulator: ['iPhone 16', 'iPad mini (A17 Pro)']
steps:
- name: Check out source code
uses: actions/[email protected]
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/firefox-ios-update-nimbus-experiments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,29 @@ jobs:
experimenter-url: https://experimenter.services.mozilla.com/api/v6/experiments-first-run/
app-name: firefox_ios
branch: automation/update-nimbus-experiments
- name: "Debug - workaround issue: 23215"
run: |-
cd firefox-ios
sudo chown runner:docker -R .git
- name: Create Pull Request
id: create-pull-request
uses: peter-evans/create-pull-request@v6
if: steps.update-experiments-json.outputs.changed == 1 && steps.update-experiments-json.outputs.changed-branch >= 1
with:
token: ${{ secrets.GITHUB_TOKEN }}
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: GitHub <[email protected]>
path: firefox-ios
add-paths: firefox-ios/Client/Experiments/initial_experiments.json
branch: automation/update-nimbus-experiments
commit-message: "update initial_experiments.json based on the current first-run experiments in experimenter"
title: "Refactor [vXXX] Update initial experiments JSON for Nimbus"
body: "This (automated) PR updates the initial_experiments.json on the `main` branch"
delete-branch: true
labels: Needs Code Review
- name: Enable Pull Request Automerge
if: steps.create-pull-request.outputs.pull-request-operation == 'created'
run: gh pr merge --squash "${{ steps.create-pull-request.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Disabling Automerge
#- name: Enable Pull Request Automerge
# if: steps.create-pull-request.outputs.pull-request-operation == 'created'
# run: gh pr merge --squash "${{ steps.create-pull-request.outputs.pull-request-number }}"
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Add changes
run: |
git diff
git diff --quiet || git add firefox-ios/Client/Assets/RemoteSettingsData/RemotePasswordRules.json
git diff --quiet || git add firefox-ios/Client/Assets/RemoteSettingsData/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/focus-ios-ui-tests-previous-os.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
name: Focus iOS 15 & 16 tests
name: Focus iOS 15, 16 & 17 tests
on:
workflow_dispatch:
schedule:
- cron: "0 7 * * 1,3,5"

env:
browser: focus-ios
xcode_version: 15.4
xcode_version: 16.1
test_results_directory: /Users/runner/tmp

jobs:
Focus-iOS-Tests:
name: Focus iOS
runs-on: macos-14
runs-on: macos-15
strategy:
fail-fast: false
max-parallel: 1
matrix:
include:
- ios_version: 17.5
ios_simulator: iPhone 15
- ios_version: 16.4
ios_simulator: iPhone 14
- ios_version: 15.5
Expand All @@ -38,7 +40,7 @@ jobs:
id: xcode
run: |
sudo rm -rf /Applications/Xcode.app
sudo rm -fr /Applications/Xcode_16*
sudo rm -fr /Applications/Xcode_15*
sudo rm -fr /Applications/Xcode_14*
sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer
xcodebuild -version
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/focus-ios-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ on:

env:
browser: focus-ios
xcode_version: 15.4
ios_version: 17.5
ios_simulator_default: iPhone 15
xcode_version: 16.1
ios_version: 18.1
ios_simulator_default: iPhone 16
xcodebuild_scheme: Focus
xcodebuild_target: XCUITest
test_results_directory: /Users/runner/tmp

jobs:
compile:
name: Compile
runs-on: macos-14
runs-on: macos-15
steps:
- name: Check out source code
uses: actions/[email protected]
Expand Down Expand Up @@ -49,14 +49,14 @@ jobs:
retention-days: 2
run-tests:
name: Run tests
runs-on: macos-14
runs-on: macos-15
needs: compile
strategy:
fail-fast: false
max-parallel: 1
matrix:
xcodebuild_test_plan: ['SmokeTest'] # , 'FullFunctionalTests']
ios_simulator: [ 'iPhone 15', 'iPad Pro (12.9-inch) (6th generation)']
ios_simulator: [ 'iPhone 16', 'iPad (10th generation)']
steps:
- name: Check out source code
uses: actions/[email protected]
Expand Down
5 changes: 3 additions & 2 deletions BrowserKit/Sources/Common/Logger/CrashManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ public class DefaultCrashManager: CrashManager {
// Turn Sentry breadcrumbs off since we have our own log swizzling
options.enableAutoBreadcrumbTracking = false
options.beforeSend = { event in
if event.error.self is CustomCrashReport {
self.alterEventForCustomCrash(event: event, crash: event.error as! CustomCrashReport)
guard let crashReport = event.error.self as? CustomCrashReport else {
return event
}
self.alterEventForCustomCrash(event: event, crash: crashReport)
return event
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class PrimaryRoundedButton: ResizableButton, ThemeApplicable {

configuration = UIButton.Configuration.filled()
titleLabel?.adjustsFontForContentSizeCategory = true

// Fix for https://openradar.appspot.com/FB12472792
titleLabel?.textAlignment = .center
}

required init?(coder aDecoder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ class DefaultContentBlockerParser: ContentBlockerParser {
return
}

entitiesRaw.forEach {
let properties = ($0.value as! [String: [String]])["properties"]!
let resources = ($0.value as! [String: [String]])["resources"]!
entitiesRaw.forEach { entitiesRawItem in
guard let entitiesDict = entitiesRawItem.value as? [String: [String]],
let properties = entitiesDict["properties"],
let resources = entitiesDict["resources"] else {
return
}
let entity = Entity(properties: properties, resources: resources)
resources.forEach {
entities[$0] = entity
Expand Down
10 changes: 8 additions & 2 deletions BrowserKit/Sources/ContentBlockingGenerator/JsonHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ struct JsonHelper {

do {
let data = try Data(contentsOf: file)
return try JSONSerialization.jsonObject(with: data, options: []) as! [String: Any]
guard let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else {
fatalError("Invalid JSON format: expected [String: Any] in \(filename)")
}
return jsonObject
} catch {
fatalError("Could not find entity file \(filename) at file \(file)")
}
Expand All @@ -21,7 +24,10 @@ struct JsonHelper {

do {
let data = try Data(contentsOf: file)
return try JSONSerialization.jsonObject(with: data, options: []) as! [String]
guard let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String] else {
fatalError("Invalid JSON format: expected [String] in \(filename)")
}
return jsonObject
} catch {
fatalError("Could not find list file \(filename) at file \(file)")
}
Expand Down
4 changes: 2 additions & 2 deletions BrowserKit/Sources/MenuKit/MenuMainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public final class MenuMainView: UIView,

tableView.topAnchor.constraint(equalTo: accountHeaderView.bottomAnchor),
tableView.bottomAnchor.constraint(equalTo: self.bottomAnchor),
tableView.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: -UX.horizontalTableViewMargin),
tableView.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: UX.horizontalTableViewMargin)
tableView.leadingAnchor.constraint(equalTo: self.leadingAnchor),
tableView.trailingAnchor.constraint(equalTo: self.trailingAnchor)
])
}

Expand Down
12 changes: 9 additions & 3 deletions BrowserKit/Sources/MenuKit/MenuTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class MenuTableView: UIView,
ThemeApplicable {
private struct UX {
static let topPadding: CGFloat = 12
static let tableViewMargin: CGFloat = 16
static let distanceBetweenSections: CGFloat = 32
}

private var tableView: UITableView
Expand All @@ -26,6 +28,8 @@ class MenuTableView: UIView,

override init(frame: CGRect) {
tableView = UITableView(frame: .zero, style: .insetGrouped)
tableView.layoutMargins = UIEdgeInsets(top: 0, left: UX.tableViewMargin, bottom: 0, right: UX.tableViewMargin)
tableView.sectionFooterHeight = 0
menuData = []
super.init(frame: .zero)
setupView()
Expand Down Expand Up @@ -70,7 +74,7 @@ class MenuTableView: UIView,
_ tableView: UITableView,
heightForHeaderInSection section: Int
) -> CGFloat {
return section == 0 ? UX.topPadding : UITableView.automaticDimension
return section == 0 ? UX.topPadding : UX.distanceBetweenSections
}

func tableView(
Expand All @@ -84,10 +88,12 @@ class MenuTableView: UIView,
_ tableView: UITableView,
cellForRowAt indexPath: IndexPath
) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(
guard let cell = tableView.dequeueReusableCell(
withIdentifier: MenuCell.cellIdentifier,
for: indexPath
) as! MenuCell
) as? MenuCell else {
return UITableViewCell()
}

cell.configureCellWith(model: menuData[indexPath.section].options[indexPath.row])
if let theme { cell.applyTheme(theme: theme) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public class BrowserAddressToolbar: UIView,
private var theme: Theme?
private var droppableUrl: URL?

/// A cache of `ToolbarButton` instances keyed by their accessibility identifier (`a11yId`).
/// This improves performance by reusing buttons instead of creating new instances.
private(set) var cachedButtonReferences = [String: ToolbarButton]()

private lazy var toolbarContainerView: UIView = .build()
private lazy var navigationActionStack: UIStackView = .build()

Expand Down Expand Up @@ -232,6 +236,7 @@ public class BrowserAddressToolbar: UIView,
setNeedsLayout()
}

// MARK: - Toolbar Actions and Layout Updates
internal func updateActions(state: AddressToolbarState) {
// Browser actions
updateActionStack(stackView: browserActionStack, toolbarElements: state.browserActions)
Expand All @@ -256,16 +261,28 @@ public class BrowserAddressToolbar: UIView,
widthAnchor.priority = .defaultHigh
}

/// Retrieves a `ToolbarButton` for the given `ToolbarElement`.
/// If a cached button exists for the element's accessibility identifier, it returns the cached button.
/// Otherwise, it creates a new button, caches it, and then returns it.
/// - Parameter toolbarElement: The `ToolbarElement` for which to retrieve the button.
/// - Returns: A `ToolbarButton` instance configured for the given `ToolbarElement`.
func getToolbarButton(for toolbarElement: ToolbarElement) -> ToolbarButton {
let button: ToolbarButton
if let cachedButton = cachedButtonReferences[toolbarElement.a11yId] {
button = cachedButton
} else {
button = toolbarElement.numberOfTabs != nil ? TabNumberButton() : ToolbarButton()
cachedButtonReferences[toolbarElement.a11yId] = button
}

return button
}

private func updateActionStack(stackView: UIStackView, toolbarElements: [ToolbarElement]) {
let existingButtons = stackView.arrangedSubviews.compactMap { $0 as? ToolbarButton }
stackView.removeAllArrangedViews()

toolbarElements.forEach { toolbarElement in
// find existing button or create new one
// we do this to avoid having a new button every time we re-configure the address toolbar
// as this can result in button taps not resulting in correct action because the action
// as the reference to an old and not displayed button (e.g. the menu that is displayed from the menu button)
let button = newOrExistingToolbarButton(for: toolbarElement, existingButtons: existingButtons)
let button = getToolbarButton(for: toolbarElement)
button.configure(element: toolbarElement)
stackView.addArrangedSubview(button)

Expand All @@ -285,17 +302,6 @@ public class BrowserAddressToolbar: UIView,
}
}

private func newOrExistingToolbarButton(for element: ToolbarElement,
existingButtons: [ToolbarButton]) -> ToolbarButton {
let existingButton = existingButtons.first { $0.isButtonFor(toolbarElement: element) }

guard let existingButton else {
return element.numberOfTabs != nil ? TabNumberButton() : ToolbarButton()
}

return existingButton
}

private func updateActionSpacing() {
// Browser action spacing
let hasBrowserActions = !browserActionStack.arrangedSubviews.isEmpty
Expand Down
Loading
Loading