Skip to content

Comments

Add overview button#106

Merged
bsudekum merged 21 commits intomasterfrom
overview-button
May 4, 2017
Merged

Add overview button#106
bsudekum merged 21 commits intomasterfrom
overview-button

Conversation

@bsudekum
Copy link
Contributor

@bsudekum bsudekum commented Mar 29, 2017

Adds an overview button which fits the user location to the end of the route on all location updates

todo:

  • style the button
  • allow for recenter button to show while panning in overview mode
  • i think the camera animations could be improved a bit

foo

@bsudekum bsudekum requested review from 1ec5 and frederoni March 29, 2017 21:54
Copy link
Contributor

Choose a reason for hiding this comment

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

If you ever have to check for nil, that’s a sign you should make the variable optional (?) instead of implicitly unwrapped optional (!). Then you can simply call resetTrackingModeTimer?.invalidate() below.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that this method is useful, but you don’t appear to be using it anywhere. Looks like you went with passing in a raw array of coordinates in order to more easily get a subarray of them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Move this extension to a separate file to make it more discoverable.

@bsudekum
Copy link
Contributor Author

bsudekum commented Apr 4, 2017

Updated with feedback and design
simulator screen shot apr 4 2017 10 56 15 am

Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

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

This looks reasonable from a technical perspective. I’m a little concerned that the hit target is too small and too close to the Cancel button, and that residential roads may bleed into the button’s white background.

/cc @mayagao

