fix: change to mmkv and fix downloads with VLC

This commit is contained in:
Fredrik Burmester
2024-11-24 19:34:49 +01:00
parent 335765993d
commit 93d117640a
12 changed files with 191 additions and 172 deletions

View File

@@ -1,19 +1,19 @@
import AsyncStorage from "@react-native-async-storage/async-storage";
import uuid from "react-native-uuid";
import { storage } from "./mmkv";
export const getOrSetDeviceId = async () => {
let deviceId = await AsyncStorage.getItem("deviceId");
export const getOrSetDeviceId = () => {
let deviceId = storage.getString("deviceId");
if (!deviceId) {
deviceId = uuid.v4() as string;
await AsyncStorage.setItem("deviceId", deviceId);
storage.set("deviceId", deviceId);
}
return deviceId;
};
export const getDeviceId = async () => {
let deviceId = await AsyncStorage.getItem("deviceId");
export const getDeviceId = () => {
let deviceId = storage.getString("deviceId");
return deviceId || null;
};