'some' changes

This commit is contained in:
Chris Sanden
2026-05-03 23:05:22 +02:00
parent 08a14b3ab2
commit 907fa18841
21 changed files with 2253 additions and 220 deletions

View File

@@ -1,11 +1,13 @@
import AsyncStorage from '@react-native-async-storage/async-storage';
import type { SessionType } from '@/lib/types';
const notificationKey = (aId: string) => `assignment_notification_${aId}`;
const activeSprintKey = 'active_sprint';
export type ActiveSprint = {
sessionId: string,
taskId: string;
export type ActiveSession = {
sessionId: string;
sessionType: SessionType;
taskId: string | null;
durationSeconds: number;
endTime: number;
};
@@ -22,20 +24,20 @@ export async function RemoveAssignmentNotificationId(aId: string) {
await AsyncStorage.removeItem(notificationKey(aId));
}
export async function SaveActiveSprint(activeSprint: ActiveSprint) {
await AsyncStorage.setItem(activeSprintKey, JSON.stringify(activeSprint));
export async function SaveActiveSession(activeSession: ActiveSession) {
await AsyncStorage.setItem(activeSprintKey, JSON.stringify(activeSession));
}
export async function GetActiveSprint() {
const activeSprint = await AsyncStorage.getItem(activeSprintKey);
export async function GetActiveSession() {
const activeSession = await AsyncStorage.getItem(activeSprintKey);
if (!activeSprint) {
if (!activeSession) {
return null;
}
return JSON.parse(activeSprint) as ActiveSprint;
return JSON.parse(activeSession) as ActiveSession;
}
export async function RemoveActiveSprint() {
export async function RemoveActiveSession() {
await AsyncStorage.removeItem(activeSprintKey);
}

View File

@@ -1,5 +1,7 @@
import type { SubjectColor } from '@/lib/subjectColors';
export type SessionType = 'focus' | 'short_break' | 'long_break';
export type Task = {
tId: string;
title: string;