ConnectyCube / connectycube-flutter-sdk-releases

ConnectyCube Flutter SDK Releases
7 stars 1 forks source link

Remove prefs.clear() from deleteUserData() #65

Closed abbas-25 closed 3 years ago

abbas-25 commented 3 years ago

It is possible the preferences are being used for other purposes, such as showing one-time onboarding screens to users. prefs.clear() removes the logic for the same. Ideally, you should only remove data concerning connectycube user.

TatankaConCube commented 3 years ago

It is not the right repo for reporting the current issue, issues related to samples need report there. About your note - in method deleteUserData() we remove all data related to the logged-in user (login, password, etc., push subscription's token, subscription's id, etc.) and method's name says about it.

abbas-25 commented 3 years ago

Okay, you can close the issue, but you didn't get my point. Shared Preferences are used for purposes as well other than connectycube. You are removing all the key-value pairs with prefs.clear() include non-connectycube or non-authentication related data.

Instead of prefs.clear() it should be -

prefs.remove(prefUserName);
    prefs.remove(prefUserAvatar);
    prefs.remove(prefUserId);
    prefs.remove(prefUserLogin);
    prefs.remove(prefUserLogin);
    prefs.remove(prefSubscriptionToken);
    prefs.remove(prefSubscriptionId);
TatankaConCube commented 3 years ago

I got it, but we save only data related to the current user in our samples to Shared Preferences. If you save there any other data you can correct this code according to your needs.