stefan-niedermann / nextcloud-deck

📋 Android client for nextcloud deck app
https://play.google.com/store/apps/details?id=it.niedermann.nextcloud.deck.play
GNU General Public License v3.0
487 stars 52 forks source link

Handle not available server better #687

Closed quanticPI closed 3 years ago

quanticPI commented 3 years ago

Given the server is not available, we have currently a bad handling in some cases. To reproduce, temporarily rename index.php of your instance to something else, so the endpoint is no longer available.

No. 1: Creating boards does not do anything

Actual behavior: Nothing happens

Expected behavior:

ToDo:

No. 2: Creating cards in an existing board

Actual behavior: App crashes completely

java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference
 at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.CardDataProvider.createOnServer(CardDataProvider.java:154)
 at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.CardDataProvider.createOnServer(CardDataProvider.java:28)
 at it.niedermann.nextcloud.deck.persistence.sync.helpers.SyncHelper.doUpSyncFor(SyncHelper.java:102)
 at it.niedermann.nextcloud.deck.persistence.sync.helpers.SyncHelper.doUpSyncFor(SyncHelper.java:85)
 at it.niedermann.nextcloud.deck.persistence.sync.SyncManager.lambda$createFullCard$24$SyncManager(SyncManager.java:1081)
 at it.niedermann.nextcloud.deck.persistence.sync.-$$Lambda$SyncManager$e6awW8MITCkROdcjir544vu2wlo.run(Unknown Source:12)
 at java.lang.Thread.run(Thread.java:919)

Expected behavior:

ToDo:

Original report has been edited by @stefan-niedermann because of new findings.

Original report Hi, I'm openning an issue about a behaviour which in my opinion is incorrect but I might be wrong. Please correct me if so. **Description** A newly added board doesn't show after creation if there is no connection to the server. The new board appears only after reopening the app. This seems inconsistent because the app doesn't indicate in any way that the creation failed which confuses the user. **Steps to reproduce** 1. Open the app without access to the server 2. Create a new board (menu -> +add board) 3. Check the board is not added to the list of boards in the menu **Expected behavior** The board that was just created should appear in the list of boards **Versions** - Nextcloud: 19.0.3 - Nextcloud Deck: 1.0.5 - Nextcloud Android: 3.13.1 - Nextcloud Android Deck: 1.9.7 **Smartphone (please complete the following information):** - Device: OnePlus 7T - Android-Version: 10 - App-Store: - [ ] Google Play Store - [ ] Google Play Store (Beta channel) - [x] F-Droid - [ ] Huawei AppGallery **Are you using LDAP?** - [ ] Yes - [x] No **Stacktrace**
desperateCoder commented 3 years ago

Hi @quanticPI, thanks for your report! I just tried it, but it worked for me :confused: What I did:

After that, the app instantly opened the newly created board and showed the created list. The board was also listed in the sidebar. Did I miss something here? Did you do anything differently?

@stefan-niedermann could you please confirm, it works for you as well?

stefan-niedermann commented 3 years ago

I can confirm that it works for me - @quanticPI can yiu reproduce this issue every time? Have you set "Sync on wi-fi only" preference active?

quanticPI commented 3 years ago

Hi @desperateCoder, @stefan-niedermann , I confirm that setting my phone to airplane mode works for me too.

What I do is I don't turn on airplane mode, phone has Internet access, but I turn off my Nextcloud server so what I think happens is the app tries to connect but in the end it fails to receive a respond from the server. I suppose in airplane mode tha app handles the offline mode correctly because it doesn't even try to connect to the server.

I realize this is very different from the first step to reproduce I described but didn't know it at that moment.

stefan-niedermann commented 3 years ago

Not trivial. To reproduce one can temporarily rename index.php to something else and then try to create a card.

stefan-niedermann commented 3 years ago

We implemented a more robust sync for the scenario where one creates a board or a card while the server itself is not available.

Those improvements will be shipped in 1.12.2. They don't cover each and every use case yet but should be enough to continue working for a while when the server is temporarily not available.

We'll have another look in the future.