Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish reframed Annotations on Current Step #261

Merged
merged 24 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9268409
WIP for publishing a current annotations object
Archdoog Sep 23, 2024
a887242
WIP for publishing a current annotations object
Archdoog Sep 23, 2024
4b16c31
Apply automatic changes
Archdoog Sep 23, 2024
bb84d48
Apply suggestions from code review
Archdoog Sep 24, 2024
377ab59
Annotations fixes from PR feedback
Archdoog Sep 24, 2024
0985f20
Incremental updates based on PR comments for annotations
Archdoog Sep 24, 2024
9755d87
Vastly improved and tested from the last push
Archdoog Sep 26, 2024
12ab32d
Merged in main and version bumped
Archdoog Sep 26, 2024
4be334c
Swiftformat and wasm-pack build fix
Archdoog Sep 26, 2024
e150d29
Corrected route snapshot errors on Apple
Archdoog Sep 26, 2024
7ab2cc8
Reverted BTreeMap to HashMap and adjusted insta configuration
Archdoog Sep 29, 2024
a00be57
Modifications based on comments
Archdoog Sep 29, 2024
d0cdc6b
Modifications based on PR comments
Archdoog Sep 29, 2024
2a0f39a
Bumped verion to 0.16.0
Archdoog Sep 29, 2024
b4a28c6
Workaround for temporary annotations test on apple
Archdoog Sep 29, 2024
0a562b6
Apply automatic changes
Archdoog Sep 29, 2024
eaf2632
Applied swiftformat
Archdoog Sep 29, 2024
7930422
Applied redaction to valhalla route parsing
Archdoog Sep 29, 2024
3cf7c37
Apply automatic changes
Archdoog Sep 29, 2024
7b7feb0
Applied redaction to valhalla route parsing
Archdoog Sep 29, 2024
db38d08
Merge branch 'feat/common/current-attrs' of github.com:stadiamaps/fer…
Archdoog Oct 1, 2024
b4e801b
Upgrading ParsingError naming
Archdoog Oct 1, 2024
ea92dca
Upgrading ParsingError naming
Archdoog Oct 1, 2024
d5d5d89
Upgrading ParsingError naming
Archdoog Oct 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ if useLocalFramework {
path: "./common/target/ios/libferrostar-rs.xcframework"
)
} else {
let releaseTag = "0.15.0"
let releaseTag = "0.16.0"
let releaseChecksum = "c44d86ae31e1fccde4a9e42fdb8474504dfee40338a341e3131f894208e3b7b2"
binaryTarget = .binaryTarget(
name: "FerrostarCoreRS",
url: "https://github.com/stadiamaps/ferrostar/releases/download/\(releaseTag)/libferrostar-rs.xcframework.zip",
url:
"https://github.com/stadiamaps/ferrostar/releases/download/\(releaseTag)/libferrostar-rs.xcframework.zip",
checksum: releaseChecksum
)
}
Expand Down Expand Up @@ -48,8 +49,10 @@ let package = Package(
),
.library(
name: "FerrostarMapLibreUI",
targets: ["FerrostarMapLibreUI",
"FerrostarSwiftUI"] // TODO: Remove FerrostarSwiftUI from FerrostarMapLibreUI once we can fix the demo app swift package config (broken in Xcode 15.3)
targets: [
"FerrostarMapLibreUI",
"FerrostarSwiftUI",
] // TODO: Remove FerrostarSwiftUI from FerrostarMapLibreUI once we can fix the demo app swift package config (broken in Xcode 15.3)
),
.library(
name: "FerrostarSwiftUI",
Expand Down
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ plugins {
alias libs.plugins.paparazzi apply false
alias libs.plugins.compose.compiler apply false
alias libs.plugins.mavenPublish apply false
alias libs.plugins.kotlinSerialization apply false
}

allprojects {
group = "com.stadiamaps.ferrostar"
version = "0.15.0"
version = "0.16.0"
}
2 changes: 2 additions & 0 deletions android/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
alias libs.plugins.cargo.ndk
alias libs.plugins.ktfmt
alias libs.plugins.mavenPublish
alias libs.plugins.kotlinSerialization
}

