vaadin / touchkit

TouchKit is a library of mobile components for Vaadin Framework
https://vaadin.com/touchkit
Other
11 stars 25 forks source link

Vaadin Touch Offline/Cordova/Caching issue #348

Closed vaadin-bot closed 10 years ago

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Please see this video for reference of the issue:

https://www.dropbox.com/s/y7a1f03rj9uldod/20140702_160425.mp4

The video shows the problem in the phone, but I've seen the same behavior in the desktop browser too.

I have offline mode disabled. There is connectivity all the time. In the previous version of Vaadin Touchkit 4.0.0-beta1 I got around the issue by launching new android activities or ios views, but in the version 4.0.0-beta1 it does not help.

The issue has been reported twice in the pro-account, the ticket numbers are: 498, 555, you can use them for more references.

The project is setup this way:

I have a javascript extension which loads the files codova.js, cordova_plugins.js, phonegap.js, jquery-1.10.2.js, phonegapextension.js, feithdriveplugin.js and some other scripts for 3rd party plugins.

The files phonegapextension.js and feithdriveplugin.js are really simple, the phonegapextension.js just initializes the javascript extension and works as a bridge between feithdriveplugin.js and the vaadin application.

The application is currently using Vaadin 7.2.3 and Vaadin Touchkit 4.0.0-beta1. The application connects to a database to retrieve the data.


Imported from https://dev.vaadin.com/ issue #14197

vaadin-bot commented 10 years ago

Originally by proaccountapp


Updated prioritization date.

vaadin-bot commented 10 years ago

Originally by @manolo


Could you please use this touchkit snapshot? it has some improvements in offline detection at startup and should fix the delay at the beginning until it shows the app.

https://github.com/manolo/touchkit/tree/master

You can download the compiled .jar files from:

https://github.com/manolo/touchkit/tree/SNAPSHOT

vaadin-bot commented 10 years ago

Originally by @manolo


The offline issue when switching back from the photos external app, only happens in android right?

Out of curiosity, how do you manage image viewer?, it seems you use some link to open an external app, why dont you show the picture directly in your app?

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


@manolo

The offline issue when switching back from the photos external app, only happens in android right?

Out of curiosity, how do you manage image viewer?, it seems you use some link to open an external app, why dont you show the picture directly in your app?

@Manolo,

Yes, when switching back from the external app is happening in android so far, and the reason is because in ios we are following another approach.

Manolo, we prefer to display the images in the external app because we are not only working with images, we handle multiple file types such as tif, pdf, docx, xls, etc. We don't want to create a viewer of editor for each of this document types, also we have the requirements the user must share those files using text messaging, emails or using the "share with" widget in the phone.

I'll try the snapshot you suggested as soon as I can and get back to you.

Thank you a lot.

vaadin-bot commented 10 years ago

Originally by @manolo


I have submitted a patch which allows the user to disable OfflineMode and CacheManifest adding an annotation to either your servlet or your ui class, obviously your servlet always should extend TouchKitServlet to use the approach.

Code example:

@Widgetset("com.example.TkSampleWidgetSet")
@Theme("touchkit")
@CacheManifestEnabled(false)
@OfflineModeEnabled(false)
public class TkSampleTouchKitUI extends UI {
   ...
}
@WebServlet("/*")
@CacheManifestEnabled(false)
@OfflineModeEnabled(false)
public class TkSampleServlet extends TouchKitServlet {
  ...
}

I think adding just the OfflineModeEnabled(false) your app should behave like before, although I would go with the phonegap offline-online notifications using the iframe method and window.postMessage in the example I sent.

I have updated the snapshots in github so as you can download, use them and give feedback.

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Hi, Thanks a lot for your response.

I am using maven, how can I reference your patch in maven?

Also, do you have access to the tickets in the pro-account? The ticket #555 has a link that allows you to see the issue were are having live. You can reproduce the problem using the Google Chrome browser.

I also noticed the application get the error 404 trying to access the endpoint "/PING", when you get 404, you get the message "Server cannot be reached", If I am not mistaken "/PING" is an internal Vaadin endpoint.

In android, when I click in an input field the screen shrinks and the keyboard displays, I get the error "Server cannot be reached" too; If I click the back button to hide the keyboard then the error disappear.

