Skip to content

Commit

Permalink
feat: try to improve logic around detecting an announcement already p…
Browse files Browse the repository at this point in the history
…laying
  • Loading branch information
davwheat committed Jun 7, 2024
1 parent 4a2877c commit 3b6c184
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/components/AmeyLiveTrainAnnouncements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,10 @@ export function LiveTrainAnnouncements<SystemKeys extends string>({
} catch (e) {
console.warn(`[Live Trains] Error playing announcement for ${train.rid}; see below`)
console.error(e)
} finally {
console.log(`[Live Trains] Announcement for ${train.rid} complete: waiting 5s until next`)
setTimeout(() => setIsPlaying(false), 5000)
}
console.log(`[Live Trains] Announcement for ${train.rid} complete: waiting 5s until next`)
setTimeout(() => setIsPlaying(false), 5000)
},
[markNextTrainAnnounced, systems, setIsPlaying, standingTrainHandler, selectedCrs, getStation, addLog, useLegacyTocNames, announceViaPoints],
)
Expand Down Expand Up @@ -657,9 +658,10 @@ export function LiveTrainAnnouncements<SystemKeys extends string>({
} catch (e) {
console.warn(`[Live Trains] Error playing announcement for ${train.rid}; see below`)
console.error(e)
} finally {
console.log(`[Live Trains] Announcement for ${train.rid} complete: waiting 5s until next`)
setTimeout(() => setIsPlaying(false), 5000)
}
console.log(`[Live Trains] Announcement for ${train.rid} complete: waiting 5s until next`)
setTimeout(() => setIsPlaying(false), 5000)
},
[
markNextTrainAnnounced,
Expand Down Expand Up @@ -733,9 +735,10 @@ export function LiveTrainAnnouncements<SystemKeys extends string>({
} catch (e) {
console.warn(`[Live Trains] Error playing announcement for ${train.rid}; see below`)
console.error(e)
} finally {
console.log(`[Live Trains] Announcement for ${train.rid} complete: waiting 5s until next`)
setTimeout(() => setIsPlaying(false), 5000)
}
console.log(`[Live Trains] Announcement for ${train.rid} complete: waiting 5s until next`)
setTimeout(() => setIsPlaying(false), 5000)
},
[markNextTrainAnnounced, systems, setIsPlaying, nextTrainHandler, getStation, addLog, useLegacyTocNames, chimeType, announceViaPoints],
)
Expand Down Expand Up @@ -824,9 +827,10 @@ export function LiveTrainAnnouncements<SystemKeys extends string>({
}

console.error(e)
} finally {
console.log(`[Live Trains] Announcement for ${train.rid} complete: waiting 5s until next`)
setTimeout(() => setIsPlaying(false), 5000)
}
console.log(`[Live Trains] Announcement for ${train.rid} complete: waiting 5s until next`)
setTimeout(() => setIsPlaying(false), 5000)
},
[markDisruptedTrainAnnounced, systems, setIsPlaying, disruptedTrainHandler, addLog, useLegacyTocNames, chimeType, announceViaPoints],
)
Expand Down

0 comments on commit 3b6c184

Please sign in to comment.