Class VisitorInfoPrefsStorage

  • All Implemented Interfaces:
    BaseStorage, VisitorInfoStorage


    public final class VisitorInfoPrefsStorage
    extends java.lang.Object
    implements VisitorInfoStorage
    Storage for saving the visitor info

    Visitor info is defined in VisitorInfo and used to configure informative data about the user in a chat. Use this storage to save available visitor information so that next time users don't have to provide save info again.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void delete()
      Deletes all storage information saved in this shared preference
      void disable()
      Disables the storage
      VisitorInfo getVisitorInfo()
      Retrieves stored visitor info from shared preferences.
      void setVisitorInfo(VisitorInfo visitorInfo)
      Saves the data of provided visitor info.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mStoragePreferences

        protected final SharedPreferences mStoragePreferences
      • mDisabled

        protected boolean mDisabled
    • Method Detail

      • setVisitorInfo

        public void setVisitorInfo(VisitorInfo visitorInfo)
        Saves the data of provided visitor info.

        If storage is disabled via PrefsStorage.disable() this will do nothing.

        Specified by:
        setVisitorInfo in interface VisitorInfoStorage
        Parameters:
        visitorInfo - to save
        Throws:
        java.lang.IllegalArgumentException - if visitor info was null
      • getVisitorInfo

        public VisitorInfo getVisitorInfo()
        Retrieves stored visitor info from shared preferences.

        If storage is disabled via PrefsStorage.disable() this will return a default value.

        Specified by:
        getVisitorInfo in interface VisitorInfoStorage
        Returns:
        stored visitor info or a default value if there was none
      • delete

        public void delete()
        Deletes all storage information saved in this shared preference
        Specified by:
        delete in interface BaseStorage
      • disable

        public void disable()
        Description copied from interface: BaseStorage
        Disables the storage
        Specified by:
        disable in interface BaseStorage