Share a hex file through the mobile sharing APIs#709
Share a hex file through the mobile sharing APIs#709glastonbridge wants to merge 1 commit intoappsfrom
Conversation
|
Preview build will be at |
|
|
||
| await Share.share({ | ||
| title: `CreateAI ${hex.name}`, | ||
| text: "Micro:bit CreateAI project: ${hex.name}", |
There was a problem hiding this comment.
| text: "Micro:bit CreateAI project: ${hex.name}", | |
| text: `micro:bit CreateAI project: ${hex.name}`, |
Missing backticks, brand casing.
| : "save-hex-dialog-message1"; | ||
| const message2Id = isShare | ||
| ? "share-hex-dialog-message2" | ||
| : "save-hex-dialog-message2"; |
There was a problem hiding this comment.
Maybe we interpolate "share" or "save"? Or have two objects with heading/message1/message2 keys? Something that makes it trivial to see there are only really two sets of strings we use. Similar elsewhere.
| </Checkbox> | ||
| <Button size="lg" variant="primary" onClick={onSave}> | ||
| <FormattedMessage id="save-action" /> | ||
| <FormattedMessage id="share-action" /> |
There was a problem hiding this comment.
Is this incorrectly hardcoded to share?
| }, | ||
| "share-action": { | ||
| "defaultMessage": "Share", | ||
| "description": "Label for action that intiiates sharing the project on mobile" |
There was a problem hiding this comment.
| "description": "Label for action that intiiates sharing the project on mobile" | |
| "description": "Label for action that initiates sharing the project on mobile" |
typo
| "description": "Heading for the dialog shown when sharing a hex file on mobile" | ||
| }, | ||
| "share-hex-dialog-message1": { | ||
| "defaultMessage": "The shared object contains your actions, data samples and your MakeCode project.", |
There was a problem hiding this comment.
shared object
We need to have something more suitable here. It's the hex file that we're sharing really so maybe that's the right noun?
| files: [url], | ||
| }); | ||
|
|
||
| await Filesystem.deleteFile({ |
There was a problem hiding this comment.
Can this be a problem for the receiving app depending on timing? Is it definitely the case that we know the app is done with the share operation by the time the share call returns?
microbit-matt-hillsdon
left a comment
There was a problem hiding this comment.
Did a quick code level review, I will try it out later.
|
Grace reports it works well on iOS. Testing on Android 16 it mostly worked well some rough experiences:
Still to test: OneDrive - I need to sign up but I think this one is worth covering. Re whether it's sufficient to have one action: Drive and DropBox both have a "Save to device". Outlook has both for attachments. They kinda can't have Share as they have a different type of notion of sharing. I'd appreciate a bit more of a survey before we settle on just Share here. |
As a proposed approach, I have replaced the current "save" buttons with "share" as this is the intuitive action on mobile. I have also put in some different text for sharing, but kept the flow otherwise roughly the same.
Android
Screen_recording_20260127_153909.webm
iOS
Simulator.Screen.Recording.-.iPad.Pro.13-inch.M5.-.2026-01-27.at.16.05.29.mov
The current "Save" button in the app has two roles: (1) as the individual user's project storage and (2) as a project exporter. Knowing that multiple project support is coming, I expect the usage of this button will be more likely just a project export function, and Sharesheets are intended for this use. If we do need filesystem-like access, the Sharesheets provide that functionality as an option.
Details