-
Notifications
You must be signed in to change notification settings - Fork 318
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
Allow the use of multiple status banners #2747
Allow the use of multiple status banners #2747
Conversation
CocoaPods integration tests are failing:
CocoaPods picked up the edit to v6.3.0 in mapbox/mapbox-gl-native-ios#549 (comment) but apparently not the earlier edit to v6.2.2 in mapbox/mapbox-gl-native-ios#549 (comment):
This is basically CocoaPods/CocoaPods#10229. We could work around it by forcing the CI job to start with a fresh cache, but at this point, it might be easier to update the integration test fixture by running these commands: mapbox-navigation-ios/scripts/update-version.sh Lines 35 to 37 in 72d7845
|
Is this PR ready to be reviewed (I can see that it's marked as |
Yes. Ready to be reviewed. I have two concerns if you could address them in your review:
|
@@ -724,21 +743,28 @@ extension NavigationViewController: NavigationServiceDelegate { | |||
public func navigationServiceShouldDisableBatteryMonitoring(_ service: NavigationService) -> Bool { | |||
return navigationComponents.allSatisfy { $0.navigationServiceShouldDisableBatteryMonitoring(service) } | |||
} | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: removing extra whitespaces and cleaning the code would be great.
MapboxNavigation/StatusView.swift
Outdated
public func showStatus(title: String, spinner spin: Bool = false, duration: TimeInterval, animated: Bool = true, interactive: Bool = false) { | ||
show(title, showSpinner: spin, interactive: interactive) | ||
// show(title, showSpinner: spin, interactive: interactive) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: removing the unnecessary comment would be better.
@@ -65,4 +65,4 @@ SPEC CHECKSUMS: | |||
|
|||
PODFILE CHECKSUM: d4084fe664fbacd0cffd88ab45eaed1ad907ad1d | |||
|
|||
COCOAPODS: 1.10.0 | |||
COCOAPODS: 1.9.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep CocoaPods 1.10.0
as it's used on CircleCI as well.
@@ -933,7 +934,7 @@ | |||
AED2156E208F7FEA009AA673 /* NavigationViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationViewControllerTests.swift; sourceTree = "<group>"; }; | |||
AED6285522CBE4CE00058A51 /* ViewController+GuidanceCards.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "ViewController+GuidanceCards.swift"; path = "Example/ViewController+GuidanceCards.swift"; sourceTree = "<group>"; }; | |||
AEF2C8F12072B603007B061F /* routeWithTunnels_9thStreetDC.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = routeWithTunnels_9thStreetDC.json; sourceTree = "<group>"; }; | |||
B430D2F925534FDC0088CC23 /* UserHaloCourseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserHaloCourseView.swift; sourceTree = "<group>"; }; | |||
C3D225502587F411007DBCDF /* StatusViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusViewTests.swift; sourceTree = "<group>"; }; B430D2F925534FDC0088CC23 /* UserHaloCourseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserHaloCourseView.swift; sourceTree = "<group>"; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this file manually changed to resolve conflicts? Seems that it now has custom format, to fix it C3D225502587F411007DBCDF /* StatusViewTests.swift */
and B430D2F925534FDC0088CC23 /* UserHaloCourseView.swift */
should be in different lines.
MapboxNavigation/StatusView.swift
Outdated
} | ||
|
||
/** | ||
Shows the status view with an optional spinner. | ||
*/ | ||
public func show(_ title: String, showSpinner: Bool, interactive: Bool = false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be better to extend existing APIs instead of replacing existing ones. If you feel that newly added API is more concise previous one can be deprecated/or left without any changes.
MapboxNavigation/StatusView.swift
Outdated
var priority: Priority | ||
} | ||
|
||
struct Priority: RawRepresentable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be better to use enum for status priority. If Status
meant to be used publicly, Priority
should be made public as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idea was to allow for arbitrary priorities, similar to constraint priorities. But making the type public would make sense.
Shows the status view for a specified amount of time. | ||
Shows a Status for a specified amount of time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think such comment would be accurate for func addNewStatus(status: StatusView.Status)
. I think it'd better to comment with - parameter
statements in this case. Please also add docs for addNewStatus(status:)
and hideStatus(status:)
.
*/ | ||
func showStatus(title: String, spinner: Bool, duration: TimeInterval, animated: Bool, interactive: Bool) | ||
|
||
func addNewStatus(status: StatusView.Status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also rename addNewStatus(status:)
to func show(_ status: StatusView.Status)
and func hideStatus(using: StatusView.Status)
to hide(_ status: StatusView.Status)
.
@@ -411,6 +416,7 @@ extension TopBannerViewController: NavigationComponent { | |||
public func navigationService(_ service: NavigationService, willEndSimulating progress: RouteProgress, becauseOf reason: SimulationIntent) { | |||
guard reason == .manual else { return } | |||
statusView.hide(delay: 0, animated: true) | |||
// statusView.hide("simulating") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is commented part needed? If not, please remove it.
7460c54
to
e187179
Compare
Looks like the PR branch got munged up somehow, as if it got merged then rebased. If |
The last thing there is a rebase; I didn't use a merge at all. |
I think this branch was rebased onto an old copy of the main branch. |
…arted new show/hide implementation and subsequent status management
…ing and hiding banners
…) without dispatch
…t one assertion fails
…o it needs to be fixed
…false to navigationServiceDidChangeAuthorization so that halo view disappears when precise location is enabled so halo disappears
Upgraded to MapboxNavigationNative v31.0.1. Removed explicit routing tile version discovery now that the navigator can automatically choose the most recent version.
…false to navigationServiceDidChangeAuthorization so that halo view disappears when precise location is enabled so halo disappears
bbac3ca
to
515dab5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is tantalizingly close – I think the remaining tasks will be pretty small in nature.
@@ -3,12 +3,13 @@ | |||
## v1.3.0 | |||
|
|||
* MapboxCoreNavigation can now be installed using Swift Package Manager. ([#2771](https://github.com/mapbox/mapbox-navigation-ios/pull/2771)) | |||
* The CarPlay guidance panel now shows lane guidance. ([#2798](https://github.com/mapbox/mapbox-navigation-ios/pull/2798)) | |||
* The CarPlay guidance panel now shows lane guidance. ([#1885](https://github.com/mapbox/mapbox-navigation-ios/pull/1885)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks like a bad merge; can you revert it? Thanks!
public struct Priority: RawRepresentable { | ||
public typealias RawValue = Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since no specific values are defined, it would be simpler to define a type alias than a raw representable type alias inside a struct:
public typealias Priority = Int
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good to go once the struct goes away per #2747 (comment) and the changelog is fixed per #2747 (comment).
@@ -52,30 +52,57 @@ public class StatusView: UIControl { | |||
`Status` is a struct which stores information to be displayed by the `StatusView` | |||
*/ | |||
public struct Status { | |||
/** | |||
`identifier` is a unique string identifier for a `Status` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, it isn’t necessary to explicitly name the property in the property’s own documentation comment. For example, this could say “A string that uniquely identifies this status.”
public struct Priority { | ||
public typealias Priority = Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the struct with the typealias. The value
property will go away: you’ll be able to use an Int as if it were a Priority.
The previous version with the raw-representable Priority would’ve been appropriate if we wanted to define some preset values like high
and low
that were tied to specific values. But only a bare typealias is necessary if we’re treating it as just an ordinary number with special semantics.
Description
This PR allows the use of multiple status banners by refactoring
StatusView.swift
to manage the display statuses.Status
struct to represent a status, store them in astatuses
array, and refactor as necessaryStatus
? (e.g.: simulation status banner is interactive, allows for changes in simulation speed)Implementation
Screenshots or Gifs