vaadin-bot commented 10 years ago

Originally by @manolo


To use it in maven you have to add vaadin snapshots repository and change the dependency to touchkit 4.0.0-SNAPSHOT

...
    <repository>
      <id>vaadin-snapshots</id>
      <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
...
                <dependency>
                        <groupId>com.vaadin.addon</groupId>
                        <artifactId>vaadin-touchkit-agpl</artifactId>
                        <version>4.0.0-SNAPSHOT</version>
                </dependency>

I think the issue you are having in the app you send is because you are using Touchkit in client side but you are not extending TouchKitServlet in your servlet which is able to handle PING requests

I have changed last touchkit so as if you dont extend TouchKitServlet we never try to check whether the server is reachable and we dont show the offline screen, so in theory if you change your dependency by the last snapshot it shouldn't happen anymore.

Android online/ofline events is crazy, webview in android fires events without any logic reason and under very different circunstances: when focusing an input, when opening the keyboard, when rotating the screen, when coming back from other app, etc. You can read http://dev.vaadin.com/ticket/13250 issue to get more info.

So the ONLY ways to avoid offline/online problems in android are:

Last two itmes are new features I have added to the snapshot with this ticket in mind.

let me know if this snapshot works ok for you.

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Manolo,

Thanks a lot for your response. I am going to try your suggestions and will get back to you.

About Maven, we are using cval, can I use vaadin-touchkit-cval? or does vaadin-touchkit-cval include your changes?

We are extending the TouchKitServlet, this is the way we have it setup:

TouchKitServlet |FeithTouchKitServlet |FeithDriveMobileServlet |__Other Feith Mobile Apps

The reason why we do not extend directly from TouchKitServlet is because the FeithTouchKitServlet do some pre-processing we don't want to repeat in all other mobile application, the same thing apply for Vaadin desktop applications.

Again, thanks for your help.

Elvin

vaadin-bot commented 10 years ago

Originally by @manolo


Yes, I updated cval snapthot as well

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Great!

Thank you. I'll get back to you once I try your changes.

Elvin

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Manolo,

I am sorry I did not get back to you before. I did some initial tests and It looks like the caching issue is fixed. We need to test in other computers to make sure everything is OK.

In the SNAPSHOT version you provided It doesn't seem to be able to display a Popover. Can you please verify that is working on you development environment? I also updated to Vaadin 7.2.4 in case it helps

I also tried to add the reference to the commercial license:

com.vaadin.addon vaadin-touchkit-cval 4.0.0-SNAPSHOT

and I get the eclipse error in the POM file: Missing artifact com.vaadin.addon:vaadin-touchkit-cval:jar:4.0.0-SNAPSHOT.

Is there any other Vaadin repository?

Thanks,

Elvin

vaadin-bot commented 10 years ago

Originally by @manolo


Did you added the snapshot repository in your pom?

Maybe as well that the snapshot were not in the repo when you tested. I realised some hours ago that it was not uploaded because we had a 'skip' flag in our deployment script.

I can see the snapshot now, https://oss.sonatype.org/content/repositories/vaadin-snapshots/com/vaadin/addon/vaadin-touchkit-cval/4.0.0-SNAPSHOT/

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Manolo,

This is the what I have setup:

vaadin-addons http://maven.vaadin.com/vaadin-addons
    <repository>
        <id>vaadin-snapshots</id>
        <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>

I right clicked > Maven/Updated Project and checked "Force Update" and I still get the same issue.

Thanks

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Manolo,

I don't know if I should report this issue in the same ticket or If I need to create a new one. This problem came after I added the new dependency for the snapshot version.

I cannot display any component that is based in the overlay such as notifications, Popover, etc.

The error I get in the console is:

SEVERE: Could not determine ApplicationConnection for Overlay. Overlay will be attached directly to the root panel

Do you know what is causing this issue? I tried to investigate but I could not find anything.

Thanks,

Elvin

vaadin-bot commented 10 years ago

Originally by @manolo


I've been able to reproduce this issue, it is not a problem in Touchkit but in the way how vaadin handles inherited widgetsets, for some reason when the dependency is a SNAPSHOT it removes the widgetset line from the .gwt.xml file, and when the name of the library does not have the SNAPSHOT fragment in the name it works.

