Skip to content

Add leg notifications - #8

Merged
KasparElmans merged 4 commits into
mainfrom
feature/add-leg-notifications
Jul 22, 2026
Merged

Add leg notifications#8
KasparElmans merged 4 commits into
mainfrom
feature/add-leg-notifications

Conversation

@KasparElmans

Copy link
Copy Markdown
Member

Description of PR

In this PR we are adding notifications to route legs. These offer us the possibility to warn drivers of potential risks on their route. These notifications are implemented in accordance with the Mapbox spec outlined here.

This is the iOS counterpart of maplibre/maplibre-navigation-android#230.

Why

At Flitsmeister we are looking to implement ferry notifications in our routing module. At the moment the RouteLeg object does not know how to parse said ferry notifications, so we could either parse the raw JSON ourselves and hack some way around it, or we could add it to the RouteLeg object as an expansion.

Changes

  • Added Notification, NotificationDetails, and related type/subtype/refresh models
  • Added RouteLeg.notifications (defaults to an empty array when absent)
  • Preserved unknown type/subtype/refresh values for forward compatibility
  • Added unit tests covering parsing, serialization, validation, defaults, and secure coding

Test plan

  • swift test --filter NotificationTests
  • Review public API surface for ObjC/Swift consumers
  • Verify a Directions response containing ferry (and other) notifications populates RouteLeg.notifications

Made with Cursor

KasparElmans and others added 4 commits July 20, 2026 15:57
Port MapLibre Android leg notifications support so iOS can warn about risks such as ferry crossings without parsing raw JSON.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep a Swift-only API while retaining NSSecureCoding for RouteLeg archiving.

Co-authored-by: Cursor <cursoragent@cursor.com>
A type named Notification collided with Foundation.Notification and broke NotificationCenter observers in MapLibre Navigation.

Co-authored-by: Cursor <cursoragent@cursor.com>
@KasparElmans
KasparElmans marked this pull request as ready for review July 21, 2026 11:13
@KasparElmans
KasparElmans requested a review from Copilot July 21, 2026 11:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class support for Directions API “notification” objects on RouteLeg, enabling clients to surface leg-level alerts/violations (for example ferry crossings and vehicle-dimension restriction violations) and to round-trip these models through JSON and NSSecureCoding.

Changes:

  • Introduced RouteNotification, RouteNotificationDetails, and related type/subtype/refresh/reason value types.
  • Added RouteLeg.notifications, parsed from leg JSON and archived via NSSecureCoding (defaulting to [] when absent).
  • Added unit tests covering parsing, JSON wire-name serialization, forward-compatibility of unknown values, and secure-coding round trips.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
MapboxDirections/MBRouteNotification.swift New notification models (types/details/secure coding/JSON representation).
MapboxDirections/MBRouteLeg.swift Parses and archives notifications on RouteLeg with an empty-array default.
MapboxDirectionsTests/NotificationTests.swift New tests validating notification parsing/serialization/secure-coding behavior.
MapboxDirections.xcodeproj/project.pbxproj Adds new source/test files to Xcode build phases/groups.
CHANGELOG.md Documents the new route-leg notification support under “Unreleased”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread MapboxDirections/MBRouteNotification.swift
Comment thread MapboxDirections/MBRouteNotification.swift
@KasparElmans

Copy link
Copy Markdown
Member Author

bugbot run

@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@KasparElmans

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 437ccfe. Configure here.

Comment thread MapboxDirections/MBRouteNotification.swift
@KasparElmans
KasparElmans merged commit c171f3b into main Jul 22, 2026
2 checks passed
@KasparElmans
KasparElmans deleted the feature/add-leg-notifications branch July 22, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants