From b8c70a41b8d2787e55a79ac52e9407e448c29f74 Mon Sep 17 00:00:00 2001 From: John Brophy Date: Fri, 20 May 2016 00:56:50 -0700 Subject: [PATCH 01/29] updated contributor section in README --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f2c3ca75..5e9bc696 100755 --- a/README.md +++ b/README.md @@ -531,7 +531,11 @@ For full documentation about our API, visit our [Developer Site](https://develop ## Contributing -We :heart: contributions. If you’ve found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo. Write a test to show your bug was fixed or the feature works as expected. +We :heart: contributions. Found a bug or looking for a new feature? Open an issue and we'll respond as fast as we can. Or, better yet, implement it yourself and open a pull request! We ask that you include tests to show the bug was fixed or the feature works as expected. + +**Note:** All contributors also need to fill out the [Uber Contributor License Agreement](http://t.uber.com/cla) before we can merge in any of your changes. + +Please open any pull requests against the latest development branch (currently `0.5.x-dev`) ## License From 042a35d836153cecefe91d34bf17b76034b4c982 Mon Sep 17 00:00:00 2001 From: John Brophy Date: Fri, 20 May 2016 00:57:28 -0700 Subject: [PATCH 02/29] update podspec to represent development branch --- UberRides.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UberRides.podspec b/UberRides.podspec index 8db05fb6..f0503ff0 100644 --- a/UberRides.podspec +++ b/UberRides.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "UberRides" - s.version = "0.4.2" + s.version = "0.5.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. From 0f0de6596b5c93deb12d0a64ab3f6f29cae77971 Mon Sep 17 00:00:00 2001 From: lesyk Date: Sat, 14 May 2016 13:18:12 +0200 Subject: [PATCH 03/29] Update README.md Clarifying documentation --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5e9bc696..c364c7dd 100755 --- a/README.md +++ b/README.md @@ -88,6 +88,8 @@ Add the following code snippet, replacing the placeholders with your app’s inf [redirect URL] ``` +Make sure UberCallbackURI mathes one, which is set on developer dashboard (use localhost for testing). + Additionally, the SDK provides a static Configuration class to further customize your settings. Inside of `application:didFinishLaunchingWithOptions:` in your `AppDelegate` is a good place to do this: ```swift From ff0db1a1602c84968d09e9956fa28564dff4c804 Mon Sep 17 00:00:00 2001 From: lesyk Date: Sat, 14 May 2016 13:19:52 +0200 Subject: [PATCH 04/29] Update README.md Fix: typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c364c7dd..2c0f27d4 100755 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ Add the following code snippet, replacing the placeholders with your app’s inf [redirect URL] ``` -Make sure UberCallbackURI mathes one, which is set on developer dashboard (use localhost for testing). +Make sure UberCallbackURI matches one, which is set on developer dashboard (use localhost for testing). Additionally, the SDK provides a static Configuration class to further customize your settings. Inside of `application:didFinishLaunchingWithOptions:` in your `AppDelegate` is a good place to do this: From accfed7ea8eb6748c9812154da1f1497161f3d62 Mon Sep 17 00:00:00 2001 From: lesyk Date: Wed, 18 May 2016 08:30:50 +0200 Subject: [PATCH 05/29] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c0f27d4..3089fa87 100755 --- a/README.md +++ b/README.md @@ -87,8 +87,7 @@ Add the following code snippet, replacing the placeholders with your app’s inf UberCallbackURI [redirect URL] ``` - -Make sure UberCallbackURI matches one, which is set on developer dashboard (use localhost for testing). +Make sure the value for UberCallbackURI exactly matches one for the Redirect URLs you have set on your developer dashboard. (You can use `localhost` for testing.) Additionally, the SDK provides a static Configuration class to further customize your settings. Inside of `application:didFinishLaunchingWithOptions:` in your `AppDelegate` is a good place to do this: From 5ea21dae162c2e9fb5aa9454ad1296ce5f177e5c Mon Sep 17 00:00:00 2001 From: lesyk Date: Thu, 19 May 2016 08:10:05 +0200 Subject: [PATCH 06/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3089fa87..e9487191 100755 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Add the following code snippet, replacing the placeholders with your app’s inf UberCallbackURI [redirect URL] ``` -Make sure the value for UberCallbackURI exactly matches one for the Redirect URLs you have set on your developer dashboard. (You can use `localhost` for testing.) +Make sure the value for UberCallbackURI exactly matches one of the Redirect URLs you have set on your developer dashboard. (You can use `localhost` for testing.) Additionally, the SDK provides a static Configuration class to further customize your settings. Inside of `application:didFinishLaunchingWithOptions:` in your `AppDelegate` is a good place to do this: From ac6c54d6fa0e0144f6ff3c3151cb4b7cffe03bd2 Mon Sep 17 00:00:00 2001 From: Viktor Lesyk Date: Wed, 18 May 2016 12:21:52 +0200 Subject: [PATCH 07/29] Fix: comments' style consistency --- source/UberRides/ModalViewController.swift | 2 +- source/UberRides/RideRequestButton.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/UberRides/ModalViewController.swift b/source/UberRides/ModalViewController.swift index 2673982f..97469a93 100644 --- a/source/UberRides/ModalViewController.swift +++ b/source/UberRides/ModalViewController.swift @@ -141,7 +141,7 @@ Possible Styles for the ModalViewController //MARK: Public /** - Function to dimiss the modalViewController. + Function to dimiss the modalViewController. */ public func dismiss() { self.delegate?.modalViewControllerWillDismiss(self) diff --git a/source/UberRides/RideRequestButton.swift b/source/UberRides/RideRequestButton.swift index 1bcd236e..6552c9e7 100644 --- a/source/UberRides/RideRequestButton.swift +++ b/source/UberRides/RideRequestButton.swift @@ -161,7 +161,7 @@ import CoreLocation return CGSizeMake(width, height) } - // initiate deeplink when button is tapped + // Initiate deeplink when button is tapped func uberButtonTapped(sender: UIButton) { rideParameters.source = RideRequestButton.sourceString From 3698d4297783cc284e86f16b768e995c97b569ef Mon Sep 17 00:00:00 2001 From: Viktor Lesyk Date: Wed, 18 May 2016 12:23:33 +0200 Subject: [PATCH 08/29] Move: comments to code --- source/UberRides/RideRequestButton.swift | 18 ++++++++----- source/UberRides/RidesUtil.swift | 3 +-- source/UberRides/UberButton.swift | 32 +++++++++++++----------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/source/UberRides/RideRequestButton.swift b/source/UberRides/RideRequestButton.swift index 6552c9e7..9225e20f 100644 --- a/source/UberRides/RideRequestButton.swift +++ b/source/UberRides/RideRequestButton.swift @@ -105,25 +105,31 @@ import CoreLocation sizeToFit() } - // add title, image, and sizing configuration override func setContent() { super.setContent() + setSizesConfigs() + addTitle() + addImage() + } + + private func setSizesConfigs() { uberTitleLabel.font = UIFont.systemFontOfSize(17) uberTitleLabel.numberOfLines = 2; uberTitleLabel.textAlignment = .Right - - // Add title label + } + + private func addTitle() { let titleText = LocalizationUtil.localizedString(forKey: "Ride there with Uber", comment: "Request button description") uberTitleLabel.text = titleText - - // add image + } + + private func addImage() { let logo = getImage("Badge") uberImageView.image = logo uberImageView.contentMode = .Center } - // get image from media directory private func getImage(name: String) -> UIImage { let bundle = NSBundle(forClass: RideRequestButton.self) let image = UIImage(named: name, inBundle: bundle, compatibleWithTraitCollection: nil) diff --git a/source/UberRides/RidesUtil.swift b/source/UberRides/RidesUtil.swift index 778d5d35..7d6c4fa8 100644 --- a/source/UberRides/RidesUtil.swift +++ b/source/UberRides/RidesUtil.swift @@ -34,8 +34,7 @@ import CoreLocation } class ColorUtil { - /// Convert hex color code into UIColor - static func uberUIColor(color: UberButtonColor) -> UIColor { + static func convertHexToUIColor(color: UberButtonColor) -> UIColor { let hexCode = hexCodeFromColor(color) let scanner = NSScanner(string: hexCode) var color: UInt32 = 0; diff --git a/source/UberRides/UberButton.swift b/source/UberRides/UberButton.swift index 3d11a4a8..e7d581ec 100644 --- a/source/UberRides/UberButton.swift +++ b/source/UberRides/UberButton.swift @@ -45,34 +45,38 @@ import UIKit } override public var highlighted: Bool { - // Change colors when button is highlighted didSet { - var color: UberButtonColor - switch colorStyle { - case .Black: - color = highlighted ? .BlackHighlighted : .UberBlack - case .White: - color = highlighted ? .WhiteHighlighted : .UberWhite - } - backgroundColor = ColorUtil.uberUIColor(color) + changeColors() } } - /// Set color scheme, default is black background with white font. + private func changeColors() { + var color: UberButtonColor + switch colorStyle { + case .Black: + color = highlighted ? .BlackHighlighted : .UberBlack + case .White: + color = highlighted ? .WhiteHighlighted : .UberWhite + } + backgroundColor = ColorUtil.convertHexToUIColor(color) + } + + /// Set color scheme public var colorStyle: RequestButtonColorStyle = .Black { didSet { setColorStyle(colorStyle) } } + /// Default is black background with white font private func setColorStyle(style: RequestButtonColorStyle) { switch colorStyle { case .Black: - backgroundColor = ColorUtil.uberUIColor(.UberBlack) - uberTitleLabel.textColor = ColorUtil.uberUIColor(.UberWhite) + backgroundColor = ColorUtil.convertHexToUIColor(.UberBlack) + uberTitleLabel.textColor = ColorUtil.convertHexToUIColor(.UberWhite) case .White : - backgroundColor = ColorUtil.uberUIColor(.UberWhite) - uberTitleLabel.textColor = ColorUtil.uberUIColor(.UberBlack) + backgroundColor = ColorUtil.convertHexToUIColor(.UberWhite) + uberTitleLabel.textColor = ColorUtil.convertHexToUIColor(.UberBlack) } } From 7ace34a882070ab3363881b45767225134ac8c53 Mon Sep 17 00:00:00 2001 From: Viktor Lesyk Date: Thu, 19 May 2016 08:23:51 +0200 Subject: [PATCH 09/29] Fixes: based on disquisition - 1 --- source/UberRides/RideRequestButton.swift | 10 ++++----- source/UberRides/RidesUtil.swift | 2 +- source/UberRides/UberButton.swift | 28 ++++++++++++------------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/source/UberRides/RideRequestButton.swift b/source/UberRides/RideRequestButton.swift index 9225e20f..0c34c4da 100644 --- a/source/UberRides/RideRequestButton.swift +++ b/source/UberRides/RideRequestButton.swift @@ -108,9 +108,8 @@ import CoreLocation override func setContent() { super.setContent() - setSizesConfigs() - addTitle() - addImage() + configureTitleLabel() + configureImage() } private func setSizesConfigs() { @@ -119,12 +118,13 @@ import CoreLocation uberTitleLabel.textAlignment = .Right } - private func addTitle() { + private func configureTitleLabel() { + setSizesConfigs() let titleText = LocalizationUtil.localizedString(forKey: "Ride there with Uber", comment: "Request button description") uberTitleLabel.text = titleText } - private func addImage() { + private func configureImage() { let logo = getImage("Badge") uberImageView.image = logo uberImageView.contentMode = .Center diff --git a/source/UberRides/RidesUtil.swift b/source/UberRides/RidesUtil.swift index 7d6c4fa8..a2678a53 100644 --- a/source/UberRides/RidesUtil.swift +++ b/source/UberRides/RidesUtil.swift @@ -34,7 +34,7 @@ import CoreLocation } class ColorUtil { - static func convertHexToUIColor(color: UberButtonColor) -> UIColor { + static func colorForUberButtonColor(color: UberButtonColor) -> UIColor { let hexCode = hexCodeFromColor(color) let scanner = NSScanner(string: hexCode) var color: UInt32 = 0; diff --git a/source/UberRides/UberButton.swift b/source/UberRides/UberButton.swift index e7d581ec..4852cb0f 100644 --- a/source/UberRides/UberButton.swift +++ b/source/UberRides/UberButton.swift @@ -46,11 +46,18 @@ import UIKit override public var highlighted: Bool { didSet { - changeColors() + updateColors(highlighted) } } - private func changeColors() { + /// Set color scheme + public var colorStyle: RequestButtonColorStyle = .Black { + didSet { + setColorStyle(colorStyle) + } + } + + private func updateColors(highlighted : Bool) { var color: UberButtonColor switch colorStyle { case .Black: @@ -58,25 +65,18 @@ import UIKit case .White: color = highlighted ? .WhiteHighlighted : .UberWhite } - backgroundColor = ColorUtil.convertHexToUIColor(color) - } - - /// Set color scheme - public var colorStyle: RequestButtonColorStyle = .Black { - didSet { - setColorStyle(colorStyle) - } + backgroundColor = ColorUtil.colorForUberButtonColor(color) } /// Default is black background with white font private func setColorStyle(style: RequestButtonColorStyle) { switch colorStyle { case .Black: - backgroundColor = ColorUtil.convertHexToUIColor(.UberBlack) - uberTitleLabel.textColor = ColorUtil.convertHexToUIColor(.UberWhite) + backgroundColor = ColorUtil.colorForUberButtonColor(.UberBlack) + uberTitleLabel.textColor = ColorUtil.colorForUberButtonColor(.UberWhite) case .White : - backgroundColor = ColorUtil.convertHexToUIColor(.UberWhite) - uberTitleLabel.textColor = ColorUtil.convertHexToUIColor(.UberBlack) + backgroundColor = ColorUtil.colorForUberButtonColor(.UberWhite) + uberTitleLabel.textColor = ColorUtil.colorForUberButtonColor(.UberBlack) } } From f6112b71264fdaf60194b054463cae73397bab99 Mon Sep 17 00:00:00 2001 From: Viktor Lesyk Date: Wed, 25 May 2016 09:32:02 +0200 Subject: [PATCH 10/29] Remove: unnecessary method --- source/UberRides/RideRequestButton.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/UberRides/RideRequestButton.swift b/source/UberRides/RideRequestButton.swift index 0c34c4da..ca52a3d0 100644 --- a/source/UberRides/RideRequestButton.swift +++ b/source/UberRides/RideRequestButton.swift @@ -112,14 +112,11 @@ import CoreLocation configureImage() } - private func setSizesConfigs() { + private func configureTitleLabel() { uberTitleLabel.font = UIFont.systemFontOfSize(17) uberTitleLabel.numberOfLines = 2; uberTitleLabel.textAlignment = .Right - } - - private func configureTitleLabel() { - setSizesConfigs() + let titleText = LocalizationUtil.localizedString(forKey: "Ride there with Uber", comment: "Request button description") uberTitleLabel.text = titleText } From 10bf12ca4f6c88dfeba50c5980f3cc7d99bb381f Mon Sep 17 00:00:00 2001 From: Viktor Lesyk Date: Wed, 25 May 2016 09:33:51 +0200 Subject: [PATCH 11/29] Update: selectors syntax --- source/UberRides/ModalViewController.swift | 4 ++-- source/UberRides/OAuth/OAuthViewController.swift | 2 +- source/UberRides/RideRequestButton.swift | 2 +- source/UberRides/RideRequestView.swift | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/UberRides/ModalViewController.swift b/source/UberRides/ModalViewController.swift index 2673982f..d2499dac 100644 --- a/source/UberRides/ModalViewController.swift +++ b/source/UberRides/ModalViewController.swift @@ -188,12 +188,12 @@ Possible Styles for the ModalViewController case .Empty: break case .DoneButton: - let doneButton = UIBarButtonItem(barButtonSystemItem: .Done , target: self, action: Selector("doneButtonPressed:")) + let doneButton = UIBarButtonItem(barButtonSystemItem: .Done , target: self, action: #selector(ModalViewController.doneButtonPressed(_:))) doneButton.tintColor = iconTintColor self.wrappedViewController.navigationItem.rightBarButtonItem = doneButton case .BackButton: let backImage = UIImage(named: "ic_back_arrow_white", inBundle: bundle, compatibleWithTraitCollection: nil) - let backButton = UIBarButtonItem(image: backImage, style: .Plain, target: self, action: Selector("backButtonPressed:")) + let backButton = UIBarButtonItem(image: backImage, style: .Plain, target: self, action: #selector(ModalViewController.backButtonPressed(_:))) backButton.tintColor = iconTintColor self.wrappedViewController.navigationItem.leftBarButtonItem = backButton } diff --git a/source/UberRides/OAuth/OAuthViewController.swift b/source/UberRides/OAuth/OAuthViewController.swift index 4c1c2ec8..c5ef346e 100644 --- a/source/UberRides/OAuth/OAuthViewController.swift +++ b/source/UberRides/OAuth/OAuthViewController.swift @@ -76,7 +76,7 @@ class OAuthViewController: UIViewController { self.view.addSubview(loginView) self.setupLoginView() // Set up navigation item - let cancelButton = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: Selector("cancel")) + let cancelButton = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: #selector(OAuthViewController.cancel)) navigationItem.leftBarButtonItem = cancelButton navigationItem.title = LocalizationUtil.localizedString(forKey: "Sign in with Uber", comment: "Title of navigation bar during OAuth") } diff --git a/source/UberRides/RideRequestButton.swift b/source/UberRides/RideRequestButton.swift index 1bcd236e..bf132936 100644 --- a/source/UberRides/RideRequestButton.swift +++ b/source/UberRides/RideRequestButton.swift @@ -99,7 +99,7 @@ import CoreLocation } private func setUp() { - addTarget(self, action: Selector("uberButtonTapped:"), forControlEvents: .TouchUpInside) + addTarget(self, action: #selector(RideRequestButton.uberButtonTapped(_:)), forControlEvents: .TouchUpInside) setContent() setConstraints() sizeToFit() diff --git a/source/UberRides/RideRequestView.swift b/source/UberRides/RideRequestView.swift index cf949019..d631d5af 100644 --- a/source/UberRides/RideRequestView.swift +++ b/source/UberRides/RideRequestView.swift @@ -181,8 +181,8 @@ import CoreLocation webView.navigationDelegate = self webView.scrollView.delegate = self - NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillAppear:"), name: UIKeyboardWillShowNotification, object: nil) - NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardDidAppear:"), name: UIKeyboardDidShowNotification, object: nil) + NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(RideRequestView.keyboardWillAppear(_:)), name: UIKeyboardWillShowNotification, object: nil) + NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(RideRequestView.keyboardDidAppear(_:)), name: UIKeyboardDidShowNotification, object: nil) setupWebView() } From 2f0d8773b84f5c9906f92123c5df9392c9a08cbc Mon Sep 17 00:00:00 2001 From: Viktor Lesyk Date: Fri, 27 May 2016 14:51:46 +0200 Subject: [PATCH 12/29] Fix: using invisible 'self' for selector calls --- source/UberRides/ModalViewController.swift | 4 ++-- source/UberRides/OAuth/OAuthViewController.swift | 2 +- source/UberRides/RideRequestButton.swift | 2 +- source/UberRides/RideRequestView.swift | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/UberRides/ModalViewController.swift b/source/UberRides/ModalViewController.swift index d2499dac..8bfaebbe 100644 --- a/source/UberRides/ModalViewController.swift +++ b/source/UberRides/ModalViewController.swift @@ -188,12 +188,12 @@ Possible Styles for the ModalViewController case .Empty: break case .DoneButton: - let doneButton = UIBarButtonItem(barButtonSystemItem: .Done , target: self, action: #selector(ModalViewController.doneButtonPressed(_:))) + let doneButton = UIBarButtonItem(barButtonSystemItem: .Done , target: self, action: #selector(doneButtonPressed(_:))) doneButton.tintColor = iconTintColor self.wrappedViewController.navigationItem.rightBarButtonItem = doneButton case .BackButton: let backImage = UIImage(named: "ic_back_arrow_white", inBundle: bundle, compatibleWithTraitCollection: nil) - let backButton = UIBarButtonItem(image: backImage, style: .Plain, target: self, action: #selector(ModalViewController.backButtonPressed(_:))) + let backButton = UIBarButtonItem(image: backImage, style: .Plain, target: self, action: #selector(backButtonPressed(_:))) backButton.tintColor = iconTintColor self.wrappedViewController.navigationItem.leftBarButtonItem = backButton } diff --git a/source/UberRides/OAuth/OAuthViewController.swift b/source/UberRides/OAuth/OAuthViewController.swift index c5ef346e..8999fc71 100644 --- a/source/UberRides/OAuth/OAuthViewController.swift +++ b/source/UberRides/OAuth/OAuthViewController.swift @@ -76,7 +76,7 @@ class OAuthViewController: UIViewController { self.view.addSubview(loginView) self.setupLoginView() // Set up navigation item - let cancelButton = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: #selector(OAuthViewController.cancel)) + let cancelButton = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: #selector(cancel)) navigationItem.leftBarButtonItem = cancelButton navigationItem.title = LocalizationUtil.localizedString(forKey: "Sign in with Uber", comment: "Title of navigation bar during OAuth") } diff --git a/source/UberRides/RideRequestButton.swift b/source/UberRides/RideRequestButton.swift index bf132936..e3356441 100644 --- a/source/UberRides/RideRequestButton.swift +++ b/source/UberRides/RideRequestButton.swift @@ -99,7 +99,7 @@ import CoreLocation } private func setUp() { - addTarget(self, action: #selector(RideRequestButton.uberButtonTapped(_:)), forControlEvents: .TouchUpInside) + addTarget(self, action: #selector(uberButtonTapped(_:)), forControlEvents: .TouchUpInside) setContent() setConstraints() sizeToFit() diff --git a/source/UberRides/RideRequestView.swift b/source/UberRides/RideRequestView.swift index d631d5af..e97f7c39 100644 --- a/source/UberRides/RideRequestView.swift +++ b/source/UberRides/RideRequestView.swift @@ -181,8 +181,8 @@ import CoreLocation webView.navigationDelegate = self webView.scrollView.delegate = self - NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(RideRequestView.keyboardWillAppear(_:)), name: UIKeyboardWillShowNotification, object: nil) - NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(RideRequestView.keyboardDidAppear(_:)), name: UIKeyboardDidShowNotification, object: nil) + NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(keyboardWillAppear(_:)), name: UIKeyboardWillShowNotification, object: nil) + NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(keyboardDidAppear(_:)), name: UIKeyboardDidShowNotification, object: nil) setupWebView() } From 32f48474c1d2357f7090ddd8a9670888dae73c04 Mon Sep 17 00:00:00 2001 From: Dasmer Singh Date: Sat, 25 Jun 2016 18:11:34 -0400 Subject: [PATCH 13/29] Add ObjectMapper as a linked library instead of copy framework --- source/UberRides.xcodeproj/project.pbxproj | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/source/UberRides.xcodeproj/project.pbxproj b/source/UberRides.xcodeproj/project.pbxproj index 42d1d44e..225d6526 100644 --- a/source/UberRides.xcodeproj/project.pbxproj +++ b/source/UberRides.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 3A66B4721D1F38D600B4F181 /* ObjectMapper.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCA459AF1D000813003CBA3D /* ObjectMapper.framework */; }; AC0404791BFACD1D00AC1501 /* UberRides.h in Headers */ = {isa = PBXBuildFile; fileRef = AC0404781BFACD1D00AC1501 /* UberRides.h */; settings = {ATTRIBUTES = (Public, ); }; }; AC0404801BFACD1D00AC1501 /* UberRides.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AC0404751BFACD1D00AC1501 /* UberRides.framework */; }; AC0404851BFACD1D00AC1501 /* UberRidesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC0404841BFACD1D00AC1501 /* UberRidesTests.swift */; }; @@ -296,6 +297,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 3A66B4721D1F38D600B4F181 /* ObjectMapper.framework in Frameworks */, AC0404801BFACD1D00AC1501 /* UberRides.framework in Frameworks */, DCA459D41D003EFC003CBA3D /* OHHTTPStubs.framework in Frameworks */, ); @@ -546,7 +548,6 @@ AC0404711BFACD1D00AC1501 /* Frameworks */, AC0404721BFACD1D00AC1501 /* Headers */, AC0404731BFACD1D00AC1501 /* Resources */, - DCA459B11D000825003CBA3D /* Copy Carthage Frameworks */, ); buildRules = ( ); @@ -656,21 +657,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - DCA459B11D000825003CBA3D /* Copy Carthage Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(SRCROOT)/../Carthage/Build/iOS/ObjectMapper.framework", - ); - name = "Copy Carthage Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/usr/local/bin/carthage copy-frameworks"; - }; DCA459D51D003F0F003CBA3D /* Copy Carthage Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; From e42656639f92c55c72af1c1f4e687def79cdcc84 Mon Sep 17 00:00:00 2001 From: John Brophy Date: Tue, 28 Jun 2016 17:10:33 -0700 Subject: [PATCH 14/29] 0.5.1 release --- CHANGELOG.md | 5 +++++ UberRides.podspec | 2 +- source/UberRides/Configuration.swift | 4 ++-- source/UberRides/Info.plist | 2 +- source/UberRidesTests/AuthenticationURLUtilityTests.swift | 8 ++++---- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48515f59..63d8988d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## [0.5.1] 2016-06-14 +### Fixed + +- [Issue #47](https://github.com/uber/rides-ios-sdk/issues/47) SSO fails for correctly configured China apps. SDK now sends the correct Region string for SSO + ## [0.5.0] 2016-06-2 ### Added diff --git a/UberRides.podspec b/UberRides.podspec index 5f6e5644..ed3eb4cf 100644 --- a/UberRides.podspec +++ b/UberRides.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "UberRides" - s.version = "0.5.0" + s.version = "0.5.1" 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/source/UberRides/Configuration.swift b/source/UberRides/Configuration.swift index fc3b794c..3053b6ff 100644 --- a/source/UberRides/Configuration.swift +++ b/source/UberRides/Configuration.swift @@ -120,9 +120,9 @@ import WebKit public static var regionString: String { switch region { case .China: - return "China" + return "china" case .Default: - return "Default" + return "default" } } diff --git a/source/UberRides/Info.plist b/source/UberRides/Info.plist index 288c341b..504fc36a 100644 --- a/source/UberRides/Info.plist +++ b/source/UberRides/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.5.0 + 0.5.1 CFBundleSignature ???? CFBundleVersion diff --git a/source/UberRidesTests/AuthenticationURLUtilityTests.swift b/source/UberRidesTests/AuthenticationURLUtilityTests.swift index 4f66c219..fb818e32 100644 --- a/source/UberRidesTests/AuthenticationURLUtilityTests.swift +++ b/source/UberRidesTests/AuthenticationURLUtilityTests.swift @@ -49,7 +49,7 @@ class AuthenticationURLUtilityTests: XCTestCase { let expectedClientID = "testClientID" let expectedAppName = "My Awesome App" let expectedCallbackURI = "testURI://uberConnectNative" - let expectedLoginType = "Default" + let expectedLoginType = "default" let expectedSDK = "ios" let expectedSDKVersion = versionNumber @@ -78,7 +78,7 @@ class AuthenticationURLUtilityTests: XCTestCase { let expectedClientID = "testClientID" let expectedAppName = "My Awesome App" let expectedCallbackURI = "testURI://uberConnectNative" - let expectedLoginType = "Default" + let expectedLoginType = "default" let expectedSDK = "ios" let expectedSDKVersion = versionNumber @@ -109,7 +109,7 @@ class AuthenticationURLUtilityTests: XCTestCase { let expectedClientID = "testClientID" let expectedAppName = "My Awesome App" let expectedCallbackURI = "testURI://uberConnectNative" - let expectedLoginType = "China" + let expectedLoginType = "china" let expectedSDK = "ios" let expectedSDKVersion = versionNumber @@ -140,7 +140,7 @@ class AuthenticationURLUtilityTests: XCTestCase { let expectedClientID = "testClientID" let expectedAppName = "My Awesome App" let expectedCallbackURI = "testURI://uberConnectNative" - let expectedLoginType = "China" + let expectedLoginType = "china" let expectedSDK = "ios" let expectedSDKVersion = versionNumber From da05e388b8ecfebd4c97f1b9da8a597c377ee941 Mon Sep 17 00:00:00 2001 From: John Brophy Date: Mon, 1 Aug 2016 18:14:53 -0700 Subject: [PATCH 15/29] Fix refresh endpoint --- source/UberRides/EndpointsManager.swift | 22 ++++++++++++---- .../UberRidesTests/RefreshEndpointTests.swift | 26 ++++++++++++++++++- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/source/UberRides/EndpointsManager.swift b/source/UberRides/EndpointsManager.swift index 16dc2f96..eda310d1 100644 --- a/source/UberRides/EndpointsManager.swift +++ b/source/UberRides/EndpointsManager.swift @@ -198,6 +198,21 @@ enum OAuth: UberAPI { var host: String { return OAuth.regionHostString() } + + var body: NSData? { + switch self { + case .Refresh(let clientID, let refreshToken): + let query = queryBuilder( + ("client_id", clientID), + ("refresh_token", refreshToken) + ) + let components = NSURLComponents() + components.queryItems = query + return components.query?.dataUsingEncoding(NSUTF8StringEncoding) + default: + return nil + } + } static func regionHostString(region: Region = Configuration.getRegion()) -> String { switch region { @@ -233,11 +248,8 @@ enum OAuth: UberAPI { ("state", state ?? "")) loginQuery.appendContentsOf(additionalQueryItems) return loginQuery - case .Refresh(let clientID, let refreshToken): - return queryBuilder( - ("client_id", clientID), - ("refresh_token", refreshToken) - ) + case .Refresh: + return queryBuilder() } } diff --git a/source/UberRidesTests/RefreshEndpointTests.swift b/source/UberRidesTests/RefreshEndpointTests.swift index 1b39dcf0..1aa3643d 100644 --- a/source/UberRidesTests/RefreshEndpointTests.swift +++ b/source/UberRidesTests/RefreshEndpointTests.swift @@ -55,15 +55,39 @@ class RefreshEndpointTests: XCTestCase { return OHHTTPStubsResponse(fileAtPath:OHPathForFile("refresh.json", self.dynamicType)!, statusCode:200, headers:self.headers) } let refreshToken = "ThisIsRefresh" + let clientID = Configuration.getClientID() let expectation = expectationWithDescription("200 success response") let endpoint = OAuth.Refresh(clientID: clientID, refreshToken: refreshToken) let request = Request(session: client.session, endpoint: endpoint) + request.execute({ response in XCTAssertEqual(response.statusCode, 200) XCTAssertNil(response.error) - + expectation.fulfill() }) + + XCTAssertEqual(request.urlRequest.HTTPMethod, "POST") + + guard let bodyData = request.urlRequest.HTTPBody, dataString = String(data: bodyData, encoding: NSUTF8StringEncoding) else { + XCTFail("Missing HTTP Body!") + return + } + let components = NSURLComponents() + components.query = dataString + + let expectedClientID = NSURLQueryItem(name: "client_id", value: clientID) + let expectedRefreshToken = NSURLQueryItem(name: "refresh_token", value: refreshToken) + + guard let queryItems = components.queryItems else { + XCTFail("Invalid HTTP Body!") + return + } + + XCTAssertTrue(queryItems.contains(expectedClientID)) + XCTAssertTrue(queryItems.contains(expectedRefreshToken)) + + waitForExpectationsWithTimeout(timeout, handler: { error in if let error = error { From f8c167e4f8a3c943499e88a0cd20afdbf1acd2d8 Mon Sep 17 00:00:00 2001 From: John Brophy Date: Tue, 2 Aug 2016 13:00:43 -0700 Subject: [PATCH 16/29] added automatic token refreshing to ride request widget --- source/UberRides/Model/RidesError.swift | 8 ++++++ .../UberRides/RideRequestViewController.swift | 25 ++++++++++++++++--- ...RidesAuthenticationErrorFactoryTests.swift | 1 + 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/source/UberRides/Model/RidesError.swift b/source/UberRides/Model/RidesError.swift index dd32c7d7..3371e487 100644 --- a/source/UberRides/Model/RidesError.swift +++ b/source/UberRides/Model/RidesError.swift @@ -121,6 +121,7 @@ extension RidesError: UberModel { - InvalidJWTSignature: There was a problem authorizing you. - InvalidNonce: There was a problem authorizing you. - InvalidRedirect: Redirect URI provided was invalid + - InvalidRefreshToken: The provided Refresh Token was invalid - InvalidRequest: General case for invalid requests. - InvalidResponse: The response from the server was un-parseable - InvalidScope: Scopes provided contains an invalid scope. @@ -148,6 +149,7 @@ extension RidesError: UberModel { case InvalidJWTSignature case InvalidNonce case InvalidRedirect + case InvalidRefreshToken case InvalidRequest case InvalidResponse case InvalidScope @@ -188,6 +190,8 @@ extension RidesError: UberModel { return "invalid_nonce" case .InvalidRedirect: return "invalid_redirect_uri" + case .InvalidRefreshToken: + return "invalid_refresh_token" case .InvalidRequest: return "invalid_parameters" case .InvalidResponse: @@ -243,6 +247,8 @@ extension RidesError: UberModel { return "There was a problem authorizing you." case .InvalidRedirect: return "Invalid Redirect URI provided." + case .InvalidRefreshToken: + return "Invalid Refresh TOken provided." case .InvalidRequest: return "The server was unable to understand your request." case .InvalidResponse: @@ -329,6 +335,8 @@ class RidesAuthenticationErrorFactory : NSObject { return .InvalidRequest case "invalid_redirect_uri": return .InvalidRedirect + case "invalid_refresh_token": + return .InvalidRefreshToken case "invalid_response": return .InvalidResponse case "invalid_scope": diff --git a/source/UberRides/RideRequestViewController.swift b/source/UberRides/RideRequestViewController.swift index ca74a56a..039e74a4 100644 --- a/source/UberRides/RideRequestViewController.swift +++ b/source/UberRides/RideRequestViewController.swift @@ -302,14 +302,31 @@ extension RideRequestViewController : RideRequestViewDelegate { if accessTokenWasUnauthorizedOnPreviousAttempt { fallthrough } - accessTokenWasUnauthorizedOnPreviousAttempt = true - self.rideRequestView.hidden = true - self.loginView.hidden = false - self.loginView.load() + attemptTokenRefresh(accessTokenIdentifier, accessGroup: keychainAccessGroup) break default: self.delegate?.rideRequestViewController(self, didReceiveError: error) break } } + + private func attemptTokenRefresh(tokenIdentifier: String?, accessGroup: String?) { + let identifer = tokenIdentifier ?? Configuration.getDefaultAccessTokenIdentifier() + let group = accessGroup ?? Configuration.getDefaultKeychainAccessGroup() + guard let accessToken = TokenManager.fetchToken(identifer, accessGroup: group), refreshToken = accessToken.refreshToken else { + accessTokenWasUnauthorizedOnPreviousAttempt = true + TokenManager.deleteToken(identifer, accessGroup: group) + self.load() + return + } + TokenManager.deleteToken(accessTokenIdentifier, accessGroup: keychainAccessGroup) + + let ridesClient = RidesClient(accessTokenIdentifier: identifer, keychainAccessGroup: group) + ridesClient.refreshAccessToken(refreshToken) { (accessToken, response) in + if let token = accessToken { + TokenManager.saveToken(token, tokenIdentifier: self.accessTokenIdentifier, accessGroup: self.keychainAccessGroup) + } + self.load() + } + } } diff --git a/source/UberRidesTests/RidesAuthenticationErrorFactoryTests.swift b/source/UberRidesTests/RidesAuthenticationErrorFactoryTests.swift index 7ba9c8fd..030c3b9f 100644 --- a/source/UberRidesTests/RidesAuthenticationErrorFactoryTests.swift +++ b/source/UberRidesTests/RidesAuthenticationErrorFactoryTests.swift @@ -40,6 +40,7 @@ class RidesAuthenticationErrorFactoryTests: XCTestCase { RidesAuthenticationErrorType.InvalidJWTSignature : "invalid_jwt_signature", RidesAuthenticationErrorType.InvalidNonce : "invalid_nonce", RidesAuthenticationErrorType.InvalidRedirect : "invalid_redirect_uri", + RidesAuthenticationErrorType.InvalidRefreshToken: "invalid_refresh_token", RidesAuthenticationErrorType.InvalidRequest : "invalid_parameters", RidesAuthenticationErrorType.InvalidResponse : "invalid_response", RidesAuthenticationErrorType.InvalidScope : "invalid_scope", From 3ff4733e87abdd3d2de10bb66fc341b3cec22659 Mon Sep 17 00:00:00 2001 From: John Brophy Date: Tue, 2 Aug 2016 13:18:50 -0700 Subject: [PATCH 17/29] Updates to prepare for release --- CHANGELOG.md | 11 +++++++++++ UberRides.podspec | 2 +- source/UberRides/Info.plist | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63d8988d..b7c1ad50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## [0.5.2] 2016-08-2 +### Added +The Ride Request Widget now attempts to refresh expired access tokens automatically. If you are using the RideRequestViewController, the SDK will attempt to hit the Refresh endpoint with your current Access Token's Refresh Token. If that fails, the user will be redirected to the appropriate login + + +### Fixed + +- [Issue #64](https://github.com/uber/rides-ios-sdk/issues/64) Refresh Endpoint returning error +- [Issue #57](https://github.com/uber/rides-ios-sdk/issues/57) Client login errors from expired access tokens. +- [Issue #52](https://github.com/uber/rides-ios-sdk/issues/57) Carthage setup incorrectly copying frameworks + ## [0.5.1] 2016-06-14 ### Fixed diff --git a/UberRides.podspec b/UberRides.podspec index ed3eb4cf..7c4a1de3 100644 --- a/UberRides.podspec +++ b/UberRides.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "UberRides" - s.version = "0.5.1" + s.version = "0.5.2" 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/source/UberRides/Info.plist b/source/UberRides/Info.plist index 504fc36a..0d4fc0a8 100644 --- a/source/UberRides/Info.plist +++ b/source/UberRides/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.5.1 + 0.5.2 CFBundleSignature ???? CFBundleVersion From a2be91a5107ac37e9b2b2f7641a5a75a5eb7b5b8 Mon Sep 17 00:00:00 2001 From: John Brophy Date: Tue, 2 Aug 2016 14:21:18 -0700 Subject: [PATCH 18/29] updated cartfiles for newest release --- examples/Obj-C SDK/Cartfile.resolved | 2 +- examples/Swift SDK/Cartfile.resolved | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/Obj-C SDK/Cartfile.resolved b/examples/Obj-C SDK/Cartfile.resolved index 6979ddb0..6606b94b 100644 --- a/examples/Obj-C SDK/Cartfile.resolved +++ b/examples/Obj-C SDK/Cartfile.resolved @@ -1,2 +1,2 @@ github "Hearst-DD/ObjectMapper" "1.3.0" -github "uber/rides-ios-sdk" "v0.5.0" +github "uber/rides-ios-sdk" "v0.5.2" diff --git a/examples/Swift SDK/Cartfile.resolved b/examples/Swift SDK/Cartfile.resolved index 6979ddb0..6606b94b 100644 --- a/examples/Swift SDK/Cartfile.resolved +++ b/examples/Swift SDK/Cartfile.resolved @@ -1,2 +1,2 @@ github "Hearst-DD/ObjectMapper" "1.3.0" -github "uber/rides-ios-sdk" "v0.5.0" +github "uber/rides-ios-sdk" "v0.5.2" From ef9eecfe701a3488954f424fb0f359451bfc3f22 Mon Sep 17 00:00:00 2001 From: David Lashkhi Date: Thu, 28 Jul 2016 20:49:41 +0400 Subject: [PATCH 19/29] Update README.md Added description on how to run example projects without Carthage --- README.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c31ce5b9..e321b4d0 100755 --- a/README.md +++ b/README.md @@ -919,13 +919,42 @@ extension your_class : RideRequestViewControllerDelegate { ## Example Apps -Example apps can be found in the `examples` folder. To run build them, you need to use Carthage. (A quick overview of installing Carthage can be found in the **Getting Started** section.) From inside the `examples/Swift SDK` or `examples/Obj-C SDK` folder, run: +Example apps can be found in the `examples` folder. To run build them, you can use Carthage or Cocoapods. + +### Carthage +(A quick overview of installing Carthage can be found in the **Getting Started** section.) From inside the `examples/Swift SDK` or `examples/Obj-C SDK` folder, run: ``` carthage update --platform iOS ``` This will build the required dependencies. Once you do that, open `Swift SDK.xcodeproj` or `Obj-C SDK.xcodeproj` in Xcode and run it. +### CocoaPods +You will have to remove Carthage dependencies. Remove Cartfile and Cartfile.resolved. + +From `examples/Swift SDK` or `examples/Obj-C SDK` folder, run: +To integrate Uber Rides into your Xcode project, navigate to the directory `examples/Swift SDK` or `examples/Obj-C SDK` and create a new **Podfile** with `pod init`, then add `pod 'UberRides'` to the main loop. If you are using the Swift SDK, make sure to add the line `use_frameworks!`. + +```ruby +use_frameworks! + +target 'Your Project Name' do +pod 'UberRides' +end +``` + +Then, run the following command to install the dependency: + +```bash +$ pod install +``` + +For Objective-C projects, set the **Embedded Content Contains Swift Code** flag in your project to **Yes** (found under **Build Options** in the **Build Settings** tab). + +Open .xcworkspace and navigate to **General** tab, scroll to **Embedded Binaries** select ObjectMapper.framework and click the `-` button, do the same for UberRides.framework. Now go to **Build Settings** tab and scroll to **Search Paths**, click on *Framework Search Paths** and remove the line $(PROJECT_DIR)/Carthage/Build/iOS. +Now got to **Build Phases** find the **Copy Carthage Frameworks** and remove it. +Now you can build the project. + Don’t forget to set `UberClientID`, `UberDisplayName`, and `UberCallbackURIs` in your `Info.plist` file.

From cb678de449a0d171eb886329ce00f781d84590bb Mon Sep 17 00:00:00 2001 From: Charlyn G Date: Mon, 8 Aug 2016 13:58:26 -0700 Subject: [PATCH 20/29] Update README.md Consistently denote placeholder text with square brackets. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c31ce5b9..62f130e9 100755 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ This will allow the Uber iOS integration to properly identify and switch to the ## SDK Configuration In order for the SDK to function correctly, you need to add some information about your app. Locate the **Info.plist** file for your application. Usually found in the **Supporting Files** folder. Right-click this file and select **Open As > Source Code** -Add the following code snippet, replacing the placeholders with your app’s information from the developer dashboard. +Add the following code snippet, replacing the placeholders within the square brackets (`[]`) with your app’s information from the developer dashboard. (Note: Do not include the square brackets) ``` UberClientID @@ -134,7 +134,7 @@ Add the following code snippet, replacing the placeholders with your app’s inf UberCallbackURIType General URIString - callback://your_callback_uri + [callback://your_callback_uri] ``` @@ -150,19 +150,19 @@ You can also define specific callback URIs for different login types. For exampl UberCallbackURIType General URIString - callback://your_callback_uri + [callback://your_callback_uri] UberCallbackURIType AuthorizationCode URIString - callback://authorization_code_uri + [callback://authorization_code_uri] UberCallbackURIType Native URIString - myApp://native_deeplink_callback + [myApp://native_deeplink_callback] ``` From 953b236a74d21d32664ec47ff304f5eb9d04424d Mon Sep 17 00:00:00 2001 From: Charlyn G Date: Tue, 9 Aug 2016 10:49:10 -0700 Subject: [PATCH 21/29] Update README.md Add information on how to locate `plist` and how to import UberRides --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c31ce5b9..8bea8083 100755 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ Now build your project and everything should be good to go! ### Configuring iOS 9.0 -If you are compiling on iOS SDK 9.0, you will need to modify your application’s `plist` to handle Apple’s [new security changes](https://developer.apple.com/videos/wwdc/2015/?id=703) to the `canOpenURL` function. +If you are compiling on iOS SDK 9.0, you will need to modify your application’s `plist` to handle Apple’s [new security changes](https://developer.apple.com/videos/wwdc/2015/?id=703) to the `canOpenURL` function. Locate the **Info.plist** file for your application. Usually found in the **Supporting Files** folder. Right-click this file and select **Open As > Source Code** ``` LSApplicationQueriesSchemes @@ -172,6 +172,9 @@ Additionally, the SDK provides a static Configuration class to further customize ```swift // Don’t forget to import UberRides +import UberRides +// ... + // Swift func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // China based apps should specify the region @@ -186,6 +189,10 @@ func application(application: UIApplication, didFinishLaunchingWithOptions launc ``` ```objective-c +// Don’t forget to import UberRides +#import +// ... + // Objective-C - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // China based apps should specify the region From 93ae8ebc5edb35189f77c50a8f5524a0acd97e1c Mon Sep 17 00:00:00 2001 From: David Lashkhi Date: Wed, 10 Aug 2016 11:41:25 +0400 Subject: [PATCH 22/29] README update Text clean up: removed copy & paste issues, added more attention to removing Carthage --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e321b4d0..c9d23413 100755 --- a/README.md +++ b/README.md @@ -930,9 +930,8 @@ carthage update --platform iOS This will build the required dependencies. Once you do that, open `Swift SDK.xcodeproj` or `Obj-C SDK.xcodeproj` in Xcode and run it. ### CocoaPods -You will have to remove Carthage dependencies. Remove Cartfile and Cartfile.resolved. +First, you will have to remove Carthage dependencies. Navigate to `examples/Swift SDK` or `examples/Obj-C SDK` and remove `Cartfile` and `Cartfile.resolved`. If you see a `Carthage` folder, remove that as well. -From `examples/Swift SDK` or `examples/Obj-C SDK` folder, run: To integrate Uber Rides into your Xcode project, navigate to the directory `examples/Swift SDK` or `examples/Obj-C SDK` and create a new **Podfile** with `pod init`, then add `pod 'UberRides'` to the main loop. If you are using the Swift SDK, make sure to add the line `use_frameworks!`. ```ruby @@ -951,7 +950,7 @@ $ pod install For Objective-C projects, set the **Embedded Content Contains Swift Code** flag in your project to **Yes** (found under **Build Options** in the **Build Settings** tab). -Open .xcworkspace and navigate to **General** tab, scroll to **Embedded Binaries** select ObjectMapper.framework and click the `-` button, do the same for UberRides.framework. Now go to **Build Settings** tab and scroll to **Search Paths**, click on *Framework Search Paths** and remove the line $(PROJECT_DIR)/Carthage/Build/iOS. +Open .xcworkspace and navigate to **General** tab, scroll to **Embedded Binaries** select ObjectMapper.framework and click the `-` button, do the same for UberRides.framework. Now go to **Build Settings** tab and scroll to **Search Paths**, click on **Framework Search Paths** and remove the line $(PROJECT_DIR)/Carthage/Build/iOS. Now got to **Build Phases** find the **Copy Carthage Frameworks** and remove it. Now you can build the project. From 3936812a1253af68614ce1b1c0f3ef90efb69905 Mon Sep 17 00:00:00 2001 From: David Lashkhi Date: Thu, 11 Aug 2016 12:20:20 +0400 Subject: [PATCH 23/29] updated readme Put the section for removing Carthage together, some text changes for better understanding --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c9d23413..f2b0c5f4 100755 --- a/README.md +++ b/README.md @@ -930,9 +930,11 @@ carthage update --platform iOS This will build the required dependencies. Once you do that, open `Swift SDK.xcodeproj` or `Obj-C SDK.xcodeproj` in Xcode and run it. ### CocoaPods -First, you will have to remove Carthage dependencies. Navigate to `examples/Swift SDK` or `examples/Obj-C SDK` and remove `Cartfile` and `Cartfile.resolved`. If you see a `Carthage` folder, remove that as well. +First, you will have to remove Carthage dependencies. Navigate to `examples/Swift SDK` or `examples/Obj-C SDK` and remove `Cartfile` and `Cartfile.resolved`. If you see a `Carthage` folder, remove that as well. Open .xcworkspace and navigate to **General** tab, scroll to **Embedded Binaries** select `ObjectMapper.framework` and click the `-` button, do the same for `UberRides.framework`. Now go to **Build Settings** tab and scroll to **Search Paths**, click on **Framework Search Paths** and remove the line $(PROJECT_DIR)/Carthage/Build/iOS. +Now got to **Build Phases** find the **Copy Carthage Frameworks** and remove it. + +Now, still inside either `examples/Swift SDK` or `examples/Obj-C SDK`, create a new **Podfile** by running `pod init`, then add `pod 'UberRides'` to your main target. If you are using the Swift SDK, make sure to add the line `use_frameworks!`. Your **Podfile** should look something like this: -To integrate Uber Rides into your Xcode project, navigate to the directory `examples/Swift SDK` or `examples/Obj-C SDK` and create a new **Podfile** with `pod init`, then add `pod 'UberRides'` to the main loop. If you are using the Swift SDK, make sure to add the line `use_frameworks!`. ```ruby use_frameworks! @@ -950,8 +952,6 @@ $ pod install For Objective-C projects, set the **Embedded Content Contains Swift Code** flag in your project to **Yes** (found under **Build Options** in the **Build Settings** tab). -Open .xcworkspace and navigate to **General** tab, scroll to **Embedded Binaries** select ObjectMapper.framework and click the `-` button, do the same for UberRides.framework. Now go to **Build Settings** tab and scroll to **Search Paths**, click on **Framework Search Paths** and remove the line $(PROJECT_DIR)/Carthage/Build/iOS. -Now got to **Build Phases** find the **Copy Carthage Frameworks** and remove it. Now you can build the project. Don’t forget to set `UberClientID`, `UberDisplayName`, and `UberCallbackURIs` in your `Info.plist` file. From e8fa928f27c652628ae33a574e12b2c1546179a4 Mon Sep 17 00:00:00 2001 From: David Lashkhi Date: Tue, 23 Aug 2016 14:40:49 +0400 Subject: [PATCH 24/29] Spelling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f2b0c5f4..13d6b684 100755 --- a/README.md +++ b/README.md @@ -931,7 +931,7 @@ This will build the required dependencies. Once you do that, open `Swift SDK.xco ### CocoaPods First, you will have to remove Carthage dependencies. Navigate to `examples/Swift SDK` or `examples/Obj-C SDK` and remove `Cartfile` and `Cartfile.resolved`. If you see a `Carthage` folder, remove that as well. Open .xcworkspace and navigate to **General** tab, scroll to **Embedded Binaries** select `ObjectMapper.framework` and click the `-` button, do the same for `UberRides.framework`. Now go to **Build Settings** tab and scroll to **Search Paths**, click on **Framework Search Paths** and remove the line $(PROJECT_DIR)/Carthage/Build/iOS. -Now got to **Build Phases** find the **Copy Carthage Frameworks** and remove it. +Now go to **Build Phases** find the **Copy Carthage Frameworks** and remove it. Now, still inside either `examples/Swift SDK` or `examples/Obj-C SDK`, create a new **Podfile** by running `pod init`, then add `pod 'UberRides'` to your main target. If you are using the Swift SDK, make sure to add the line `use_frameworks!`. Your **Podfile** should look something like this: From 2a512a72523207a67a50738a9698bec9a5b073d3 Mon Sep 17 00:00:00 2001 From: GauravDS Date: Tue, 30 Aug 2016 11:51:48 +0530 Subject: [PATCH 25/29] fix swift error --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2255efb7..b4f6971a 100755 --- a/README.md +++ b/README.md @@ -305,7 +305,7 @@ You can optionally set a `LoginButtonDelegate` to handle logging in / logging ou ```swift // Swift -let scopes = [.Profile, .Places, .Request] +let scopes: [RidesScope] = [.Profile, .Places, .Request] let loginManager = LoginManager(loginType: .Native) let loginButton = LoginButton(frame: CGRectZero, scopes: scopes, loginManager: loginManager) loginButton.presentingViewController = self From 2b41ad2183a9b32ee4112d406295d0da2eeddb4e Mon Sep 17 00:00:00 2001 From: Dustin Whittle Date: Thu, 8 Sep 2016 16:27:33 -0700 Subject: [PATCH 26/29] Fixed request typos in docs --- source/UberRides/RidesClient.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/UberRides/RidesClient.swift b/source/UberRides/RidesClient.swift index 32bbd4ae..02717e6e 100644 --- a/source/UberRides/RidesClient.swift +++ b/source/UberRides/RidesClient.swift @@ -44,7 +44,7 @@ import CoreLocation private var serverToken: String? = Configuration.getServerToken() /** - Initializer for the RidesClient. The RidesClient handles making reqeusts to the API + Initializer for the RidesClient. The RidesClient handles making requests to the API for you. - parameter accessTokenIdentifier: The accessTokenIdentifier to use. This identifier @@ -64,11 +64,11 @@ import CoreLocation } /** - Initializer for the RidesClient. The RidesClient handles making reqeusts to the API + Initializer for the RidesClient. The RidesClient handles making requests to the API for you. By default, uses NSURLSessionConfiguration.defaultSessionConfiguration() for the URL requests - - parameter accessTokenIdentifier: Initializer for the RidesClient. The RidesClient handles making reqeusts to the API + - parameter accessTokenIdentifier: Initializer for the RidesClient. The RidesClient handles making requests to the API for you. By default, it is initialized using the keychainAccessGroup default from your Configuration object Also uses NSURLSessionConfiguration.defaultSessionConfiguration() for the URL requests @@ -85,7 +85,7 @@ import CoreLocation } /** - Initializer for the RidesClient. The RidesClient handles making reqeusts to the API + Initializer for the RidesClient. The RidesClient handles making requests to the API for you. By default, it is initialized using the keychainAccessGroup default from your Configuration object @@ -102,7 +102,7 @@ import CoreLocation } /** - Initializer for the RidesClient. The RidesClient handles making reqeusts to the API + Initializer for the RidesClient. The RidesClient handles making requests to the API for you. By default, it is initialized using the keychainAccessGroup default from your Configuration object Also uses NSURLSessionConfiguration.defaultSessionConfiguration() for the URL requests @@ -119,7 +119,7 @@ import CoreLocation } /** - Initializer for the RidesClient. The RidesClient handles making reqeusts to the API + Initializer for the RidesClient. The RidesClient handles making requests to the API for you. By default, it is initialized using the accessTokenIdentifier & keychainAccessGroup defaults from your Configuration object From f752b8de9edac2c72e5d2290722c5602e1ca5c5f Mon Sep 17 00:00:00 2001 From: Junda Date: Fri, 23 Sep 2016 11:41:46 +0800 Subject: [PATCH 27/29] Fix RideScope not mapping for all cases --- source/UberRides/Model/RidesScope.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/UberRides/Model/RidesScope.swift b/source/UberRides/Model/RidesScope.swift index 1d9ddf5c..30afaa69 100644 --- a/source/UberRides/Model/RidesScope.swift +++ b/source/UberRides/Model/RidesScope.swift @@ -173,6 +173,12 @@ class RidesScopeFactory : NSObject { return .Profile case RidesScopeType.RideWidgets.toString(): return .RideWidgets + case RidesScopeType.AllTrips.toString(): + return .AllTrips + case RidesScopeType.Request.toString(): + return .Request + case RidesScopeType.RequestReceipt.toString(): + return .RequestReceipt default: return nil } From 89886078b27499180610e9d0f4a7949f6a651160 Mon Sep 17 00:00:00 2001 From: Junda Date: Tue, 27 Sep 2016 09:34:04 +0800 Subject: [PATCH 28/29] Add tests for RidesScope --- source/UberRidesTests/RidesScopeFactoryTests.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/UberRidesTests/RidesScopeFactoryTests.swift b/source/UberRidesTests/RidesScopeFactoryTests.swift index 9c720747..21ac670e 100644 --- a/source/UberRidesTests/RidesScopeFactoryTests.swift +++ b/source/UberRidesTests/RidesScopeFactoryTests.swift @@ -30,6 +30,9 @@ class RidesScopeFactoryTests: XCTestCase { RidesScopeType.HistoryLite : RidesScopeType.HistoryLite.toString(), RidesScopeType.Places : RidesScopeType.Places.toString(), RidesScopeType.RideWidgets : RidesScopeType.RideWidgets.toString(), + RidesScopeType.AllTrips : RidesScopeType.AllTrips.toString(), + RidesScopeType.Request : RidesScopeType.Request.toString(), + RidesScopeType.RequestReceipt : RidesScopeType.RequestReceipt.toString(), ] func testCreateRidesScopeByRidesScopeType() { From 2b99da1c6056d4a746615a4fb02a907fdb6a115c Mon Sep 17 00:00:00 2001 From: John Brophy Date: Wed, 12 Oct 2016 18:52:00 -0700 Subject: [PATCH 29/29] v0.5.3 Release --- CHANGELOG.md | 18 ++ Cartfile.resolved | 4 +- Carthage/Checkouts/OHHTTPStubs | 2 +- Carthage/Checkouts/ObjectMapper | 2 +- README.md | 10 +- UberRides.podspec | 2 +- examples/Obj-C SDK/Cartfile.resolved | 2 - examples/Swift SDK/Cartfile.resolved | 2 - source/UberRides.xcodeproj/project.pbxproj | 139 ++++++++-------- source/UberRides/Info.plist | 2 +- source/UberRides/Model/Ride.swift | 2 +- source/UberRides/Model/RidesError.swift | 12 ++ source/UberRides/OAuth/KeychainWrapper.swift | 4 +- source/UberRides/OAuth/LoginManager.swift | 4 +- source/UberRides/RideRequestButton.swift | 91 +++++----- source/UberRidesTests/LoginButtonTests.swift | 51 +++--- .../UberRidesTests/ObjectMappingTests.swift | 42 ++--- .../UberRidesTests/RequestButtonTests.swift | 157 +++++++++++++++++- source/UberRidesTests/RequestLayerTests.swift | 2 +- source/UberRidesTests/RidesClientTests.swift | 156 +++-------------- .../getHistory.json} | 0 .../{getme.json => TestData/getMe.json} | 0 .../getPaymentMethods.json} | 0 .../getPriceEstimates.json} | 0 .../TestData/getPriceEstimatesEmpty.json | 3 + .../getProductID.json} | 0 .../getProducts.json} | 0 .../getRequest.json} | 0 .../getTimeEstimateProduct.json} | 0 .../getTimeEstimates.json} | 0 .../TestData/getTimeEstimatesEmpty.json | 3 + .../UberRidesTests/{ => TestData}/place.json | 0 .../postRequests.json} | 0 .../{ => TestData}/refresh.json | 0 .../requestEstimate.json} | 0 .../requestEstimateNoCars.json} | 0 .../{ridemap.json => TestData/rideMap.json} | 0 .../rideReceipt.json} | 0 .../rideReceiptNullSurgeTotalOwed.json} | 0 .../{ => TestData}/testInfo.plist | 0 .../testInfoMissingCallbacks.plist | 0 .../testInfoNoServerToken.plist | 0 source/UberRidesTests/TokenManagerTests.swift | 60 +++---- 43 files changed, 417 insertions(+), 353 deletions(-) delete mode 100644 examples/Obj-C SDK/Cartfile.resolved delete mode 100644 examples/Swift SDK/Cartfile.resolved rename source/UberRidesTests/{gethistory.json => TestData/getHistory.json} (100%) rename source/UberRidesTests/{getme.json => TestData/getMe.json} (100%) rename source/UberRidesTests/{getpaymentmethods.json => TestData/getPaymentMethods.json} (100%) rename source/UberRidesTests/{getpriceestimates.json => TestData/getPriceEstimates.json} (100%) create mode 100644 source/UberRidesTests/TestData/getPriceEstimatesEmpty.json rename source/UberRidesTests/{getproductid.json => TestData/getProductID.json} (100%) rename source/UberRidesTests/{getproducts.json => TestData/getProducts.json} (100%) rename source/UberRidesTests/{getrequest.json => TestData/getRequest.json} (100%) rename source/UberRidesTests/{gettimeestimateproduct.json => TestData/getTimeEstimateProduct.json} (100%) rename source/UberRidesTests/{gettimeestimates.json => TestData/getTimeEstimates.json} (100%) create mode 100644 source/UberRidesTests/TestData/getTimeEstimatesEmpty.json rename source/UberRidesTests/{ => TestData}/place.json (100%) rename source/UberRidesTests/{postrequests.json => TestData/postRequests.json} (100%) rename source/UberRidesTests/{ => TestData}/refresh.json (100%) rename source/UberRidesTests/{requestestimate.json => TestData/requestEstimate.json} (100%) rename source/UberRidesTests/{RequestEstimateNoCars.json => TestData/requestEstimateNoCars.json} (100%) rename source/UberRidesTests/{ridemap.json => TestData/rideMap.json} (100%) rename source/UberRidesTests/{ridereceipt.json => TestData/rideReceipt.json} (100%) rename source/UberRidesTests/{RideReceiptNullSurgeTotalOwed.json => TestData/rideReceiptNullSurgeTotalOwed.json} (100%) rename source/UberRidesTests/{ => TestData}/testInfo.plist (100%) rename source/UberRidesTests/{ => TestData}/testInfoMissingCallbacks.plist (100%) rename source/UberRidesTests/{ => TestData}/testInfoNoServerToken.plist (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7c1ad50..88d66526 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Change Log +## [0.5.3] + +This will be the final release using Swift 2.2 + +### Fixed + +- [Issue #51](https://github.com/uber/rides-ios-sdk/issues/51) Added Information about Server Token in README +- [Issue #58](https://github.com/uber/rides-ios-sdk/issues/58) Updated README examples to correctly use pickup & dropoff +- [Issue #76](https://github.com/uber/rides-ios-sdk/issues/76) Update Ride Request Button Delegate to always fire. The RideRequestButtonDelegate will now always fire `didLoadRideInformation` once information has been loaded. Including if it encounters an error. Any errors that are encountered will still fire `didReceiveError`. `didReceiveError` will always be called before `didLoadRideInformation` +- [Issue #86](https://github.com/uber/rides-ios-sdk/issues/86) via [Pull #114](https://github.com/uber/rides-ios-sdk/pull/114) Fix RideScope not mapping for all cases +- [Issue #94](https://github.com/uber/rides-ios-sdk/issues/94) Make ride status available in Objective-C +- [Issue #127](https://github.com/uber/rides-ios-sdk/issues/127) Shared Credentials across iOS app and extension + +- [Pull #105](https://github.com/uber/rides-ios-sdk/pull/105) Fixing typos +- [Pull #72](https://github.com/uber/rides-ios-sdk/pull/72) Updates to make README more clear +- [Pull #73](https://github.com/uber/rides-ios-sdk/pull/73) Updates to README about info.plist +- [Pull #65](https://github.com/uber/rides-ios-sdk/pull/65) Example of how to run samples without Carthage + ## [0.5.2] 2016-08-2 ### Added The Ride Request Widget now attempts to refresh expired access tokens automatically. If you are using the RideRequestViewController, the SDK will attempt to hit the Refresh endpoint with your current Access Token's Refresh Token. If that fails, the user will be redirected to the appropriate login diff --git a/Cartfile.resolved b/Cartfile.resolved index 958f8b3f..46d45173 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ -github "AliSoftware/OHHTTPStubs" "5.1.0" -github "Hearst-DD/ObjectMapper" "1.3.0" +github "AliSoftware/OHHTTPStubs" "5.2.2" +github "Hearst-DD/ObjectMapper" "1.5.0" diff --git a/Carthage/Checkouts/OHHTTPStubs b/Carthage/Checkouts/OHHTTPStubs index 75c04cba..e3cd0173 160000 --- a/Carthage/Checkouts/OHHTTPStubs +++ b/Carthage/Checkouts/OHHTTPStubs @@ -1 +1 @@ -Subproject commit 75c04cbaed43ea180283b1c9e028409b4d371b64 +Subproject commit e3cd0173c459b8cd43f202fe8816f16759167170 diff --git a/Carthage/Checkouts/ObjectMapper b/Carthage/Checkouts/ObjectMapper index cf7c4ba9..6b80f55c 160000 --- a/Carthage/Checkouts/ObjectMapper +++ b/Carthage/Checkouts/ObjectMapper @@ -1 +1 @@ -Subproject commit cf7c4ba9e206531176104e06c24449c48823e136 +Subproject commit 6b80f55cb4081c6f740adabbf99026d1d70b37a5 diff --git a/README.md b/README.md index b4f6971a..4ebd5117 100755 --- a/README.md +++ b/README.md @@ -126,6 +126,8 @@ Add the following code snippet, replacing the placeholders within the square bra ``` UberClientID [ClientID] +UberServerToken +[Server Token] UberDisplayName [App Name] UberCallbackURIs @@ -141,6 +143,8 @@ Add the following code snippet, replacing the placeholders within the square bra Make sure the value for UberCallbackURI exactly matches one of the Redirect URLs you have set on your developer dashboard. (You can use `localhost` for testing.) +**Note:** Your `Server Token` is used to make [Price](https://developer.uber.com/docs/rides/api/v1-estimates-price) & [Time](https://developer.uber.com/docs/rides/api/v1-estimates-time) estimates when your user hasn't authenticated with Uber yet. We suggest adding it in your `Info.plist` only if you need to get estimates before your user logs in. + You can also define specific callback URIs for different login types. For example, if you want to use Native login, but also support a fallback to Authorization Code Grant, you can define a callback to your app AND a callback for your server: ``` @@ -372,7 +376,8 @@ let button = RideRequestButton() let ridesClient = RidesClient() let pickupLocation = CLLocation(latitude: 37.787654, longitude: -122.402760) let dropoffLocation = CLLocation(latitude: 37.775200, longitude: -122.417587) -let builder = RideParametersBuilder().setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation) +let dropoffNickname = "Work" +let builder = RideParametersBuilder().setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation, nickname: dropoffNickname) ridesClient.fetchCheapestProduct(pickupLocation: pickupLocation, completion: { product, response in if let productID = product?.productID { @@ -389,9 +394,10 @@ UBSDKRideRequestButton *button = [[UBSDKRideRequestButton alloc] init]; UBSDKRidesClient *ridesClient = [[UBSDKRidesClient alloc] init]; CLLocation *pickupLocation = [[CLLocation alloc] initWithLatitude: 37.787654 longitude: -122.402760]; CLLocation *dropoffLocation = [[CLLocation alloc] initWithLatitude: 37.775200 longitude: -122.417587]; +NSString *dropoffNickname = @"Work"; __block UBSDKRideParametersBuilder *builder = [[UBSDKRideParametersBuilder alloc] init]; builder = [builder setPickupLocation: pickupLocation]; -builder = [builder setDropoffLocation: dropoffLocation]; +builder = [builder setDropoffLocation: dropoffLocation nickname: dropoffNickname]; [ridesClient fetchCheapestProductWithPickupLocation: pickupLocation completion:^(UBSDKUberProduct* _Nullable product, UBSDKResponse* _Nullable response) { if (product) { builder = [builder setProductID: product.productID]; diff --git a/UberRides.podspec b/UberRides.podspec index 7c4a1de3..0bb2d80a 100644 --- a/UberRides.podspec +++ b/UberRides.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "UberRides" - s.version = "0.5.2" + s.version = "0.5.3" 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/Cartfile.resolved b/examples/Obj-C SDK/Cartfile.resolved deleted file mode 100644 index 6606b94b..00000000 --- a/examples/Obj-C SDK/Cartfile.resolved +++ /dev/null @@ -1,2 +0,0 @@ -github "Hearst-DD/ObjectMapper" "1.3.0" -github "uber/rides-ios-sdk" "v0.5.2" diff --git a/examples/Swift SDK/Cartfile.resolved b/examples/Swift SDK/Cartfile.resolved deleted file mode 100644 index 6606b94b..00000000 --- a/examples/Swift SDK/Cartfile.resolved +++ /dev/null @@ -1,2 +0,0 @@ -github "Hearst-DD/ObjectMapper" "1.3.0" -github "uber/rides-ios-sdk" "v0.5.2" diff --git a/source/UberRides.xcodeproj/project.pbxproj b/source/UberRides.xcodeproj/project.pbxproj index 225d6526..75029520 100644 --- a/source/UberRides.xcodeproj/project.pbxproj +++ b/source/UberRides.xcodeproj/project.pbxproj @@ -16,7 +16,7 @@ AC04049A1BFACE5400AC1501 /* RequestDeeplinkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC0404991BFACE5400AC1501 /* RequestDeeplinkTests.swift */; }; D80D4A521CD01894000EE8A9 /* AuthorizationCodeGrantAuthenticator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80D4A511CD01894000EE8A9 /* AuthorizationCodeGrantAuthenticator.swift */; }; D81A8B161C658A2800339C13 /* TimeEstimate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81A8B151C658A2800339C13 /* TimeEstimate.swift */; }; - D81A8B181C658A4F00339C13 /* gettimeestimates.json in Resources */ = {isa = PBXBuildFile; fileRef = D81A8B171C658A4F00339C13 /* gettimeestimates.json */; }; + D81A8B181C658A4F00339C13 /* getTimeEstimates.json in Resources */ = {isa = PBXBuildFile; fileRef = D81A8B171C658A4F00339C13 /* getTimeEstimates.json */; }; D81A8B1A1C69186B00339C13 /* RequestLayerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81A8B191C69186B00339C13 /* RequestLayerTests.swift */; }; D81A9EC91C6A6C3A000F33F9 /* RidesError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81A9EC81C6A6C3A000F33F9 /* RidesError.swift */; }; D81C85261CC74F0200DC82EE /* LoginViewAuthenticator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C85251CC74F0200DC82EE /* LoginViewAuthenticator.swift */; }; @@ -27,29 +27,29 @@ D81C85321CC819C500DC82EE /* Place.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C85311CC819C500DC82EE /* Place.swift */; }; D81C85341CC830F800DC82EE /* DistanceEstimate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C85331CC830F800DC82EE /* DistanceEstimate.swift */; }; D81C85361CC8315200DC82EE /* RideEstimate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C85351CC8315200DC82EE /* RideEstimate.swift */; }; - D81C85381CC831F900DC82EE /* requestestimate.json in Resources */ = {isa = PBXBuildFile; fileRef = D81C85371CC831F900DC82EE /* requestestimate.json */; }; + D81C85381CC831F900DC82EE /* requestEstimate.json in Resources */ = {isa = PBXBuildFile; fileRef = D81C85371CC831F900DC82EE /* requestEstimate.json */; }; D81C853A1CC836F300DC82EE /* place.json in Resources */ = {isa = PBXBuildFile; fileRef = D81C85391CC836F300DC82EE /* place.json */; }; D81C853C1CC848F800DC82EE /* PaymentMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C853B1CC848F800DC82EE /* PaymentMethod.swift */; }; - D81C853E1CC84DE200DC82EE /* getpaymentmethods.json in Resources */ = {isa = PBXBuildFile; fileRef = D81C853D1CC84DE200DC82EE /* getpaymentmethods.json */; }; + D81C853E1CC84DE200DC82EE /* getPaymentMethods.json in Resources */ = {isa = PBXBuildFile; fileRef = D81C853D1CC84DE200DC82EE /* getPaymentMethods.json */; }; D81C85501CCEE14900DC82EE /* UberAuthenticatingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D81C854F1CCEE14900DC82EE /* UberAuthenticatingProtocol.swift */; }; D82706FD1CCF2D1F00D9297E /* RideReceipt.swift in Sources */ = {isa = PBXBuildFile; fileRef = D82706FC1CCF2D1F00D9297E /* RideReceipt.swift */; }; D82706FF1CCF2D6700D9297E /* RideCharge.swift in Sources */ = {isa = PBXBuildFile; fileRef = D82706FE1CCF2D6700D9297E /* RideCharge.swift */; }; - D82707011CCF327E00D9297E /* ridereceipt.json in Resources */ = {isa = PBXBuildFile; fileRef = D82707001CCF327E00D9297E /* ridereceipt.json */; }; + D82707011CCF327E00D9297E /* rideReceipt.json in Resources */ = {isa = PBXBuildFile; fileRef = D82707001CCF327E00D9297E /* rideReceipt.json */; }; D82707051CCF37BD00D9297E /* RideMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = D82707041CCF37BD00D9297E /* RideMap.swift */; }; - D82707071CCF39B000D9297E /* ridemap.json in Resources */ = {isa = PBXBuildFile; fileRef = D82707061CCF39B000D9297E /* ridemap.json */; }; + D82707071CCF39B000D9297E /* rideMap.json in Resources */ = {isa = PBXBuildFile; fileRef = D82707061CCF39B000D9297E /* rideMap.json */; }; D829FD531C98A09F00AC6578 /* UserActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = D829FD521C98A09F00AC6578 /* UserActivity.swift */; }; - D829FD551C98A0B200AC6578 /* gethistory.json in Resources */ = {isa = PBXBuildFile; fileRef = D829FD541C98A0B200AC6578 /* gethistory.json */; }; + D829FD551C98A0B200AC6578 /* getHistory.json in Resources */ = {isa = PBXBuildFile; fileRef = D829FD541C98A0B200AC6578 /* getHistory.json */; }; D829FD9C1C9A3E5200AC6578 /* RideRequestView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D829FD9B1C9A3E5200AC6578 /* RideRequestView.swift */; }; D829FD9E1C9A3E5800AC6578 /* EndpointsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D829FD9D1C9A3E5800AC6578 /* EndpointsManager.swift */; }; D844751B1C5B01FB00B03456 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = D844751A1C5B01FB00B03456 /* Request.swift */; }; D8505CF91C598FE1007DC576 /* APIManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8505CF81C598FE1007DC576 /* APIManagerTests.swift */; }; - D8582C0D1C5ACB8D00E55231 /* getproducts.json in Resources */ = {isa = PBXBuildFile; fileRef = D8582C0C1C5ACB8D00E55231 /* getproducts.json */; }; + D8582C0D1C5ACB8D00E55231 /* getProducts.json in Resources */ = {isa = PBXBuildFile; fileRef = D8582C0C1C5ACB8D00E55231 /* getProducts.json */; }; D885CD3C1CADEF1E0055976D /* UberButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D885CD3B1CADEF1E0055976D /* UberButton.swift */; }; D8874F291C5ABB9E0098DF99 /* UberProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8874F281C5ABB9E0098DF99 /* UberProduct.swift */; }; D8874F2B1C5AC4DB0098DF99 /* ObjectMappingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8874F2A1C5AC4DB0098DF99 /* ObjectMappingTests.swift */; }; - D8874F2E1C5AC5470098DF99 /* getproductid.json in Resources */ = {isa = PBXBuildFile; fileRef = D8874F2D1C5AC5470098DF99 /* getproductid.json */; }; + D8874F2E1C5AC5470098DF99 /* getProductID.json in Resources */ = {isa = PBXBuildFile; fileRef = D8874F2D1C5AC5470098DF99 /* getProductID.json */; }; D89338F11C77CAE0005B5486 /* OAuthTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89338F01C77CAE0005B5486 /* OAuthTests.swift */; }; - D8A0D7191C72798400707DC6 /* gettimeestimateproduct.json in Resources */ = {isa = PBXBuildFile; fileRef = D8A0D7181C72798400707DC6 /* gettimeestimateproduct.json */; }; + D8A0D7191C72798400707DC6 /* getTimeEstimateProduct.json in Resources */ = {isa = PBXBuildFile; fileRef = D8A0D7181C72798400707DC6 /* getTimeEstimateProduct.json */; }; D8A0D71D1C72E3C400707DC6 /* RidesClientTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A0D71C1C72E3C400707DC6 /* RidesClientTests.swift */; }; D8A0D7231C73A74700707DC6 /* RidesScope.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A0D7221C73A74700707DC6 /* RidesScope.swift */; }; D8A196BC1C56FC250050A264 /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D8A196B81C56FC250050A264 /* Media.xcassets */; }; @@ -65,18 +65,20 @@ D8D18E7F1CBF417600055B76 /* Ride.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D18E7E1CBF417600055B76 /* Ride.swift */; }; D8D18E811CBF419700055B76 /* RideStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D18E801CBF419700055B76 /* RideStatus.swift */; }; D8D18E831CBF41F200055B76 /* Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D18E821CBF41F200055B76 /* Driver.swift */; }; - D8D18E851CBF429C00055B76 /* getrequest.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D18E841CBF429C00055B76 /* getrequest.json */; }; - D8D18E871CBF42AD00055B76 /* postrequests.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D18E861CBF42AD00055B76 /* postrequests.json */; }; + D8D18E851CBF429C00055B76 /* getRequest.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D18E841CBF429C00055B76 /* getRequest.json */; }; + D8D18E871CBF42AD00055B76 /* postRequests.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D18E861CBF42AD00055B76 /* postRequests.json */; }; D8D2DC091C90E54700A65FF0 /* UserProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D2DC081C90E54700A65FF0 /* UserProfile.swift */; }; - D8D2DC0B1C90E55900A65FF0 /* getme.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D2DC0A1C90E55900A65FF0 /* getme.json */; }; + D8D2DC0B1C90E55900A65FF0 /* getMe.json in Resources */ = {isa = PBXBuildFile; fileRef = D8D2DC0A1C90E55900A65FF0 /* getMe.json */; }; D8DAB6371C60240B007DE82C /* ModelMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8DAB6361C60240B007DE82C /* ModelMapper.swift */; }; D8E2C96C1C62B3B2006091BA /* PriceEstimate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8E2C96B1C62B3B2006091BA /* PriceEstimate.swift */; }; - D8E2C96E1C62B3C7006091BA /* getpriceestimates.json in Resources */ = {isa = PBXBuildFile; fileRef = D8E2C96D1C62B3C7006091BA /* getpriceestimates.json */; }; + D8E2C96E1C62B3C7006091BA /* getPriceEstimates.json in Resources */ = {isa = PBXBuildFile; fileRef = D8E2C96D1C62B3C7006091BA /* getPriceEstimates.json */; }; DC1039731C96B1CE004854E3 /* RidesScopeExtensionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC1039721C96B1CE004854E3 /* RidesScopeExtensionsTests.swift */; }; DC1AE1B91CF6BF3900B8CFCB /* LoginButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC1AE1B81CF6BF3900B8CFCB /* LoginButton.swift */; }; DC1AE1BB1CF775F800B8CFCB /* LoginButtonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC1AE1BA1CF775F800B8CFCB /* LoginButtonTests.swift */; }; DC1AE1BD1CF78A3300B8CFCB /* refresh.json in Resources */ = {isa = PBXBuildFile; fileRef = DC1AE1BC1CF78A3300B8CFCB /* refresh.json */; }; DC1AE1BF1CF78ADF00B8CFCB /* RefreshEndpointTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC1AE1BE1CF78ADF00B8CFCB /* RefreshEndpointTests.swift */; }; + DC1D80321DA34CA400712178 /* getTimeEstimatesEmpty.json in Resources */ = {isa = PBXBuildFile; fileRef = DC1D80311DA34CA400712178 /* getTimeEstimatesEmpty.json */; }; + DC1D80341DA34CD600712178 /* getPriceEstimatesEmpty.json in Resources */ = {isa = PBXBuildFile; fileRef = DC1D80331DA34CD600712178 /* getPriceEstimatesEmpty.json */; }; DC2730EF1CBC46520044AB04 /* RidesMocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC2730EE1CBC46520044AB04 /* RidesMocks.swift */; }; DC2C77911CACDDD000A052BA /* ModalRideRequestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC2C77901CACDDD000A052BA /* ModalRideRequestViewController.swift */; }; DC3F740B1CF63D6700A713AA /* DeeplinkErrorType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC3F740A1CF63D6700A713AA /* DeeplinkErrorType.swift */; }; @@ -123,8 +125,8 @@ DCAEA9941CEE91D000E6F239 /* AuthenticationURLUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCAEA9931CEE91D000E6F239 /* AuthenticationURLUtility.swift */; }; DCB0D38E1CAD9D5800194DD5 /* RideRequestViewRequestingBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCB0D38D1CAD9D5800194DD5 /* RideRequestViewRequestingBehavior.swift */; }; DCB0D3901CADAA6300194DD5 /* RideRequestViewRequestingBehaviorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCB0D38F1CADAA6300194DD5 /* RideRequestViewRequestingBehaviorTests.swift */; }; - DCD8060C1CFE50F300EF6EB1 /* RequestEstimateNoCars.json in Resources */ = {isa = PBXBuildFile; fileRef = DCD8060B1CFE50F300EF6EB1 /* RequestEstimateNoCars.json */; }; - DCD8060E1CFE533F00EF6EB1 /* RideReceiptNullSurgeTotalOwed.json in Resources */ = {isa = PBXBuildFile; fileRef = DCD8060D1CFE533F00EF6EB1 /* RideReceiptNullSurgeTotalOwed.json */; }; + DCD8060C1CFE50F300EF6EB1 /* requestEstimateNoCars.json in Resources */ = {isa = PBXBuildFile; fileRef = DCD8060B1CFE50F300EF6EB1 /* requestEstimateNoCars.json */; }; + DCD8060E1CFE533F00EF6EB1 /* rideReceiptNullSurgeTotalOwed.json in Resources */ = {isa = PBXBuildFile; fileRef = DCD8060D1CFE533F00EF6EB1 /* rideReceiptNullSurgeTotalOwed.json */; }; DCE7A0011CF5238A003AC3BD /* BaseDeeplinkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCE7A0001CF5238A003AC3BD /* BaseDeeplinkTests.swift */; }; DCED60F21C9724D4001A65E0 /* AccessTokenFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCED60F11C9724D4001A65E0 /* AccessTokenFactory.swift */; }; DCED60F61C9770D9001A65E0 /* AccessTokenFactoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCED60F51C9770D9001A65E0 /* AccessTokenFactoryTests.swift */; }; @@ -161,7 +163,7 @@ C1C60712D3DA8E230F9B36D2 /* Pods-UberRidesTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UberRidesTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-UberRidesTests/Pods-UberRidesTests.release.xcconfig"; sourceTree = ""; }; D80D4A511CD01894000EE8A9 /* AuthorizationCodeGrantAuthenticator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AuthorizationCodeGrantAuthenticator.swift; path = OAuth/AuthorizationCodeGrantAuthenticator.swift; sourceTree = ""; }; D81A8B151C658A2800339C13 /* TimeEstimate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TimeEstimate.swift; path = Model/TimeEstimate.swift; sourceTree = ""; }; - D81A8B171C658A4F00339C13 /* gettimeestimates.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = gettimeestimates.json; sourceTree = ""; }; + D81A8B171C658A4F00339C13 /* getTimeEstimates.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getTimeEstimates.json; sourceTree = ""; }; D81A8B191C69186B00339C13 /* RequestLayerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestLayerTests.swift; sourceTree = ""; }; D81A9EC81C6A6C3A000F33F9 /* RidesError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RidesError.swift; path = Model/RidesError.swift; sourceTree = ""; }; D81C85251CC74F0200DC82EE /* LoginViewAuthenticator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LoginViewAuthenticator.swift; path = OAuth/LoginViewAuthenticator.swift; sourceTree = ""; }; @@ -172,29 +174,29 @@ D81C85311CC819C500DC82EE /* Place.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Place.swift; path = Model/Place.swift; sourceTree = ""; }; D81C85331CC830F800DC82EE /* DistanceEstimate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DistanceEstimate.swift; path = Model/DistanceEstimate.swift; sourceTree = ""; }; D81C85351CC8315200DC82EE /* RideEstimate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideEstimate.swift; path = Model/RideEstimate.swift; sourceTree = ""; }; - D81C85371CC831F900DC82EE /* requestestimate.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = requestestimate.json; sourceTree = ""; }; + D81C85371CC831F900DC82EE /* requestEstimate.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = requestEstimate.json; sourceTree = ""; }; D81C85391CC836F300DC82EE /* place.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = place.json; sourceTree = ""; }; D81C853B1CC848F800DC82EE /* PaymentMethod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PaymentMethod.swift; path = Model/PaymentMethod.swift; sourceTree = ""; }; - D81C853D1CC84DE200DC82EE /* getpaymentmethods.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getpaymentmethods.json; sourceTree = ""; }; + D81C853D1CC84DE200DC82EE /* getPaymentMethods.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getPaymentMethods.json; sourceTree = ""; }; D81C854F1CCEE14900DC82EE /* UberAuthenticatingProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UberAuthenticatingProtocol.swift; path = OAuth/UberAuthenticatingProtocol.swift; sourceTree = ""; }; D82706FC1CCF2D1F00D9297E /* RideReceipt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideReceipt.swift; path = Model/RideReceipt.swift; sourceTree = ""; }; D82706FE1CCF2D6700D9297E /* RideCharge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideCharge.swift; path = Model/RideCharge.swift; sourceTree = ""; }; - D82707001CCF327E00D9297E /* ridereceipt.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = ridereceipt.json; sourceTree = ""; }; + D82707001CCF327E00D9297E /* rideReceipt.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = rideReceipt.json; sourceTree = ""; }; D82707041CCF37BD00D9297E /* RideMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideMap.swift; path = Model/RideMap.swift; sourceTree = ""; }; - D82707061CCF39B000D9297E /* ridemap.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = ridemap.json; sourceTree = ""; }; + D82707061CCF39B000D9297E /* rideMap.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = rideMap.json; sourceTree = ""; }; D829FD521C98A09F00AC6578 /* UserActivity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UserActivity.swift; path = Model/UserActivity.swift; sourceTree = ""; }; - D829FD541C98A0B200AC6578 /* gethistory.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = gethistory.json; sourceTree = ""; }; + D829FD541C98A0B200AC6578 /* getHistory.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getHistory.json; sourceTree = ""; }; D829FD9B1C9A3E5200AC6578 /* RideRequestView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RideRequestView.swift; sourceTree = ""; }; D829FD9D1C9A3E5800AC6578 /* EndpointsManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EndpointsManager.swift; sourceTree = ""; }; D844751A1C5B01FB00B03456 /* Request.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Request.swift; sourceTree = ""; }; D8505CF81C598FE1007DC576 /* APIManagerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIManagerTests.swift; sourceTree = ""; }; - D8582C0C1C5ACB8D00E55231 /* getproducts.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getproducts.json; sourceTree = ""; }; + D8582C0C1C5ACB8D00E55231 /* getProducts.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getProducts.json; sourceTree = ""; }; D885CD3B1CADEF1E0055976D /* UberButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UberButton.swift; sourceTree = ""; }; D8874F281C5ABB9E0098DF99 /* UberProduct.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UberProduct.swift; path = Model/UberProduct.swift; sourceTree = ""; }; D8874F2A1C5AC4DB0098DF99 /* ObjectMappingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectMappingTests.swift; sourceTree = ""; }; - D8874F2D1C5AC5470098DF99 /* getproductid.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getproductid.json; sourceTree = ""; }; + D8874F2D1C5AC5470098DF99 /* getProductID.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getProductID.json; sourceTree = ""; }; D89338F01C77CAE0005B5486 /* OAuthTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OAuthTests.swift; sourceTree = ""; }; - D8A0D7181C72798400707DC6 /* gettimeestimateproduct.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = gettimeestimateproduct.json; sourceTree = ""; }; + D8A0D7181C72798400707DC6 /* getTimeEstimateProduct.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getTimeEstimateProduct.json; sourceTree = ""; }; D8A0D71C1C72E3C400707DC6 /* RidesClientTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RidesClientTests.swift; sourceTree = ""; }; D8A0D7221C73A74700707DC6 /* RidesScope.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RidesScope.swift; path = Model/RidesScope.swift; sourceTree = ""; }; D8A196B81C56FC250050A264 /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Media.xcassets; path = Resources/Media.xcassets; sourceTree = ""; }; @@ -210,18 +212,20 @@ D8D18E7E1CBF417600055B76 /* Ride.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Ride.swift; path = Model/Ride.swift; sourceTree = ""; }; D8D18E801CBF419700055B76 /* RideStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideStatus.swift; path = Model/RideStatus.swift; sourceTree = ""; }; D8D18E821CBF41F200055B76 /* Driver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Driver.swift; path = Model/Driver.swift; sourceTree = ""; }; - D8D18E841CBF429C00055B76 /* getrequest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getrequest.json; sourceTree = ""; }; - D8D18E861CBF42AD00055B76 /* postrequests.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = postrequests.json; sourceTree = ""; }; + D8D18E841CBF429C00055B76 /* getRequest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getRequest.json; sourceTree = ""; }; + D8D18E861CBF42AD00055B76 /* postRequests.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = postRequests.json; sourceTree = ""; }; D8D2DC081C90E54700A65FF0 /* UserProfile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UserProfile.swift; path = Model/UserProfile.swift; sourceTree = ""; }; - D8D2DC0A1C90E55900A65FF0 /* getme.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getme.json; sourceTree = ""; }; + D8D2DC0A1C90E55900A65FF0 /* getMe.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getMe.json; sourceTree = ""; }; D8DAB6361C60240B007DE82C /* ModelMapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModelMapper.swift; sourceTree = ""; }; D8E2C96B1C62B3B2006091BA /* PriceEstimate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PriceEstimate.swift; path = Model/PriceEstimate.swift; sourceTree = ""; }; - D8E2C96D1C62B3C7006091BA /* getpriceestimates.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getpriceestimates.json; sourceTree = ""; }; + D8E2C96D1C62B3C7006091BA /* getPriceEstimates.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getPriceEstimates.json; sourceTree = ""; }; DC1039721C96B1CE004854E3 /* RidesScopeExtensionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RidesScopeExtensionsTests.swift; sourceTree = ""; }; DC1AE1B81CF6BF3900B8CFCB /* LoginButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginButton.swift; sourceTree = ""; }; DC1AE1BA1CF775F800B8CFCB /* LoginButtonTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginButtonTests.swift; sourceTree = ""; }; DC1AE1BC1CF78A3300B8CFCB /* refresh.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = refresh.json; sourceTree = ""; }; DC1AE1BE1CF78ADF00B8CFCB /* RefreshEndpointTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RefreshEndpointTests.swift; sourceTree = ""; }; + DC1D80311DA34CA400712178 /* getTimeEstimatesEmpty.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getTimeEstimatesEmpty.json; sourceTree = ""; }; + DC1D80331DA34CD600712178 /* getPriceEstimatesEmpty.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = getPriceEstimatesEmpty.json; sourceTree = ""; }; DC2730EE1CBC46520044AB04 /* RidesMocks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RidesMocks.swift; sourceTree = ""; }; DC2C77901CACDDD000A052BA /* ModalRideRequestViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModalRideRequestViewController.swift; sourceTree = ""; }; DC3F740A1CF63D6700A713AA /* DeeplinkErrorType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeeplinkErrorType.swift; sourceTree = ""; }; @@ -235,7 +239,7 @@ DC676EBA1CEEA0E4009F7209 /* AuthenticationURLUtilityTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticationURLUtilityTests.swift; sourceTree = ""; }; DC676EBC1CEEAA5E009F7209 /* AuthenticationDeeplinkTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticationDeeplinkTests.swift; sourceTree = ""; }; DC6852C71CED17B100DCAA3E /* DeeplinkingProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeeplinkingProtocol.swift; sourceTree = ""; }; - DC75DFE51CA4FB5400071417 /* testInfoNoServerToken.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = testInfoNoServerToken.plist; sourceTree = ""; }; + DC75DFE51CA4FB5400071417 /* testInfoNoServerToken.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = testInfoNoServerToken.plist; sourceTree = ""; }; DC75DFE71CA51DB000071417 /* RideRequestViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RideRequestViewController.swift; sourceTree = ""; }; DC75DFEB1CA5EC1200071417 /* RideParameters.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RideParameters.swift; path = Model/RideParameters.swift; sourceTree = ""; }; DC75DFED1CA5F5EB00071417 /* RideParametersTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RideParametersTest.swift; sourceTree = ""; }; @@ -253,7 +257,7 @@ DC8D42A81CF4C95000C16D16 /* RidesAppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RidesAppDelegate.swift; sourceTree = ""; }; DC8E2ACF1C9AA17400EDD74B /* Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = ""; }; DC8E2AD11C9B19ED00EDD74B /* ConfigurationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigurationTests.swift; sourceTree = ""; }; - DC8E2AD31C9B268600EDD74B /* testInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = testInfo.plist; sourceTree = ""; }; + DC8E2AD31C9B268600EDD74B /* testInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = testInfo.plist; sourceTree = ""; }; DC8FC3621CBDF4D000D58839 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Resources/en.lproj/Localizable.strings; sourceTree = ""; }; DC8FC3641CBDF4E800D58839 /* hi-IN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "hi-IN"; path = "Resources/hi-IN.lproj/Localizable.strings"; sourceTree = ""; }; DC8FC3651CBDF52200D58839 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "Resources/zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; @@ -272,12 +276,12 @@ DCAEA9931CEE91D000E6F239 /* AuthenticationURLUtility.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AuthenticationURLUtility.swift; path = Utilities/AuthenticationURLUtility.swift; sourceTree = ""; }; DCB0D38D1CAD9D5800194DD5 /* RideRequestViewRequestingBehavior.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RideRequestViewRequestingBehavior.swift; sourceTree = ""; }; DCB0D38F1CADAA6300194DD5 /* RideRequestViewRequestingBehaviorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RideRequestViewRequestingBehaviorTests.swift; sourceTree = ""; }; - DCD8060B1CFE50F300EF6EB1 /* RequestEstimateNoCars.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = RequestEstimateNoCars.json; sourceTree = ""; }; - DCD8060D1CFE533F00EF6EB1 /* RideReceiptNullSurgeTotalOwed.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = RideReceiptNullSurgeTotalOwed.json; sourceTree = ""; }; + DCD8060B1CFE50F300EF6EB1 /* requestEstimateNoCars.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = requestEstimateNoCars.json; sourceTree = ""; }; + DCD8060D1CFE533F00EF6EB1 /* rideReceiptNullSurgeTotalOwed.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = rideReceiptNullSurgeTotalOwed.json; sourceTree = ""; }; DCE7A0001CF5238A003AC3BD /* BaseDeeplinkTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseDeeplinkTests.swift; sourceTree = ""; }; DCED60F11C9724D4001A65E0 /* AccessTokenFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AccessTokenFactory.swift; path = OAuth/AccessTokenFactory.swift; sourceTree = ""; }; DCED60F51C9770D9001A65E0 /* AccessTokenFactoryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccessTokenFactoryTests.swift; sourceTree = ""; }; - DCF87E781CF2F7AF0081894C /* testInfoMissingCallbacks.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = testInfoMissingCallbacks.plist; sourceTree = ""; }; + DCF87E781CF2F7AF0081894C /* testInfoMissingCallbacks.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = testInfoMissingCallbacks.plist; sourceTree = ""; }; DCF87E7A1CF3995C0081894C /* BaseAuthenticator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BaseAuthenticator.swift; path = OAuth/BaseAuthenticator.swift; sourceTree = ""; }; DCF87E7C1CF3A9D40081894C /* BaseAuthenticatorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseAuthenticatorTests.swift; sourceTree = ""; }; DCF87E7E1CF3DD010081894C /* NativeAuthenticatorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NativeAuthenticatorTests.swift; sourceTree = ""; }; @@ -442,28 +446,31 @@ D8874F2C1C5AC52B0098DF99 /* Test Data */ = { isa = PBXGroup; children = ( - D81A8B171C658A4F00339C13 /* gettimeestimates.json */, - D8E2C96D1C62B3C7006091BA /* getpriceestimates.json */, - D8874F2D1C5AC5470098DF99 /* getproductid.json */, - D8582C0C1C5ACB8D00E55231 /* getproducts.json */, - D8A0D7181C72798400707DC6 /* gettimeestimateproduct.json */, - D8D2DC0A1C90E55900A65FF0 /* getme.json */, - D829FD541C98A0B200AC6578 /* gethistory.json */, + D81A8B171C658A4F00339C13 /* getTimeEstimates.json */, + D8E2C96D1C62B3C7006091BA /* getPriceEstimates.json */, + D8874F2D1C5AC5470098DF99 /* getProductID.json */, + D8582C0C1C5ACB8D00E55231 /* getProducts.json */, + D8A0D7181C72798400707DC6 /* getTimeEstimateProduct.json */, + D8D2DC0A1C90E55900A65FF0 /* getMe.json */, + D829FD541C98A0B200AC6578 /* getHistory.json */, + D8D18E841CBF429C00055B76 /* getRequest.json */, + D8D18E861CBF42AD00055B76 /* postRequests.json */, + D81C85371CC831F900DC82EE /* requestEstimate.json */, + D81C85391CC836F300DC82EE /* place.json */, + D81C853D1CC84DE200DC82EE /* getPaymentMethods.json */, + D82707001CCF327E00D9297E /* rideReceipt.json */, + D82707061CCF39B000D9297E /* rideMap.json */, + DC1AE1BC1CF78A3300B8CFCB /* refresh.json */, + DCD8060B1CFE50F300EF6EB1 /* requestEstimateNoCars.json */, + DCD8060D1CFE533F00EF6EB1 /* rideReceiptNullSurgeTotalOwed.json */, DC8E2AD31C9B268600EDD74B /* testInfo.plist */, DC75DFE51CA4FB5400071417 /* testInfoNoServerToken.plist */, DCF87E781CF2F7AF0081894C /* testInfoMissingCallbacks.plist */, - D8D18E841CBF429C00055B76 /* getrequest.json */, - D8D18E861CBF42AD00055B76 /* postrequests.json */, - D81C85371CC831F900DC82EE /* requestestimate.json */, - D81C85391CC836F300DC82EE /* place.json */, - D81C853D1CC84DE200DC82EE /* getpaymentmethods.json */, - D82707001CCF327E00D9297E /* ridereceipt.json */, - D82707061CCF39B000D9297E /* ridemap.json */, - DC1AE1BC1CF78A3300B8CFCB /* refresh.json */, - DCD8060B1CFE50F300EF6EB1 /* RequestEstimateNoCars.json */, - DCD8060D1CFE533F00EF6EB1 /* RideReceiptNullSurgeTotalOwed.json */, + DC1D80311DA34CA400712178 /* getTimeEstimatesEmpty.json */, + DC1D80331DA34CD600712178 /* getPriceEstimatesEmpty.json */, ); name = "Test Data"; + path = TestData; sourceTree = ""; }; D8A196B61C56FC1A0050A264 /* Resources */ = { @@ -631,26 +638,28 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - D8D18E871CBF42AD00055B76 /* postrequests.json in Resources */, + D8D18E871CBF42AD00055B76 /* postRequests.json in Resources */, DC1AE1BD1CF78A3300B8CFCB /* refresh.json in Resources */, - D81C853E1CC84DE200DC82EE /* getpaymentmethods.json in Resources */, - D829FD551C98A0B200AC6578 /* gethistory.json in Resources */, + D81C853E1CC84DE200DC82EE /* getPaymentMethods.json in Resources */, + D829FD551C98A0B200AC6578 /* getHistory.json in Resources */, D81C853A1CC836F300DC82EE /* place.json in Resources */, DCF87E791CF2F7AF0081894C /* testInfoMissingCallbacks.plist in Resources */, - DCD8060E1CFE533F00EF6EB1 /* RideReceiptNullSurgeTotalOwed.json in Resources */, - D8D2DC0B1C90E55900A65FF0 /* getme.json in Resources */, - D82707011CCF327E00D9297E /* ridereceipt.json in Resources */, - D8582C0D1C5ACB8D00E55231 /* getproducts.json in Resources */, - D8874F2E1C5AC5470098DF99 /* getproductid.json in Resources */, + DCD8060E1CFE533F00EF6EB1 /* rideReceiptNullSurgeTotalOwed.json in Resources */, + D8D2DC0B1C90E55900A65FF0 /* getMe.json in Resources */, + D82707011CCF327E00D9297E /* rideReceipt.json in Resources */, + D8582C0D1C5ACB8D00E55231 /* getProducts.json in Resources */, + D8874F2E1C5AC5470098DF99 /* getProductID.json in Resources */, DC8E2AD41C9B268600EDD74B /* testInfo.plist in Resources */, - D8A0D7191C72798400707DC6 /* gettimeestimateproduct.json in Resources */, + DC1D80341DA34CD600712178 /* getPriceEstimatesEmpty.json in Resources */, + D8A0D7191C72798400707DC6 /* getTimeEstimateProduct.json in Resources */, DC75DFE61CA4FB5400071417 /* testInfoNoServerToken.plist in Resources */, - D8E2C96E1C62B3C7006091BA /* getpriceestimates.json in Resources */, - D82707071CCF39B000D9297E /* ridemap.json in Resources */, - DCD8060C1CFE50F300EF6EB1 /* RequestEstimateNoCars.json in Resources */, - D81C85381CC831F900DC82EE /* requestestimate.json in Resources */, - D8D18E851CBF429C00055B76 /* getrequest.json in Resources */, - D81A8B181C658A4F00339C13 /* gettimeestimates.json in Resources */, + DC1D80321DA34CA400712178 /* getTimeEstimatesEmpty.json in Resources */, + D8E2C96E1C62B3C7006091BA /* getPriceEstimates.json in Resources */, + D82707071CCF39B000D9297E /* rideMap.json in Resources */, + DCD8060C1CFE50F300EF6EB1 /* requestEstimateNoCars.json in Resources */, + D81C85381CC831F900DC82EE /* requestEstimate.json in Resources */, + D8D18E851CBF429C00055B76 /* getRequest.json in Resources */, + D81A8B181C658A4F00339C13 /* getTimeEstimates.json in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/source/UberRides/Info.plist b/source/UberRides/Info.plist index 0d4fc0a8..c89d5f29 100644 --- a/source/UberRides/Info.plist +++ b/source/UberRides/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.5.2 + 0.5.3 CFBundleSignature ???? CFBundleVersion diff --git a/source/UberRides/Model/Ride.swift b/source/UberRides/Model/Ride.swift index ff074fbc..1ff1ae36 100644 --- a/source/UberRides/Model/Ride.swift +++ b/source/UberRides/Model/Ride.swift @@ -50,7 +50,7 @@ import ObjectMapper public private(set) var requestID: String? /// The status of the Request indicating state. - public private(set) var status: RideStatus? + public private(set) var status: RideStatus = .Unknown /// The surge pricing multiplier used to calculate the increased price of a Request. public private(set) var surgeMultiplier: Double = 1.0 diff --git a/source/UberRides/Model/RidesError.swift b/source/UberRides/Model/RidesError.swift index 3371e487..e11aec91 100644 --- a/source/UberRides/Model/RidesError.swift +++ b/source/UberRides/Model/RidesError.swift @@ -45,6 +45,18 @@ import ObjectMapper override init() { } + + /// Convenience initializer. + /// + /// - parameter status: The Status code to use for this error + /// - parameter code: The underscore delimited code string to use for this error + /// - parameter title: Human readable message which corresponds to this error + public convenience init(status: Int, code: String?, title: String?) { + self.init() + self.status = status + self.code = code + self.title = title + } public required init?(_ map: Map) { } diff --git a/source/UberRides/OAuth/KeychainWrapper.swift b/source/UberRides/OAuth/KeychainWrapper.swift index 52b76931..720806b8 100644 --- a/source/UberRides/OAuth/KeychainWrapper.swift +++ b/source/UberRides/OAuth/KeychainWrapper.swift @@ -66,7 +66,7 @@ class KeychainWrapper: NSObject { if result == errSecDuplicateItem { result = SecItemUpdate(keychainItemData, [ValueData: value]) } - + return result == errSecSuccess } @@ -127,7 +127,7 @@ class KeychainWrapper: NSObject { keychainItemData[Class] = kSecClassGenericPassword if !accessGroup.isEmpty { - keychainItemData[AttrAccount] = accessGroup + keychainItemData[AttrAccessGroup] = accessGroup } return keychainItemData diff --git a/source/UberRides/OAuth/LoginManager.swift b/source/UberRides/OAuth/LoginManager.swift index f949d3c8..cb1bfa7d 100644 --- a/source/UberRides/OAuth/LoginManager.swift +++ b/source/UberRides/OAuth/LoginManager.swift @@ -91,7 +91,7 @@ - returns: An initialized LoginManager */ @objc public convenience init(loginType: LoginType) { - self.init(accessTokenIdentifier: Configuration.getDefaultAccessTokenIdentifier(), keychainAccessGroup: Configuration.getDefaultAccessTokenIdentifier(), loginType: loginType) + self.init(accessTokenIdentifier: Configuration.getDefaultAccessTokenIdentifier(), keychainAccessGroup: Configuration.getDefaultKeychainAccessGroup(), loginType: loginType) } /** @@ -102,7 +102,7 @@ - returns: An initialized LoginManager */ @objc public convenience override init() { - self.init(accessTokenIdentifier: Configuration.getDefaultAccessTokenIdentifier(), keychainAccessGroup: Configuration.getDefaultAccessTokenIdentifier(), loginType: LoginType.Native) + self.init(accessTokenIdentifier: Configuration.getDefaultAccessTokenIdentifier(), keychainAccessGroup: Configuration.getDefaultKeychainAccessGroup(), loginType: LoginType.Native) } // Mark: LoginManaging diff --git a/source/UberRides/RideRequestButton.swift b/source/UberRides/RideRequestButton.swift index 66c24cf1..bab81123 100644 --- a/source/UberRides/RideRequestButton.swift +++ b/source/UberRides/RideRequestButton.swift @@ -278,6 +278,7 @@ import CoreLocation */ public func loadRideInformation() { guard client != nil else { + delegate?.rideRequestButton(self, didReceiveError: createValidationFailedError()) return } @@ -339,8 +340,13 @@ import CoreLocation attrString.addAttribute(NSFontAttributeName, value: metadataFont, range: (attrString.string as NSString).rangeOfString(title)) attrString.addAttribute(NSFontAttributeName, value: metadataFont, range: (attrString.string as NSString).rangeOfString(subtitle)) - - uberTitleLabel.text = LocalizationUtil.localizedString(forKey: "Get a ride", comment: "Request button shorter description") + + if attrString.string.isEmpty { + uberTitleLabel.text = LocalizationUtil.localizedString(forKey: "Ride there with Uber", comment: "Request button description") + } else { + uberTitleLabel.text = LocalizationUtil.localizedString(forKey: "Get a ride", comment: "Request button shorter description") + } + uberMetadataLabel.attributedText = attrString } @@ -356,7 +362,11 @@ import CoreLocation return attachment } - + + private func createValidationFailedError() -> RidesError { + return RidesError(status: 422, code: "validation_failed", title: "Invalid Request") + } + /** Sets metadata on button by fetching all required information. */ @@ -365,6 +375,7 @@ import CoreLocation * These are all required for the following requests. */ guard let client = client, let pickupLatitude = metadata.pickupLatitude, let pickupLongitude = metadata.pickupLongitude, let productID = metadata.productID else { + delegate?.rideRequestButton(self, didReceiveError: createValidationFailedError()) return } @@ -375,40 +386,44 @@ import CoreLocation // Set the information on the button label once all information is retrieved. dispatch_group_notify(downloadGroup, dispatch_get_main_queue(), { - guard let estimate = self.metadata.timeEstimate?.estimate else { - for error in errors { - self.delegate?.rideRequestButton(self, didReceiveError: error) + + var titleText = "" + var subtitleText = "" + + if let timeEstimate = self.metadata.timeEstimate?.estimate { + let mins = timeEstimate / 60 + if mins == 1 { + titleText = String(format: LocalizationUtil.localizedString(forKey: "%d min away", comment: "Estimate is for car one minute away"), mins).uppercaseStringWithLocale(NSLocale.currentLocale()) + } else { + titleText = String(format: LocalizationUtil.localizedString(forKey: "%d mins away", comment: "Estimate is for car multiple minutes away"), mins).uppercaseStringWithLocale(NSLocale.currentLocale()) } - return - } - - let mins = estimate/60 - var titleText: String - if mins == 1 { - titleText = String(format: LocalizationUtil.localizedString(forKey: "%d min away", comment: "Estimate is for car one minute away"), mins).uppercaseStringWithLocale(NSLocale.currentLocale()) - } else { - titleText = String(format: LocalizationUtil.localizedString(forKey: "%d mins away", comment: "Estimate is for car multiple minutes away"), mins).uppercaseStringWithLocale(NSLocale.currentLocale()) } - var subtitleText = "" + var surge = false - - if let productName = self.metadata.productName { - for estimate in self.metadata.priceEstimates { - if estimate.productID == productID, let price = estimate.estimate { - if estimate.surgeMultiplier > 1.0 { - surge = true - } - subtitleText = String(format: LocalizationUtil.localizedString(forKey: "%1$@ for %2$@", comment: "Price estimate string for an Uber product"), price, productName) + for estimate in self.metadata.priceEstimates { + if let price = estimate.estimate, productName = estimate.name where estimate.productID == productID { + if estimate.surgeMultiplier > 1.0 { + surge = true + } + let priceEstimateString = String(format: LocalizationUtil.localizedString(forKey: "%1$@ for %2$@", comment: "Price estimate string for an Uber product"), price, productName) + if titleText.isEmpty { + titleText = priceEstimateString + } else { + subtitleText = priceEstimateString } + break } } - - self.setMultilineAttributedString(titleText, subtitle: subtitleText, surge: surge) - self.delegate?.rideRequestButtonDidLoadRideInformation(self) + + if !titleText.isEmpty { + self.setMultilineAttributedString(titleText, subtitle: subtitleText, surge: surge) + } for error in errors { self.delegate?.rideRequestButton(self, didReceiveError: error) } + + self.delegate?.rideRequestButtonDidLoadRideInformation(self) }) // Get time estimate for productID @@ -418,14 +433,9 @@ import CoreLocation dispatch_group_leave(downloadGroup) return } - - if timeEstimates.count == 0 { - dispatch_group_leave(downloadGroup) - return - } - - self.metadata.timeEstimate = timeEstimates.first! - self.metadata.productName = timeEstimates.first!.name + + self.metadata.timeEstimate = timeEstimates.first + self.metadata.productName = timeEstimates.first?.name dispatch_group_leave(downloadGroup) } @@ -439,12 +449,7 @@ import CoreLocation dispatch_group_leave(downloadGroup) return } - - if priceEstimates.count == 0 { - dispatch_group_leave(downloadGroup) - return - } - + self.metadata.priceEstimates = priceEstimates dispatch_group_leave(downloadGroup) } @@ -482,9 +487,9 @@ struct ButtonMetadata { var dropoffLongitude: Double? var timeEstimate: TimeEstimate? private var priceEstimateList: [PriceEstimate]? - var priceEstimates: [PriceEstimate]! { + var priceEstimates: [PriceEstimate] { get { - return priceEstimateList != nil ? priceEstimateList : [] + return priceEstimateList ?? [] } set { priceEstimateList = newValue diff --git a/source/UberRidesTests/LoginButtonTests.swift b/source/UberRidesTests/LoginButtonTests.swift index 1413b24d..c6731ca9 100644 --- a/source/UberRidesTests/LoginButtonTests.swift +++ b/source/UberRidesTests/LoginButtonTests.swift @@ -45,52 +45,46 @@ class LoginButtonTests : XCTestCase { func testButtonState_whenSignedOut() { let identifier = "testIdentifier" - let accessGroup = "testAccessGroup" - - keychain?.setAccessGroup(accessGroup) - keychain?.deleteObjectForKey(identifier) + + keychain!.deleteObjectForKey(identifier) - let token = TokenManager.fetchToken(identifier, accessGroup: accessGroup) + let token = TokenManager.fetchToken(identifier) XCTAssertNil(token) - let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: accessGroup, loginType: .Implicit) + let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: nil, loginType: .Implicit) let loginButton = LoginButton(frame: CGRectZero, scopes: [], loginManager: loginManager) XCTAssertEqual(loginButton.buttonState, LoginButtonState.SignedOut) - keychain?.deleteObjectForKey(identifier) + keychain!.deleteObjectForKey(identifier) } func testLabelText_whenSignedIn() { let identifier = "testIdentifier" - let accessGroup = "testAccessGroup" let token = getTestToken() + + XCTAssertTrue(keychain!.setObject(token, key: identifier)) - keychain?.setAccessGroup(accessGroup) - keychain?.setObject(token, key: identifier) - - let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: accessGroup, loginType: .Implicit) + let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: nil, loginType: .Implicit) let loginButton = LoginButton(frame: CGRectZero, scopes: [], loginManager: loginManager) XCTAssertEqual(loginButton.buttonState, LoginButtonState.SignedIn) - keychain?.deleteObjectForKey(identifier) + XCTAssertTrue(keychain!.deleteObjectForKey(identifier)) } func testLoginCalled_whenSignedOut() { let identifier = "testIdentifier" - let accessGroup = "testAccessGroup" - - keychain?.setAccessGroup(accessGroup) - keychain?.deleteObjectForKey(identifier) + + keychain!.deleteObjectForKey(identifier) - let token = TokenManager.fetchToken(identifier, accessGroup: accessGroup) + let token = TokenManager.fetchToken(identifier) XCTAssertNil(token) let expectation = expectationWithDescription("Expected executeLogin() called") - let loginManager = LoginManagerPartialMock(accessTokenIdentifier: identifier, keychainAccessGroup: accessGroup, loginType: .Implicit) + let loginManager = LoginManagerPartialMock(accessTokenIdentifier: identifier, keychainAccessGroup: nil, loginType: .Implicit) loginManager.executeLoginClosure = { expectation.fulfill() } @@ -102,23 +96,20 @@ class LoginButtonTests : XCTestCase { loginButton.uberButtonTapped(loginButton) waitForExpectationsWithTimeout(0.2) { _ in - self.keychain?.deleteObjectForKey(identifier) + self.keychain!.deleteObjectForKey(identifier) } } func testLogOut_whenSignedIn() { let identifier = "testIdentifier" - let accessGroup = "testAccessGroup" - - keychain?.setAccessGroup(accessGroup) - keychain?.deleteObjectForKey(identifier) + + keychain!.deleteObjectForKey(identifier) let token = getTestToken() + + XCTAssertTrue(keychain!.setObject(token, key: identifier)) - keychain?.setAccessGroup(accessGroup) - keychain?.setObject(token, key: identifier) - - let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: accessGroup, loginType: .Implicit) + let loginManager = LoginManager(accessTokenIdentifier: identifier, keychainAccessGroup: nil, loginType: .Implicit) let loginButton = LoginButton(frame: CGRectZero, scopes: [.Profile], loginManager: loginManager) loginButton.presentingViewController = UIViewController() @@ -126,9 +117,9 @@ class LoginButtonTests : XCTestCase { XCTAssertEqual(loginButton.buttonState, LoginButtonState.SignedIn) loginButton.uberButtonTapped(loginButton) - XCTAssertNil(TokenManager.fetchToken(identifier, accessGroup: accessGroup)) + XCTAssertNil(TokenManager.fetchToken(identifier)) - self.keychain?.deleteObjectForKey(identifier) + keychain!.deleteObjectForKey(identifier) } //Mark: Helpers diff --git a/source/UberRidesTests/ObjectMappingTests.swift b/source/UberRidesTests/ObjectMappingTests.swift index f56ac2cb..636b0bc3 100644 --- a/source/UberRidesTests/ObjectMappingTests.swift +++ b/source/UberRidesTests/ObjectMappingTests.swift @@ -44,7 +44,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetProduct() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("getproductid", ofType: "json") { + if let path = bundle.pathForResource("getProductID", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! let product = ModelMapper().mapFromJSON(JSONString) @@ -79,7 +79,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetProductBadJSON() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("getproductid", ofType: "json") { + if let path = bundle.pathForResource("getProductID", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! @@ -97,7 +97,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetAllProducts() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("getproducts", ofType: "json") { + if let path = bundle.pathForResource("getProducts", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! let products = ModelMapper().mapFromJSON(JSONString) @@ -118,7 +118,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetAllProductsBadJSON() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("getproducts", ofType: "json") { + if let path = bundle.pathForResource("getProducts", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! @@ -136,7 +136,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetTimeEstimates() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("gettimeestimates", ofType: "json") { + if let path = bundle.pathForResource("getTimeEstimates", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! let timeEstimates = ModelMapper().mapFromJSON(JSONString) @@ -160,7 +160,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetTimeEstimatesBadJSON() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("gettimeestimates", ofType: "json") { + if let path = bundle.pathForResource("getTimeEstimates", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! @@ -178,7 +178,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetPriceEstimates() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("getpriceestimates", ofType: "json") { + if let path = bundle.pathForResource("getPriceEstimates", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! let priceEstimates = ModelMapper().mapFromJSON(JSONString) @@ -205,7 +205,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetPriceEstimatesBadJSON() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("getpriceestimates", ofType: "json") { + if let path = bundle.pathForResource("getPriceEstimates", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! @@ -223,7 +223,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetTripHistory() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("gethistory", ofType: "json") { + if let path = bundle.pathForResource("getHistory", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! let userActivity = ModelMapper().mapFromJSON(JSONString) @@ -258,7 +258,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetHistoryBadJSON() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("gethistory", ofType: "json") { + if let path = bundle.pathForResource("getHistory", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! @@ -276,7 +276,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetUserProfile() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("getme", ofType: "json") { + if let path = bundle.pathForResource("getMe", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! let userProfile = ModelMapper().mapFromJSON(JSONString) @@ -296,7 +296,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetUserProfileBadJSON() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("getme", ofType: "json") { + if let path = bundle.pathForResource("getMe", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! JSONString = JSONString.stringByReplacingOccurrencesOfString("{", withString: "") @@ -312,7 +312,7 @@ class ObjectMappingTests: XCTestCase { */ func testPostRequest() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("postrequests", ofType: "json") { + if let path = bundle.pathForResource("postRequests", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! guard let trip = ModelMapper().mapFromJSON(JSONString) else { @@ -337,7 +337,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetRequest() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("getrequest", ofType: "json") { + if let path = bundle.pathForResource("getRequest", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! guard let trip = ModelMapper().mapFromJSON(JSONString) else { @@ -385,7 +385,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetRequestEstimate() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("requestestimate", ofType: "json") { + if let path = bundle.pathForResource("requestEstimate", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! let estimate = ModelMapper().mapFromJSON(JSONString) @@ -406,7 +406,7 @@ class ObjectMappingTests: XCTestCase { func testGetRequestEstimateNoCars() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("RequestEstimateNoCars", ofType: "json") { + if let path = bundle.pathForResource("requestEstimateNoCars", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! let estimate = ModelMapper().mapFromJSON(JSONString) @@ -451,7 +451,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetPaymentMethods() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("getpaymentmethods", ofType: "json") { + if let path = bundle.pathForResource("getPaymentMethods", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! guard let paymentMethods = ModelMapper().mapFromJSON(JSONString) else { @@ -494,7 +494,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetRideReceipt() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("ridereceipt", ofType: "json") { + if let path = bundle.pathForResource("rideReceipt", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! guard let receipt = ModelMapper().mapFromJSON(JSONString) else { @@ -563,7 +563,7 @@ class ObjectMappingTests: XCTestCase { func testGetRideReceipt_withNullSurge_withTotalOwed() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("RideReceiptNullSurgeTotalOwed", ofType: "json") { + if let path = bundle.pathForResource("rideReceiptNullSurgeTotalOwed", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! guard let receipt = ModelMapper().mapFromJSON(JSONString) else { @@ -628,7 +628,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetRideReceiptBadJSON() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("ridereceipt", ofType: "json") { + if let path = bundle.pathForResource("rideReceipt", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { var JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! JSONString = JSONString.stringByReplacingOccurrencesOfString("[", withString: "") @@ -646,7 +646,7 @@ class ObjectMappingTests: XCTestCase { */ func testGetRideMap() { let bundle = NSBundle(forClass: ObjectMappingTests.self) - if let path = bundle.pathForResource("ridemap", ofType: "json") { + if let path = bundle.pathForResource("rideMap", ofType: "json") { if let jsonData = NSData(contentsOfFile: path) { let JSONString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! guard let map = ModelMapper().mapFromJSON(JSONString) else { diff --git a/source/UberRidesTests/RequestButtonTests.swift b/source/UberRidesTests/RequestButtonTests.swift index 5b9d4694..7b870a3d 100644 --- a/source/UberRidesTests/RequestButtonTests.swift +++ b/source/UberRidesTests/RequestButtonTests.swift @@ -183,7 +183,7 @@ class RequestButtonTests: XCTestCase { */ func testGetMetadataSimple() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("gettimeestimateproduct.json", self.dynamicType)!, statusCode:200, headers:nil) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimateProduct.json", self.dynamicType)!, statusCode:200, headers:nil) } expectation = expectationWithDescription("information loaded") @@ -207,9 +207,9 @@ class RequestButtonTests: XCTestCase { func testGetMetadataDetailed() { stub(isHost("sandbox-api.uber.com")) { urlRequest in if isPath("/v1/estimates/price")(urlRequest) { - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getpriceestimates.json", self.dynamicType)!, statusCode:200, headers:nil) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimates.json", self.dynamicType)!, statusCode:200, headers:nil) } else if isPath("/v1/estimates/time")(urlRequest) { - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("gettimeestimateproduct.json", self.dynamicType)!, statusCode:200, headers:nil) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimateProduct.json", self.dynamicType)!, statusCode:200, headers:nil) } else { XCTAssert(false) return OHHTTPStubsResponse() @@ -234,7 +234,7 @@ class RequestButtonTests: XCTestCase { func testErrorGettingPriceEstimates() { stub(isHost("sandbox-api.uber.com")) { urlRequest in if isPath("/v1/estimates/time")(urlRequest) { - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("gettimeestimateproduct.json", self.dynamicType)!, statusCode:200, headers: [ "Authorization" : "Bearer token" ]) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimateProduct.json", self.dynamicType)!, statusCode:200, headers: [ "Authorization" : "Bearer token" ]) } else if isPath("/v1/estimates/price")(urlRequest) { let obj = ["code":"price_estimate_error"] return OHHTTPStubsResponse(JSONObject: obj, statusCode: 404, headers: nil) @@ -263,7 +263,7 @@ class RequestButtonTests: XCTestCase { func testErrorGettingTimeEstimates() { stub(isHost("sandbox-api.uber.com")) { urlRequest in if isPath("/v1/estimates/price")(urlRequest) { - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getpriceestimates.json", self.dynamicType)!, statusCode:200, headers:nil) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimates.json", self.dynamicType)!, statusCode:200, headers:nil) } else if isPath("/v1/estimates/time")(urlRequest) { let obj = ["code":"time_estimate_error"] return OHHTTPStubsResponse(JSONObject: obj, statusCode: 404, headers: nil) @@ -283,11 +283,154 @@ class RequestButtonTests: XCTestCase { waitForExpectationsWithTimeout(timeout, handler: { error in XCTAssertNil(error) - XCTAssertEqual(self.button.uberTitleLabel.text!, "Ride there with Uber") + XCTAssertEqual(self.button.uberTitleLabel.text!, "Get a ride") + XCTAssertEqual(self.button.uberMetadataLabel.text!, "$15 for uberX") XCTAssertEqual(self.rideButtonError.code, "time_estimate_error") }) } - + + func testEmptyTimeEstimatesCallsDelegateValidPriceEstimates() { + stub(isHost("sandbox-api.uber.com")) { urlRequest in + + if isPath("/v1/estimates/price")(urlRequest) { + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimates.json", self.dynamicType)!, statusCode:200, headers:nil) + } else if isPath("/v1/estimates/time")(urlRequest) { + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimatesEmpty.json", self.dynamicType)!, statusCode:200, headers:nil) + } else { + XCTAssert(false) + return OHHTTPStubsResponse() + } + } + + expectation = expectationWithDescription("information loaded") + + let pickupLocation = CLLocation(latitude: pickupLat, longitude: pickupLong) + let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong) + let rideParams = RideParametersBuilder().setProductID(productID).setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation).build() + button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior()) + button.delegate = self + button.loadRideInformation() + + waitForExpectationsWithTimeout(timeout, handler: { error in + XCTAssertNil(error) + XCTAssertEqual(self.button.uberTitleLabel.text!, "Get a ride") + XCTAssertEqual(self.button.uberMetadataLabel.text!, "$15 for uberX") + }) + } + + func testEmptyPriceEstimatesValidTimeEstimates() { + stub(isHost("sandbox-api.uber.com")) { urlRequest in + if isPath("/v1/estimates/price")(urlRequest) { + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimatesEmpty.json", self.dynamicType)!, statusCode:200, headers:nil) + } else if isPath("/v1/estimates/time")(urlRequest) { + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimateProduct.json", self.dynamicType)!, statusCode:200, headers:nil) + } else { + XCTAssert(false) + return OHHTTPStubsResponse() + } + } + + expectation = expectationWithDescription("information loaded") + let pickupLocation = CLLocation(latitude: pickupLat, longitude: pickupLong) + let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong) + let rideParams = RideParametersBuilder().setProductID(productID).setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation).build() + button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior()) + button.delegate = self + button.loadRideInformation() + + waitForExpectationsWithTimeout(timeout, handler: { error in + XCTAssertNil(error) + XCTAssertEqual(self.button.uberTitleLabel.text!, "Get a ride") + XCTAssertEqual(self.button.uberMetadataLabel.text!, "4 MINS AWAY") + }) + } + + func testEmptyPriceEstimatesEmptyTimeEstimates() { + stub(isHost("sandbox-api.uber.com")) { urlRequest in + if isPath("/v1/estimates/price")(urlRequest) { + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimatesEmpty.json", self.dynamicType)!, statusCode:200, headers:nil) + } else if isPath("/v1/estimates/time")(urlRequest) { + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimatesEmpty.json", self.dynamicType)!, statusCode:200, headers:nil) + } else { + XCTAssert(false) + return OHHTTPStubsResponse() + } + } + + expectation = expectationWithDescription("information loaded") + let pickupLocation = CLLocation(latitude: pickupLat, longitude: pickupLong) + let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong) + let rideParams = RideParametersBuilder().setProductID(productID).setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation).build() + button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior()) + button.delegate = self + button.loadRideInformation() + + waitForExpectationsWithTimeout(timeout, handler: { error in + XCTAssertNil(error) + XCTAssertEqual(self.button.uberTitleLabel.text!, "Ride there with Uber") + XCTAssertNil(self.button.uberMetadataLabel.text) + }) + } + + func testMissingClientTriggersErrorDelegate() { + errorExpectation = expectationWithDescription("Expected to receive 422 error") + let pickupLocation = CLLocation(latitude: pickupLat, longitude: pickupLong) + let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong) + let rideParams = RideParametersBuilder().setProductID(productID).setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation).build() + button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior()) + button.delegate = self + button.client = nil + button.loadRideInformation() + + waitForExpectationsWithTimeout(timeout, handler: { error in + guard let ridesError = self.rideButtonError else { + XCTFail("Expected to receive 422 error") + return + } + XCTAssertEqual(ridesError.status, 422) + XCTAssertEqual(ridesError.code, "validation_failed") + XCTAssertEqual(ridesError.title, "Invalid Request") + }) + } + + func testMissingPickupTriggersErrorDelegate() { + errorExpectation = expectationWithDescription("Expected to receive 422 error") + let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong) + let rideParams = RideParametersBuilder().setProductID(productID).setDropoffLocation(dropoffLocation).build() + button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior()) + button.delegate = self + button.loadRideInformation() + + waitForExpectationsWithTimeout(timeout, handler: { error in + guard let ridesError = self.rideButtonError else { + XCTFail("Expected to receive 422 error") + return + } + XCTAssertEqual(ridesError.status, 422) + XCTAssertEqual(ridesError.code, "validation_failed") + XCTAssertEqual(ridesError.title, "Invalid Request") + }) + } + + func testUseCurrentLocationTriggersErrorDelegate() { + errorExpectation = expectationWithDescription("Expected to receive 422 error") + let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong) + let rideParams = RideParametersBuilder().setProductID(productID).setDropoffLocation(dropoffLocation).setPickupToCurrentLocation().build() + button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior()) + button.delegate = self + button.loadRideInformation() + + waitForExpectationsWithTimeout(timeout, handler: { error in + guard let ridesError = self.rideButtonError else { + XCTFail("Expected to receive 422 error") + return + } + XCTAssertEqual(ridesError.status, 422) + XCTAssertEqual(ridesError.code, "validation_failed") + XCTAssertEqual(ridesError.title, "Invalid Request") + }) + } + /** Test that button defaults to "Get a Ride" when no productID is set. */ diff --git a/source/UberRidesTests/RequestLayerTests.swift b/source/UberRidesTests/RequestLayerTests.swift index 2c424266..e99ca948 100644 --- a/source/UberRidesTests/RequestLayerTests.swift +++ b/source/UberRidesTests/RequestLayerTests.swift @@ -52,7 +52,7 @@ class RequestLayerTests: XCTestCase { */ func test200Response() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getproductid.json", self.dynamicType)!, statusCode:200, headers:self.headers) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getProductID.json", self.dynamicType)!, statusCode:200, headers:self.headers) } let expectation = expectationWithDescription("200 success response") diff --git a/source/UberRidesTests/RidesClientTests.swift b/source/UberRidesTests/RidesClientTests.swift index 421c4bae..db6d836a 100644 --- a/source/UberRidesTests/RidesClientTests.swift +++ b/source/UberRidesTests/RidesClientTests.swift @@ -64,7 +64,7 @@ class RidesClientTests: XCTestCase { */ func testGetCheapestProduct() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getproducts.json", self.dynamicType)!, statusCode:200, headers:nil) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getProducts.json", self.dynamicType)!, statusCode:200, headers:nil) } let expectation = expectationWithDescription("get cheapest product") @@ -88,7 +88,7 @@ class RidesClientTests: XCTestCase { */ func testGetProducts() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getproducts.json", self.dynamicType)!, statusCode:200, headers:nil) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getProducts.json", self.dynamicType)!, statusCode:200, headers:nil) } let expectation = expectationWithDescription("get all products") @@ -117,7 +117,7 @@ class RidesClientTests: XCTestCase { */ func testGetProductByID() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getproductid.json", self.dynamicType)!, statusCode:200, headers:nil) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getProductID.json", self.dynamicType)!, statusCode:200, headers:nil) } let expectation = expectationWithDescription("get product by id") @@ -143,7 +143,7 @@ class RidesClientTests: XCTestCase { */ func testGetTimeEstimates() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("gettimeestimates.json", self.dynamicType)!, statusCode:200, headers:nil) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimates.json", self.dynamicType)!, statusCode:200, headers:nil) } let expectation = expectationWithDescription("get time estimates") @@ -171,7 +171,7 @@ class RidesClientTests: XCTestCase { */ func testGetPriceEstimates() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getpriceestimates.json", self.dynamicType)!, statusCode:200, headers:nil) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimates.json", self.dynamicType)!, statusCode:200, headers:nil) } let expectation = expectationWithDescription("get price estimates") @@ -200,7 +200,7 @@ class RidesClientTests: XCTestCase { */ func testGetHistory() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath:OHPathForFile("gethistory.json", self.dynamicType)!, statusCode:200, headers:nil) + return OHHTTPStubsResponse(fileAtPath:OHPathForFile("getHistory.json", self.dynamicType)!, statusCode:200, headers:nil) } let expectation = expectationWithDescription("get user history") @@ -226,7 +226,7 @@ class RidesClientTests: XCTestCase { */ func testGetUserProfile() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getme.json", self.dynamicType)!, statusCode: 200, headers: nil) + return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getMe.json", self.dynamicType)!, statusCode: 200, headers: nil) } let expectation = expectationWithDescription("get user profile") @@ -251,7 +251,7 @@ class RidesClientTests: XCTestCase { */ func testMakeRideRequest() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath: OHPathForFile("postrequests.json", self.dynamicType)!, statusCode: 200, headers: nil) + return OHHTTPStubsResponse(fileAtPath: OHPathForFile("postRequests.json", self.dynamicType)!, statusCode: 200, headers: nil) } let expectation = expectationWithDescription("make ride request") @@ -259,7 +259,7 @@ class RidesClientTests: XCTestCase { let rideParameters = RideParametersBuilder().setPickupPlaceID("home").build() client.requestRide(rideParameters, completion: { ride, response in XCTAssertNotNil(ride) - XCTAssertEqual(ride!.status, .Processing) + XCTAssertEqual(ride!.status, RideStatus.Processing) XCTAssertEqual(ride!.requestID, "852b8fdd-4369-4659-9628-e122662ad257") XCTAssertEqual(ride!.eta, 5) @@ -278,7 +278,7 @@ class RidesClientTests: XCTestCase { */ func testGetCurrentRide() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getrequest.json", self.dynamicType)!, statusCode: 200, headers: nil) + return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getRequest.json", self.dynamicType)!, statusCode: 200, headers: nil) } let expectation = expectationWithDescription("get current ride") @@ -286,7 +286,7 @@ class RidesClientTests: XCTestCase { client.fetchCurrentRide({ ride, response in XCTAssertNotNil(ride) XCTAssertEqual(ride!.requestID, "17cb78a7-b672-4d34-a288-a6c6e44d5315") - XCTAssertEqual(ride!.status, .Accepted) + XCTAssertEqual(ride!.status, RideStatus.Accepted) expectation.fulfill() }) @@ -303,7 +303,7 @@ class RidesClientTests: XCTestCase { */ func testGetRideByID() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getrequest.json", self.dynamicType)!, statusCode: 200, headers: nil) + return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getRequest.json", self.dynamicType)!, statusCode: 200, headers: nil) } let expectation = expectationWithDescription("get ride by ID") @@ -311,7 +311,7 @@ class RidesClientTests: XCTestCase { client.fetchRideDetails("someID", completion: { ride, response in XCTAssertNotNil(ride) XCTAssertEqual(ride!.requestID, "17cb78a7-b672-4d34-a288-a6c6e44d5315") - XCTAssertEqual(ride!.status, .Accepted) + XCTAssertEqual(ride!.status, RideStatus.Accepted) expectation.fulfill() }) @@ -328,7 +328,7 @@ class RidesClientTests: XCTestCase { */ func testGetRequestEstimate() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath: OHPathForFile("requestestimate.json", self.dynamicType)!, statusCode: 200, headers: nil) + return OHHTTPStubsResponse(fileAtPath: OHPathForFile("requestEstimate.json", self.dynamicType)!, statusCode: 200, headers: nil) } let expectation = expectationWithDescription("get request estimate") @@ -753,7 +753,7 @@ class RidesClientTests: XCTestCase { */ func testGetPaymentMethods() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getpaymentmethods.json", self.dynamicType)!, statusCode: 200, headers: nil) + return OHHTTPStubsResponse(fileAtPath: OHPathForFile("getPaymentMethods.json", self.dynamicType)!, statusCode: 200, headers: nil) } let expectation = expectationWithDescription("get payment methods") @@ -778,7 +778,7 @@ class RidesClientTests: XCTestCase { func testGetRideReceipt() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath: OHPathForFile("ridereceipt.json", self.dynamicType)!, statusCode: 200, headers: nil) + return OHHTTPStubsResponse(fileAtPath: OHPathForFile("rideReceipt.json", self.dynamicType)!, statusCode: 200, headers: nil) } let expectation = expectationWithDescription("ride receipt") @@ -801,7 +801,7 @@ class RidesClientTests: XCTestCase { func testGetRideMap() { stub(isHost("sandbox-api.uber.com")) { _ in - return OHHTTPStubsResponse(fileAtPath: OHPathForFile("ridemap.json", self.dynamicType)!, statusCode: 200, headers: nil) + return OHHTTPStubsResponse(fileAtPath: OHPathForFile("rideMap.json", self.dynamicType)!, statusCode: 200, headers: nil) } let expectation = expectationWithDescription("ride map") @@ -922,14 +922,14 @@ class RidesClientTests: XCTestCase { let tokenGroup = Configuration.getDefaultKeychainAccessGroup() keychainHelper.setAccessGroup(tokenGroup) - keychainHelper.setObject(token, key: tokenKey) + XCTAssertTrue(keychainHelper.setObject(token, key: tokenKey)) defer { - keychainHelper.deleteObjectForKey(tokenKey) + XCTAssertTrue(keychainHelper.deleteObjectForKey(tokenKey)) } let ridesClient = RidesClient() guard let accessToken = ridesClient.fetchAccessToken() else { - XCTAssert(false) + XCTFail("Unable to fetch Access Token") return } XCTAssertEqual(accessToken.tokenString, token.tokenString) @@ -961,126 +961,16 @@ class RidesClientTests: XCTestCase { let tokenGroup = Configuration.getDefaultKeychainAccessGroup() keychainHelper.setAccessGroup(tokenGroup) - keychainHelper.setObject(token, key: tokenKey) + XCTAssertTrue(keychainHelper.setObject(token, key: tokenKey)) defer { - keychainHelper.deleteObjectForKey(tokenKey) + XCTAssertTrue(keychainHelper.deleteObjectForKey(tokenKey)) } let ridesClient = RidesClient(accessTokenIdentifier: tokenKey) guard let accessToken = ridesClient.fetchAccessToken() else { - XCTAssert(false) - return - } - XCTAssertEqual(accessToken.tokenString, token.tokenString) - } - - /** - Test to check getting the access token when using the default ID and cusom group - and the token exists - */ - func testGetAccessTokenSuccess_defaultId_customGroup() { - let tokenData = [ "access_token" : "testAccessToken" ] - guard let token = AccessToken(JSON: tokenData) else { - XCTAssert(false) - return - } - let keychainHelper = KeychainWrapper() - - let tokenKey = Configuration.getDefaultAccessTokenIdentifier() - let tokenGroup = "newTokenGroup" - - keychainHelper.setAccessGroup(tokenGroup) - keychainHelper.setObject(token, key: tokenKey) - defer { - keychainHelper.deleteObjectForKey(tokenKey) - } - - let ridesClient = RidesClient(accessTokenIdentifier: tokenKey, keychainAccessGroup:tokenGroup) - guard let accessToken = ridesClient.fetchAccessToken() else { - XCTAssert(false) - return - } - XCTAssertEqual(accessToken.tokenString, token.tokenString) - } - - /** - Test to check getting the access token when using custom settings - and the token exists - */ - func testGetAccessTokenSuccess_customId_customGroup() { - let tokenData = [ "access_token" : "testAccessToken" ] - guard let token = AccessToken(JSON: tokenData) else { - XCTAssert(false) - return - } - let keychainHelper = KeychainWrapper() - - let tokenKey = "newTokenID" - let tokenGroup = "newTokenGroup" - - keychainHelper.setAccessGroup(tokenGroup) - keychainHelper.setObject(token, key: tokenKey) - defer { - keychainHelper.deleteObjectForKey(tokenKey) - } - - let ridesClient = RidesClient(accessTokenIdentifier: tokenKey, keychainAccessGroup:tokenGroup) - guard let accessToken = ridesClient.fetchAccessToken() else { - XCTAssert(false) + XCTFail("Unable to fetch Access Token") return } XCTAssertEqual(accessToken.tokenString, token.tokenString) } - - /** - Test to check getting the access token when using custom settings - and the token doesn't exist - */ - func testGetAccessTokenFailure_customId_customGroup() { - let tokenData = [ "access_token" : "testAccessToken" ] - guard let token = AccessToken(JSON: tokenData) else { - XCTAssert(false) - return - } - let keychainHelper = KeychainWrapper() - - let tokenKey = "newTokenID" - let tokenGroup = "newTokenGroup" - - keychainHelper.setAccessGroup(tokenGroup) - keychainHelper.setObject(token, key: tokenKey) - defer { - keychainHelper.deleteObjectForKey(tokenKey) - } - - let ridesClient = RidesClient() - let accessToken = ridesClient.fetchAccessToken() - XCTAssertNil(accessToken) - } - - /** - Test to check getting the access token fails when using a matching ID but different - group - */ - func testGetAccessTokenFailure_groupMismatch() { - let tokenData = [ "access_token" : "testAccessToken" ] - guard let token = AccessToken(JSON: tokenData) else { - XCTAssert(false) - return - } - let keychainHelper = KeychainWrapper() - - let tokenKey = "newTokenID" - let tokenGroup = "newTokenGroup" - - keychainHelper.setAccessGroup(tokenGroup) - keychainHelper.setObject(token, key: tokenKey) - defer { - keychainHelper.deleteObjectForKey(tokenKey) - } - - let ridesClient = RidesClient(accessTokenIdentifier: tokenKey) - let accessToken = ridesClient.fetchAccessToken() - XCTAssertNil(accessToken) - } } diff --git a/source/UberRidesTests/gethistory.json b/source/UberRidesTests/TestData/getHistory.json similarity index 100% rename from source/UberRidesTests/gethistory.json rename to source/UberRidesTests/TestData/getHistory.json diff --git a/source/UberRidesTests/getme.json b/source/UberRidesTests/TestData/getMe.json similarity index 100% rename from source/UberRidesTests/getme.json rename to source/UberRidesTests/TestData/getMe.json diff --git a/source/UberRidesTests/getpaymentmethods.json b/source/UberRidesTests/TestData/getPaymentMethods.json similarity index 100% rename from source/UberRidesTests/getpaymentmethods.json rename to source/UberRidesTests/TestData/getPaymentMethods.json diff --git a/source/UberRidesTests/getpriceestimates.json b/source/UberRidesTests/TestData/getPriceEstimates.json similarity index 100% rename from source/UberRidesTests/getpriceestimates.json rename to source/UberRidesTests/TestData/getPriceEstimates.json diff --git a/source/UberRidesTests/TestData/getPriceEstimatesEmpty.json b/source/UberRidesTests/TestData/getPriceEstimatesEmpty.json new file mode 100644 index 00000000..01f51abe --- /dev/null +++ b/source/UberRidesTests/TestData/getPriceEstimatesEmpty.json @@ -0,0 +1,3 @@ +{ + "prices": [] +} diff --git a/source/UberRidesTests/getproductid.json b/source/UberRidesTests/TestData/getProductID.json similarity index 100% rename from source/UberRidesTests/getproductid.json rename to source/UberRidesTests/TestData/getProductID.json diff --git a/source/UberRidesTests/getproducts.json b/source/UberRidesTests/TestData/getProducts.json similarity index 100% rename from source/UberRidesTests/getproducts.json rename to source/UberRidesTests/TestData/getProducts.json diff --git a/source/UberRidesTests/getrequest.json b/source/UberRidesTests/TestData/getRequest.json similarity index 100% rename from source/UberRidesTests/getrequest.json rename to source/UberRidesTests/TestData/getRequest.json diff --git a/source/UberRidesTests/gettimeestimateproduct.json b/source/UberRidesTests/TestData/getTimeEstimateProduct.json similarity index 100% rename from source/UberRidesTests/gettimeestimateproduct.json rename to source/UberRidesTests/TestData/getTimeEstimateProduct.json diff --git a/source/UberRidesTests/gettimeestimates.json b/source/UberRidesTests/TestData/getTimeEstimates.json similarity index 100% rename from source/UberRidesTests/gettimeestimates.json rename to source/UberRidesTests/TestData/getTimeEstimates.json diff --git a/source/UberRidesTests/TestData/getTimeEstimatesEmpty.json b/source/UberRidesTests/TestData/getTimeEstimatesEmpty.json new file mode 100644 index 00000000..8896e1ba --- /dev/null +++ b/source/UberRidesTests/TestData/getTimeEstimatesEmpty.json @@ -0,0 +1,3 @@ +{ + "times": [] +} diff --git a/source/UberRidesTests/place.json b/source/UberRidesTests/TestData/place.json similarity index 100% rename from source/UberRidesTests/place.json rename to source/UberRidesTests/TestData/place.json diff --git a/source/UberRidesTests/postrequests.json b/source/UberRidesTests/TestData/postRequests.json similarity index 100% rename from source/UberRidesTests/postrequests.json rename to source/UberRidesTests/TestData/postRequests.json diff --git a/source/UberRidesTests/refresh.json b/source/UberRidesTests/TestData/refresh.json similarity index 100% rename from source/UberRidesTests/refresh.json rename to source/UberRidesTests/TestData/refresh.json diff --git a/source/UberRidesTests/requestestimate.json b/source/UberRidesTests/TestData/requestEstimate.json similarity index 100% rename from source/UberRidesTests/requestestimate.json rename to source/UberRidesTests/TestData/requestEstimate.json diff --git a/source/UberRidesTests/RequestEstimateNoCars.json b/source/UberRidesTests/TestData/requestEstimateNoCars.json similarity index 100% rename from source/UberRidesTests/RequestEstimateNoCars.json rename to source/UberRidesTests/TestData/requestEstimateNoCars.json diff --git a/source/UberRidesTests/ridemap.json b/source/UberRidesTests/TestData/rideMap.json similarity index 100% rename from source/UberRidesTests/ridemap.json rename to source/UberRidesTests/TestData/rideMap.json diff --git a/source/UberRidesTests/ridereceipt.json b/source/UberRidesTests/TestData/rideReceipt.json similarity index 100% rename from source/UberRidesTests/ridereceipt.json rename to source/UberRidesTests/TestData/rideReceipt.json diff --git a/source/UberRidesTests/RideReceiptNullSurgeTotalOwed.json b/source/UberRidesTests/TestData/rideReceiptNullSurgeTotalOwed.json similarity index 100% rename from source/UberRidesTests/RideReceiptNullSurgeTotalOwed.json rename to source/UberRidesTests/TestData/rideReceiptNullSurgeTotalOwed.json diff --git a/source/UberRidesTests/testInfo.plist b/source/UberRidesTests/TestData/testInfo.plist similarity index 100% rename from source/UberRidesTests/testInfo.plist rename to source/UberRidesTests/TestData/testInfo.plist diff --git a/source/UberRidesTests/testInfoMissingCallbacks.plist b/source/UberRidesTests/TestData/testInfoMissingCallbacks.plist similarity index 100% rename from source/UberRidesTests/testInfoMissingCallbacks.plist rename to source/UberRidesTests/TestData/testInfoMissingCallbacks.plist diff --git a/source/UberRidesTests/testInfoNoServerToken.plist b/source/UberRidesTests/TestData/testInfoNoServerToken.plist similarity index 100% rename from source/UberRidesTests/testInfoNoServerToken.plist rename to source/UberRidesTests/TestData/testInfoNoServerToken.plist diff --git a/source/UberRidesTests/TokenManagerTests.swift b/source/UberRidesTests/TokenManagerTests.swift index a72c22c1..f5faacd0 100644 --- a/source/UberRidesTests/TokenManagerTests.swift +++ b/source/UberRidesTests/TokenManagerTests.swift @@ -47,65 +47,59 @@ class TokenManagerTests: XCTestCase { func testSave() { let identifier = "testIdentifier" - let accessGroup = "testAccessGroup" let token = getTestToken() - XCTAssertTrue(TokenManager.saveToken(token, tokenIdentifier:identifier, accessGroup: accessGroup)) - - keychain?.setAccessGroup(accessGroup) + XCTAssertTrue(TokenManager.saveToken(token, tokenIdentifier:identifier)) + guard let actualToken = keychain?.getObjectForKey(identifier) as? AccessToken else { - XCTAssert(false) + XCTFail("Unable to fetch token") return } XCTAssertEqual(actualToken.tokenString, token.tokenString) - keychain?.deleteObjectForKey(identifier) + XCTAssertTrue(keychain!.deleteObjectForKey(identifier)) } func testSave_firesNotification() { let identifier = "testIdentifier" - let accessGroup = "testAccessGroup" let token = getTestToken() NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(handleTokenManagerNotifications), name: TokenManager.TokenManagerDidSaveTokenNotification, object: nil) - XCTAssertTrue(TokenManager.saveToken(token, tokenIdentifier:identifier, accessGroup: accessGroup)) + XCTAssertTrue(TokenManager.saveToken(token, tokenIdentifier:identifier)) NSNotificationCenter.defaultCenter().removeObserver(self) - - keychain?.setAccessGroup(accessGroup) + guard let actualToken = keychain?.getObjectForKey(identifier) as? AccessToken else { - XCTAssert(false) + XCTFail("Unable to fetch token") return } XCTAssertEqual(actualToken.tokenString, token.tokenString) XCTAssertTrue(notificationFired) - keychain?.deleteObjectForKey(identifier) + XCTAssertTrue(keychain!.deleteObjectForKey(identifier)) } func testGet() { let identifier = "testIdentifier" - let accessGroup = "testAccessGroup" let token = getTestToken() + + XCTAssertTrue(keychain!.setObject(token, key: identifier)) - keychain?.setAccessGroup(accessGroup) - keychain?.setObject(token, key: identifier) - - let actualToken = TokenManager.fetchToken(identifier, accessGroup: accessGroup) + let actualToken = TokenManager.fetchToken(identifier) XCTAssertNotNil(actualToken) XCTAssertEqual(actualToken?.tokenString, token.tokenString) - keychain?.deleteObjectForKey(identifier) + XCTAssertTrue(keychain!.deleteObjectForKey(identifier)) } func testGet_nonExistent() { @@ -116,19 +110,17 @@ class TokenManagerTests: XCTestCase { func testDelete() { let identifier = "testIdentifier" - let accessGroup = "testAccessGroup" let token = getTestToken() + + XCTAssertTrue(keychain!.setObject(token, key: identifier)) - keychain?.setAccessGroup(accessGroup) - keychain?.setObject(token, key: identifier) - - XCTAssertTrue(TokenManager.deleteToken(identifier, accessGroup: accessGroup)) + XCTAssertTrue(TokenManager.deleteToken(identifier)) let actualToken = keychain?.getObjectForKey(identifier) as? AccessToken guard actualToken == nil else { - XCTAssert(false) - keychain?.deleteObjectForKey(identifier) + XCTFail("Token should have been deleted") + XCTAssertTrue(keychain!.deleteObjectForKey(identifier)) return } } @@ -143,16 +135,14 @@ class TokenManagerTests: XCTestCase { func testDelete_firesNotification() { let identifier = "testIdentifier" - let accessGroup = "testAccessGroup" let token = getTestToken() - - keychain?.setAccessGroup(accessGroup) - keychain?.setObject(token, key: identifier) + + XCTAssertTrue(keychain!.setObject(token, key: identifier)) NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(handleTokenManagerNotifications), name: TokenManager.TokenManagerDidDeleteTokenNotification, object: nil) - XCTAssertTrue(TokenManager.deleteToken(identifier, accessGroup: accessGroup)) + XCTAssertTrue(TokenManager.deleteToken(identifier)) NSNotificationCenter.defaultCenter().removeObserver(self) @@ -160,8 +150,8 @@ class TokenManagerTests: XCTestCase { let actualToken = keychain?.getObjectForKey(identifier) as? AccessToken guard actualToken == nil else { - XCTAssert(false) - keychain?.deleteObjectForKey(identifier) + XCTFail("Token should have been deleted") + XCTAssertTrue(keychain!.deleteObjectForKey(identifier)) return } } @@ -201,14 +191,12 @@ class TokenManagerTests: XCTestCase { XCTAssertEqual(cookieStorage.cookiesForURL(chinaURL)?.count, 2) let identifier = "testIdentifier" - let accessGroup = "testAccessGroup" let token = getTestToken() - - keychain?.setAccessGroup(accessGroup) + keychain?.setObject(token, key: identifier) - XCTAssertTrue(TokenManager.deleteToken(identifier, accessGroup: accessGroup)) + XCTAssertTrue(TokenManager.deleteToken(identifier)) let actualToken = keychain?.getObjectForKey(identifier) as? AccessToken guard actualToken == nil else {