You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Andrew Grieve <ag...@chromium.org> on 2013/02/13 20:26:59 UTC

iOS has a window.Settings object

 @implementation CDVDevice

- (void)getDeviceInfo:(CDVInvokedUrlCommand*)command
{
    /* Settings.plist
     * Read the optional Settings.plist file and push these user-defined
settings down into the web application.
     * This can be useful for supplying build-time configuration variables
down to the app to change its behavior,
     * such as specifying Full / Lite version, or localization (English vs
German, for instance).
     */
    // TODO: turn this into an iOS only plugin
    NSDictionary* temp = [CDVViewController getBundlePlist:@"Settings"];

    if ([temp respondsToSelector:@selector(JSONString)]) {
        NSString* js = [NSString stringWithFormat:@"window.Settings = %@;",
[temp JSONString]];
        [self.commandDelegate evalJs:js];
    }



I can't find any docs that mention this feature. Do other platforms have
something like this? Any objections to deprecating this? Seems like you
could accomplish x-platform & without a plugin by XHR'ing a .json file from
your app directory.

Re: iOS has a window.Settings object

Posted by Andrew Grieve <ag...@chromium.org>.
https://issues.apache.org/jira/browse/CB-2433


On Wed, Feb 13, 2013 at 2:54 PM, Shazron <sh...@gmail.com> wrote:

> Deprecating sounds good to me - I've never used this feature and the
> alternative is better.
>
>
> On Wed, Feb 13, 2013 at 11:26 AM, Andrew Grieve <agrieve@chromium.org
> >wrote:
>
> >  @implementation CDVDevice
> >
> > - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command
> > {
> >     /* Settings.plist
> >      * Read the optional Settings.plist file and push these user-defined
> > settings down into the web application.
> >      * This can be useful for supplying build-time configuration
> variables
> > down to the app to change its behavior,
> >      * such as specifying Full / Lite version, or localization (English
> vs
> > German, for instance).
> >      */
> >     // TODO: turn this into an iOS only plugin
> >     NSDictionary* temp = [CDVViewController getBundlePlist:@"Settings"];
> >
> >     if ([temp respondsToSelector:@selector(JSONString)]) {
> >         NSString* js = [NSString stringWithFormat:@"window.Settings =
> > %@;",
> > [temp JSONString]];
> >         [self.commandDelegate evalJs:js];
> >     }
> >
> >
> >
> > I can't find any docs that mention this feature. Do other platforms have
> > something like this? Any objections to deprecating this? Seems like you
> > could accomplish x-platform & without a plugin by XHR'ing a .json file
> from
> > your app directory.
> >
>

Re: iOS has a window.Settings object

Posted by Shazron <sh...@gmail.com>.
Deprecating sounds good to me - I've never used this feature and the
alternative is better.


On Wed, Feb 13, 2013 at 11:26 AM, Andrew Grieve <ag...@chromium.org>wrote:

>  @implementation CDVDevice
>
> - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command
> {
>     /* Settings.plist
>      * Read the optional Settings.plist file and push these user-defined
> settings down into the web application.
>      * This can be useful for supplying build-time configuration variables
> down to the app to change its behavior,
>      * such as specifying Full / Lite version, or localization (English vs
> German, for instance).
>      */
>     // TODO: turn this into an iOS only plugin
>     NSDictionary* temp = [CDVViewController getBundlePlist:@"Settings"];
>
>     if ([temp respondsToSelector:@selector(JSONString)]) {
>         NSString* js = [NSString stringWithFormat:@"window.Settings =
> %@;",
> [temp JSONString]];
>         [self.commandDelegate evalJs:js];
>     }
>
>
>
> I can't find any docs that mention this feature. Do other platforms have
> something like this? Any objections to deprecating this? Seems like you
> could accomplish x-platform & without a plugin by XHR'ing a .json file from
> your app directory.
>