diff --git a/Gigya.podspec b/Gigya.podspec index 9565f4a0..c1360d67 100644 --- a/Gigya.podspec +++ b/Gigya.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'Gigya' - spec.version = '1.6.1' + spec.version = '1.6.2' spec.license = 'Apache 2.0' spec.homepage = 'https://developers.gigya.com/display/GD/Swift+SDK' spec.author = 'Gigya SAP' @@ -10,7 +10,7 @@ Pod::Spec.new do |spec| your Swift application DESC - spec.source = { :git => 'https://github.com/SAP/gigya-swift-sdk.git', :tag => 'core/v1.6.1' } + spec.source = { :git => 'https://github.com/SAP/gigya-swift-sdk.git', :tag => 'core/v1.6.2' } spec.module_name = 'Gigya' spec.swift_version = '5.3' diff --git a/GigyaSwift.xcodeproj/project.pbxproj b/GigyaSwift.xcodeproj/project.pbxproj index f10d1c85..a161be4e 100644 --- a/GigyaSwift.xcodeproj/project.pbxproj +++ b/GigyaSwift.xcodeproj/project.pbxproj @@ -124,6 +124,10 @@ E760668C2278998E005E4CFD /* WebViewWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = E76066892278998E005E4CFD /* WebViewWrapper.swift */; }; E760668D2278998E005E4CFD /* GigyaWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E760668A2278998E005E4CFD /* GigyaWebViewController.swift */; }; E76421DF25E2BFEB00CDED4C /* ApiRequestModel+GlobalConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = E76421DE25E2BFEB00CDED4C /* ApiRequestModel+GlobalConfig.swift */; }; + E76A94C12BFF6E9A00862A4B /* App.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = E732A82328BB55240035DDEA /* App.xcframework */; }; + E76A94C22BFF6E9A00862A4B /* App.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E732A82328BB55240035DDEA /* App.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + E76A94C32BFF6E9A00862A4B /* Flutter.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = E732A82428BB55240035DDEA /* Flutter.xcframework */; }; + E76A94C42BFF6E9A00862A4B /* Flutter.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E732A82428BB55240035DDEA /* Flutter.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; E76AF6EB24C88BA8008B9114 /* ApiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E76AF6EA24C88BA8008B9114 /* ApiService.swift */; }; E76B94F7285089D100E63E3B /* GigyaAuth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E779232526A04F1E00446A7F /* GigyaAuth.framework */; }; E76B94F8285089D100E63E3B /* GigyaAuth.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E779232526A04F1E00446A7F /* GigyaAuth.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -163,10 +167,6 @@ E7ACF9AE226C843100900C65 /* SessionServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7ACF9AD226C843100900C65 /* SessionServiceProtocol.swift */; }; E7ACF9B0226C844A00900C65 /* AccountServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7ACF9AF226C844A00900C65 /* AccountServiceProtocol.swift */; }; E7ACF9CC226F2A4100900C65 /* ProviderWrapperProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7ACF9CB226F2A4100900C65 /* ProviderWrapperProtocol.swift */; }; - E7B16EAC2BA045EE005DD81E /* App.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = E732A82328BB55240035DDEA /* App.xcframework */; }; - E7B16EAD2BA045EE005DD81E /* App.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E732A82328BB55240035DDEA /* App.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - E7B16EAE2BA045EE005DD81E /* Flutter.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = E732A82428BB55240035DDEA /* Flutter.xcframework */; }; - E7B16EAF2BA045EE005DD81E /* Flutter.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E732A82428BB55240035DDEA /* Flutter.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; E7B2FA9525F0FAF6002A7010 /* GigyaSchema.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7B2FA9425F0FAF6002A7010 /* GigyaSchema.swift */; }; E7B4D69C238329F50090E57D /* PushNotificationsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E720D34B2382D32300446EA4 /* PushNotificationsService.swift */; }; E7B5408A23952E2200C0C8D8 /* UserNotificationCenterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7B5408923952E2200C0C8D8 /* UserNotificationCenterProtocol.swift */; }; @@ -319,9 +319,9 @@ E76B94F8285089D100E63E3B /* GigyaAuth.framework in Embed Frameworks */, E732A83028BB62720035DDEA /* (null) in Embed Frameworks */, E7A5329A2AE7B039005F3662 /* GigyaTfa.xcframework in Embed Frameworks */, - E7B16EAF2BA045EE005DD81E /* Flutter.xcframework in Embed Frameworks */, + E76A94C42BFF6E9A00862A4B /* Flutter.xcframework in Embed Frameworks */, E76B94FA285089EF00E63E3B /* GigyaNss.framework in Embed Frameworks */, - E7B16EAD2BA045EE005DD81E /* App.xcframework in Embed Frameworks */, + E76A94C22BFF6E9A00862A4B /* App.xcframework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -684,11 +684,11 @@ files = ( E7DC2C6D2280778000A13426 /* libc++.tbd in Frameworks */, E7DC2C6C2280771700A13426 /* libz.tbd in Frameworks */, - E7B16EAC2BA045EE005DD81E /* App.xcframework in Frameworks */, + E76A94C12BFF6E9A00862A4B /* App.xcframework in Frameworks */, E7A532992AE7B039005F3662 /* GigyaTfa.xcframework in Frameworks */, E76B94F7285089D100E63E3B /* GigyaAuth.framework in Frameworks */, E76B94F9285089EF00E63E3B /* GigyaNss.framework in Frameworks */, - E7B16EAE2BA045EE005DD81E /* Flutter.xcframework in Frameworks */, + E76A94C32BFF6E9A00862A4B /* Flutter.xcframework in Frameworks */, E7DC2C6B228076E600A13426 /* libsqlite3.tbd in Frameworks */, E73373F522633BDA00ADEDBB /* SafariServices.framework in Frameworks */, E731B72D232A53AD0032E111 /* AuthenticationServices.framework in Frameworks */, @@ -2605,7 +2605,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.6.0; + MARKETING_VERSION = 1.6.2; MODULEMAP_FILE = ""; MODULEMAP_PRIVATE_FILE = ""; ONLY_ACTIVE_ARCH = NO; @@ -2666,7 +2666,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.6.0; + MARKETING_VERSION = 1.6.2; MODULEMAP_FILE = ""; MODULEMAP_PRIVATE_FILE = ""; ONLY_ACTIVE_ARCH = NO; diff --git a/GigyaSwift.xcworkspace/xcuserdata/i507698.xcuserdatad/UserInterfaceState.xcuserstate b/GigyaSwift.xcworkspace/xcuserdata/i507698.xcuserdatad/UserInterfaceState.xcuserstate index ecaf8e07..7b3f915a 100644 Binary files a/GigyaSwift.xcworkspace/xcuserdata/i507698.xcuserdatad/UserInterfaceState.xcuserstate and b/GigyaSwift.xcworkspace/xcuserdata/i507698.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/GigyaSwift/Gigya/GigyaCore.swift b/GigyaSwift/Gigya/GigyaCore.swift index 8993e823..4f724ffa 100644 --- a/GigyaSwift/Gigya/GigyaCore.swift +++ b/GigyaSwift/Gigya/GigyaCore.swift @@ -533,6 +533,10 @@ public final class GigyaCore: GigyaInstanceProtocol { } // MARK: Global methods + + public func getAuthCode(completion: @escaping (GigyaApiResult) -> Void) { + businessApiService.getAuthCode(completion: completion) + } /** Register Social Provider without reflection. @@ -712,5 +716,19 @@ public extension GigyaCore { } }) } + + func getAuthCode() async throws -> String { + return try await withCheckedThrowingContinuation({ + (continuation: CheckedContinuation) in + self.getAuthCode() { result in + switch result { + case .success(data: let data): + continuation.resume(returning: data) + case .failure(let error): + continuation.resume(throwing: error) + } + } + }) + } } diff --git a/GigyaSwift/Global/Api/BusinessApiService.swift b/GigyaSwift/Global/Api/BusinessApiService.swift index c64d7aaa..6f647f09 100644 --- a/GigyaSwift/Global/Api/BusinessApiService.swift +++ b/GigyaSwift/Global/Api/BusinessApiService.swift @@ -117,7 +117,7 @@ class BusinessApiService: NSObject, BusinessApiServiceProtocol { } func register(email: String, password: String, params: [String: Any], dataType: T.Type, completion: @escaping (GigyaLoginResult) -> Void) { - let model = ApiRequestModel(method: GigyaDefinitions.API.initRegistration) + let model = ApiRequestModel(method: GigyaDefinitions.API.initRegistration, config: config) apiService.send(model: model, responseType: [String: AnyCodable].self) { [weak self] (result) in switch result { @@ -158,7 +158,7 @@ class BusinessApiService: NSObject, BusinessApiServiceProtocol { } func login(params: [String: Any], completion: @escaping (GigyaLoginResult) -> Void) { - let model = ApiRequestModel(method: GigyaDefinitions.API.login, params: params) + let model = ApiRequestModel(method: GigyaDefinitions.API.login, params: params, config: config) apiService.send(model: model, responseType: T.self) { [weak self] result in switch result { @@ -373,6 +373,25 @@ class BusinessApiService: NSObject, BusinessApiServiceProtocol { } } } + + func getAuthCode(completion: @escaping (GigyaApiResult) -> Void) { + let params = ["resource": "urn:gigya:account", + "subject_token_type": "urn:gigya:token-type:mobile", + "response_type": "code" + ] + let model = ApiRequestModel(method: "accounts.identity.token.exchange", params: params) + + apiService.send(model: model, responseType: GigyaDictionary.self) { result in + switch result { + case .success(let data): + let code = data["code"]?.value as? String ?? "" + completion(.success(data: code)) + case .failure(let error): + completion(.failure(error)) + } + } + + } // MARK: - Internal methods diff --git a/GigyaSwift/Global/Api/BusinessApiServiceProtocol.swift b/GigyaSwift/Global/Api/BusinessApiServiceProtocol.swift index 4eb806e9..79ec94cc 100644 --- a/GigyaSwift/Global/Api/BusinessApiServiceProtocol.swift +++ b/GigyaSwift/Global/Api/BusinessApiServiceProtocol.swift @@ -69,5 +69,7 @@ public protocol BusinessApiServiceProtocol { func getSchema(params: [String: Any], completion: @escaping (GigyaApiResult) -> Void) func verifySession(params: [String: Any], completion: @escaping (GigyaApiResult) -> Void) + + func getAuthCode(completion: @escaping (GigyaApiResult) -> Void) } diff --git a/GigyaSwift/Global/Plugins/GigyaWebBridge.swift b/GigyaSwift/Global/Plugins/GigyaWebBridge.swift index 96debc7c..ab486e38 100644 --- a/GigyaSwift/Global/Plugins/GigyaWebBridge.swift +++ b/GigyaSwift/Global/Plugins/GigyaWebBridge.swift @@ -253,7 +253,7 @@ open class GigyaWebBridge: NSObject, WKScriptMessageHan /** Delegate received plugin events to client. */ - private func onPluginEvent(type: T.Type, params: [String: String]) { + private func onPluginEvent(type: B.Type, params: [String: String]) { if let eventName = params["eventName"] { switch eventName { case "beforeScreenLoad": diff --git a/GigyaSwift/Models/Config/InternalConfig.swift b/GigyaSwift/Models/Config/InternalConfig.swift index ef95ccc2..373488d2 100644 --- a/GigyaSwift/Models/Config/InternalConfig.swift +++ b/GigyaSwift/Models/Config/InternalConfig.swift @@ -10,7 +10,7 @@ import Foundation struct InternalConfig { struct General { - internal static let version = "\(GigyaDefinitions.versionPrefix ?? "")ios_swift_1.6.1" + internal static let version = "\(GigyaDefinitions.versionPrefix ?? "")ios_swift_1.6.2" internal static let sdkDomain = "com.gigya.GigyaSDK" internal static let defaultLang = "en" }