bentocorp / ios

The customer iOS app
2 stars 0 forks source link

Add ability to track order status #508

Open josephlausf opened 8 years ago

josephlausf commented 8 years ago

@xkokushox @marcdoan @vcardillo @demant

Flow

vcardillo commented 8 years ago

My biggest concern and question:

What happens when the driver's phone stops tracking them for whatever reason? What happens when the driver falls off Atlas? What does the customer see?

I think we'll want a way to roll this out to production, incrementally. So we can put it into the app store, but only certain people can see the feature at first. Maybe just some of us, to ensure that it's working. On Feb 16, 2016 2:17 PM, "Joseph Lau" notifications@github.com wrote:

@xkokushox https://github.com/xkokushox @marcdoan https://github.com/marcdoan @vcardillo https://github.com/vcardillo @demant https://github.com/demant Flow

-

Due to background service constraints with the customer app, we'll be using SMS as opposed to triggering local notifications through node when notifying users of order statuses

SMS will contain a deep link into the app

The navigation flow into Order Status within the app will follow that of the current flow into Orders screen

Order Status screen will only be accessible through orders that are under In progress, meaning the order has been assigned to a driver

Orders under In progress will be green and tappable

Tapping an order under In progress will navigate into Order Status screen

Order Status screen will include:

  • a back button

    • a visual guide to the 4-step process of Prep -> Delivery -> Assembly -> Pickup
    • a map to display the driver and destination markers
    • a Build Another Bento button at the bottom that takes user back to the build screen

    The visual guide will show a transitional green highlight of each step that has been completed:

  • Prep - means that the driver is not yet en-route, but has been assigned the order. In this case, we'll only show a message explaining that the order is being prepared ( something like this https://www.dropbox.com/s/wgl9djw9p6m9s3i/Bento-Delivery-Arrived.png?dl=0 )

    Once the driver hits Complete, order status will be removed for that particular order in the customer app. If that screen is still in view, automatically pop back to Orders screen

Tech specs

-

@vcardillo https://github.com/vcardillo is it possible to include driverId with orders under In progress?

when user taps on order -> connect and authenticate with node to get token -> using token and driverId, call track -> if successful -> listen to loc stat push

render map with updated coordinates from loc channel

listen for order completion from push channel

if user goes to background or kills app, close socket connection

if user returns to foreground directly to Order Status, repeat above

— Reply to this email directly or view it on GitHub https://github.com/bentocorp/ios/issues/508.

josephlausf commented 8 years ago

@vcardillo hi, along with driverId in /orderhistory, can you also add lat and long of customer address?

EDIT: Oh, can you also add text for the states PREP and PICKUP to /ioscopy?

vcardillo commented 8 years ago

I can, but what do you need it for? Another problem is, @marcdoan, if an address is edited in Atlas, do you update the lat/long in the DB?

josephlausf commented 8 years ago

Thanks, we need the delivery address per order in case customer sets different addresses for different orders

vcardillo commented 8 years ago

It's on dev and prod.

“prep_status_title” = “Your Bento is being prepped” “prep_status_description” = “We’ll be en-route shortly!”

“pickup_status_title” = “Your Bento is here!" “pickup_status_description” = “Please meet your driver at the curbside to pick up your order.”

josephlausf commented 8 years ago

Hi, can you add value of text for key type for all of the above ioscopies

{
    key = "prep_status_title";
    type = "<null>";
    value = "Your Bento is being prepped";
}
vcardillo commented 8 years ago

ok done

On Wed, Mar 2, 2016 at 4:07 PM, Joseph Lau notifications@github.com wrote:

Hi, can you add value of text for key type for all of the above ioscopies

{ key = "prep_status_title"; type = ""; value = "Your Bento is being prepped"; }

— Reply to this email directly or view it on GitHub https://github.com/bentocorp/ios/issues/508#issuecomment-191502532.

josephlausf commented 8 years ago

@xkokushox

In regards to disconnecting from Node when tracking driver, I think we should go with making a call to Google Maps API. We already have an account for it with an API key plus directions enabled. Here's how it would look like: http://recordit.co/KfhSNHxB5u

I make a call to Google Maps API, passing in, for example, the last location received from Node before being disconnected, which returns a bunch of data from that last location to the final destination. I parse the response, getting a route, which contains all the steps.

Each step includes a start_location, end_location, duration and polyline. I can't animate the driver icon from step to step because it would cause the driver icon to fly over buildings to get from one point to another. What I need are all the points in between the start_location and end_location of each individual step.

To do that, I decode the polyline to get an array of all the coordinates, then loop through the array using a timer that increments based on duration divided by the amount of coordinates returned from polyline (speedFromPointToPoint).

If reestablished connection to Node, then stop the above and update each coordinate based on the data received from Node.

vcardillo commented 8 years ago

Are you able to get ETA too? Ideally we could show ETA as well.

vcardillo commented 8 years ago

Check out the Waze SDK, too. Google bought Waze, so it's probably all the same, but check it out anyways. I am hoping we can do ETA on the front end, too.

josephlausf commented 8 years ago

@vcardillo Hi, can we get orderId in /orderhistory as well? We need to be able to identify an order before checking its status, thanks

josephlausf commented 8 years ago

Also, in the case where customer connects to node, but the driver isn't emitting location, we need the last saved location of the driver returned to us in the /api/track?client_id=d-10 call to even be able to simulate the route using Google Maps API.

This is what we get now:

{
"code": 0,
"msg": "",
"ret": {
    "clientId":"d-1",
    "connected":false,
    }
}

We need something like this:

{
"code": 0,
"msg": "",
"ret": {
    "clientId":"d-1",
    "connected":false,
    "last_lat":11,123123,
    "last_lng":123,123
    }
}

``
josephlausf commented 8 years ago

Ok, actually calling api/gloc?token=c-1-0-randombits&clientId=d-8 returns the saved location

josephlausf commented 8 years ago

Tracking Demo: http://recordit.co/owp1KwGnPA Deep linking: http://recordit.co/e44Hdy16Vo

vcardillo commented 8 years ago

How is the deep linking being used with our customers?

On Sat, Mar 12, 2016 at 6:30 PM, Joseph Lau notifications@github.com wrote:

Tracking Demo: http://recordit.co/owp1KwGnPA Deep linking: http://recordit.co/e44Hdy16Vo

— Reply to this email directly or view it on GitHub https://github.com/bentocorp/ios/issues/508#issuecomment-195854425.

josephlausf commented 8 years ago

Hi, the link is set up here: https://dashboard.branch.io/?origin=website-nav-&#/marketing under the marketing title, Deep Link to Orders Screen.

Short URL: https://bnc.lt/orders-screen

This link needs to be attached to the order status text messages, so when the customer gets a text message, they can tap on the link to open up to the Orders screen.