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:
|
| return navigationComponents.allSatisfy { $0.navigationServiceShouldDisableBatteryMonitoring(service) } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Nit: removing extra whitespaces and cleaning the code would be great.
| @available(*, deprecated, message: "Add a status using addNewStatus instead") | ||
| 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.
Nit: removing the unnecessary comment would be better.
| PODFILE CHECKSUM: d4084fe664fbacd0cffd88ab45eaed1ad907ad1d | ||
|
|
||
| COCOAPODS: 1.10.0 | ||
| COCOAPODS: 1.9.3 |
There was a problem hiding this comment.
I think we should keep CocoaPods 1.10.0 as it's used on CircleCI as well.
| 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.
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.
| /** | ||
| 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.
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.
| var priority: Priority | ||
| } | ||
|
|
||
| struct Priority: RawRepresentable { |
There was a problem hiding this comment.
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.
I think the idea was to allow for arbitrary priorities, similar to constraint priorities. But making the type public would make sense.
| public protocol NavigationStatusPresenter: class { | ||
| /** | ||
| 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.
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.
I'd also rename addNewStatus(status:) to func show(_ status: StatusView.Status) and func hideStatus(using: StatusView.Status) to hide(_ status: StatusView.Status).
| 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.
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
1ec5
left a comment
There was a problem hiding this comment.
This is tantalizingly close – I think the remaining tasks will be pretty small in nature.
|
|
||
| * 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.
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.
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.
This is good to go once the struct goes away per #2747 (comment) and the changelog is fixed per #2747 (comment).
| */ | ||
| public struct Status { | ||
| /** | ||
| `identifier` is a unique string identifier for a `Status` |
There was a problem hiding this comment.
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.
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.swiftto manage the display statuses.Statusstruct to represent a status, store them in astatusesarray, and refactor as necessaryStatus? (e.g.: simulation status banner is interactive, allows for changes in simulation speed)Implementation
Screenshots or Gifs