feat: add alert sound for timer and time-until done
All checks were successful
Pull Request Check / validate (pull_request) Successful in 28s

This commit is contained in:
2026-03-30 20:35:12 +02:00
parent 5f2c63ac05
commit 0640144e6b
3 changed files with 37 additions and 9 deletions

18
App.js
View File

@@ -3,6 +3,7 @@ import { BackHandler, Platform, StatusBar, Modal, View, Image, StyleSheet, Butto
import * as ScreenOrientation from 'expo-screen-orientation';
import * as SplashScreen from 'expo-splash-screen';
import { Accelerometer } from 'expo-sensors';
import { Audio } from 'expo-av';
import FocusScreen from './src/screens/FocusScreen';
import HomeScreen from './src/screens/HomeScreen';
import TimeUntilScreen from './src/screens/TimeUntilScreen';
@@ -194,6 +195,23 @@ export default function App() {
const timerSec = timerRemaining % 60;
const tuCountdown = getTuCountdown();
const playSound = async () => {
try {
const { sound } = await Audio.Sound.createAsync(
{ uri: 'https://shx.reversed.dev/u/mCgT76.mp3' },
{ shouldPlay: true, volume: 1.0 }
);
} catch (error) {
console.log('Error playing sound:', error);
}
};
useEffect(() => {
if (timerDone || tuIsOver) {
playSound();
}
}, [timerDone, tuIsOver]);
if (focusMode) {
return (
<FocusScreen