mirror of
https://github.com/ente-io/ente.git
synced 2025-05-24 12:09:17 +00:00
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import { LS_KEYS, getData, setData } from ".";
|
|
|
|
export const getToken = (): string => {
|
|
const token = getData(LS_KEYS.USER)?.token;
|
|
return token;
|
|
};
|
|
|
|
export const getUserID = () => getData(LS_KEYS.USER)?.id;
|
|
|
|
export const isFirstLogin = () =>
|
|
getData(LS_KEYS.IS_FIRST_LOGIN)?.status ?? false;
|
|
|
|
export function setIsFirstLogin(status: boolean) {
|
|
setData(LS_KEYS.IS_FIRST_LOGIN, { status });
|
|
}
|
|
|
|
export const justSignedUp = () =>
|
|
getData(LS_KEYS.JUST_SIGNED_UP)?.status ?? false;
|
|
|
|
export function setJustSignedUp(status: boolean) {
|
|
setData(LS_KEYS.JUST_SIGNED_UP, { status });
|
|
}
|
|
|
|
export function getLivePhotoInfoShownCount() {
|
|
return getData(LS_KEYS.LIVE_PHOTO_INFO_SHOWN_COUNT)?.count ?? 0;
|
|
}
|
|
|
|
export function setLivePhotoInfoShownCount(count: boolean) {
|
|
setData(LS_KEYS.LIVE_PHOTO_INFO_SHOWN_COUNT, { count });
|
|
}
|
|
|
|
export function getLocalMapEnabled(): boolean {
|
|
return getData(LS_KEYS.MAP_ENABLED)?.value ?? false;
|
|
}
|
|
|
|
export function setLocalMapEnabled(value: boolean) {
|
|
setData(LS_KEYS.MAP_ENABLED, { value });
|
|
}
|
|
|
|
export function getHasOptedOutOfCrashReports(): boolean {
|
|
return getData(LS_KEYS.OPT_OUT_OF_CRASH_REPORTS)?.value ?? false;
|
|
}
|
|
|
|
export function getLocalSentryUserID() {
|
|
return getData(LS_KEYS.AnonymizedUserID)?.id;
|
|
}
|
|
|
|
export function setLocalSentryUserID(id: string) {
|
|
setData(LS_KEYS.AnonymizedUserID, { id });
|
|
}
|
|
|
|
export function getLocalReferralSource() {
|
|
return getData(LS_KEYS.REFERRAL_SOURCE)?.source;
|
|
}
|
|
|
|
export function setLocalReferralSource(source: string) {
|
|
setData(LS_KEYS.REFERRAL_SOURCE, { source });
|
|
}
|