if isInOverviewMode {
recenterButton.isHidden = true
overviewButton.setTitle("Overview", for: .normal)
isInOverviewMode = !isInOverviewMode
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be clearer to either move this line out of the if statement (and remove the similar one from the else case) or explicitly say false here and true below.

@bsudekum
Copy link
Contributor Author

Made some more headway. Still todo:

  • adopt standard tint for overview button
  • adopt standard tint for resume button text
    untitled

<state key="normal" image="location"/>
<inset key="contentEdgeInsets" minX="0.0" minY="0.0" maxX="10" maxY="0.0"/>
<inset key="titleEdgeInsets" minX="15" minY="0.0" maxX="0.0" maxY="0.0"/>
<state key="normal" title="Resume" image="location">
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we localize this?

@frederoni
Copy link
Contributor

adopt standard tint for overview button

If the image asset is set to render as template image and the button type is MBButton it should just work.

adopt standard tint for resume button text

Is slightly more tricky since not all buttons should have tinted image and text.

I would:
Create a highlighted button class in the style.

@objc(MBHighlightedButton)
public class HighlightedButton: Button { }

and apply a textColor for all labels that are contained inside a HighlightedButton

UILabel.appearance(for: traitCollection, whenContainedInInstancesOf: [HighlightedButton.self]).textColor = color

@bsudekum
Copy link
Contributor Author

@frederoni having a hard time getting the style of the button customizable. Could you take a look at this?

@frederoni
Copy link
Contributor

frederoni commented Apr 28, 2017

Added MBHighlightedButton that only supports tint and text color so far. Let's extend customizability as the design solidifies.

Bobby Sudekum added 2 commits April 28, 2017 09:53
@bsudekum
Copy link
Contributor Author

@frederoni @1ec5 this is ready for another round of review

@bsudekum
Copy link
Contributor Author

Crappy errors on bitrise:

*** Cloning osrm-text-instructions.swift
*** Cloning aws-sdk-ios
*** Cloning Pulley
*** Cloning MapboxDirections.swift
*** Skipped downloading aws-sdk-ios.framework binary due to the error:
	"API rate limit exceeded for 208.52.166.154. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)"
*** Checking out aws-sdk-ios at "1a8432b03c22326fb7ed86fac978212106e2d465"
*** Downloading binary-only framework Mapbox-iOS-SDK at "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json"
*** Downloading Mapbox-iOS-SDK.framework binary at "3.5.2"
*** Skipped downloading Polyline.framework binary due to the error:
	"API rate limit exceeded for 208.52.166.154. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)"
*** Checking out Polyline at "v4.1.1"
*** Skipped downloading MapboxDirections.swift.framework binary due to the error:
	"API rate limit exceeded for 208.52.166.154. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)"
*** Checking out MapboxDirections.swift at "v0.9.0"
*** Skipped downloading osrm-text-instructions.swift.framework binary due to the error:
	"API rate limit exceeded for 208.52.166.154. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)"
*** Checking out osrm-text-instructions.swift at "v0.1.1"
*** Skipped downloading Pulley.framework binary due to the error:
	"API rate limit exceeded for 208.52.166.154. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)"
*** Checking out Pulley at "1.3.1"
*** Skipped downloading SDWebImage.framework binary due to the error:
	"API rate limit exceeded for 208.52.166.154. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)"
*** Checking out SDWebImage at "4.0.0"
A shell task (/usr/bin/env git checkout --quiet 3d97bb75144147e47db278ec76e5e70c6b2243db) failed with exit code 128:
fatal: reference is not a tree: 3d97bb75144147e47db278ec76e5e70c6b2243db

@frederoni
Copy link
Contributor

frederoni commented Apr 28, 2017

Did caching stop working? Update carthage and see if you get any changes in Cartfile.resolved, if so, commit it.

-edited-
Oh, I get the same locally using the latest version of Carthage and our Bitrise workflow always upgrades to the latest version.

@frederoni
Copy link
Contributor

frederoni commented Apr 28, 2017

Crappy errors on bitrise:

Seems to be a mirror of libwebp (SDWebImage dependency) that disappeared from GH. (https://github.com/webmproject/libwebp)

@bsudekum
Copy link
Contributor Author

@@ -1,5 +1,5 @@
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "3.5.2"
github "52inc/Pulley" "1.4"
github "52inc/Pulley" "1.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

What happened here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oy, bad merge. Will fix

@bsudekum
Copy link
Contributor Author

bsudekum commented May 2, 2017

Note, when in overview mode, I'm hiding the current way name label as not to clutter the screen.

@bsudekum
Copy link
Contributor Author

bsudekum commented May 3, 2017

@1ec5 @frederoni bump, review here would be 💯

@bsudekum bsudekum changed the title Add overview button [wip] Add overview button May 3, 2017
@frederoni
Copy link
Contributor

@bsudekum Can you rebase this PR before review?

@bsudekum
Copy link
Contributor Author

bsudekum commented May 3, 2017

@frederoni the rebase is looking pretty rough. the branch is up to date with master however.

<fontDescription key="fontDescription" type="system" pointSize="16"/>
<inset key="contentEdgeInsets" minX="0.0" minY="0.0" maxX="10" maxY="0.0"/>
<inset key="titleEdgeInsets" minX="15" minY="0.0" maxX="0.0" maxY="0.0"/>
<state key="normal" title="Resume" image="location">
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be localized. In the File inspector, click the Make Localizable button. When we merge this PR, we'll need to add Navigation.strings to Transifex and set up autoupdating.

guard polyline.overlayBounds.ne - polyline.overlayBounds.sw > 200 else {
return
}
mapView.setVisibleCoordinateBounds(polyline.overlayBounds, edgePadding: overviewContentInset, animated: true)
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, the map SDK has a "targeted course tracking" feature that accomplishes a similar effect. You keep the userTrackingMode as followWithCourse but also set targetCoordinate. The map automatically adjusts the visible coordinate bounds to keep both the current location and target coordinate in view at the same time. What's nice is that the user puck continues to show (and point in the right direction).

Nevertheless, I think this code is fine for now, because targeted course tracking mode doesn't reset to north (which is arguably better) and may not show the entire route line (if part of the route bows way off to the side or behind the user.

@bsudekum bsudekum merged commit 0f8cf74 into master May 4, 2017
@bsudekum bsudekum deleted the overview-button branch May 4, 2017 16:05
wishtrip-dev pushed a commit to wishtrip-dev/mapbox-navigation-ios that referenced this pull request Feb 28, 2018
Bridge profile identifier to Objective-C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants