-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: default to file scheme #866
Conversation
Codecov Report
@@ 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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checked the code with my limited knowledge. LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should cheek if the appScheme is not null, otherwise it adds (null)://
to allowNavigations
https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.m#L48
Similar thing here https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m#L163
it makes window.CDV_ASSETS_URL
to be"(null)://"
, we should probably just not set it so it's undefined.
Finally the convertFilePath
function should check if window.CDV_ASSETS_URL
is undefined and in that case just return the same path that was provided without modifications.
The feedback suggestions were applied
4251ee8
to
ac2db4c
Compare
ac2db4c
to
653cbf9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
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 :
But in the code, the actual condition is :
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 #781 (review) |
|
Cordova-ios@6.1.0 says 'refactor: default to file scheme', why the url of my app is still |
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>
-> if
file
,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