Fixes a bug which caused notification sounds to overlap in five times mode; instead of five times the sound was played just twice. Closes #1000.

Thank you Alex for help!
pull/1205/head
przemhb 5 years ago
parent 4bbc6707ed
commit 666d7033d2

@ -202,6 +202,9 @@ class NotificationManager @Inject constructor(
cancel(evicted)
}
for (i in 0 until ringTimes) {
if (i > 0) {
notificationManager.pause(2000)
}
notificationManager.notify(notificationId.toInt(), notification)
}
}

@ -34,4 +34,8 @@ internal class Throttle constructor(
oldest = (oldest + 1) % throttle.size
}
}
fun pause(millis: Long) = executor.execute {
Thread.sleep(millis)
}
}

@ -26,6 +26,8 @@ class ThrottledNotificationManager @Inject constructor(
}
}
fun pause(millis: Long) = throttle.pause(millis)
companion object {
private const val NOTIFICATIONS_PER_SECOND = 4
}

Loading…
Cancel
Save