'some' changes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user