Redesign mobile time clock, add shortcuts, and improve account management.
Add iOS Shortcuts/Siri intents, local send-reminder notifications, stable client picker with last-client defaults, account refresh/remove, and softer session handling on unauthorized API responses. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,6 +12,20 @@ function storageKeyForPrefix(prefix: string, suffix: (typeof AUTH_STORAGE_SUFFIX
|
||||
return normalizeSecureStoreKey(`${prefix}${suffix}`);
|
||||
}
|
||||
|
||||
async function readSecureStoreValue(key: string): Promise<string | null> {
|
||||
const value = await SecureStore.getItemAsync(key);
|
||||
if (value == null) return null;
|
||||
if (!value.startsWith(CHUNK_MARKER)) return value;
|
||||
|
||||
const count = Number(value.slice(CHUNK_MARKER.length));
|
||||
if (!Number.isInteger(count) || count < 1) return null;
|
||||
|
||||
const chunks = await Promise.all(
|
||||
Array.from({ length: count }, (_, index) => SecureStore.getItemAsync(`${key}.${index}`)),
|
||||
);
|
||||
return chunks.map((chunk) => chunk ?? "").join("");
|
||||
}
|
||||
|
||||
async function copySecureStoreEntry(fromKey: string, toKey: string): Promise<void> {
|
||||
const value = await SecureStore.getItemAsync(fromKey);
|
||||
if (value == null) return;
|
||||
@@ -31,6 +45,27 @@ async function copySecureStoreEntry(fromKey: string, toKey: string): Promise<voi
|
||||
}
|
||||
}
|
||||
|
||||
export async function readStoredSessionUser(prefix: string): Promise<{
|
||||
id?: string;
|
||||
name?: string;
|
||||
email?: string;
|
||||
} | null> {
|
||||
const raw = await readSecureStoreValue(storageKeyForPrefix(prefix, "_session_data"));
|
||||
if (!raw) return null;
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(raw) as {
|
||||
user?: { id?: string; name?: string; email?: string };
|
||||
session?: { user?: { id?: string; name?: string; email?: string } };
|
||||
};
|
||||
const user = parsed.user ?? parsed.session?.user;
|
||||
if (!user) return null;
|
||||
return { id: user.id, name: user.name, email: user.email };
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function migrateAuthStorage(fromPrefix: string, toPrefix: string): Promise<void> {
|
||||
if (fromPrefix === toPrefix) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user