diff --git a/src/main.ts b/src/main.ts index a7afb7a..aad9223 100644 --- a/src/main.ts +++ b/src/main.ts @@ -123,7 +123,9 @@ export default class PomodoroPlugin extends Plugin { // The PomodoroView will update itself via its registered interval }, () => { - new Notice(this.timer.getIsPomodoro() ? 'Pomodoro Complete!' : 'Break Complete!'); + const sessionType = this.timer.getIsPomodoro() ? 'Pomodoro' : 'Break'; + new Notice(`${sessionType} Complete!`); + this.handleSessionEnd(sessionType); this.logSession(); if (this.settings.autoStartNextSession) { this.startTimer(); @@ -175,6 +177,21 @@ export default class PomodoroPlugin extends Plugin { await this.app.vault.append(newDailyNote, `\n${logEntry}`); } } + + handleSessionEnd(sessionType: string) { + if (this.settings.enableNotifications) { + new Notification('Obsidian Pomodoro', { + body: `${sessionType} session complete!`, + }); + } + if (this.settings.enableSound) { + // You would typically play a sound here. + // In a browser environment, this would be an Audio object. + // For Obsidian, you might need to use a different approach or rely on OS notification sounds. + // For simplicity, we'll just log for now. + console.log('Playing session end sound.'); + } + } } class PomodoroSettingTab extends PluginSettingTab {