implement setPreference and setPlatformPreference#63
Merged
dpogue merged 1 commit intoApr 14, 2019
Conversation
raphinesse
reviewed
Apr 14, 2019
| setPlatformPreference: function (name, platform, value) { | ||
| const platformEl = this.doc.find('./platform[@name="' + platform + '"]'); | ||
| if (!platformEl) { | ||
| throw new CordovaError('platform does not exist (received platform: ' + platform + ')'); |
Contributor
There was a problem hiding this comment.
Wouldn't it be nicer if we created the platform element here instead of throwing?
Contributor
Author
There was a problem hiding this comment.
I guess it's much simpler to just throw. A new platform won't work automatically by just add a new section in the config.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Platforms affected
None or All, it will not affect any existing code, just provides new APIs
What does this PR do?
Support set the preference for a specific platform. Currently, only global preference is supported by the
cordova-common. We have used the new API to implement a hook which will update platform preference in config.xmlWhat testing has been done on this change?
Four unit tests are added. The new added tests don't have
Test ${number}prefix bc that would lead to a lot of changes in unrelated tests.