Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/renderer/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ export const ToastEventBus = new EventTarget()
* @param {AbortSignal} abortSignal
*/
export function showToast(message, time = null, action = null, abortSignal = null) {
// Sometimes caller just pass user setting based value in and it can be zero
if (time === 0) {
console.warn('showToast called with time: 0', { message, time, action, abortSignal })
return
}

ToastEventBus.dispatchEvent(new CustomEvent('toast-open', {
detail: {
message,
Expand Down
21 changes: 12 additions & 9 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -1367,15 +1367,18 @@ export default defineComponent({
this.playNextTimeout = null
}, nextVideoInterval * 1000)

showToast(
({ remainingMs }) => {
const countDownTimeLeftInSecond = remainingMs / 1000
return this.$tc('Playing Next Video Interval', countDownTimeLeftInSecond, { nextVideoInterval: countDownTimeLeftInSecond })
},
// So that we don't see last countdown text like 0/N
nextVideoInterval * 1000,
this.abortAutoplayCountdown,
)
if (nextVideoInterval > 0) {
// No countdown for 0s interval
showToast(
({ remainingMs }) => {
const countDownTimeLeftInSecond = remainingMs / 1000
return this.$tc('Playing Next Video Interval', countDownTimeLeftInSecond, { nextVideoInterval: countDownTimeLeftInSecond })
},
// So that we don't see last countdown text like 0/N
nextVideoInterval * 1000,
this.abortAutoplayCountdown,
)
}
},

// Skip to the next video if in a playlist
Expand Down