Conversation
WalkthroughThe NotificationScreen composable was updated to introduce a multi-select delete mode for notifications. The notification list now supports mutable state, allowing dynamic updates. New UI controls enable selecting, deselecting, deleting, and marking notifications as read. NotificationItemData was extended with a selection property, and a redundant composable was removed. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant NotificationScreen
participant NotificationList
User->>NotificationScreen: Tap delete icon
NotificationScreen->>NotificationScreen: Toggle delete mode
User->>NotificationScreen: Select/deselect notifications
NotificationScreen->>NotificationList: Update isSelected state
User->>NotificationScreen: Tap "Select All"
NotificationScreen->>NotificationList: Select/deselect all notifications
User->>NotificationScreen: Tap "Delete"
NotificationScreen->>NotificationList: Remove selected notifications
NotificationScreen->>NotificationScreen: Exit delete mode
NotificationScreen->>User: Invoke onDeletePressed callback
User->>NotificationScreen: Tap "Cancel"
NotificationScreen->>NotificationList: Clear selections
NotificationScreen->>NotificationScreen: Exit delete mode
User->>NotificationScreen: Tap "Read"
NotificationScreen->>NotificationList: Mark selected as read
NotificationScreen->>NotificationList: Clear selection and priority flags
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt (2)
60-61: Consider lifting state to a ViewModel for better architecture.Managing notification items and delete mode state directly in the composable violates the separation of concerns principle. This makes the UI harder to test and reuse.
Consider moving the state management to a ViewModel:
+@HiltViewModel +class NotificationViewModel @Inject constructor( + private val notificationRepository: NotificationRepository +) : ViewModel() { + private val _notificationItems = MutableStateFlow<List<NotificationItemData>>(emptyList()) + val notificationItems = _notificationItems.asStateFlow() + + private val _isDeleteMode = MutableStateFlow(false) + val isDeleteMode = _isDeleteMode.asStateFlow() + + fun toggleDeleteMode() { ... } + fun deleteSelectedItems() { ... } + fun toggleItemSelection(index: Int) { ... } +}
339-352: Make the bold text pattern configurable.The
boldPartis hardcoded to a specific string, making this function work only for that exact content.Make the function more flexible by accepting a pattern or using a more generic approach:
-@Composable -private fun createAnnotatedString(content: String) = buildAnnotatedString { - append(content) - - val boldPart = "D-3 [목요일] 리자이드 양주점" - val startIndex = content.indexOf(boldPart) - if (startIndex >= 0) { - addStyle( - style = SpanStyle(fontWeight = FontWeight.Bold), - start = startIndex, - end = startIndex + boldPart.length - ) - } -} +@Composable +private fun createAnnotatedString( + content: String, + boldPattern: Regex = Regex("D-\\d+ \\[.*?\\] [^,]+") +) = buildAnnotatedString { + append(content) + + boldPattern.find(content)?.let { matchResult -> + addStyle( + style = SpanStyle(fontWeight = FontWeight.Bold), + start = matchResult.range.first, + end = matchResult.range.last + 1 + ) + } +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt(9 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt (1)
notification/presentation/src/main/java/com/hyunjung/notification/presentation/component/NotificationToggleItem.kt (2)
NotificationActiveToggleItem(81-120)NotificationToggleItem(122-180)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
PULL REQUEST
Description
allSelectanddeletemodeScreenShots
Summary by CodeRabbit
New Features
Improvements