views:

17

answers:

1

I added the following to myModule.gwt.xml. I expected it would generate 6*2 permutations when compile. However, it still only generated six permutation. Did I miss anything there?

<define-property name="mobile.user.agent" values="mobile, not_mobile" />

<property-provider name="mobile.user.agent"><![CDATA[
{
 var ua = window.navigator.userAgent.toLowerCase();
 if ( ( ua.indexOf('android') != -1) || 
   ( ua.indexOf('iphone') != -1) || 
   ( ua.indexOf('midp') != -1) || 
   ( ua.indexOf('opera mobi') != -1) || 
   ( ua.indexOf('opera mini') != -1) || 
   ( ua.indexOf('blackberry') != -1)  )
 { return 'mobile'; }

 else { return 'not_mobile';}
}
 ]]></property-provider>

I can see the myModule.nocache.js file contain the following:

u[sb]=function(){{var a=window.navigator.userAgent.toLowerCase();if(a.indexOf(tb)!=-1||(a.indexOf(ub)!=-1||(a.indexOf(vb)!=-1||(a.indexOf(wb)!=-1||(a.indexOf(xb)!=-1||a.indexOf(yb)!=-1))))){return zb}else{return Ab}}};t[sb]={mobile:0,not_mobile:1};

A: 

If you leave it like this, nothing will happen. You need to make a Deferred Binding rule based upon your property. So for your mobile browsers you'll likely want to have other implementations for some interfaces than for the desktop browsers (most likely view-related interfaces). This could play nicely with the MVP pattern where you can choose different View implementations based on the module property.

Jeroen