Skip to content

[DO NOT MERGE] Merge apps into main#740

Draft
microbit-matt-hillsdon wants to merge 222 commits intomainfrom
apps
Draft

[DO NOT MERGE] Merge apps into main#740
microbit-matt-hillsdon wants to merge 222 commits intomainfrom
apps

Conversation

@microbit-matt-hillsdon
Copy link

Draft to monitor merge status and stop GitHub suggesting I create this PR all the while...

There are significant barriers to merging this back:

  • Includes unreleased beta changes that are currently on the beta branch
  • Includes incomplete work on supporting multiple projects from support-multiple-projects-beta (depends on beta changes)
  • Includes connection library changes from the apps branch which needs itself needs work before it can be merged back (primarily testing on Windows via this CreateAI branch) - see Apps Bluetooth support & 1.0 breaking changes microbit-connection#67

microbit-matt-hillsdon and others added 30 commits November 20, 2025 10:17
Fix theme and upgrade ml-trainer-microbit theme package (#626)
- New and updated nudges to guide user through recording for 2 actions then training.
- Also replaced empty data samples page state with an initial placeholder action.
- Add screen reading and reduced motion support for nudges.
- Update homepage step-by-step and move it above video.
- The welcome dialog has not been finalised yet, but has a placeholder video. 

---------

Co-authored-by: Matt Hillsdon <matt.hillsdon@microbit.org>
Android should have signing. We'll revisit iOS.
No signing for iOS
Top padding to respect the safe area on mobile.
* Add icon/splash - just a quick starting point.
* Call the apps CreateAI - micro:bit CreateAI doesn't fit - on iPad the space is smooshed and on Android phone I just see "micro:bit..."
* Assets cap plugin pulls in prettier xml formatting so ignore the existing SVGs in the app
Uses alpha apps release microbit-connection for native Bluetooth support.

This change also uses capacitor for web BLE which we need to evaluate.
It seems to roughly work but there are a bunch of notes in microbit-connection
that we'll follow up on.

This integration is partial but is sufficient to use a single micro:bit to
flash data collection, record data and flash a MakeCode program.

There's lots about this that's WIP but I think it's a good base for further
fixes. Note it targets the apps branch.

I plan to merge this and then get the iOS app testable in non-dev environments
(e.g. deal with signing, internal distribution).

Known issues we're going to merge with anyway:

- Not tested on Android. The underlying connection code used to work there before recent fixes, likely still does.
- Only superficial testing on web (Mac only, V1 + V2).
  - Seems OK but we lost many subtle cases from microbit-connection that will need to be investigated there.
- No or wrong flow's error and reconnection (after 2 x fail) UX.
- Poor experience reconnecting after flashing a MakeCode hex.

Non-obvious changes:
- Switches to MakeCode programs for the data collection hex
- Upgrades Playwright and Node versions to get local dev working again
- Very basic CLAUDE.md
Eventually we'll align with Web CreateAI's minor version at least, but for now
let's start low.
* Update data collection hex files with correct bluetooth pattern

- Added note on generating hex files with configured Bluetooth mode.
- Minor correction in local develoment doc

Co-authored-by: Matt Hillsdon <matt.hillsdon@microbit.org>

---------

Co-authored-by: Matt Hillsdon <matt.hillsdon@microbit.org>
- Move lower-level connection code to ConnectionService (might eliminate later)
- Update UI code to fire simple state machine events or use hooks for data
  subscriptions.
- Unit test the state machines
- Add e2e tests covering key connection/reconnection scenarios.

UI changes for web/radio flows:

- Don't show a dialog behind bluetooth requestDevice (we didn't for USB already)
- Don't talk about Web Bluetooth quite so in the dialog flow, after the first dialog just talk about connecting to the data connection micro:bit (will help with less text for native/web scenarios and is more user oriented)

This change relies on the introduction of the PAUSED state in the apps branch of the connection library.
It's daft to talk about tablets and the other mobile OS when they've clearly
installed an app not just stumbled on a website.
This only deals with Bluetooth permissions in the data connection flow.

They also apply to the download flow (especially if you skip past connecting, but all the time in principle) but I want to refactor in a separate PR to enable better sharing between the flows before implementing it there.

I've also added in the missing A+B reset dialog.

I regenerated all the translated strings via `find lang -type f -not -name ui.en.json | while read n; do git checkout main -- $n; done  && npm run i18n:compile` as they were a mess and no actual translation has happened on the apps branch.

Includes these changes in the microbit-connection upgrade:

