SAP / gigya-android-sdk

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

No way to get the updated account after an update #8

Closed cristan closed 4 years ago

cristan commented 4 years ago

If I call gigya.showScreenSet(Constants.GIGYA_SCREEN_SET_ACCOUNT_DETAILS, set the gigyaPluginCallback and call gigya.getAccount at onAfterSubmit, I don't get an updated account. I do when I call gigya.getAccount about a second later. I don't want to wait an arbitrary amount of time and try to call the backend then in the hopes that the account has been updated by then. Therefore: please add a way users of your SDK can get a callback on where the account is updated to.

tal-mi commented 4 years ago

The onSubmit event is triggered before the actual submission of the screen-set form. Your updated account will be available after the form has completed its task and triggers the "onHide" event with a "finished" reason.

cristan commented 4 years ago

I've tried waiting for the "onHide" event with a "finished" reason. This sometimes works: sometimes I get the updated account right away, but sometimes I still get the old product info. The odds seem about 50/50. Is there any way to always get the updated user?

tal-mi commented 4 years ago

Use this interface: public void getAccount(final boolean invalidateCache, GigyaCallback gigyaCallback) and use true to always invalidate the cache. I will add a task to test it extensively nevertheless.

cristan commented 4 years ago

You are my hero! Getting the user with invalidateCache set to true after an onHide event with a "finished" reason indeed did the trick. (I ended up using the constant GigyaDefinitions.Plugin.FINISHED instead of just hardcoding "finished" BTW). It would be better if the cache would always be invalidated after the user has updated their account, but for now this works.

tal-mi commented 4 years ago

Hi, Glad to see that this solves your issue. Will take your suggestion into consideration in future tasks. Thanks, Tal.