feat: Add OS native notifications and placeholder for sound
This commit is contained in:
		
							parent
							
								
									ccb2ec8439
								
							
						
					
					
						commit
						3eaf807100
					
				
							
								
								
									
										19
									
								
								src/main.ts
								
								
								
								
							
							
						
						
									
										19
									
								
								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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue