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

Link for PushNotifications could not be parsed #707

Closed llucax closed 3 years ago

llucax commented 3 years ago

Please use GitHub reactions πŸ‘ to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!

Describe the bug

The app crashed after switching to another app and the switching back after a while.

To reproduce Issue is reproducible with an account from try.nextcloud.com:

Steps to reproduce the behavior:

  1. Go to the app
  2. Do some stuff
  3. Switch to another app
  4. Switch back after a while
  5. The app shows that crash backtrace.

I haven't checked yet if it happens consistently, I just got the stack trace and thought it was better to report it now.

Expected behavior

The app resumes the activity correctly.

Screenshots

Versions

Smartphone (please complete the following information):

Are you using LDAP?

Stacktrace

Full Crash:

App Version: 1.11.1
App Version Code: 1011001
App Flavor: fdroid

Files App Version Code: 30130190

---

OS Version: 3.18.120-perf+(1930916292597)
OS API Level: 28
Device: lucye
Manufacturer: LGE
Model (and Product): LG-H870 (lucye_global_com)

---

java.lang.RuntimeException: Unable to resume activity {it.niedermann.nextcloud.deck/it.niedermann.nextcloud.deck.ui.PushNotificationActivity}: java.lang.IllegalArgumentException: this doesn't seem to be an URL containing the board ID
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3947)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3979)
    at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1864)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:205)
    at android.app.ActivityThread.main(ActivityThread.java:6991)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:884)
Caused by: java.lang.IllegalArgumentException: this doesn't seem to be an URL containing the board ID
    at it.niedermann.nextcloud.deck.util.ProjectUtil.extractBoardIdAndCardIdFromUrl(ProjectUtil.java:53)
    at it.niedermann.nextcloud.deck.ui.PushNotificationActivity.onResume(PushNotificationActivity.java:62)
    at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1413)
    at android.app.Activity.performResume(Activity.java:7315)
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3939)
    ... 11 more
stefan-niedermann commented 3 years ago

Hey, thanks for the report! Are you able to reproduce this issue or did it only happen one time?

stefan-niedermann commented 3 years ago

Did you receive and open a push notification and then switched back?

llucax commented 3 years ago

Hey, thanks for the report! Are you able to reproduce this issue or did it only happen one time?

On a simple switch, I can't reproduce it. I'm forcing the resume of the activity by using the debugging option of Android "Don't keep activities", because otherwise I can't predict when my phone will decide to kill the app in the background, but I'm not sure if that could also interfere with the bug.

Did you receive and open a push notification and then switched back?

Sadly I don't remember how I left the app before switching back, but I'm almost sure I didn't open the app via a Nextloud Deck App notification.

stefan-niedermann commented 3 years ago

@desperateCoder branch: 707-push-notifications

I have added a few unit tests for ProjectUtil#extractBoardIdAndCardIdFromUrl, please try to adjust the extraction magic to match the new unit test setup.

What has changed: The # character in the URL is now optional.

I think @llucax is using an old Deck version, where the URLs didn't contain this character yet. @llucax which version of the Deck server app exactly are you using? I just noticed it was 1.1.2 so this can't be the root cause.

llucax commented 3 years ago

In case it helps in any way, I didn't experience the crash again since I reported it. I update the app frequently though, and I am now at 1.12.1 (updated just today).

stefan-niedermann commented 3 years ago

Thank you for the feedback - i already updated the error messages that we will get better messages the next time it happens - let us implement this hardening and then close this issue u til it happens again πŸ™‚

stefan-niedermann commented 3 years ago

Okay, as discussed:

Both improvements will be shipped with version 1.12.2.

Please continue to report any issues, especially if this error happens again :+1: Thank you for your contribution!