cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shazron <shaz...@gmail.com>
Subject Re: Get customized feature parameter value from config.xml
Date Wed, 16 Apr 2014 17:03:04 GMT
I added the issue: https://issues.apache.org/jira/browse/CB-6458

Re-created below:

For the proposed solution, there are no changes needed to the config.xml
specification, since the feature tag already supports param child tags.

I'm only speaking for iOS, not sure about the other platforms.
The problem is, there is no access to these additional values in plugin
code. The plugin has to re-read the config.xml to access this.

What are the alternatives in config.xml/plugin.xml?

1. preference tag on the plugin level
2. preference tag on the platform level

The problem with either of these two approaches is that if another plugin
has the same key, it will clobber your preference. The ugly solution to
that is, to namespace your key with your feature name as a prefix.

Proposed solutions:

1. Create a plugin in cordova-labs to read these extra param values without
touching the core code.
2. Modify the core code to read these extra param values, and expose them
to the user


On Tue, Apr 15, 2014 at 7:06 PM, Carlos Santana <csantana23@gmail.com>wrote:

> Shaz do we have a jira item for this limitation?
>
> Maybe something that can be address short term via plugin dev docs, and
> long term maybe with new config.xml/json :-)
>
>
>
> On Mon, Apr 14, 2014 at 4:29 PM, Li, Jonathan <jonathan.li@sap.com> wrote:
>
> > That works. Thanks.
> >
> > On 4/14/14 4:26 PM, "Shazron" <shazron@gmail.com> wrote:
> >
> > >Yes, that is the known limitation. My suggestion is to prefix the
> > >preference name with your plugin name, or whatever you prefer.
> > >
> > >
> > >On Mon, Apr 14, 2014 at 1:12 PM, Li, Jonathan <jonathan.li@sap.com>
> > wrote:
> > >
> > >> Although the preference can be defined in plugin.xml on per platform
> and
> > >> plugin level, but when the information is used to generate config.xml,
> > >>the
> > >> related preference element will be generated under the root "widget"
> > >> element, and so shared by all plugins. This may cause conflict if the
> > >>same
> > >> preference name is used by multiple plugins.
> > >>
> > >>
> > >>
> > >> On 4/14/14 3:48 PM, "Shazron" <shazron@gmail.com> wrote:
> > >>
> > >> >per platform in the platform tag - yes.
> > >> >plugin level  - yes.
> > >> >
> > >> >
> > >> >On Mon, Apr 14, 2014 at 11:34 AM, Li, Jonathan <jonathan.li@sap.com>
> > >> >wrote:
> > >> >
> > >> >> Does "preference" can be set on per platform and plugin level?
> > >> >>
> > >> >> On 4/14/14 2:27 PM, "Shazron" <shazron@gmail.com> wrote:
> > >> >>
> > >> >> >Will a <preference />  tag not suffice?
> > >> >> >
> > >> >> >
> > >> >> >On Mon, Apr 14, 2014 at 11:23 AM, Li, Jonathan <
> jonathan.li@sap.com
> > >
> > >> >> >wrote:
> > >> >> >
> > >> >> >> Hi,
> > >> >> >> In the following sample plugin.xml and config.xml , the
> parameter
> > >> >> >> "enable-redirect" can be configured by app developers
when they
> > >>add
> > >> >>the
> > >> >> >> plugin to cordova project. However, currently only "ios-package"
> > >>and
> > >> >> >> "onload" parameters are parsed and stored by config.xml's
> settings
> > >> >> >>parser,
> > >> >> >> other parameters (like "enable-redirect") are ignored
by the
> > >>settings
> > >> >> >> parser, so plugin developer has to parse the config.xml
again by
> > >> >> >>themselves
> > >> >> >> in order to get the other parameters' value.
> > >> >> >>
> > >> >> >> Just wonder it maybe a good idea to parse all parameters
under
> > >> >>feature
> > >> >> >> element, and return it as a "param" dictionary, so as
to make it
> > >> >>ready
> > >> >> >>to
> > >> >> >> use by developers within plugin's native code.
> > >> >> >>
> > >> >> >> Plugin.xml:
> > >> >> >>   <platform name="ios">
> > >> >> >> <config-file target="config.xml" parent="/widget">
> > >> >> >> <feature name="myplugin">
> > >> >> >> <param name="ios-package" value="myPlugin"/>
> > >> >> >> <param name="onload" value="true"/>
> > >> >> >> <param name="enable-redirect" value="$REDIRECT"/>
> > >> >> >> </feature>
> > >> >> >> </config-file>
> > >> >> >>         <source-file src="ios/libs/myPlugin.a"
> framework="true"/>
> > >> >> >>     </platform>
> > >> >> >>
> > >> >> >> Config.xml
> > >> >> >>     <feature name="myplugin">
> > >> >> >>         <param name="ios-package" value="myplugin"
/>
> > >> >> >>         <param name="onload" value="true" />
> > >> >> >>         <param name="enable-redirect" value="true"
/>
> > >> >> >>     </feature>
> > >> >> >>
> > >> >> >> Thanks
> > >> >> >> Jonathan
> > >> >> >>
> > >> >>
> > >> >>
> > >>
> > >>
> >
> >
>
>
> --
> Carlos Santana
> <csantana23@gmail.com>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message