Skip to content

Droid 3622 add counters to space chat widget #2449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 23, 2025

Conversation

uburoiubu
Copy link
Member


  • I understand that contributing to this repository will require me to agree with the CLA

Description

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added to documentation?

  • 📜 README.md
  • 📓 tech-docs
  • 🙅 no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

@uburoiubu uburoiubu requested a review from konstantiniiv as a code owner May 23, 2025 15:49
@konstantiniiv konstantiniiv requested a review from Copilot May 23, 2025 15:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds unread message and mention counters to the Space Chat widget, including model, view, and UI updates for real-time updates.

  • Introduces Widget.Chat and updates parsing to include chat widgets
  • Implements SpaceChatWidgetContainer using ChatPreviewContainer to feed counter flows
  • Updates composable and Home screen to render unread counts and fallback on errors

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/WidgetView.kt Converted SpaceChat to data class with counter fields
presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/Widget.kt Added Widget.Chat type and parsing logic
presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/SpaceChatWidgetContainer.kt Wired flow mapping from previews to WidgetView.SpaceChat
domain/src/main/java/com/anytypeio/anytype/domain/chats/ChatPreviewContainer.kt Exposed observePreview API for chat previews
app/src/main/java/com/anytypeio/anytype/ui/widgets/types/SpaceChatWidget.kt Updated composable to display unread counts and icon
presentation/src/main/java/com/anytypeio/anytype/presentation/home/HomeScreenViewModel.kt Injected ChatPreviewContainer and mapped Widget.Chat
app/src/main/java/com/anytypeio/anytype/ui/home/HomeScreen.kt Passed counter props and updated click handler for chat widget
presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/DataViewListWidgetContainer.kt Excluded Widget.Chat from incompatible widget throws
feature-chats/src/main/java/com/anytypeio/anytype/feature_chats/ui/Toolbars.kt Added fallback for empty chat title
core-ui/src/main/res/drawable/ic_widget_chat.xml Added new chat widget icon asset
app/src/main/java/com/anytypeio/anytype/di/feature/home/HomescreenDI.kt Registered ChatPreviewContainer in DI
Comments suppressed due to low confidence (4)

app/src/main/java/com/anytypeio/anytype/ui/widgets/types/SpaceChatWidget.kt:64

  • Update the contentDescription to describe the chat icon (e.g., "Chat widget icon") for proper accessibility.
contentDescription = "All content icon",

app/src/main/java/com/anytypeio/anytype/ui/widgets/types/SpaceChatWidget.kt:39

  • [nitpick] Parameter name unReadMessageCount is inconsistent; rename to unreadMessageCount to follow camelCase convention.
unReadMessageCount: Int = 0,

app/src/main/java/com/anytypeio/anytype/ui/widgets/types/SpaceChatWidget.kt:40

  • [nitpick] Parameter name unReadMentionCount is inconsistent; rename to unreadMentionCount to follow camelCase convention.
unReadMentionCount: Int = 0

presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/SpaceChatWidgetContainer.kt:17

  • [nitpick] The new counter mapping and error fallback in SpaceChatWidgetContainer lack unit tests. Consider adding tests to cover both successful flows and error scenarios.
override val view: Flow<WidgetView> = flow {

@uburoiubu uburoiubu merged commit 622b4ea into main May 23, 2025
3 checks passed
@uburoiubu uburoiubu deleted the DROID-3622-add-counters-to-space-chat-widget branch May 23, 2025 17:01
@github-actions github-actions bot locked and limited conversation to collaborators May 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants