Closed erisu closed 4 years ago
Merging #866 into master will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #866 +/- ##
=======================================
Coverage 74.40% 74.40%
=======================================
Files 13 13
Lines 1676 1676
=======================================
Hits 1247 1247
Misses 429 429
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 7460737...653cbf9. Read the comment docs.
I have a hard time understanding how to use custom scheme with cordova-ios 6, specifically the behaviour introduced here :
In the description of the behaviour by erisu, it says :
it will also validate against WKWebView handlesURLScheme, if it is not valid, it will default to app
But in the code, the actual condition is :
if(scheme == nil || [WKWebView handlesURLScheme:scheme]){
scheme = @"app";
}
which, to my understanding of Objective-C, means that if it IS valid, it will default to app, cf. WKWebView handlesURLScheme documentation here
Could someone clarify this to me ?
During the course of development, defaulting to custom scheme was changed to default to the file url.
The reasoning is because changing protocols will cause users to be missing their web storage data. So we wanted to make schemes an opt-in feature instead.
I don't think this feature is documented yet, but an example config to use schemes can be found at https://github.com/apache/cordova-ios/pull/781#pullrequestreview-357408875
handlesURLScheme
returns true if the webview already handles the scheme, if the webview already handles that scheme, it means we can't use that scheme for serving the app content, so if you set the scheme to http, https, file or a few others, handlesURLScheme
is true and we default to app
, if it returns false, it means whatever you configured is safe to use.
Cordova-ios@6.1.0 says 'refactor: default to file scheme', why the url of my app is still myscheme://
not 'file://'?
How to open file://
url while still remain <preference name="scheme" value="myscheme" />
?
Motivation and Context
Use
file
as default scheme to avoid break in current apps/Description
file
if preferencescheme
is not set.file
if preference scheme is set tofile
.scheme
as a custom scheme handler, excludingfile
which was defined in the above case 2.hostname
is only used whenscheme
is notfile
.CDV_ASSETS_URL
is set to<scheme>://<hostname>
-> iffile
,hostname = “”
. -> if!file
,hostname = "localhost"
or user define value for preferencehostname
.scheme
is set and is notfile
, it will also validate againstWKWebView handlesURLScheme
, if it is not valid, it will default toapp
Testing
Checklist