Skip to content

Commit 3ef6382

Browse files
committed
Remove universal link from service locator as it can be just called directly from app delegate.
1 parent fc725e8 commit 3ef6382

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

WooCommerce/Classes/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4949
///
5050
private lazy var appleIDCredentialChecker = AppleIDCredentialChecker()
5151

52-
private let universalLinkRouter = ServiceLocator.universalLinkRouter
52+
private let universalLinkRouter = UniversalLinkRouter.defaultUniversalLinkRouter()
5353

5454
// MARK: - AppDelegate Methods
5555

WooCommerce/Classes/ServiceLocator/ServiceLocator.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,6 @@ final class ServiceLocator {
219219
static var generalAppSettings: GeneralAppSettingsStorage {
220220
_generalAppSettings
221221
}
222-
223-
static var universalLinkRouter: UniversalLinkRouter {
224-
UniversalLinkRouter(routes: UniversalLinkRouter.defaultRoutes)
225-
}
226222
}
227223

228224

WooCommerce/Classes/Universal Links/UniversalLinkRouter.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ struct UniversalLinkRouter {
1717
self.bouncingURLOpener = bouncingURLOpener
1818
}
1919

20-
static let defaultRoutes: [Route] = [
20+
static func defaultUniversalLinkRouter() -> UniversalLinkRouter {
21+
UniversalLinkRouter(routes: UniversalLinkRouter.defaultRoutes)
22+
}
23+
24+
/// Add your route here if you want it to be considered when matching for an incoming universal link.
25+
/// As we only perform one action to avoid conflicts, order matters (only the first matched route will be called to perform its action)
26+
///
27+
private static let defaultRoutes: [Route] = [
2128
OrderDetailsRoute()
2229
]
2330

0 commit comments

Comments
 (0)