uservoice/uservoice-android-sdk

How can I clear the user email?

Opened this issue · 1 comments

Hello,

After the user submits the contact form with a comment, I would like to clear his email address so that later when displaying the contact form again, the email field is empty.

Is there a proper way to do it with the SDK?

I tried this: UserVoice.identifyUser(null, null, null) but somehow the SDK has a way to find the email back and fill in the contact form later.

I believe that this is where it happens: https://github.com/uservoice/uservoice-android-sdk/blob/master/UserVoiceSDK/src/com/uservoice/uservoicesdk/flow/InitManager.java#L84

Thanks for any help,
Christophe.

This worked for me:

    @SuppressLint("ApplySharedPref")
    private static void clearUser(Context context, Session session) {
        if (session != null) {
            session.setUser(context, new User());
            SharedPreferences.Editor edit = session.getSharedPreferences(context).edit();
            edit.remove("user_name");
            edit.remove("user_email");
            edit.commit();
        }
    }

call it with clearUser(context, Session.getInstance())