From fe1e1342ba8a6833f7a594aa2c9f319ccdaea6d2 Mon Sep 17 00:00:00 2001 From: Farwa Naqi Date: Mon, 1 Feb 2016 13:53:56 -0800 Subject: [PATCH] Change lat/long parameters for locations to Double (breaking). Fixes #9. --- CHANGELOG.md | 19 +++++++++++++++ README.md | 8 +++---- UberRides.podspec | 2 +- examples/Obj-C SDK/Obj-C SDK/ViewController.m | 4 ++-- .../Swift SDK/Swift SDK/ViewController.swift | 4 ++-- source/UberRides/RequestButton.swift | 8 +++---- source/UberRides/RequestDeeplink.swift | 23 ++++++++++++++----- .../UberRidesTests/RequestDeeplinkTests.swift | 8 +++---- 8 files changed, 53 insertions(+), 23 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..673fc7d6 --- /dev/null +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index b78d8121..6d59d20c 100755 --- a/README.md +++ b/README.md @@ -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. diff --git a/UberRides.podspec b/UberRides.podspec index 2f32b025..44c37272 100644 --- a/UberRides.podspec +++ b/UberRides.podspec @@ -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. diff --git a/examples/Obj-C SDK/Obj-C SDK/ViewController.m b/examples/Obj-C SDK/Obj-C SDK/ViewController.m index 72b9161d..b54fdead 100644 --- a/examples/Obj-C SDK/Obj-C SDK/ViewController.m +++ b/examples/Obj-C SDK/Obj-C SDK/ViewController.m @@ -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 diff --git a/examples/Swift SDK/Swift SDK/ViewController.swift b/examples/Swift SDK/Swift SDK/ViewController.swift index ac4b93c0..9332846a 100644 --- a/examples/Swift SDK/Swift SDK/ViewController.swift +++ b/examples/Swift SDK/Swift SDK/ViewController.swift @@ -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 diff --git a/source/UberRides/RequestButton.swift b/source/UberRides/RequestButton.swift index bfb00004..d13c8d32 100644 --- a/source/UberRides/RequestButton.swift +++ b/source/UberRides/RequestButton.swift @@ -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) } } @@ -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) } } diff --git a/source/UberRides/RequestDeeplink.swift b/source/UberRides/RequestDeeplink.swift index baba53fb..17528586 100644 --- a/source/UberRides/RequestDeeplink.swift +++ b/source/UberRides/RequestDeeplink.swift @@ -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!) @@ -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!) diff --git a/source/UberRidesTests/RequestDeeplinkTests.swift b/source/UberRidesTests/RequestDeeplinkTests.swift index 8a5f9179..67f0ab14 100644 --- a/source/UberRidesTests/RequestDeeplinkTests.swift +++ b/source/UberRidesTests/RequestDeeplinkTests.swift @@ -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"