SAP / gigya-android-sdk

SAP CDC (Gigya) android sdk for mobile
Apache License 2.0
19 stars 13 forks source link

check specific API response onHide() callback #47

Closed MandaliaBhavik closed 11 months ago

MandaliaBhavik commented 1 year ago

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 clilck 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.

tal-mi commented 11 months ago

On Admin side, make sure "isFlowFinalized" is not being sent with the onHide event before the async flow is completed. The flow is managed in the WebSDK it needs to delay the onHide event until it is completed. If this information is insufficient you will need to open a support case so WEB SDK team can handle this as the mobile is agnostic to admin flows.