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

Bunch of minor cleanup + prep for 0.7.0 release #183

Merged
merged 4 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/maplibre/maplibre-gl-native-distribution.git",
"state" : {
"revision" : "cf66f087af489ebc091c03cbd4f38d0540135871",
"version" : "6.5.3"
"revision" : "abe762f1e19e03a4c6943d2aad92c219da384b29",
"version" : "6.5.4"
}
},
{
Expand Down Expand Up @@ -41,8 +41,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "e883fc9ea51e76dc9ed13fd4a92b0ee258a1e8c9",
"version" : "1.17.3"
"revision" : "6d932a79e7173b275b96c600c86c603cf84f153c",
"version" : "1.17.4"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if useLocalFramework {
path: "./common/target/ios/libferrostar-rs.xcframework"
)
} else {
let releaseTag = "0.6.1"
let releaseTag = "0.7.0"
let releaseChecksum = "f95a7e525ebfb66515fa24d37599b5bf2a91274999d2832933d5909081e6ad31"
binaryTarget = .binaryTarget(
name: "FerrostarCoreRS",
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
agp = "8.5.1"
agp = "8.5.2"
kotlin = "2.0.0"
cargo-ndk = "0.3.4"
ktfmt = "0.19.0"
Expand Down
12 changes: 11 additions & 1 deletion apple/Sources/UniFFI/ferrostar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,11 @@ public protocol NavigationControllerProtocol: AnyObject {

/**
* Updates the user's current location and updates the navigation state accordingly.
*
* # Panics
*
* If there is no current step ([`TripState::Navigating`] has an empty `remainingSteps` value),
* this function will panic.
*/
func updateUserLocation(location: UserLocation, state: TripState) -> TripState
}
Expand Down Expand Up @@ -624,6 +629,11 @@ open class NavigationController:

/**
* Updates the user's current location and updates the navigation state accordingly.
*
* # Panics
*
* If there is no current step ([`TripState::Navigating`] has an empty `remainingSteps` value),
* this function will panic.
*/
open func updateUserLocation(location: UserLocation, state: TripState) -> TripState {
try! FfiConverterTypeTripState.lift(try! rustCall {
Expand Down Expand Up @@ -4021,7 +4031,7 @@ private var initializationResult: InitializationResult = {
if uniffi_ferrostar_checksum_method_navigationcontroller_get_initial_state() != 63862 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_ferrostar_checksum_method_navigationcontroller_update_user_location() != 43166 {
if uniffi_ferrostar_checksum_method_navigationcontroller_update_user_location() != 3165 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_ferrostar_checksum_method_routeadapter_generate_request() != 59034 {
Expand Down
10 changes: 5 additions & 5 deletions common/ferrostar/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ fn create_osrm_response_parser(polyline_precision: u32) -> Arc<dyn RouteResponse
#[cfg(feature = "uniffi")]
#[uniffi::export]
fn create_route_from_osrm(
route_data: Vec<u8>,
waypoint_data: Vec<u8>,
route_data: &[u8],
waypoint_data: &[u8],
polyline_precision: u32,
) -> Result<Route, ParsingError> {
let route: OsrmRoute = serde_json::from_slice(&route_data)?;
let waypoints: Vec<OsrmWaypoint> = serde_json::from_slice(&waypoint_data)?;
return Route::from_osrm(&route, &waypoints, polyline_precision);
let route: OsrmRoute = serde_json::from_slice(route_data)?;
let waypoints: Vec<OsrmWaypoint> = serde_json::from_slice(waypoint_data)?;
Route::from_osrm(&route, &waypoints, polyline_precision)
}
8 changes: 4 additions & 4 deletions common/ferrostar/src/models.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Common data models.
//!
//! Quick tour:
//! - [Route]: Common notion of what a route is; You can go top-down from here if you're curious.
//! - [Waypoint]: Points that a user is intending to traverse; interesting because there are multiple kinds of them.
//! - [SpokenInstruction] and [VisualInstruction]: Audiovisual prompts as the user progresses through the route.
//! - [GeographicCoordinate] and [BoundingBox]: Geographic primitives
//! - [`Route`]: Common notion of what a route is; You can go top-down from here if you're curious.
//! - [`Waypoint`]: Points that a user is intending to traverse; interesting because there are multiple kinds of them.
//! - [`SpokenInstruction`] and [`VisualInstruction`]: Audiovisual prompts as the user progresses through the route.
//! - [`GeographicCoordinate`] and [`BoundingBox`]: Geographic primitives
//! (providing a shared language and type definition across multiple platforms).

#[cfg(feature = "alloc")]
Expand Down
5 changes: 5 additions & 0 deletions common/ferrostar/src/navigation_controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ impl NavigationController {
}

/// Updates the user's current location and updates the navigation state accordingly.
///
/// # Panics
///
/// If there is no current step ([`TripState::Navigating`] has an empty `remainingSteps` value),
/// this function will panic.
pub fn update_user_location(&self, location: UserLocation, state: &TripState) -> TripState {
match state {
TripState::Idle => TripState::Idle,
Expand Down
11 changes: 4 additions & 7 deletions common/ferrostar/src/routing_adapters/osrm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ use crate::routing_adapters::{
ParsingError, Route,
};
#[cfg(all(not(feature = "std"), feature = "alloc"))]
use alloc::{collections::BTreeSet as HashSet, string::ToString, vec, vec::Vec};
use alloc::{string::ToString, vec, vec::Vec};
use geo::BoundingRect;
use polyline::decode_polyline;
#[cfg(feature = "std")]
use std::collections::HashSet;
use uuid::Uuid;

/// A response parser for OSRM-compatible routing backends.
Expand All @@ -40,18 +38,17 @@ impl RouteResponseParser for OsrmResponseParser {
fn parse_response(&self, response: Vec<u8>) -> Result<Vec<Route>, ParsingError> {
let res: RouteResponse = serde_json::from_slice(&response)?;

return res
.routes
res.routes
.iter()
.map(|route| Route::from_osrm(route, &res.waypoints, self.polyline_precision))
.collect::<Result<Vec<_>, _>>();
.collect::<Result<Vec<_>, _>>()
}
}

impl Route {
pub fn from_osrm(
route: &OsrmRoute,
waypoints: &Vec<OsrmWaypoint>,
waypoints: &[OsrmWaypoint],
polyline_precision: u32,
) -> Result<Self, ParsingError> {
let via_waypoint_indices: Vec<_> = route
Expand Down
Loading