Thud icon indicating copy to clipboard operation
Thud copied to clipboard

Android: Using the "back" functionality, the state of the collection page is lost

Open func0der opened this issue 6 months ago • 2 comments

Describe the bug Basically #13 but for the "back" button, which most Android either have physically or with a gesture.

To Reproduce Steps to reproduce the behavior:

  1. Go to the collections, swipe right on one
  2. Click on any article but the first one
  3. Use the "back" button
  4. See that collection page state (horizontal scrolling position) is lost

Exception: If you have used the "back" icon inside the footer ONCE, it will always work. Easily reproducable by just closing the app and starting at 1.

Expected behavior The state of the collections page should be preserved even for first time going back via the "button"

Screenshots

Smartphone (please complete the following information):

  • Device: Any Android
  • OS: Android 12
  • Browser: Internal App Browser
  • Version: 1.2.1 (of the app)

Additional context Ionic article about the back button of Android: https://ionicframework.com/docs/developing/hardware-back-button#basic-usage

My two cents: I think adding the code from the article above here would resolve the issue: https://github.com/aerotoad/Thud/blob/a5e7b8e441a180f7a10f1c061e7546b811b8e7a2/src/app/pages/entry/entry.page.ts#L76

  this.platform.backButton.subscribeWithPriority(10, () => {
    goBack();
  });

I have not seen that you have registered ANY handler for the back button, so I guess Ionic just does a browser back and loses the state that way. Not sure though.

<3 your app by the way.

func0der avatar Jan 04 '24 23:01 func0der