index.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { Language } from 'constants/locale';
  2. import { getData, LS_KEYS, setData } from './localStorage';
  3. export const isFirstLogin = () =>
  4. getData(LS_KEYS.IS_FIRST_LOGIN)?.status ?? false;
  5. export function setIsFirstLogin(status) {
  6. setData(LS_KEYS.IS_FIRST_LOGIN, { status });
  7. }
  8. export const justSignedUp = () =>
  9. getData(LS_KEYS.JUST_SIGNED_UP)?.status ?? false;
  10. export function setJustSignedUp(status) {
  11. setData(LS_KEYS.JUST_SIGNED_UP, { status });
  12. }
  13. export function getLivePhotoInfoShownCount() {
  14. return getData(LS_KEYS.LIVE_PHOTO_INFO_SHOWN_COUNT)?.count ?? 0;
  15. }
  16. export function setLivePhotoInfoShownCount(count) {
  17. setData(LS_KEYS.LIVE_PHOTO_INFO_SHOWN_COUNT, { count });
  18. }
  19. export function getUserLocale(): Language {
  20. return getData(LS_KEYS.LOCALE)?.value;
  21. }
  22. export function getLocalMapEnabled(): boolean {
  23. return getData(LS_KEYS.MAP_ENABLED)?.value ?? false;
  24. }
  25. export function setLocalMapEnabled(value: boolean) {
  26. setData(LS_KEYS.MAP_ENABLED, { value });
  27. }
  28. export function getHasOptedOutOfCrashReports(): boolean {
  29. return getData(LS_KEYS.OPT_OUT_OF_CRASH_REPORTS)?.value ?? false;
  30. }