[ALOY-377] Touch Test - An Alloy enabled app won't work by default because there isn't an app.js by default
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2012-11-28T20:07:53.000+0000 |
Affected Version/s | Alloy 0.3.2 |
Fix Version/s | Alloy 0.3.3, 2012 Sprint 24 |
Components | Titanium SDK |
Labels | n/a |
Reporter | Michael Pettiford |
Assignee | Unknown |
Created | 2012-11-12T19:38:32.000+0000 |
Updated | 2018-03-07T22:25:40.000+0000 |
Description
When I was testing if Soasta Touch Test would work with an alloy project, I discovered that by default it won't because when you touch enable the app it looks to add code to app.js which won't be there.
Steps to reproduce:
*You will need access to Touch Test to reproduce this issue*
But generally the process is
1. Create a new default Titanium mobile project
2. Allot enable it
3. Follow the instructions contained here for touch test enabling a Titanium app: http://cdn.soasta.com/productresource/download/SOASTA_TouchTest_Appcelerator_iOS_Tutorial.pdf
Actual result:
You will notice in the docs that touch test enabling an app adds code to app.js. This is why by default the app won't be touch test enabled. However, if you copy and paste the following code in index.js the app will then be touch test enabled
if (Ti.Platform.osname === 'iphone' || Ti.Platform.osname === 'ipad')
{
var touchTestModule = require("com.soasta.touchtest");
var cloudTestURL = Ti.App.getArguments().url;
if (cloudTestURL != null)
{
// The URL will be null if we don't launch through TouchTest.
touchTestModule.initTouchTest(cloudTestURL);
}
Ti.App.addEventListener('resumed',function(e)
{
// Hook the resumed from background
var cloudTestURL = Ti.App.getArguments().url;
if (cloudTestURL != null)
{
touchTestModule.initTouchTest(cloudTestURL);
}
});
}
Expected result:
We probably need to work with Soasta to detect whether an app has an app.js or an index.js to put the code into.
If we can get the Soasta process to run AFTER the alloy compile, then it should work fine. Also, the changes would probably be better suited to be made in the *app/alloy.js* file instead of the *app/controllers/index.js*. Code in the *app/alloy.js* will be put in the generated app.js and will be executed before any view code, including the index itself, is rendered.
I will attempt to contact the people working with/on Soasta to see if we can get the above order-of-operations changed so that no code needs to change on either end to work with alloy.
Michael has reached out to the Soasta developers. They are actively addressing this issue, I believe opting to make changes to the *app/alloy.js* in the case of an Alloy app. Additional testing will done when their changes are made to confirm that it works with Alloy.
This has been resolved by injecting Soasta's necessary code into the index.js. Any further improvements on this process will be documented in a new ticket.