Skip to content

Commit

Permalink
fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
yagu-osakana committed Oct 17, 2023
1 parent ec55680 commit d246ac0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 37 deletions.
8 changes: 0 additions & 8 deletions YJLoginSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
B1C8D74222C475FA004CF30C /* UserAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C8D74122C475FA004CF30C /* UserAgent.swift */; };
B1C8D74422C47BFC004CF30C /* AuthenticationProcess.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C8D74322C47BFC004CF30C /* AuthenticationProcess.swift */; };
B1C8D74622C4A6FC004CF30C /* ASWebAuthenticationSessionUserAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C8D74522C4A6FC004CF30C /* ASWebAuthenticationSessionUserAgent.swift */; };
B1C8D74822C4A727004CF30C /* SFAuthenticationSessionUserAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C8D74722C4A727004CF30C /* SFAuthenticationSessionUserAgent.swift */; };
B1C8D74A22C4A746004CF30C /* SFSafariViewControllerUserAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C8D74922C4A746004CF30C /* SFSafariViewControllerUserAgent.swift */; };
B1C8D74C22C4BD87004CF30C /* AuthenticationResponseError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C8D74B22C4BD87004CF30C /* AuthenticationResponseError.swift */; };
B1C8D74F22C5089F004CF30C /* AuthenticationProcessTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C8D74E22C5089F004CF30C /* AuthenticationProcessTests.swift */; };
B1C8D75222C5B19A004CF30C /* Scope.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C8D75122C5B19A004CF30C /* Scope.swift */; };
Expand Down Expand Up @@ -115,8 +113,6 @@
B1C8D74122C475FA004CF30C /* UserAgent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserAgent.swift; sourceTree = "<group>"; };
B1C8D74322C47BFC004CF30C /* AuthenticationProcess.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationProcess.swift; sourceTree = "<group>"; };
B1C8D74522C4A6FC004CF30C /* ASWebAuthenticationSessionUserAgent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ASWebAuthenticationSessionUserAgent.swift; sourceTree = "<group>"; };
B1C8D74722C4A727004CF30C /* SFAuthenticationSessionUserAgent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAuthenticationSessionUserAgent.swift; sourceTree = "<group>"; };
B1C8D74922C4A746004CF30C /* SFSafariViewControllerUserAgent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFSafariViewControllerUserAgent.swift; sourceTree = "<group>"; };
B1C8D74B22C4BD87004CF30C /* AuthenticationResponseError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationResponseError.swift; sourceTree = "<group>"; };
B1C8D74E22C5089F004CF30C /* AuthenticationProcessTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationProcessTests.swift; sourceTree = "<group>"; };
B1C8D75122C5B19A004CF30C /* Scope.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Scope.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -212,8 +208,6 @@
isa = PBXGroup;
children = (
B1C8D74522C4A6FC004CF30C /* ASWebAuthenticationSessionUserAgent.swift */,
B1C8D74722C4A727004CF30C /* SFAuthenticationSessionUserAgent.swift */,
B1C8D74922C4A746004CF30C /* SFSafariViewControllerUserAgent.swift */,
B1C8D74122C475FA004CF30C /* UserAgent.swift */,
);
path = UserAgent;
Expand Down Expand Up @@ -470,7 +464,6 @@
buildActionMask = 2147483647;
files = (
B10A5EB8230BECA600EBB294 /* LoginButton.swift in Sources */,
B1C8D74822C4A727004CF30C /* SFAuthenticationSessionUserAgent.swift in Sources */,
B1D5762422D884E100A85071 /* OptionalParameters.swift in Sources */,
B10562CC2398A62D00359322 /* Data+base64url.swift in Sources */,
B10FE25E22C10910000EEC85 /* URLComponents+FormUrlencode.swift in Sources */,
Expand All @@ -480,7 +473,6 @@
B1DCE1FA22B265C8005F5703 /* LoginManager.swift in Sources */,
B1C8D75422C5B1C0004CF30C /* ResponseType.swift in Sources */,
B1C8D74622C4A6FC004CF30C /* ASWebAuthenticationSessionUserAgent.swift in Sources */,
B1C8D74A22C4A746004CF30C /* SFSafariViewControllerUserAgent.swift in Sources */,
B1EEBF2F22FD4BC1009F600D /* Constant.swift in Sources */,
B1C8D75822C5B200004CF30C /* Prompt.swift in Sources */,
B10FE25422BBEC87000EEC85 /* LoginError.swift in Sources */,
Expand Down
24 changes: 2 additions & 22 deletions YJLoginSDK/AuthenticationProcess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ internal class AuthenticationProcess: AuthenticationProcessProtocol {
var enableUniversalLinks: Bool = true

init(viewController: UIViewController?) {
if #available(iOS 12.0, *) {
ua = ASWebAuthenticationSessionUserAgent()
} else if #available(iOS 11.0, *) {
ua = SFAuthenticationSessionUserAgent()
} else {
ua = SFSafariViewControllerUserAgent()
}
ua = ASWebAuthenticationSessionUserAgent()
self.viewController = viewController
}

Expand All @@ -41,21 +35,7 @@ internal class AuthenticationProcess: AuthenticationProcessProtocol {

private func convertLoginError(url: URL?, error: Error?) -> Result<LoginResult, LoginError> {
if let error = error {
if #available(iOS 12.0, *) {
if case ASWebAuthenticationSessionError.canceledLogin = error {
return .failure(.userCancel)
}
return .failure(.undefinedError(error: error))
}

if #available(iOS 11.0, *) {
if case SFAuthenticationError.canceledLogin.rawValue = (error as NSError).code {
return .failure(.userCancel)
}
return .failure(.undefinedError(error: error))
}

if case SFSafariViewControllerUserAgentError.userCancel = error {
if case ASWebAuthenticationSessionError.canceledLogin = error {
return .failure(.userCancel)
}
return .failure(.undefinedError(error: error))
Expand Down
8 changes: 1 addition & 7 deletions YJLoginSDKTests/AuthenticationProcessTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@ class AuthenticationProcessTests: XCTestCase {

func test_user_cancel() {
let error: Error!
if #available(iOS 12.0, *) {
error = ASWebAuthenticationSessionError.init(.canceledLogin)
} else if #available(iOS 11.0, *) {
error = SFAuthenticationError.init(.canceledLogin)
} else {
error = SFSafariViewControllerUserAgentError.userCancel
}
error = ASWebAuthenticationSessionError.init(.canceledLogin)

let stub = StubUserAgent(result: .failure(error))
process = AuthenticationProcess(ua: stub)
Expand Down

0 comments on commit d246ac0

Please sign in to comment.