[TIMOB-7711] Mobile Web: Expose analytics Boolean Property on Ti.App
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-02-17T15:11:50.000+0000 |
Affected Version/s | Release 2.0.0 |
Fix Version/s | Sprint 2012-04, Release 2.0.0 |
Components | MobileWeb |
Labels | n/a |
Reporter | Dawson Toth |
Assignee | Chris Barber |
Created | 2012-02-17T12:27:26.000+0000 |
Updated | 2017-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'));
I think this can be accomplished entirely by changing lines 11-12 of mobileweb/src/config.js to the following:
PR sent: https://github.com/appcelerator/titanium_mobile/pull/1463 Verified to work with functional test.
Workaround for this issue on Mobile Web:
This doesn't offer platform parity, though.
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.
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.
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".
Agreed. Check out the PR, it's been updated with those changes.
Looks good!
Closing ticket as fixed.