microbit-foundation/microbit-connection#73
Still just manually uploading to TestFlight etc. but that should be easy to
automate via Fastlane with a bit more work.

I've left Debug builds using automatic signing.

Use job run number for the numeric versions so we can just upload them without
faff. We'll worry about marketing version numbers later once we tag releases.
Keeping them on the apps branch for now for two reasons:

1. We're always using the -apps version of microbit-connection which has a
different BLE implementation that hasn't been adequately tested (especially on
Windows).

2. More generally aiming to reduce risk to main until changes stabilize.

Includes logic to ensure we don't release the web app from the apps branch and
a temporary backstop for the first tag in case I screwed that up.

See README.md changes for the plan.
- Remove ConnectionService class in favour of more direct connection access via Connections interface that tracks which is the current data connection and exposes a listener API for it for the data connection state machine to use to get events.                                                                                
- Unify connection actions (connectBluetooth, connectMicrobits, reconnect) into single   
connectData action
After this change, if you either skip straight to MakeCode (because you previously collected data) or remove BT permissions after a data connection was made, then you will be re-prompted for permissions in the MakeCode download flow.
Move it to be a setting. This might cause a minor conflict with Rob's work to
add IndexDB storage but should mean it ultimately gets stored in the right
place not still in localStorage.

Closes #672
This removes a gap where there was briefly no dialog.
microbit-matt-hillsdon and others added 30 commits March 6, 2026 14:23
This contains the pre-1.0 breaking API changes and USB serial re-work.
New animation layout introduced for portrait mobile / narrower screen sizes.
Some of the strings have been unused since the image -> video swap in the old home page.
useBoardVersion() called getBoardVersion() unconditionally, which
throws DeviceError("not-connected") since the connection library
update. Handle this by catching the error and returning undefined.

Also update mock Bluetooth/USB connections to match the real
library's caching behavior: getBoardVersion()/getDeviceId() now
throw pre-connect and persist after disconnect until clearDevice().
Omit the `text` parameter from Share.share() on iOS where
UIActivityViewController treats it as a second shareable item.
Android still receives it as EXTRA_TEXT for email body pre-fill.

Dismiss the save progress dialog as soon as the hex is ready on all
platforms, before entering platform-specific save/share logic. Previously
the Download path on iOS left SaveStep.SaveProgress active while the
share sheet was open. Nothing then dismissed it if you cancelled.
Prevents it showing again on navigation back from Train Model when you didn't
connect (e.g. opened project with data already).
…795)

syncConnectionSettings in the download flow read the micro:bit name
from persisted settings, but since 97fc526 setMicrobitName only
writes to download state (deferring persistence until connection
succeeds). This meant changing the pattern via "My pattern is
different" during FindingDevice left the old name filter on the
Bluetooth connection, preventing it from finding the new micro:bit.

Read from download state instead, matching the analogous fix already
applied to the data connection flow in 97fc526.

Adds an e2e test that changes the pattern mid-download and asserts
the correct name filter is applied.

There's a slightly odd behaviour where we write to settings the last
micro:bit you successfully used (in either flow) but the connection flows keep
their own state. I think this is OK if we don't / until we do support explicit
same/different. I guess one option would be not to persist the name in the
download flow unless no name was persisted at all.
This avoids conflict with the virtual keyboard in the app (where we don't
resize the viewport for the keyboard) and seems fine more broadly.
Add @capacitor/keyboard and disable automatic WebView resizing:
- iOS: set Keyboard.resize to "none" in Capacitor config
- Android: strip IME insets in MainActivity so EdgeToEdge doesn't
  resize the layout

The useKeyboardHeight hook reports the keyboard height so
DataSamplesTable can add padding and scroll the focused input
into view manually.
Android's WebView (Capacitor's BridgeWebChromeClient) converts the file
input accept attribute to MIME types via MimeTypeMap. Since .hex has no
registered MIME type, it gets silently dropped, leaving only .json in the
file picker. Add application/octet-stream to the accept types on Android
so hex files are selectable.

This is not an issue when using Chrome on Android.
* Button B press should only record 1 recording
* Don't allow recording when tour is in progress
* Allow button B recording only when record button for selected action is displayed
…ve project (#809)

Extract renameProject to project-utils so it can be shared between
store and storage. The shared version updates both header.name and
pxt.json name, and handles missing headers gracefully.
* Make visible toolbar editable name focus ring
* Maximise showing project name by tweaking ActionBar styling
Fixes issue where closing Bluetooth/Radio try again/reconnect dialog has issue where clicking "Connect" starts from scratch as opposed to retries connection (live behaviour).
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.

4 participants