I've not investigated so much in this issue so far, but it is definitively a problem in vaadin framework, not in Touchkit.

In order to test the snapshot, the best way is that you download it from maven repo, rename it an put it in your project:

1.- Download the snapthot and rename it replacing SNAPSHOT with beta2, with curl you can do in this way:

curl https://oss.sonatype.org/content/repositories/vaadin-snapshots/com/vaadin/addon/vaadin-touchkit-cval/4.0.0-SNAPSHOT/vaadin-touchkit-cval-4.0.0-20140717.150707-2.jar > vaadin-touchkit-cval-4.0.0.beta2.jar

2.- Create a local folder with this structure and move the jar to it:

mkdir -p repo/com/vaadin/addon/vaadin-touchkit-cval/4.0.0.beta2
mv vaadin-touchkit-cval-4.0.0.beta2.jar repo/com/vaadin/addon/vaadin-touchkit-cval/4.0.0.beta2

3.- Add this local repo to your pom.xml:

  <repositories>
    <repository>
      <id>local-repository</id>
      <url>file://${basedir}/repo</url>
    </repository>
  </repositories>

4.- change the dependency:

<dependency>
    <groupId>com.vaadin.addon</groupId> 
    <artifactId>vaadin-touchkit-cval</artifactId>
    <version>4.0.0.beta1</version> 
</dependency>
vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Thanks,

I am going to try it.

Elvin

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Monolo,

I am able to reference the new version now, thanks for it.

Do you know what could be causing the issue "SEVERE: Could not determine ApplicationConnection for Overlay. Overlay will be attached directly to the root panel"?

I cannot find any cause, and I have looked in the forum but I don't see any solution, I downgraded to beta1 and the overlays shows again but then I have the caching issue. It looks like it's something related to this new version.

Any help would be really appreciated.

Thanks,

Elvin

vaadin-bot commented 10 years ago

Originally by @manolo


I have seen that error always in 4.0.0.x , it's not a big issue. I think it should be an INFO instead of a SEVERE, but we should get rid of it. Probably it is related to the way how offline panel is attached to the DOM, but since have never worried about it, I have not investigated yet.

I guess your app works without problem despite the error, but anyway you can open a ticket.

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Manolo,

The problem is that I cannot show any Notifications, Windows, Popovers, Date pickers don't work, anything that is an overlay does not work.

When I check the console that is the only error I get, if I analyze the layout, it says everything is OK.

Is there any other thing that could be causing the issue?

Thanks,

Elvin

vaadin-bot commented 10 years ago

Originally by @manolo


It is weird in my tests apps at least Notifications are working, do you have a very simple code which I can use to verify the issue?

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Manolo,

What Vaadin version are you using? I am not in the office at this time. Once I have access to a computer I am going to create a simple project and will send it to you.

Thanks,

Elvin

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Attachment added: myproject.zip (10.4 KiB) Sources

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Manolo,

Attached is a simple project I created. When you click the button a notification is not showing.

I used the browser Chrome.

Please let me know if you need any other information.

Elvin

vaadin-bot commented 10 years ago

Originally by @manolo


ok, I saw the problem, it is a css problem, regression introduced in https://dev.vaadin.com/review/#/c/3891, I have update the snapshot with the fix.

Please check out it and let me know if it works for you.

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Manolo,

It seems to be working now. Thanks.

I tried with the agpl license, can you apply it to cval?

I'll ask QA to do other tests before we close this ticket.

Thank you.

Elvin

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Manolo,

We think everything is OK, you can go ahead and close this ticket.

When do you think is going to be a beta of final release that include these changes?

Thank you a lot for all your help, we are very happy for everything you done.

Elvin

vaadin-bot commented 10 years ago

Originally by @manolo


We are about to release TK-4.0.0.rc1 today or tomorrow. When it is out we will close this ticket

vaadin-bot commented 10 years ago

Originally by @manolo


@Elvin, vaadin-touchkit-4.0.0.beta2 with all these fixes has just been released and pushed to maven repository so as you dont depend on a SNAPSHOT version. We have to perform more internal testing before releasing RC1 though.

vaadin-bot commented 10 years ago

Originally by elvin@feith.com


Manolo,

Thanks for the update.

We really appreciate what you've done.

Thanks,

Elvin