fix: 修根因——EventBus加buffer防事件丢失+恢复正确架构
根因:SharedFlow(replay=0,extraBufferCapacity=0)导致emit挂起, 多个collector竞争时事件丢失。之前的补丁越改越乱。 修复: 1. EventBus: extraBufferCapacity=64,emit不再阻塞 2. 恢复正确架构: - MainActivity: 监听MQTT type=1→NotificationManager→横幅 - NotificationManager: 处理后emit NewTaskArrived - HomeFragment: 监听NewTaskArrived→红点+统计 3. StatusBarView: 电池位置恢复原位,默认电量-1,主动查询系统电量 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@ import javax.inject.Singleton
|
||||
@Singleton
|
||||
class EventBus @Inject constructor() {
|
||||
|
||||
private val _events = MutableSharedFlow<AppEvent>(replay = 0)
|
||||
private val _events = MutableSharedFlow<AppEvent>(replay = 0, extraBufferCapacity = 64)
|
||||
val events: SharedFlow<AppEvent> = _events.asSharedFlow()
|
||||
|
||||
suspend fun emit(event: AppEvent) {
|
||||
|
||||
Reference in New Issue
Block a user