Skip to content

Commit

Permalink
Merge branch 'main' into wt/FXIOS-8361-update-mobile-icons-to-new-sty…
Browse files Browse the repository at this point in the history
…le-pt4
  • Loading branch information
thatswinnie committed May 13, 2024
2 parents cb9ceb9 + 5422599 commit f811a29
Show file tree
Hide file tree
Showing 116 changed files with 1,417 additions and 872 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/firefox-ios-autofill-playwrite-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Build and Run Autofill Automation
permissions: read-all
on:
workflow_call:
secrets:
SLACK_WEBHOOK_URL:
required: true
workflow_dispatch: {}
pull_request:
paths:
- 'firefox-ios/Client/Assets/CC_Script/**'
Expand All @@ -16,10 +21,14 @@ jobs:
matrix:
python-version: [3.9]
xcode: ["15.2"]
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get the current github action name
run: |
github_action_name="Update credential provider script"
echo "github_action_name=$github_action_name" >> $GITHUB_ENV
- name: Clone repository
run: |
git clone https://github.com/issammani/test-playwright.git
Expand All @@ -39,3 +48,23 @@ jobs:
echo "Run tests"
npm test
- name: Send Slack notification if tests fail
if: '!cancelled()'
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"text": "GitHub Action Running Tests For ${{ env.github_action_name }} result: ${{ job.status }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action Running Tests For result: ${{ job.status }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- cron: '0 0 * * *'
workflow_dispatch: # adding the workflow_dispatch so it can be triggered manually

