google-code-export / mgwt

Automatically exported from code.google.com/p/mgwt
Other
1 stars 0 forks source link

OsDetection.isTablet() returns true for mgwt.os desktop #308

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using Maven create an MGWT archetype, and import it into Eclipse.
2. Modify MgwtAppEntryPoint.java, inserting the isDesktop() test as shown:

  if ((MGWT.getOsDetection().isTablet())) {
    // very nasty workaround because GWT does not corretly support
    // @media
    StyleInjector.inject(AppBundle.INSTANCE.css().getText());
    GWT.log("isTablet");
    createTabletDisplay(clientFactory);
  } else if (MGWT.getOsDetection().isDesktop()) {
    GWT.log("isDesktop");
    createTabletDisplay(clientFactory);
  } else {
    GWT.log("isPhone");
    createPhoneDisplay(clientFactory);
  }

3. From Eclipse, Run As -> Web Application and open the DevMode URL 

What is the expected output? What do you see instead?

I expect to see "isDeskop" in my DevMode console and desktop display in the 
browser. Instead I see "isTablet" and a tablet display in the browser.

4. Shutdown|kill DevMode. Add <set-property name="mgwt.os" value="desktop" /> 
to the module's gwt.xml file, and repeat #3.

Again, I expect to see "isDeskop" in my DevMode console and desktop display in 
the browser. Instead I see "isTablet" and a tablet display in the browser.

5. Shutdown|kill DevMode. Remove the <set-property> from the module's gwt.xml 
file. Modify MgwtAppEntryPoint.java, reversing the tests for desktop and tablet:

  if (MGWT.getOsDetection().isDesktop()) {
    GWT.log("isDesktop");
    GWT.log("but also isTablet=="+MGWT.getOsDetection().isTablet());
    createTabletDisplay(clientFactory);
  } else if ((MGWT.getOsDetection().isTablet())) {
    // very nasty workaround because GWT does not corretly support
    // @media
    StyleInjector.inject(AppBundle.INSTANCE.css().getText());
    GWT.log("isTablet");
    createTabletDisplay(clientFactory);
  } else {
    GWT.log("isPhone");
    createPhoneDisplay(clientFactory);
  }

Expect in DevMode console, "isDesktop" and "but also isTablet==false" with a 
desktop display in the browser.
Instead I see "isDesktop" and "but also isTablet==true" with a desktop display 
in the browser.

6. Shutdown|kill DevMode. Try different valued for the mgwt.os property--ipad, 
android, android_tablet, etc. They work as expected.

What version of the product are you using? On what operating system?

MGWT 1.1.2 and 1.2.0-SNAPSHOT on MacOS 10.8.4
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 
(KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36

Please provide any additional information below.

GWT 2.5.1 and Java 1.7.0_25

Original issue reported on code.google.com by thad.hum...@gmail.com on 4 Sep 2013 at 4:11

GoogleCodeExporter commented 9 years ago
This is fixed in mgwt 2.0.

Original comment by kurka.da...@gmail.com on 13 Jul 2014 at 5:14