Skip to content

Share a hex file through the mobile sharing APIs#709

Open
glastonbridge wants to merge 1 commit intoappsfrom
apps-share-hex
Open

Share a hex file through the mobile sharing APIs#709
glastonbridge wants to merge 1 commit intoappsfrom
apps-share-hex

Conversation

@glastonbridge
Copy link
Collaborator

@glastonbridge glastonbridge commented Jan 27, 2026

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

  • We don't display a "sharing complete" toast as the behaviour is more obvious in the mobile sharing flow and it seems overly verbose to show the user.
  • The text on the "share" version of the save dialogs is different to reflect the changes in the user's expectations and next steps, but it's just a first proposal.
  • There are several places where I have not updated the "Save" flow to become the "Share" flow because they seem to fit the "individual project storage" role above. I'm very open to being wrong about this!
    • The NameProjectDialog has a save button
    • OpenSharedProjectPage offers a save to avoid overwriting the user's currently-active project
    • ImportPage offers a save to avoid overwriting the user's currently-active project

@github-actions
Copy link

Preview build will be at
https://review-createai.microbit.org/apps-share-hex/

@glastonbridge glastonbridge marked this pull request as ready for review January 27, 2026 16:17

await Share.share({
title: `CreateAI ${hex.name}`,
text: "Micro:bit CreateAI project: ${hex.name}",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this incorrectly hardcoded to share?

},
"share-action": {
"defaultMessage": "Share",
"description": "Label for action that intiiates sharing the project on mobile"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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.",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link

@microbit-matt-hillsdon microbit-matt-hillsdon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick code level review, I will try it out later.

@microbit-matt-hillsdon
Copy link

microbit-matt-hillsdon commented Jan 29, 2026

Grace reports it works well on iOS. Testing on Android 16 it mostly worked well some rough experiences:

  • Google Drive worked as expected but I got no extension on the uploaded file
  • Files app didn't work I got "We can't save this file" toast. App is called "Files by Google" in the sharing list and says "Download" under it. I think this is worth investigating. This seems like an important one.
    • If I share a hex file from an Outlook attachment then I don't get offered "Files by Google" as an option. It has far fewer apps suggested. But then it has a separate Download action.
  • WhatsApp just sent the text (with the broken placeholder). To test: does this generally work from other apps? Not sure I've ever tried to send a non-image/video via WhatsApp. If not then I guess nothing we can do.
    • If I share a hex file from an Outlook attachment then WhatsApp works
  • Zoom: it sent the file just fine but I got stuck in Zoom (well, Zoom's share activity running in a CreateAI context or whatever exactly is going on). Exiting didn't get me back to CreateAI which is a pretty rough experience. I suspect this one is Zoom's fault.
    • Trying Share from an Outlook .hex attachment just opened Zoom and didn't even succeed in sharing. Let's not worry about Zoom...

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.

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