env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -15,8 +18,11 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get the current github action name
run: |
github_action_name="Update credential provider script"
echo "github_action_name=$github_action_name" >> $GITHUB_ENV
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -41,3 +47,27 @@ jobs:
title: Refactor [vXXX] auto update credential provider script
branch: update-cred-provider-script
token: ${{ secrets.GITHUB_TOKEN }}
- name: Send Slack to notifiy if github action fails
if: '!cancelled()'
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"text": "GitHub Action ${{ env.github_action_name }} build result: ${{ job.status }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action build result: ${{ job.status }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
call-firefox-ios-autofill-playwrite-tests:
uses: ./.github/workflows/firefox-ios-autofill-playwrite-tests.yml
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class SecondaryRoundedButton: ResizableButton, ThemeApplicable {
updatedConfiguration.background.backgroundColorTransformer = nil
updatedConfiguration.background.cornerRadius = UX.buttonCornerRadius
updatedConfiguration.cornerStyle = .fixed
addCornerRadiusForVisualEffectView(radiusSize: UX.buttonCornerRadius)

accessibilityIdentifier = viewModel.a11yIdentifier

Expand Down Expand Up @@ -97,6 +98,14 @@ public class SecondaryRoundedButton: ResizableButton, ThemeApplicable {
setNeedsUpdateConfiguration()
}

func addCornerRadiusForVisualEffectView(radiusSize: CGFloat) {
// Note: changing the corner radius for the subview, in this case UIVisualEffectView
// is required for certain cases where UIVisualEffectView doesn't update with super view radius change
for subview in self.subviews where subview is UIVisualEffectView {
subview.layer.cornerRadius = radiusSize
}
}

// MARK: ThemeApplicable

public func applyTheme(theme: Theme) {
Expand Down
14 changes: 1 addition & 13 deletions BrowserKit/Sources/TabDataStore/TabDataStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,7 @@ public actor DefaultTabDataStore: TabDataStore {
}

private func parseWindowDataFile(fromURL url: URL) -> WindowData? {
return parseWindowDataFiles(fromURLs: [url]).first
}

private func parseWindowDataFiles(fromURLs urlList: [URL]) -> [WindowData] {
var windowsData: [WindowData] = []
for fileURL in urlList {
do {
if let windowData = try? fileManager.getWindowDataFromPath(path: fileURL) {
windowsData.append(windowData)
}
}
}
return windowsData
return try? fileManager.getWindowDataFromPath(path: url)
}

// MARK: - Saving Data
Expand Down
34 changes: 33 additions & 1 deletion BrowserKit/Sources/ToolbarKit/ToolbarButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class ToolbarButton: UIButton, ThemeApplicable {
var foregroundColorDisabled: UIColor = .clear
var backgroundColorNormal: UIColor = .clear

private var onLongPress: (() -> Void)?

override init(frame: CGRect) {
super.init(frame: frame)

Expand All @@ -30,6 +32,8 @@ class ToolbarButton: UIButton, ThemeApplicable {
guard var config = configuration else {
return
}
removeAllGestureRecognizers()
configureLongPressGestureRecognizerIfNeeded(for: element)

let image = UIImage(named: element.iconName)?.withRenderingMode(.alwaysTemplate)
let action = UIAction(title: element.a11yLabel,
Expand Down Expand Up @@ -74,7 +78,35 @@ class ToolbarButton: UIButton, ThemeApplicable {
configuration = updatedConfiguration
}

// MARK: ThemeApplicable
private func configureLongPressGestureRecognizerIfNeeded(for element: ToolbarElement) {
guard element.onLongPress != nil else { return }
onLongPress = element.onLongPress
let longPressRecognizer = UILongPressGestureRecognizer(
target: self,
action: #selector(handleLongPress)
)
addGestureRecognizer(longPressRecognizer)
}

private func removeAllGestureRecognizers() {
if let gestureRecognizers = gestureRecognizers {
for recognizer in gestureRecognizers {
removeGestureRecognizer(recognizer)
}
}
}

// MARK: - Selectors
@objc
private func handleLongPress(_ gestureRecognizer: UILongPressGestureRecognizer) {
if gestureRecognizer.state == .began {
let generator = UIImpactFeedbackGenerator(style: .light)
generator.impactOccurred()
onLongPress?()
}
}

// MARK: - ThemeApplicable
public func applyTheme(theme: Theme) {
foregroundColorNormal = theme.colors.iconPrimary
foregroundColorHighlighted = theme.colors.iconPrimary
Expand Down
7 changes: 6 additions & 1 deletion BrowserKit/Sources/ToolbarKit/ToolbarElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,21 @@ public struct ToolbarElement {
/// Closure that is executed when the toolbar element is tapped
let onSelected: (() -> Void)?

/// Closure that is executed when the toolbar element is long pressed
let onLongPress: (() -> Void)?

// We need this init as by default the init generated by the compiler for the struct will be internal and
// can therefor not be used outside of the ToolbarKit
public init(iconName: String,
isEnabled: Bool,
a11yLabel: String,
a11yId: String,
onSelected: (() -> Void)?) {
onSelected: (() -> Void)?,
onLongPress: (() -> Void)? = nil) {
self.iconName = iconName
self.isEnabled = isEnabled
self.onSelected = onSelected
self.onLongPress = onLongPress
self.a11yLabel = a11yLabel
self.a11yId = a11yId
}
Expand Down
2 changes: 2 additions & 0 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ workflows:
echo "Swiftlint version before mirror swap"
swiftlint version
# Workaround to find the homebrew-core folder
brew tap homebrew/core --force
cd "$(brew --repository)/Library/Taps/homebrew/homebrew-core"
# Bypass Bitrise mirror that lags 1 week to 1 month behind homebrew-core versions
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
Expand Down
2 changes: 2 additions & 0 deletions firefox-ios/Account/FxAPushMessageHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ extension FxAPushMessageHandler {
let title = tabData.entries.last?.title ?? ""
let url = tabData.entries.last?.url ?? ""
completion(.success(PushMessage.commandReceived(tab: ["title": title, "url": url])))
default:
break
}
case .deviceConnected(let deviceName):
completion(.success(PushMessage.deviceConnected(deviceName)))
Expand Down
8 changes: 7 additions & 1 deletion firefox-ios/Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
1D2F68B12ACCA22000524B92 /* RemoteTabsEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D2F68B02ACCA22000524B92 /* RemoteTabsEmptyView.swift */; };
1D3822E92BAB99250046BC5E /* UIView+Multiwindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D3822E82BAB99250046BC5E /* UIView+Multiwindow.swift */; };
1D3C90882ACE1AF400304C87 /* RemoteTabPanelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D3C90872ACE1AF400304C87 /* RemoteTabPanelTests.swift */; };
1D558A572BED7ECB001EF527 /* MockWindowManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D558A562BED7ECB001EF527 /* MockWindowManager.swift */; };
1D558A582BED7ECB001EF527 /* MockWindowManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D558A562BED7ECB001EF527 /* MockWindowManager.swift */; };
1D5CBF492B17E3CB0001D033 /* NotificationPayloads.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D5CBF482B17E3CB0001D033 /* NotificationPayloads.swift */; };
1D5CBF4A2B17E3CB0001D033 /* NotificationPayloads.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D5CBF482B17E3CB0001D033 /* NotificationPayloads.swift */; };
1D69FF8D27B17286001F660E /* HomeLogoHeaderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D69FF8C27B17285001F660E /* HomeLogoHeaderCell.swift */; };
Expand Down Expand Up @@ -2230,6 +2232,7 @@
1D2F68B02ACCA22000524B92 /* RemoteTabsEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteTabsEmptyView.swift; sourceTree = "<group>"; };
1D3822E82BAB99250046BC5E /* UIView+Multiwindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Multiwindow.swift"; sourceTree = "<group>"; };
1D3C90872ACE1AF400304C87 /* RemoteTabPanelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteTabPanelTests.swift; sourceTree = "<group>"; };
1D558A562BED7ECB001EF527 /* MockWindowManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockWindowManager.swift; sourceTree = "<group>"; };
1D5CBF482B17E3CB0001D033 /* NotificationPayloads.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationPayloads.swift; sourceTree = "<group>"; };
1D69FF8C27B17285001F660E /* HomeLogoHeaderCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeLogoHeaderCell.swift; sourceTree = "<group>"; };
1D74FF4D2B27962200FF01D0 /* WindowManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowManagerTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -10559,6 +10562,7 @@
E1463D0529830E4F0074E16E /* MockUserNotificationCenter.swift */,
2173326929CCF901007F20C7 /* UIPanGestureRecognizerMock.swift */,
BA1C68BB2B7ED153000D9397 /* MockWebKit.swift */,
1D558A562BED7ECB001EF527 /* MockWindowManager.swift */,
);
path = Mocks;
sourceTree = "<group>";
Expand Down Expand Up @@ -13801,6 +13805,7 @@
8A93F86229D36F0F004159D9 /* NavigationController.swift in Sources */,
E13F8C342928194800BDC8B4 /* PhotonActionSheetSiteHeaderView.swift in Sources */,
C2D71B9B2A3850B4003DEC7A /* ThemedTableViewCellViewModel.swift in Sources */,
1D558A572BED7ECB001EF527 /* MockWindowManager.swift in Sources */,
C869912F28917688007ACC5C /* WallpaperMetadataLoader.swift in Sources */,
8A6904802B97BBAE00E30047 /* SplashScreenAnimation.swift in Sources */,
2137785D297F1F2800D01309 /* DownloadedFile.swift in Sources */,
Expand Down Expand Up @@ -14558,6 +14563,7 @@
E19B38B128A3E69300D8C541 /* WallpaperCollectionAvailabilityTests.swift in Sources */,
8A359EF62A1FE840004A5BB7 /* MockAdjustWrapper.swift in Sources */,
8AC225662B6D403200CDA7FD /* HomepageTelemetryTests.swift in Sources */,
1D558A582BED7ECB001EF527 /* MockWindowManager.swift in Sources */,
C8DC90D22A067C6D0008832B /* MarkupAttributionUtilityTests.swift in Sources */,
BA1C68BC2B7ED153000D9397 /* MockWebKit.swift in Sources */,
21737FB72878A4BD000A9A92 /* HistoryPanelViewModelTests.swift in Sources */,
Expand Down Expand Up @@ -21575,7 +21581,7 @@
repositoryURL = "https://github.com/mozilla/rust-components-swift.git";
requirement = {
kind = exactVersion;
version = 127.0.20240430050317;
version = 127.0.20240509050254;
};
};
435C85EE2788F4D00072B526 /* XCRemoteSwiftPackageReference "glean-swift" */ = {
Expand Down
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" : "fb6671d24023c79a1dc2afd3aac7c850167c5c63",
"version" : "127.0.20240430050317"
"revision" : "77974078cfa6bfb4e7aee40139c97a544989aff7",
"version" : "127.0.20240509050254"
}
},
{
Expand Down
3 changes: 0 additions & 3 deletions firefox-ios/Client/Application/DependencyHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ class DependencyHelper {
let downloadQueue: DownloadQueue = appDelegate.appSessionManager.downloadQueue
AppContainer.shared.register(service: downloadQueue)

let tabDataStore: TabDataStore = appDelegate.tabDataStore
AppContainer.shared.register(service: tabDataStore)

let windowManager: WindowManager = appDelegate.windowManager
AppContainer.shared.register(service: windowManager)

Expand Down
2 changes: 2 additions & 0 deletions firefox-ios/Client/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

// Notify WindowManager that window is closing
(AppContainer.shared.resolve() as WindowManager).windowWillClose(uuid: sceneCoordinator.windowUUID)
self.sceneCoordinator?.removeAllChildren()
self.sceneCoordinator = nil
}

// MARK: - Transitioning to Foreground
Expand Down
14 changes: 10 additions & 4 deletions firefox-ios/Client/Application/WindowManager+DebugUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ extension WindowManagerImplementation {
var result = "----------- Window Debug Info ------------\n"
result.append("Open windows (\(windows.count)) & normal tabs (via TabManager):\n")
for (idx, (uuid, _)) in windows.enumerated() {
result.append(" \(idx + 1): \(short(uuid))\n")
let tabMgr = tabManager(for: uuid)
let window = windows[uuid]?.sceneCoordinator?.window
let frame = window?.frame ?? .zero
result.append(" \(idx + 1): \(short(uuid)) (\(tabMgr.normalTabs.count) tabs) (frame: \(frame.debugDescription))\n")
for (tabIdx, tab) in tabMgr.normalTabs.enumerated() {
result.append(" \(tabIdx): \(tab.url?.absoluteString ?? "<nil url>")\n")
let memAddr = Unmanaged.passUnretained(tab).toOpaque()
result.append(" \(tabIdx + 1) (\(memAddr)): \(tab.url?.absoluteString ?? "<nil url>")\n")
}
}
result.append("\n")
Expand All @@ -34,12 +37,15 @@ extension WindowManagerImplementation {

// Note: this is provided as a convenience for internal debugging. See `DefaultTabDataStore.swift`.
for (idx, uuid) in tabDataStore.fetchWindowDataUUIDs().enumerated() {
result.append(" \(idx + 1): Window \(short(uuid))\n")
let baseURL = fileManager.windowDataDirectory(isBackup: false)!
let dataURL = baseURL.appendingPathComponent("window-" + uuid.uuidString)
if idx == 0 {
result.append(" Data dir: \(baseURL.absoluteString)\n")
}
result.append(" \(idx + 1): Window \(short(uuid))\n")
guard let data = try? fileManager.getWindowDataFromPath(path: dataURL) else { continue }
for (tabIdx, tabData) in data.tabData.enumerated() {
result.append(" \(tabIdx + 1): \(tabData.siteUrl)\n")
result.append(" \(tabIdx + 1): \(tabData.siteUrl) (Window: \(short(data.id))\n")
}
}
return result
Expand Down
Loading

0 comments on commit f811a29

Please sign in to comment.