Skip to content
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

(iOS) Project changes to allow consuming cordova as submodule #1015

Merged
merged 1 commit into from Oct 30, 2020

Conversation

wmathurin
Copy link
Contributor

Platforms affected

iOS

Motivation and Context

If your application consumes cordova as a submodule and depends on the cordova dynamic framework, it will fail to run properly because the web view engine classes are not in the framework.
As a result, CDVViewController fails to build the web view engine by reflection.

self.webViewEngine = [[NSClassFromString(defaultWebViewEngineClass) alloc] initWithFrame:bounds];

And the view controller is never unhidden.

Description

The change simply adds the cordova framework as a target for the web view engine classes.

Testing

In https://github.com/forcedotcom/salesforceMobileSDK-ios-hybrid, we consume cordova through a submodule.
We have several sample apps as well as suites of tests. The change allowed the apps to run properly and the tests to pass.

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

Copy link
Member

@dpogue dpogue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to expose these as public API, because the CDVWebView classes are meant to be part of an internal plugin.

The better option is probably to add a fallback case to CDVViewController that explicitly uses CDVWebViewEngine if all else fails.
It is not totally clear to me why the CordovaDefaultWebViewEngine preference exists when CordovaWebViewEngine already allows overriding.

@wmathurin
Copy link
Contributor Author

The PR is not making them public but make them part of the framework target.

The fallback is here: https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Public/CDVViewController.m#L508

Because the class is not in the framework, it fails to find the class at runtime.

When you consume cordova through cocoapod, the class is available because we have

cordova.source_files = 'CordovaLib/Classes/**/*.{h,m}', 'CordovaLib/Cordova/Cordova.h'

in https://github.com/apache/cordova-ios/blob/master/Cordova.podspec#L41.

Copy link
Member

@dpogue dpogue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying, and thanks for the pull request

@codecov-io
Copy link

codecov-io commented Oct 30, 2020

Codecov Report

Merging #1015 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1015   +/-   ##
=======================================
  Coverage   74.91%   74.91%           
=======================================
  Files          13       13           
  Lines        1718     1718           
=======================================
  Hits         1287     1287           
  Misses        431      431           

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 cb20c9b...d1b6496. Read the comment docs.

@dpogue dpogue merged commit e92f653 into apache:master Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants