Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove UberButton_DEPRECATED #312

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Sources/UberAuth/Authorize/AuthenticationSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class AuthenticationSession: AuthenticationSessioning {
completion(.failure(UberAuthError.invalidAuthCode))
case (.some(let url), _):
guard let code = Self.parse(url: url) else {
completion(.failure(UberAuthError.invalidAuthCode))
completion(.failure(Self.parseError(url: url)))
return
}
completion(.success(.init(authorizationCode: code)))
Expand Down Expand Up @@ -68,6 +68,19 @@ final class AuthenticationSession: AuthenticationSessioning {
}
return codeParameter.value
}

private static func parseError(url: URL) -> UberAuthError {
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false),
let errorParameter = components.queryItems?.first(where: { $0.name == "error" })?.value else {
return .invalidAuthCode
}
switch OAuthError(rawValue: errorParameter) {
case .some(let error):
return UberAuthError.oAuth(error)
case .none:
return .invalidAuthCode
}
}
}

final class AuthPresentationContextProvider: NSObject, ASWebAuthenticationPresentationContextProviding {
Expand Down
4 changes: 2 additions & 2 deletions Sources/UberAuth/Button/LoginButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public final class LoginButton: UberButton {

// MARK: UberButton

override public var title: String {
buttonState.title
public override var title: NSAttributedString? {
NSAttributedString(string: buttonState.title)
}

override public var image: UIImage? {
Expand Down
14 changes: 10 additions & 4 deletions Sources/UberCore/Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@

import UIKit

extension UIColor {
public extension UIColor {

static let uberButtonBackground: UIColor = UIColor(
named: "UberButtonBackground",
in: .resource(for: UberButton.self),
compatibleWith: nil
) ?? UIColor.darkText

static let uberButtonHighlightedBackground: UIColor = UIColor(
named: "UberButtonHighlightedBackground",
in: .resource(for: UberButton.self),
static let uberButtonHighlightedDarkBackground: UIColor = UIColor(
named: "UberButtonHighlightedDarkBackground",
in: .module,
compatibleWith: nil
) ?? UIColor.darkText

static let uberButtonHighlightedLightBackground: UIColor = UIColor(
named: "UberButtonHighlightedLightBackground",
in: .module,
compatibleWith: nil
) ?? UIColor.darkText

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xE4",
"green" : "0xE5",
"red" : "0xE5"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x27",
"green" : "0x27",
"red" : "0x28"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Loading