Skip to content

Commit

Permalink
Change lat/long parameters for locations to Double (breaking). Fixes #9.
Browse files Browse the repository at this point in the history
  • Loading branch information
faarwa committed Feb 1, 2016
1 parent e5e0961 commit fe1e134
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 23 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Change Log

## [0.3.0] 2016-02-01
### Breaking
- Change function signature of `setPickupLocationWithLatitude:longitude:nickname:address:` and `setDropoffLocationWithLatitude:longitude:nickname:address:` in `RequestButton` and `RequestDeeplink` to accept `Double` for latitude and longitude parameters instead of `String`.

## [0.2.1] 2016-01-26
### Fixed
- [Issue #8](https://github.com/uber/rides-ios-sdk/issues/8) where manual integration of SDK didn't allow use of resources.

## [0.2.0] 2016-01-15
### Added
- Localization of request button text for zh-Hans and zh-Hant.

### Fixed
- [Issue #6](https://github.com/uber/rides-ios-sdk/issues/6) where custom pick-up location is ignored and reset to current location.

## [0.1.1] 2015-12-02
- Initial version.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ We suggest passing additional parameters to make the Uber experience even more s
```swift
// Swift
button.setProductID("abc123-productID")
button.setPickupLocation(latitude: "37.770", longitude: "-122.466", nickname: "California Academy of Sciences")
button.setDropoffLocation(latitude: "37.791", longitude: "-122.405", nickname: "Pier 39")
button.setPickupLocation(latitude: 37.770, longitude: -122.466, nickname: "California Academy of Sciences")
button.setDropoffLocation(latitude: 37.791, longitude: -122.405, nickname: "Pier 39")
```

```objective-c
// Objective-C
[button setProductID:@"abc123-productID"];
[button setPickupLocationWithLatitude:@"37.770" longitude:@"-122.466" nickname:@"California Academy of Sciences" address:nil];
[button setDropoffLocationWithLatitude:@"37.791" longitude:@"-122.405" nickname:@"Pier 39" address:nil];
[button setPickupLocationWithLatitude:37.770 longitude:-122.466 nickname:@"California Academy of Sciences" address:nil];
[button setDropoffLocationWithLatitude:37.791 longitude:-122.405 nickname:@"Pier 39" address:nil];
```
With all the necessary parameters set, pressing the button will seamlessly prompt a ride request confirmation screen.
Expand Down
2 changes: 1 addition & 1 deletion UberRides.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "UberRides"
s.version = "0.2.1"
s.version = "0.3.0"
s.summary = "The Official Uber Rides iOS SDK."
s.description = <<-DESC
This Swift library allows you to integrate Uber into your iOS app. It is designed to make it quick and easy to add a 'Request a Ride' button in your application, seamlessly connecting your users with Uber.
Expand Down
4 changes: 2 additions & 2 deletions examples/Obj-C SDK/Obj-C SDK/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ - (void)viewDidLoad {
// add white request button and add custom configurations
RequestButton *whiteRequestButton = [[RequestButton alloc] initWithColorStyle:RequestButtonColorStyleWhite];
[whiteRequestButton setProductID:@"a1111c8c-c720-46c3-8534-2fcdd730040d"];
[whiteRequestButton setPickupLocationWithLatitude:@"37.770" longitude:@"-122.466" nickname:@"California Academy of Sciences" address:nil];
[whiteRequestButton setDropoffLocationWithLatitude:@"37.791" longitude:@"-122.405" nickname:@"Pier 39" address:nil];
[whiteRequestButton setPickupLocationWithLatitude:37.770 longitude:-122.466 nickname:@"California Academy of Sciences" address:nil];
[whiteRequestButton setDropoffLocationWithLatitude:37.791 longitude:-122.405 nickname:@"Pier 39" address:nil];
[bottomView addSubview:whiteRequestButton];

// position UIViews and request buttons
Expand Down
4 changes: 2 additions & 2 deletions examples/Swift SDK/Swift SDK/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class ViewController: UIViewController {
// add white request button and add custom configurations
let whiteRequestButton = RequestButton(colorStyle: .White)
whiteRequestButton.setProductID("a1111c8c-c720-46c3-8534-2fcdd730040d")
whiteRequestButton.setPickupLocation(latitude: "37.770", longitude: "-122.466", nickname: "California Academy of Sciences")
whiteRequestButton.setDropoffLocation(latitude: "37.791", longitude: "-122.405", nickname: "Pier 39")
whiteRequestButton.setPickupLocation(latitude: 37.770, longitude: -122.466, nickname: "California Academy of Sciences")
whiteRequestButton.setDropoffLocation(latitude: 37.791, longitude: -122.405, nickname: "Pier 39")
bottomView.addSubview(whiteRequestButton)

// position UIViews and request buttons
Expand Down
8 changes: 4 additions & 4 deletions source/UberRides/RequestButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public class RequestButton: UIButton {
- parameter nickname: Optional pickup location name
- parameter address: Optional pickup location address
*/
public func setPickupLocation(latitude lat: String, longitude: String, nickname: String? = nil, address: String? = nil) {
public func setPickupLocation(latitude latitude: Double, longitude: Double, nickname: String? = nil, address: String? = nil) {
if RidesClient.sharedInstance.hasClientID() {
deeplink!.setPickupLocation(latitude: lat, longitude: longitude, nickname: nickname, address: address)
deeplink!.setPickupLocation(latitude: latitude, longitude: longitude, nickname: nickname, address: address)
}
}

Expand All @@ -115,9 +115,9 @@ public class RequestButton: UIButton {
- parameter nickname: Optional dropoff location name
- parameter address: Optional dropoff location address
*/
public func setDropoffLocation(latitude lat: String, longitude: String, nickname: String? = nil, address: String? = nil) {
public func setDropoffLocation(latitude latitude: Double, longitude: Double, nickname: String? = nil, address: String? = nil) {
if RidesClient.sharedInstance.hasClientID() {
deeplink!.setDropoffLocation(latitude: lat, longitude: longitude, nickname: nickname, address: address)
deeplink!.setDropoffLocation(latitude: latitude, longitude: longitude, nickname: nickname, address: address)
}
}

Expand Down
23 changes: 17 additions & 6 deletions source/UberRides/RequestDeeplink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,17 @@ public class RequestDeeplink: NSObject {

/**
Set deeplink pickup location information.

- parameter latitude: The latitude coordinate for pickup.
- parameter longitude: The longitude coordinate for pickup.
- parameter nickname: A URL-encoded string of the pickup location name. (Optional)
- parameter address: A URL-encoded string of the pickup address. (Optional)
*/
public func setPickupLocation(latitude lat: String, longitude: String, nickname: String? = nil, address: String? = nil) {
public func setPickupLocation(latitude latitude: Double, longitude: Double, nickname: String? = nil, address: String? = nil) {
parameters.deleteParameters([.PickupNickname, .PickupAddress])
parameters.setParameter(.Action, parameterValue: "setPickup")
parameters.setParameter(.PickupLatitude, parameterValue: lat)
parameters.setParameter(.PickupLongitude, parameterValue: longitude)
parameters.setParameter(.PickupLatitude, parameterValue: "\(latitude)")
parameters.setParameter(.PickupLongitude, parameterValue: "\(longitude)")

if nickname != nil {
parameters.setParameter(.PickupNickname, parameterValue: nickname!)
Expand All @@ -107,10 +112,16 @@ public class RequestDeeplink: NSObject {

/**
Set deeplink dropoff location information.

- parameter latitude: The latitude coordinate for dropoff.
- parameter longitude: The longitude coordinate for dropoff.
- parameter nickname: A URL-encoded string of the dropoff location name. (Optional)
- parameter address: A URL-encoded string of the dropoff address. (Optional)
*/
public func setDropoffLocation(latitude lat: String, longitude: String, nickname: String? = nil, address: String? = nil) {
parameters.setParameter(.DropoffLatitude, parameterValue: lat)
parameters.setParameter(.DropoffLongitude, parameterValue: longitude)
public func setDropoffLocation(latitude latitude: Double, longitude: Double, nickname: String? = nil, address: String? = nil) {
parameters.deleteParameters([.DropoffNickname, .DropoffAddress])
parameters.setParameter(.DropoffLatitude, parameterValue: "\(latitude)")
parameters.setParameter(.DropoffLongitude, parameterValue: "\(longitude)")

if nickname != nil {
parameters.setParameter(.DropoffNickname, parameterValue: nickname!)
Expand Down
8 changes: 4 additions & 4 deletions source/UberRidesTests/RequestDeeplinkTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import XCTest

let clientID = "clientID1234"
let productID = "productID1234"
let pickupLat = "37.770"
let pickupLong = "-122.466"
let dropoffLat = "37.791"
let dropoffLong = "-122.405"
let pickupLat = 37.770
let pickupLong = -122.466
let dropoffLat = 37.791
let dropoffLong = -122.405
let pickupNickname = "California Academy of Science"
let pickupAddress = "55 Music Concourse Drive, San Francisco"
let dropoffNickname = "Pier 39"
Expand Down

0 comments on commit fe1e134

Please sign in to comment.