@capacitor/ios 3.4.3 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.5.0](https://github.com/ionic-team/capacitor/compare/3.4.3...3.5.0) (2022-04-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **ios:** Add overrideable routing for CAPBridgeViewController subclasses ([#5546](https://github.com/ionic-team/capacitor/issues/5546)) ([8875d5e](https://github.com/ionic-team/capacitor/commit/8875d5e2721e8a8ee763ce70cb672db383f36efa))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [3.4.3](https://github.com/ionic-team/capacitor/compare/3.4.2...3.4.3) (2022-03-04)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @capacitor/ios
|
|
@@ -42,7 +42,7 @@ import Cordova
|
|
|
42
42
|
setScreenOrientationDefaults()
|
|
43
43
|
|
|
44
44
|
// get the web view
|
|
45
|
-
let assetHandler = WebViewAssetHandler()
|
|
45
|
+
let assetHandler = WebViewAssetHandler(router: router())
|
|
46
46
|
assetHandler.setAssetPath(configuration.appLocation.path)
|
|
47
47
|
let delegationHandler = WebViewDelegationHandler()
|
|
48
48
|
prepareWebView(with: configuration, assetHandler: assetHandler, delegationHandler: delegationHandler)
|
|
@@ -89,7 +89,11 @@ import Cordova
|
|
|
89
89
|
}
|
|
90
90
|
return descriptor
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
|
|
93
|
+
open func router() -> Router {
|
|
94
|
+
return _Router()
|
|
95
|
+
}
|
|
96
|
+
|
|
93
97
|
/**
|
|
94
98
|
The WKWebViewConfiguration to use for the webview.
|
|
95
99
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Router.swift
|
|
3
|
+
// Capacitor
|
|
4
|
+
//
|
|
5
|
+
// Created by Steven Sherry on 3/29/22.
|
|
6
|
+
// Copyright © 2022 Drifty Co. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import Foundation
|
|
10
|
+
|
|
11
|
+
public protocol Router {
|
|
12
|
+
func route(for path: String) -> String
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// swiftlint:disable:next type_name
|
|
16
|
+
internal struct _Router: Router {
|
|
17
|
+
func route(for path: String) -> String {
|
|
18
|
+
let pathUrl = URL(string: path)
|
|
19
|
+
|
|
20
|
+
// if the pathUrl is null, then it is an invalid url (meaning it is empty or just plain invalid) then we want to route to /index.html
|
|
21
|
+
if pathUrl?.pathExtension.isEmpty ?? true {
|
|
22
|
+
return "/index.html"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return path
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -3,8 +3,13 @@ import MobileCoreServices
|
|
|
3
3
|
|
|
4
4
|
@objc(CAPWebViewAssetHandler)
|
|
5
5
|
internal class WebViewAssetHandler: NSObject, WKURLSchemeHandler {
|
|
6
|
-
|
|
6
|
+
private let router: Router
|
|
7
7
|
private var basePath: String = ""
|
|
8
|
+
|
|
9
|
+
init(router: Router) {
|
|
10
|
+
self.router = router
|
|
11
|
+
super.init()
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
func setAssetPath(_ assetPath: String) {
|
|
10
15
|
self.basePath = assetPath
|
|
@@ -14,14 +19,14 @@ internal class WebViewAssetHandler: NSObject, WKURLSchemeHandler {
|
|
|
14
19
|
var startPath = self.basePath
|
|
15
20
|
let url = urlSchemeTask.request.url!
|
|
16
21
|
let stringToLoad = url.path
|
|
17
|
-
|
|
22
|
+
|
|
23
|
+
let resolvedRoute = router.route(for: stringToLoad)
|
|
18
24
|
if stringToLoad.starts(with: CapacitorBridge.fileStartIdentifier) {
|
|
19
25
|
startPath = stringToLoad.replacingOccurrences(of: CapacitorBridge.fileStartIdentifier, with: "")
|
|
20
|
-
} else if stringToLoad.isEmpty || url.pathExtension.isEmpty {
|
|
21
|
-
startPath.append("/index.html")
|
|
22
26
|
} else {
|
|
23
|
-
startPath.append(
|
|
27
|
+
startPath.append(resolvedRoute)
|
|
24
28
|
}
|
|
29
|
+
|
|
25
30
|
let localUrl = URL.init(string: url.absoluteString)!
|
|
26
31
|
let fileUrl = URL.init(fileURLWithPath: startPath)
|
|
27
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/ios",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
|
5
5
|
"homepage": "https://capacitorjs.com",
|
|
6
6
|
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"xc:build:CapacitorCordova": "cd CapacitorCordova && xcodebuild && cd .."
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@capacitor/core": "^3.
|
|
27
|
+
"@capacitor/core": "^3.5.0"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "f03e1a67140c8af25288456f9e99dd6234b50f25"
|
|
33
33
|
}
|