Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Going 'back' from MakeCode doesn't work the way you expect #54

Open
jaustin opened this issue Apr 8, 2024 · 2 comments
Open

Going 'back' from MakeCode doesn't work the way you expect #54

jaustin opened this issue Apr 8, 2024 · 2 comments

Comments

@jaustin
Copy link

jaustin commented Apr 8, 2024

Describe the bug

Using the Android 'back' button from the 'Create Code' menu doesn't behave as I would expect.

It appears that something is popping more views onto the stack than user is aware of. For example home screen, then editor.

** To reproduce **

  • Open the app
  • Click "Create code"
  • Create a new project
  • use the 'gear' menu and select home
  • create another new project
  • Use the back button - *for me it takes 4 presses of 'back' to get back to the home screen of the app (not MakeCode)

** Expected behaviour **
I think either

  • The back button should take you first to the MakeCode homescreen and second back to the app

OR

  • the back button with a single press should take you back to the homescreen of the app.

Either way, needing to press back multiple times without user feedback that something has happened is not right.

CC @microbit-lucy

@martinwork
Copy link
Collaborator

martinwork commented Apr 9, 2024

@jaustin The MakeCode activity overrides onBackPressed to use webView.canGoBack()/goBack(). Somehow, each change from/to Home adds to the history, but goBack() doesn't do anything.

The iOS app implements Back by checking the current URL... If it's Makecode, leave Makecode, otherwise relaunch MakeCode, either home or editor, whichever was last. That supports cancelling GitHub login and MakeCode Sign In. The iOS app also displays a back button when the current URL isn't MakeCode.

I've experimented with this. Calling super.onBackPressed() works to leave Makecode, but I wonder if finish() might be safer. GitHub login worked for me, but MakeCode Sign In didn't.

Leaving Makecode goes back to whichever screen launched it (Home or FLASH).

EDIT: At least, I think it should! It doesn't return to FLASH right now because of this mistake
https://github.com/microbit-foundation/microbit-android/blob/main/app/src/main/java/com/samsung/microbit/ui/activity/ProjectActivity.java#L223

@martinwork
Copy link
Collaborator

martinwork commented Apr 9, 2024

@jaustin @microbit-lucy I now notice that things like ?(Help)/Support and Reference are navigated to within the webview. To navigate the reference pages, for example, back would be needed to do more than return to MakeCode.

The iOS app allows certain specific domains and URLs inside the webview and sends all others out to the external browser.

EDIT: I think URL filtering can be done here. I'm not sure why "https://microbit.org/" has been singled out to trigger an exit.
https://github.com/microbit-foundation/microbit-android/blob/main/app/src/main/java/com/samsung/microbit/ui/activity/MakeCodeWebView.java#L95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants