Check specific API response onHide() callback

41 Views Asked by At

I am showing the Login/Registration Screen-set on click of the button using below code. I am passing the pre-defined Screen-set name/ID.

gigya.showScreenSet(screenSet,
            true, map,
            object : GigyaPluginCallback<MyAccount>()

Above code is opening registration form by GigyaSDK using webview. On click of the Submit button I am getting the below callback.

override fun onHide(event: GigyaPluginEvent, reason: String?) {
                    Log.d(GIGYA, "onHide" + reason)
                    if (reason != null) {
                        when (reason) {
                           gigya.verifySession()
                            GigyaDefinitions.Plugin.FINISHED ->     {                                                            
                                    if (gigya.isLoggedIn) {
                                        gigya.getAccount(true,object : GigyaCallbackMyAccount>() {
                                            override fun onSuccess(obj: MyAccount?) {                                    
                                                    callBack.onSuccess(account)
                                                }
                                            }
                                            override fun onError(error: GigyaError?) {
                                                callBack.onError(error?.localizedMessage!!)
                                               
                                            }
                                        })
                                }
                                
                                return
                            }
                            GigyaDefinitions.Plugin.CANCELED -> {
                                callBack.onError(reason)
                                Log.d(GIGYA, "OnCancelled")
                            }

                        }
                    }
                }

Problem :: On click of Submit button, Admin team is hitting one API which is accounts.finalizeregistration() to set the user data into their database. But I am getting the onHide() callback very instantly as soon as the form is finished. But API call is still running in the background and due to this whenever I tried to fetch the updated userAccount data, I am getting error from SDK.

So is there any way to check the API call is completed successfully and there after I can proceed with the UI update at my end?

0

There are 0 best solutions below