Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7711] Mobile Web: Expose analytics Boolean Property on Ti.App

GitHub Issuen/a
TypeStory
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-02-17T15:11:50.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sSprint 2012-04, Release 2.0.0
ComponentsMobileWeb
Labelsn/a
ReporterDawson Toth
AssigneeChris Barber
Created2012-02-17T12:27:26.000+0000
Updated2017-03-09T01:05:22.000+0000

Description

Task

Expose "analytics" property on Ti.App so that developers can detect if analytics are enabled or not in the tiapp.xml.

Test

See if the below reflects what is in your tiapp.xml:
alert('Enabled? ' + (Ti.App.analytics ? 'Yes!' : 'No'));

Comments

  1. Dawson Toth 2012-02-17

    I think this can be accomplished entirely by changing lines 11-12 of mobileweb/src/config.js to the following:
       version: "${app_version | jsQuoteEscapeFilter}",
       analytics: ${app_analytics | jsQuoteEscapeFilter}
       
  2. Dawson Toth 2012-02-17

    PR sent: https://github.com/appcelerator/titanium_mobile/pull/1463 Verified to work with functional test.
  3. Dawson Toth 2012-02-17

    Workaround for this issue on Mobile Web:
       var cfg = require.config,
           analyticsEnabled = cfg.analytics;
       
    This doesn't offer platform parity, though.
  4. Chris Barber 2012-02-17

    There is no Ti.App.analytics property according to the API docs (http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.App-module), Android source, and iPhone source. Furthermore, adding the "analtyics" setting to the config twice is redundant and not acceptable.
  5. Dawson Toth 2012-02-17

    Of course it's not in the docs, it doesn't exist yet. That's why this ticket was created, and that's why it was created for Android and iOS and APIDocs as well (see linked tickets). This is necessary for us to detect if analytics is enabled or not.
  6. Chris Barber 2012-02-17

    OK, understood. I still stand think your solution in your pull request could be improved before being accepted. Namely, there's no point in having the "analytics" config option defined twice. Just keep the one in the "app" section and update line 10 of Ti/_/analytics with the correct "analyticsEnabled = cfg.app.analytics".
  7. Dawson Toth 2012-02-17

    Agreed. Check out the PR, it's been updated with those changes.
  8. Chris Barber 2012-02-17

    Looks good!
  9. Lee Morris 2017-03-09

    Closing ticket as fixed.

JSON Source