Fix edition

This commit is contained in:
yostyle 2023-08-01 15:20:20 +02:00
parent a3aac9f66a
commit a611766476
4 changed files with 14 additions and 34 deletions

View file

@ -35,30 +35,15 @@ class RustNotificationSettingsService(
private val notificationSettings: NotificationSettings = client.getNotificationSettings()
private val _notificationSettingsChangeFlow = MutableSharedFlow<Unit>(onBufferOverflow = BufferOverflow.DROP_OLDEST)
private val _notificationSettingsChangeFlow = MutableSharedFlow<Unit>(extraBufferCapacity = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST)
override val notificationSettingsChangeFlow: SharedFlow<Unit> = _notificationSettingsChangeFlow.asSharedFlow()
private var notificationSettingsDelegate = object : NotificationSettingsDelegate {
override fun settingsDidChange() {
Timber.d("emit ${_notificationSettingsChangeFlow.subscriptionCount.value}")
val ok = _notificationSettingsChangeFlow.tryEmit(Unit)
Timber.d("emit $ok")
_notificationSettingsChangeFlow.tryEmit(Unit)
}
}
// override val notificationSettingsChangeFlow = callbackFlow {
// val delegate = object:NotificationSettingsDelegate {
// override fun notificationSettingsDidChange() {
// trySendBlocking(Unit)
// }
// }
// send(Unit)
// notificationSettings.setDelegate(delegate)
// awaitClose {
// // notificationSettings.setDelegate(null)
// }
// }.buffer(Channel.UNLIMITED)
init {
notificationSettings.setDelegate(notificationSettingsDelegate)
}