refactor: update reminders retrieval method
- Replaced `getRealRemindersSimple` with `getRemindersFromEnabledLists` for improved reminder fetching logic. - Removed the old method to streamline the code and enhance maintainability. - Adjusted error handling to ensure consistent behavior during reminder parsing.
This commit is contained in:
@@ -179,36 +179,13 @@ export class RemindersService {
|
|||||||
|
|
||||||
// Pour l'instant, on utilise une approche simple avec des données réelles
|
// Pour l'instant, on utilise une approche simple avec des données réelles
|
||||||
// TODO: Implémenter le parsing complet de la sortie AppleScript
|
// TODO: Implémenter le parsing complet de la sortie AppleScript
|
||||||
return this.getRealRemindersSimple();
|
return this.getRemindersFromEnabledLists();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Erreur lors du parsing AppleScript:', error);
|
console.error('Erreur lors du parsing AppleScript:', error);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Récupère les rappels réels avec une approche simplifiée
|
|
||||||
*/
|
|
||||||
private async getRealRemindersSimple(): Promise<MacOSReminder[]> {
|
|
||||||
try {
|
|
||||||
const reminders: MacOSReminder[] = [];
|
|
||||||
const lists = await this.getReminderLists();
|
|
||||||
|
|
||||||
for (const listName of lists.slice(0, 3)) { // Limiter à 3 listes pour commencer
|
|
||||||
try {
|
|
||||||
const listReminders = await this.getRemindersFromListSimple(listName);
|
|
||||||
reminders.push(...listReminders);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(`Erreur pour la liste ${listName}:`, error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return reminders;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Erreur getRealRemindersSimple:', error);
|
|
||||||
return this.getMockReminders();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Récupère les rappels d'une liste avec une approche simple
|
* Récupère les rappels d'une liste avec une approche simple
|
||||||
|
|||||||
Reference in New Issue
Block a user