android {
Expand Down Expand Up @@ -53,6 +54,7 @@ dependencies {
implementation(platform(libs.okhttp.bom))
implementation(libs.okhttp.core)
implementation libs.moshi
implementation libs.moshi.kotlin

// TODO: Migrate version to TOML (doesn't work). Likely related issue: https://github.com/gradle/gradle/issues/21267
//noinspection UseTomlInstead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ class FerrostarCoreTest {
secondaryContent = null,
triggerDistanceBeforeManeuver = 42.0)),
spokenInstructions = listOf(),
duration = 0.0)))
duration = 0.0,
annotations = null)))

@Test
fun test401UnauthorizedRouteResponse() = runTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ fun NavigationState.Companion.pedestrianExample(): NavigationState {
secondaryContent = null,
triggerDistanceBeforeManeuver = 0.0,
),
spokenInstruction = null),
spokenInstruction = null,
annotationJson = null),
routeGeometry = listOf(),
isCalculatingNewRoute = false)
}
Expand Down
4 changes: 3 additions & 1 deletion android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-
okhttp-bom = { group = "com.squareup.okhttp3", name = "okhttp-bom", version.ref = "okhttp" }
okhttp-core = { group = "com.squareup.okhttp3", name = "okhttp" }
moshi = { group = "com.squareup.moshi", name = "moshi", version.ref = "moshi" }
moshi-kotlin = { group = "com.squareup.moshi", name = "moshi-kotlin", version.ref = "moshi" }
okhttp-mock = { group = "com.github.gmazzo", name = "okhttp-mock", version.ref = "okhttp-mock" }
# MapLibre
maplibre-compose = { group = "io.github.rallista", name = "maplibre-compose", version.ref = "maplibre-compose" }
Expand All @@ -74,4 +75,5 @@ cargo-ndk = { id = "com.github.willir.rust.cargo-ndk-android", version.ref = "ca
ktfmt = { id = "com.ncorti.ktfmt.gradle", version.ref = "ktfmt" }
paparazzi = { id = "app.cash.paparazzi", version.ref = "paparazzi" }
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
mapsplatform-secrets-plugin = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "secretsGradlePlugin" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
mapsplatform-secrets-plugin = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "secretsGradlePlugin" }
3 changes: 2 additions & 1 deletion apple/Sources/FerrostarCore/FerrostarCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ public protocol FerrostarCoreDelegate: AnyObject {
progress: _,
deviation: deviation,
visualInstruction: _,
spokenInstruction: spokenInstruction
spokenInstruction: spokenInstruction,
annotationJson: _
):
switch deviation {
case .noDeviation:
Expand Down
9 changes: 6 additions & 3 deletions apple/Sources/FerrostarCore/Mock/MockNavigationState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public extension NavigationState {
),
deviation: .noDeviation,
visualInstruction: nil,
spokenInstruction: nil
spokenInstruction: nil,
annotationJson: nil
),
routeGeometry: samplePedestrianWaypoints,
isCalculatingNewRoute: false
Expand Down Expand Up @@ -63,7 +64,8 @@ public extension NavigationState {
secondaryContent: nil, triggerDistanceBeforeManeuver: 42.0
),
],
spokenInstructions: []
spokenInstructions: [],
annotations: nil
),
],
remainingWaypoints: [],
Expand All @@ -74,7 +76,8 @@ public extension NavigationState {
),
deviation: .noDeviation,
visualInstruction: nil,
spokenInstruction: nil
spokenInstruction: nil,
annotationJson: nil
),
routeGeometry: samplePedestrianWaypoints,
isCalculatingNewRoute: false
Expand Down
26 changes: 26 additions & 0 deletions apple/Sources/FerrostarCore/NavigationState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,30 @@ public struct NavigationState: Hashable {
self.routeGeometry = routeGeometry
self.isCalculatingNewRoute = isCalculatingNewRoute
}

public var currentProgress: TripProgress? {
ianthetechie marked this conversation as resolved.
Show resolved Hide resolved
guard case let .navigating(_, _, _, _, progress: progress, _, _,
_, _) = tripState
else {
return nil
}

return progress
}

