-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FXIOS-10299 [Universal Links]Add AppLinks configuration for blog.…
…mozilla.com and handle ULs (#23867) * Add AppLinks configuration for blog.mozilla.com and handle ULs * Add feature flagging for universal links * update ff off logic to allow any activity type * move isBrowsing activity to a function instead of an inline variable
- Loading branch information
Showing
10 changed files
with
130 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
firefox-ios/firefox-ios-tests/Tests/ClientTests/Coordinators/RouteBuilderTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// 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 XCTest | ||
@testable import Client | ||
|
||
class RouteBuilderTests: XCTestCase { | ||
let testURL = URL(string: "https://example.com") | ||
let handoffUserActivity = NSUserActivity(activityType: browsingActivityType) | ||
let universalLinkUserActivity = NSUserActivity(activityType: NSUserActivityTypeBrowsingWeb) | ||
let randomActivity = NSUserActivity(activityType: "random") | ||
|
||
override func setUp() { | ||
super.setUp() | ||
LegacyFeatureFlagsManager.shared.initializeDeveloperFeatures(with: MockProfile()) | ||
handoffUserActivity.webpageURL = testURL | ||
universalLinkUserActivity.webpageURL = testURL | ||
randomActivity.webpageURL = testURL | ||
} | ||
func test_makeRoute_whenUniversalLinkIsDisabled_HandlesAnyACtivityType() { | ||
setupNimbusUniversalLinksTesting(isEnabled: false) | ||
let routeBuilder = createSubject() | ||
|
||
let route = routeBuilder.makeRoute( | ||
userActivity: handoffUserActivity | ||
) | ||
|
||
let universalLinkRoute = routeBuilder.makeRoute( | ||
userActivity: universalLinkUserActivity | ||
) | ||
|
||
let randomRoute = routeBuilder.makeRoute( | ||
userActivity: randomActivity | ||
) | ||
|
||
XCTAssertEqual(route, .search(url: testURL, isPrivate: false)) | ||
XCTAssertEqual(universalLinkRoute, .search(url: testURL, isPrivate: false)) | ||
XCTAssertEqual(randomRoute, .search(url: testURL, isPrivate: false)) | ||
} | ||
|
||
func test_makeRoute_whenUniversalLinkIsEnabled_handlesWebpageURLForActivityTypeBrowsingActivityAndBrowsingWeb() { | ||
setupNimbusUniversalLinksTesting(isEnabled: true) | ||
let routeBuilder = createSubject() | ||
|
||
let route = routeBuilder.makeRoute( | ||
userActivity: handoffUserActivity | ||
) | ||
|
||
let universalLinkRoute = routeBuilder.makeRoute( | ||
userActivity: universalLinkUserActivity | ||
) | ||
|
||
let randomRoute = routeBuilder.makeRoute( | ||
userActivity: randomActivity | ||
) | ||
|
||
XCTAssertEqual(route, .search(url: testURL, isPrivate: false)) | ||
XCTAssertEqual(universalLinkRoute, .search(url: testURL, isPrivate: false)) | ||
XCTAssertNil(randomRoute) | ||
} | ||
|
||
private func createSubject() -> RouteBuilder { | ||
let subject = RouteBuilder() | ||
trackForMemoryLeaks(subject) | ||
return subject | ||
} | ||
|
||
private func setupNimbusUniversalLinksTesting(isEnabled: Bool) { | ||
FxNimbus.shared.features.universalLinks.with { _, _ in | ||
return UniversalLinks( | ||
enabled: isEnabled | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# The configuration for the universalLinks feature | ||
features: | ||
universal-links: | ||
description: > | ||
This feature is for managing the roll out of universal link support in the iOS App | ||
variables: | ||
enabled: | ||
description: > | ||
If true, enables the feature | ||
type: Boolean | ||
default: false | ||
defaults: | ||
- channel: beta | ||
value: | ||
enabled: false | ||
- channel: developer | ||
value: | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters