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

[DEMO - DO NOT MERGE] Demo opening hex directly in the micro:bit app #1083

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

microbit-robert
Copy link
Collaborator

No description provided.

@github-actions
Copy link

@microbit-robert
Copy link
Collaborator Author

Does not check what browser/device you are using. Just assumes you are on iPad/mobile and attempts to open the project hex in the micro:bit app. Not sure what happens if you don't have the app downloaded, but it is likely to fail in the same semi-silent way that MakeCode does.

MakeCode manages to preserve project titles with spaces, this implementation resorts to URI encoding. Needs fixing.

@microbit-robert
Copy link
Collaborator Author

Notes from conversation with Jonny:

If we're on iOS, we should aim to open the .hex in the micro:bit app.

It seems that there is no way to determine whether an iOS device has an app installed from the browser. This is a possible work around:
https://stackoverflow.com/questions/13044805/how-can-i-check-if-an-app-is-installed-from-a-web-page-on-an-iphone

The plan is to raise a new issue in microbit-ios repo, linking this branch and tagging Martin. We'd need to tweak the app so that Python .hex files are opened in the Python Editor instead of MakeCode if the user attempts to edit the project from the app. To do this we'd need to update the migration code to handle the current format, and a multiple project format. Perhaps we should do this first before raising an issue?

Current migration format as JSON:

{
  "meta": {
    "cloudId": "microbit.org",
    "comment": "",
    "editor": "python",
    "name": "beating-heart",
  },
  "source": "code as text"
};

@martinwork
Copy link

martinwork commented Dec 16, 2022

MakeCode shows a banner if the app is not installed. Will the app launch the Python Editor via a URL with the encoded project appended?

@microbit-robert
Copy link
Collaborator Author

Yep, MakeCode in Safari shows a banner at the top prompting the user to either install the app, or open in the app.

The Python Editor V3 doesn't currently support opening a project as a base64 encoded .hex file appended on the URL. We'd need to change this first before being able to launch via the app.

@martinwork
Copy link

Right. sorry, I was meaning... is that the intended method?

@microbit-robert
Copy link
Collaborator Author

Right. sorry, I was meaning... is that the intended method?

Yes, it's my understanding that is the intended method.

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

Successfully merging this pull request may close these issues.

2 participants