public var currentVisualInstruction: VisualInstruction? {
guard case let .navigating(_, _, _, _, _, _, visualInstruction: visualInstruction, _, _) = tripState else {
return nil
}

return visualInstruction
}

public var currentAnnotationJSON: String? {
guard case let .navigating(_, _, _, _, _, _, _, _, annotationJson: annotationJson) = tripState else {
return nil
}

return annotationJson
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public struct DynamicallyOrientingNavigationView: View, CustomizableNavigatingIn
formatter.locale = Locale(identifier: "en-US")
formatter.units = .imperial

guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand All @@ -158,7 +158,7 @@ public struct DynamicallyOrientingNavigationView: View, CustomizableNavigatingIn
formatter.locale = Locale(identifier: "en-US")
formatter.units = .metric

guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public struct LandscapeNavigationView: View, CustomizableNavigatingInnerGridView
formatter.locale = Locale(identifier: "en-US")
formatter.units = .imperial

guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand All @@ -129,7 +129,7 @@ public struct LandscapeNavigationView: View, CustomizableNavigatingInnerGridView
formatter.locale = Locale(identifier: "en-US")
formatter.units = .metric

guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public struct NavigationMapView: View {
}

private func updateCameraIfNeeded() {
if case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = navigationState?.tripState,
if case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _, _) = navigationState?.tripState,
// There is no reason to push an update if the coordinate and heading are the same.
// That's all that gets displayed, so it's all that MapLibre should care about.
locationManager.lastLocation.coordinate != userLocation.coordinates
Expand All @@ -98,7 +98,7 @@ public struct NavigationMapView: View {
// TODO: Make map URL configurable but gitignored
let state = NavigationState.modifiedPedestrianExample(droppingNWaypoints: 4)

guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ struct LandscapeNavigationOverlayView: View, CustomizableNavigatingInnerGridView
var body: some View {
HStack {
VStack {
if case let .navigating(_, _, _, _, progress: progress, _, visualInstruction: visualInstruction,
_) = navigationState?.tripState,
let visualInstruction
if case .navigating = navigationState?.tripState,
let visualInstruction = navigationState?.currentVisualInstruction,
let progress = navigationState?.currentProgress
{
InstructionsView(
visualInstruction: visualInstruction,
Expand All @@ -60,7 +60,9 @@ struct LandscapeNavigationOverlayView: View, CustomizableNavigatingInnerGridView

Spacer()

if case let .navigating(_, _, _, _, progress: progress, _, _, _) = navigationState?.tripState {
if case .navigating = navigationState?.tripState,
let progress = navigationState?.currentProgress
{
ArrivalView(
progress: progress,
onTapExit: onTapExit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ struct PortraitNavigationOverlayView: View, CustomizableNavigatingInnerGridView

var body: some View {
VStack {
if case let .navigating(_, _, _, _, progress: progress, _, visualInstruction: visualInstruction,
_) = navigationState?.tripState,
let visualInstruction
if case .navigating = navigationState?.tripState,
let visualInstruction = navigationState?.currentVisualInstruction,
let progress = navigationState?.currentProgress
{
InstructionsView(
visualInstruction: visualInstruction,
Expand Down Expand Up @@ -79,7 +79,9 @@ struct PortraitNavigationOverlayView: View, CustomizableNavigatingInnerGridView
bottomTrailing?()
}

if case let .navigating(_, _, _, _, progress: progress, _, _, _) = navigationState?.tripState {
if case .navigating = navigationState?.tripState,
let progress = navigationState?.currentProgress
{
ArrivalView(
progress: progress,
onTapExit: onTapExit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public struct PortraitNavigationView: View, CustomizableNavigatingInnerGridView
formatter.locale = Locale(identifier: "en-US")
formatter.units = .imperial

guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand All @@ -129,7 +129,7 @@ public struct PortraitNavigationView: View, CustomizableNavigatingInnerGridView
formatter.locale = Locale(identifier: "en-US")
formatter.units = .metric

guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand Down
Loading
Loading