davthecoder × Vectencia
🔍
P1 Bug Hunter
Find the bugs in each code snippet
Notification Manager0 P0s3 total
1/8
1class NotificationViewModel(2 private val context: Context,3 private val repository: BookingRepository4) : ViewModel() {56 private val receiver = object : BroadcastReceiver() {7 override fun onReceive(ctx: Context, intent: Intent) {8 viewModelScope.launch {9 val booking = repository.getActiveBooking()10 if (booking != null) {11 showLocalNotification(ctx, booking)12 }13 }14 }15 }1617 init {18 context.registerReceiver(19 receiver,20 IntentFilter("BOOKING_UPDATE"),21 Context.RECEIVER_NOT_EXPORTED22 )23 }2425 val notifications = MutableStateFlow<List<Notification>>(emptyList())2627 fun markRead(id: String) {28 viewModelScope.launch {29 repository.markNotificationRead(id)30 notifications.update { list ->31 list.map { if (it.id == id) it.copy(read = true) else it }32 }33 }34 }35}Click on the lines you think have bugsFound 0 of 3
←→NavigateAShow remainingRReset
🎯Bug Formula: What's wrong → What breaks for the user → The fix → The trade-off