You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2022/10/19 14:29:12 UTC
[GitHub] [cordova-common] TylerBreau opened a new issue, #182: PluginInfo getPreferences is designed in a way that prevents safely adding new attributes
TylerBreau opened a new issue, #182:
URL: https://github.com/apache/cordova-common/issues/182
# Bug Report
## Problem
PluginInfo getPreferences is designed in a way that prevents safely adding new attributes.
While I am not aware of a need to add new attributes to the preference tag, if a need comes up in the future it does not appear to be supported at all.
### What is expected to happen?
Adding new attributes should probably be possible.
### What does actually happen?
Preferences are aggregated into a single object and the value in the name attribute is used to create new attributes on this object.
Common attributes are overwritten. For example if you have 2 preferences with the names pref1 and pref2.
The object will contain 1 name attribute with either the value pref1 or pref2.
If you wanted to add a new attribute, difference preferences would override each other's new attribute.
## Information
<!-- Include all relevant information that might help understand and reproduce the problem -->
I noticed this while preparing unit tests for the XML Passthrough update, https://github.com/apache/cordova-common/pull/181.
Seems like it is not possible to support additional attributes on preferences.
```
describe('Preference', () => {
it('Test 007: Preference supports xml passthrough', function () {
const preferences = pluginPassthrough.getPreferences('android');
console.log(preferences);
expect(preferences.passthroughpref.anattrib).toBe('value');
});
});
<preference name="passthroughpref" anattrib="value" />
<!-- <preference name="passthroughpref2" anattrib="value2" /> -->
{ name: 'passthroughpref', anattrib: 'value', PASSTHROUGHPREF: null }
<preference name="passthroughpref" anattrib="value" />
<preference name="passthroughpref2" anattrib="value2" />
{
name: 'passthroughpref2',
anattrib: 'value2',
PASSTHROUGHPREF: null,
PASSTHROUGHPREF2: null
}
```
_Originally posted by @TylerBreau in https://github.com/apache/cordova-common/issues/181#issuecomment-1284078001_
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
XML file with 2 or more preferences.
You will see attributes like name will overwrite eachother.
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you experiencing the issue? -->
N/A
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
cordova-common master, commit fc966d136c719285eb9a9c9d4470ed6f7da8163d
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-common] breautek commented on issue #182: PluginInfo getPreferences is designed in a way that prevents safely adding new attributes
Posted by GitBox <gi...@apache.org>.
breautek commented on issue #182:
URL: https://github.com/apache/cordova-common/issues/182#issuecomment-1284368825
I'm not certain if this is something we want to support anyway. Supporting would require a pretty detrimental breaking change I think.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-common] breautek commented on issue #182: PluginInfo getPreferences is designed in a way that prevents safely adding new attributes
Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #182:
URL: https://github.com/apache/cordova-common/issues/182#issuecomment-1411327631
XML passthrough on preferences is wil not be a planned feature as there is a strict requirement for preferences to be a keypair.
Closing as won't do.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-common] breautek closed issue #182: PluginInfo getPreferences is designed in a way that prevents safely adding new attributes
Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek closed issue #182: PluginInfo getPreferences is designed in a way that prevents safely adding new attributes
URL: https://github.com/apache/cordova-common/issues/182
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org