chrisboyle / sgtpuzzles

Android port of Simon Tatham's Puzzles
https://chris.boyle.name/puzzles
Other
584 stars 166 forks source link

Undo action performed when leaving app #592

Closed JonnyTech closed 1 year ago

JonnyTech commented 1 year ago

Describe the bug When one switches away from the app, or closes it, then restarts it, the last move has been undone.

To Reproduce Steps to reproduce the behavior:

  1. Start bridges
  2. Link some islands
  3. Swipe up to recents switcher
  4. Notice the last move missing
  5. Switch back to app
  6. Swipe up again
  7. Another undo action performed
  8. Repeat
  9. More moves undone

Expected behavior The last game state to be remembered and preserved when leaving the app.

Screenshots Make some moves: Screenshot_20230220-111012_Trebuchet Swipe up: Screenshot_20230220-111034_Puzzles Where did that last line go to?

Version info (optional, but sometimes helpful)

Additional context This may simply be a consequence of having system gestures enabled.

JupiLogy commented 1 year ago

I've tested this in my own phone (OnePlus as well, but Android 12). On mine, it works as expected.

JonnyTech commented 1 year ago

Update: the issue is not present with 3 button navigation, but does manifest with gesture navigation and 2 button navigation (which also uses swipe up gestures)

Screenshot_20230220-113314_Trebuchet

JonnyTech commented 1 year ago

I've tested this in my own phone (OnePlus as well, but Android 12). On mine, it works as expected.

@JupiLogy thanks for testing, this may ba a specific Android 13 issue but I have no other devies to check.

chrisboyle commented 1 year ago

Reproduced on Pixel 6 Pro with Android 13. I have a thin grey bar added by the system (see screenshot) and I think I normally start my gestures from the very edge of the screen or within that area. By starting my swipe a few pixels further up, within the application area and such that it crosses the undo button, I get the behaviour described. This is probably very common especially among people who use cases on their phones, and needs fixing.

The broader issue here is it looks like all the keyboard buttons will take action if a swipe crosses them, whereas the intention was only to act if the touch is contained within a single key from start to finish (and perhaps constrained more tightly than that according to any Android standard touch parameters). Relatedly, we are relying on deprecated platform keyboard classes (see #532) which don't have an androidx replacement as far as I know, so it's probably time to fix that too by implementing our own keyboard view that behaves sensibly, or adding a dependency if a very small and permissively-licensed one exists.

home-bar

JonnyTech commented 1 year ago

Thanks for confirming @chrisboyle, havivg a case or not swiping from the very bottom is not the issue, it seems that disabling the navigation hint (thin line at bottom) is the cause:

IMG_20230220_122146

At least I have a workaround for now, I appreciate you looking into this.

goyalyashpal commented 1 year ago

so it's probably time to fix that too by implementing our own keyboard view that behaves sensibly, or adding a dependency if a very small and permissively-licensed one exists. - @ chrisboyle at https://github.com/chrisboyle/sgtpuzzles/issues/592#issuecomment-1436881219

is keyboard view same as keyboard?

if yes, then rkkr/simple-keyboard might be the one. Apache-V2 0.8 MiB in setup (apk) size.

chrisboyle commented 1 year ago

That keyboard app certainly contains a KeyboardView, but it's basically Android's own one, so doesn't really add anything versus copying Android's one directly, and the complication with doing that is it's Apache-licensed like the rest of Android, whereas I don't want to change this project's licence away from MIT (same as upstream).

goyalyashpal commented 1 year ago

Apache-licensed like the rest of Android, whereas I don't want to change this project's licence away from MIT (same as upstream).

FutharkBoard (Elder Futhark keyboard for Android) - https://f-droid.org/app/de.drmaxnix.futharkboard

Irregular Expressions (Virtual keyboard for writing expressive messages in various text styles) - https://f-droid.org/app/mf.asciitext.lite

these are lnly 2 i could find on searching for "keyboard" in officual fdroid repo with MIT licence. there were others with unlicence or bsd-3, but i dont onow if they are compTible with mit-l.

chrisboyle commented 1 year ago

Thank you for finding these, but unfortunately they both just import the deprecated KeyboardView from the OS i.e. they do what Puzzles does now that I'm trying to change - Futhark here and Irregular here). Looks like I'll have to write my own View for it then.