Skip to content

Add sync group and routing hint based on location#80

Open
Brian Plattenburg (bplattenburg) wants to merge 3 commits into
mainfrom
BP/sync-group-and-routing-hint
Open

Add sync group and routing hint based on location#80
Brian Plattenburg (bplattenburg) wants to merge 3 commits into
mainfrom
BP/sync-group-and-routing-hint

Conversation

@bplattenburg

@bplattenburg Brian Plattenburg (bplattenburg) commented Apr 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Configure Ditto's syncGroup and routingHint from the selected location ID so devices at the same location form an isolated peer-to-peer mesh and the Big Peer co-locates their data efficiently
  • Remove the custom location feature to simplify location IDs to numeric strings, which can be used directly as routing values across both Swift and Kotlin
  • Simplify location setup flow on both platforms

Breaking change

This sets a non-default syncGroup, so devices running this build will not form a mesh with older builds that use the default sync group (0). All devices in a demo need to be on this version or later.

Why remove custom locations?

syncGroup and routingHint require a UInt32. Demo location IDs are already numeric ("00001""00007") and parse directly. Custom locations used string IDs ("companyName-locationName") that would need a cross-platform hash — unnecessary complexity for a demo app.

@bplattenburg Brian Plattenburg (bplattenburg) requested a review from a team April 8, 2026 21:00
@bplattenburg Brian Plattenburg (bplattenburg) force-pushed the BP/sync-group-and-routing-hint branch 2 times, most recently from 8b1ac69 to 1f0f1dc Compare April 9, 2026 13:18
@bplattenburg Brian Plattenburg (bplattenburg) force-pushed the BP/sync-group-and-routing-hint branch 2 times, most recently from f2f4632 to 275ff23 Compare April 9, 2026 13:47
@bplattenburg Brian Plattenburg (bplattenburg) changed the base branch from main to BP/sdk-bump-and-tools April 10, 2026 18:00
Brian Plattenburg (bplattenburg) added a commit that referenced this pull request Apr 30, 2026
Resolved conflicts:
- iOS DittoService.swift (DittoInstance.init): folded #80's setRoutingConfig logic into the existing transport config block. Reads Settings.locationId at init and sets syncGroup/routingHint before sync starts. DittoInstance now owns initial Ditto configuration; DittoService still handles dynamic stop/setRoutingConfig/start when location changes.
- iOS DittoService.swift (DittoService.init): dropped #80's pre-startSync routing block; sync starts in DittoInstance.init via #82, with routing already applied above.
- iOS SettingsModel.swift: kept #80's removal of the storedCustomLocation/customLocationPublisher extension. Custom locations are removed in this PR.
@bplattenburg Brian Plattenburg (bplattenburg) changed the base branch from BP/sdk-bump-and-tools to main May 4, 2026 14:31
@bplattenburg Brian Plattenburg (bplattenburg) requested a review from a team as a code owner May 4, 2026 14:31
@bplattenburg

Copy link
Copy Markdown
Member Author

@getditto/commercial-solutions I'm closing this but keeping the branch if we ever need this sample code.

@bplattenburg

Copy link
Copy Markdown
Member Author

Re-opening with the primary goal of removing custom locations

- Configure syncGroup and routingHint from numeric location ID so
  devices at the same location form an isolated peer-to-peer mesh
  and the Big Peer co-locates their data efficiently
- Remove the custom location feature — demo locations only
- Simplify location setup flow on both platforms
- README: rewrite Location selection to reflect demo-only locations
  and document sync group / routing hint behavior
- SettingsModel: drop comment about user-defined locations
- strings.xml: remove unused button_demo_locations
- Kotlin: re-order imports in files touched by the rebase to satisfy
  ktlint
The location-switch trigger point on each platform was calling two
functions back-to-back — set routing, then set up subscriptions. The
routing config is conceptually part of "activate this location," so
move it inside that function on both platforms. iOS also drops a
redundant init-time routing call now that the sink covers it.
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.

1 participant