Skip to content

Commit

Permalink
fix bug for link account v2
Browse files Browse the repository at this point in the history
  • Loading branch information
sagishm committed Jun 9, 2024
1 parent ff4c088 commit 463f19a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Gigya.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'Gigya'
spec.version = '1.6.2'
spec.version = '1.6.3'
spec.license = 'Apache 2.0'
spec.homepage = 'https://developers.gigya.com/display/GD/Swift+SDK'
spec.author = 'Gigya SAP'
Expand All @@ -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.2' }
spec.source = { :git => 'https://github.com/SAP/gigya-swift-sdk.git', :tag => 'core/v1.6.3' }
spec.module_name = 'Gigya'
spec.swift_version = '5.3'

Expand Down
4 changes: 2 additions & 2 deletions GigyaSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2605,7 +2605,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.6.2;
MARKETING_VERSION = 1.6.3;
MODULEMAP_FILE = "";
MODULEMAP_PRIVATE_FILE = "";
ONLY_ACTIVE_ARCH = NO;
Expand Down Expand Up @@ -2666,7 +2666,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.6.2;
MARKETING_VERSION = 1.6.3;
MODULEMAP_FILE = "";
MODULEMAP_PRIVATE_FILE = "";
ONLY_ACTIVE_ARCH = NO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<key>GigyaUITestsApp.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>32</integer>
<integer>35</integer>
</dict>
<key>GigyaXC.xcscheme_^#shared#^_</key>
<dict>
Expand Down
Binary file not shown.
8 changes: 7 additions & 1 deletion GigyaSwift/Global/Plugins/GigyaWebBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ open class GigyaWebBridge<T: GigyaAccountProtocol>: NSObject, WKScriptMessageHan
case "afterSubmit":
completion(.onAfterSubmit(event: params))
case "hide":
completion(.onHide(event: params))
handleOnHide(params: params)
case "error":
completion(.error(event: params))
case "fieldChanged":
Expand All @@ -281,6 +281,12 @@ open class GigyaWebBridge<T: GigyaAccountProtocol>: NSObject, WKScriptMessageHan
}
}
}

private func handleOnHide(params: [String: String]) {
if interruptionManager.resolverIsActive == false {
completion(.onHide(event: params))
}
}

/**
Generic send request method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class WebBridgeFroceLoginResolver: WebBridgeResolver {
switch result {
case .success(data: let userdata):
completion(.onLogin(account: userdata))
completion(.onHide(event: ["isFlowFinalized": "true"]))
case .failure(_):
break
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ enum WebBridgeInterruption: Int {
}

public protocol WebBridgeInterruptionResolverFactoryProtocol {
var resolverIsActive: Bool { get }

func interruptionHandler(error: NetworkError)

func responseManager<T: GigyaAccountProtocol>(apiMethod: String, params: [String: String], data: T, completion: @escaping (GigyaPluginEvent<T>) -> Void)
Expand All @@ -33,6 +35,10 @@ class WebBridgeInterruptionManager: WebBridgeInterruptionResolverFactoryProtocol
}
}

var resolverIsActive: Bool {
return resolver != nil
}

init(busnessApi: BusinessApiDelegate, accountService: AccountServiceProtocol) {
self.busnessApi = busnessApi
self.accountService = accountService
Expand Down
13 changes: 6 additions & 7 deletions GigyaSwift/Global/Resolvers/InterruptionResolverFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,8 @@ final class InterruptionResolverFactory: InterruptionResolverFactoryProtocol {
// get all data from request
let dataResponse = data.toDictionary()

guard let regToken = dataResponse["regToken"] as? String else {
GigyaLogger.log(with: self, message: "[interruptionResolver] - regToken not exists")

forwordFailed(error: error, completion: completion)
return
}

let regToken = getRegToken(from: dataResponse)

switch errorCode {
case .pendingRegistration:
// pending registration
Expand Down Expand Up @@ -82,4 +77,8 @@ final class InterruptionResolverFactory: InterruptionResolverFactoryProtocol {
let loginError = LoginApiError<T>(error: error, interruption: nil)
completion(.failure(loginError))
}

private func getRegToken(from data: [String: Any]) -> String {
return data["regToken"] as? String ?? ""
}
}
2 changes: 1 addition & 1 deletion GigyaSwift/Models/Config/InternalConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

struct InternalConfig {
struct General {
internal static let version = "\(GigyaDefinitions.versionPrefix ?? "")ios_swift_1.6.2"
internal static let version = "\(GigyaDefinitions.versionPrefix ?? "")ios_swift_1.6.3"
internal static let sdkDomain = "com.gigya.GigyaSDK"
internal static let defaultLang = "en"
}
Expand Down

0 comments on commit 463f19a

Please sign in to comment.