Extending Groser iOS and Rails apps to support grocery delivery in multiple cities - Part 4
6 minute read
In this part I will modify sign up flow and include one more step, by asking user to detect or manually select his delivery city.
Sign up will start with social signup options using Facebook, VKontakte and email. Proceed to explain Location Services permission request.
In order to enhance user’s first app experience, I want to convince him to allow access to Location Services. After that I will reverse geocode his coordinates to get delivery city name. If he declines Location Services access, I will ask user to select his delivery city from list of active delivery cities.
I decided to use city names to differentiate between delivery zones instead of postal codes, cause in Russia we rarely use them, and few recall them right away.
Each city will be devided into delivery zones, either to vary delivery fee or exclusively split city between delivery partners.
Initially I wanted to ask user his street address (last screen in mockup) to check if his address inside active delivery zone. But decided to keep sign up flow short and check delivery availablility upon entering delivery address, after they decided to place an order.
On one side short signup flow should help with signup rate, but I anticipate frustration from some clients, who happen to be in the active city, but outside of supported delivery zones after they’ve spent time assembling carts.
Mockup of Sign Up Flow
Location Services pre-permission
Now, let’s create LocationPermissionController to teach user why location services access is required. View controller will be shown right after User proceeds to with Facebook, VKontakte or Email option. Text says “Groser uses your location information to show stores near you from where delivery is possible”.
User can either allow or skip, in which case he’ll be prompted with system dialog, or will be transfered to CitiesViewController to select his city manually.
LocationPermissionController.swift
LocationPermissionController.xib
Reverse geocode user location to get city name
I’ll use my existing class GRCityLocator to request location and do reverse geocoding using Google API.
LocationPermissionController.swift
Below is GRCityLocator code along with GRLocation. It uses excellend INTULocationManager from Intuit to request current location with timeout.
GRCityLocator.m
Quick Google API geocoder wrapper.
GRGoogleGeocoder.m
I parse Google geocoder response and extract only important bit like street address and city in GRLocation class.
GRLocation.m
Sign up flow with Location Services enabled
Signup with Facebook and Location Services to detect city
Sign up flow with manual city selection
Signup with Facebook and manual City Selection
That’s it. All this work just to switch between cities :-). I’ll be pushing new code to production this week and we’ll begin deliveries in Saint Petersburg early January 2016.
Thank you for purchasing my iOS control. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page co...
Right now you can shop and order delivery only in Moscow from single chain of supermarkets. My goal in this post, is to allow customers to switch cities, and...
This is Part 2 of multi part series about how I re-architect Rails and iOS apps to support grocery delivery in multiple cities to enable our new business mod...