Open microbit-robert opened 1 year ago
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.
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"
};
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?
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.
Right. sorry, I was meaning... is that the intended method?
Right. sorry, I was meaning... is that the intended method?
Yes, it's my understanding that is the intended method.
Preview build will be at https://review-python-editor-v3.microbit.org/app-protocol-demo/