-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto stash before merge of "main" and "origin/main"
- Loading branch information
Showing
3 changed files
with
106 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
example/BitsBytes/Services/GigyaProviders/GoogleWrapper 2.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// GoogleWrapper.swift | ||
// GigyaSwift | ||
// | ||
// Created by Shmuel, Sagi on 15/07/2023. | ||
// Copyright © 2019 Gigya. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import GoogleSignIn | ||
import Gigya | ||
|
||
// MARK: - for Gigya v1.7.0+ | ||
// MARK: - Google Sign In V7 wrapper | ||
|
||
class GoogleWrapper: ProviderWrapperProtocol { | ||
var clientID: String? = { | ||
return Bundle.main.infoDictionary?["GoogleClientID"] as? String | ||
}() | ||
|
||
var googleServerClientID: String? { | ||
return Bundle.main.infoDictionary?["GoogleServerClientID"] as? String | ||
} | ||
|
||
required init() { | ||
} | ||
|
||
func login(params: [String: Any]? = nil, viewController: UIViewController? = nil, | ||
completion: @escaping (_ jsonData: [String: Any]?, _ error: String?) -> Void) { | ||
guard let clientID = self.clientID, let viewController = viewController else { | ||
GigyaLogger.log(with: self, message: "clientID not found.") | ||
return | ||
} | ||
|
||
let signInConfig = GIDConfiguration.init(clientID: clientID, serverClientID: googleServerClientID) | ||
|
||
GIDSignIn.sharedInstance.configuration = signInConfig | ||
|
||
GIDSignIn.sharedInstance.signIn(withPresenting: viewController) { user, error in | ||
guard error == nil else { | ||
completion(nil, error?.localizedDescription) | ||
return | ||
} | ||
|
||
let jsonData: [String: Any] = ["idToken": user?.user.idToken?.tokenString ?? ""] | ||
|
||
completion(jsonData, nil) | ||
} | ||
} | ||
|
||
func logout() { | ||
GIDSignIn.sharedInstance.signOut() | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
example/BitsBytes/Services/GigyaProviders/LineWrapper 2.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// LineWrapper.swift | ||
// GigyaSwift | ||
// | ||
// Created by Shmuel, Sagi on 02/05/2019. | ||
// Copyright © 2019 Gigya. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import LineSDK | ||
import Gigya | ||
|
||
// MARK: - for Gigya v1.7.0+ | ||
|
||
class LineWrapper: ProviderWrapperProtocol { | ||
var clientID: String? | ||
|
||
private lazy var lineLogin: LoginManager = LoginManager.shared | ||
|
||
required init() { } | ||
|
||
func login(params: [String: Any]? = nil, viewController: UIViewController? = nil, | ||
completion: @escaping (_ jsonData: [String: Any]?, _ error: String?) -> Void) { | ||
lineLogin.login(permissions: [.profile], in: viewController) { result in | ||
switch result { | ||
case .success(let loginResult): | ||
let jsonData = ["authToken": loginResult.accessToken.value] | ||
|
||
completion(jsonData, nil) | ||
case .failure(let error): | ||
completion(nil, error.localizedDescription) | ||
} | ||
} | ||
} | ||
} | ||
|