-
Notifications
You must be signed in to change notification settings - Fork 144
Merge adaptive improvements and navigation 3 #175
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
Conversation
Adding ChatsListDetail to show both chats list and chat details on one screen when launching on a large screen device.
Add ChatsListDetail
Feat: Enable opening chats in new app instance
Fix the pane transition issue on the ChatListDetails screen
Add keyboard shortcuts
Migrated from navigation 2 to navigation 3. Had to use a snapshot build as it's not public yet. Manually copied Navigation 3 CAMAL support as it is not merged yet.
Migrated to Navigation 3
Fix: keyboard shortcut issues
…meline Fix: self-letterboxing on the timeline screen.
Feat: Enable opening chats by dropping chat list item into desktop
Avoid updating widgets if not supported
Drag and drop files into Socialite
Notifications fix
Migration of drag & drop indication to IndicationNodeFactory
Fix: crash on the timeline pane
Feat: Enable sharing assets
Update Navigation 3 library
Update to latest navigation3 snapshot and add shared elements
# Conflicts: # app/build.gradle.kts # gradle/libs.versions.toml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @sashalukin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a suite of modern Android development features to the Socialite app, focusing on improving user experience across different device form factors and interaction methods. The core navigation system has been upgraded, and new functionalities like drag-and-drop, right-click menus, and keyboard shortcuts have been implemented. Additionally, the underlying media handling and build system have been significantly enhanced to support these new capabilities.
Highlights
- Navigation System Overhaul: The application's navigation has been migrated to the new Navigation 3 library, replacing
androidx.navigation.compose. This includes a complete refactoring of how navigation is handled internally, utilizing a custom back stack ofPaneobjects, which are nowParcelable. - Adaptive Layout Support: Adaptive layout capabilities have been integrated, allowing the UI to dynamically adjust based on screen size and window class. This is particularly evident in the Timeline screen, which now supports both Pager and Grid layouts, and the Chat List, which can display a bottom sheet for chat options on smaller screens.
- Enhanced User Interaction (Drag & Drop, Right-Click, Keyboard Shortcuts): New interaction features have been added, including drag-and-drop for media items within chats and the timeline, right-click context menu support for copying media, and keyboard shortcuts for common actions like sending messages and scrolling chat history.
- Media Handling Improvements: Significant improvements to media handling include a new
MediaItemdata class, functions for saving and removing attached media in the repository, and aFileProvidersetup for secure content sharing. The camera and photo picker functionalities have been updated to integrate with these changes. - Build System and Dependency Updates: The project's build configuration has been updated to
compileSdk = 36, and numerous dependencies have been upgraded to their latest versions, including various Compose, CameraX, Media3, and Hilt libraries. New adaptive and navigation3 dependencies have been added, and snapshot repositories are configured.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a major architectural refactoring by migrating to Navigation 3, implementing adaptive layouts, and adding significant new features like drag-and-drop and keyboard shortcuts. The changes are extensive and represent a great step forward for the application's structure and capabilities.
My review highlights a critical issue in ChatRepository concerning media handling and a resource leak, a potential UI regression on the camera screen, and some suggestions for improving code organization and build stability. Addressing these points will help ensure the new functionality is robust and the codebase is more maintainable.
| data class MediaItem(val uri: String, val mimeType: String) { | ||
|
|
||
| val extension get(): String? { | ||
| return mimeTypeToExtensionMap[mimeType] | ||
| } | ||
|
|
||
| companion object { | ||
| private val mimeTypeToExtensionMap = mapOf( | ||
| "image/bmp" to "bmp", | ||
| "image/gif" to "gif", | ||
| "image/jpeg" to "jpg", | ||
| "image/jpg" to "jpg", | ||
| "image/png" to "png", | ||
| "image/svg+xml" to "svg", | ||
| "image/webp" to "webp", | ||
| "video/mp4" to "mp4", | ||
| "video/mpeg" to "mpeg", | ||
| ) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MediaItem data class is a model class that is used by both this ChatViewModel and ChatRepository. Defining it inside the ViewModel file couples it too tightly to this specific ViewModel.
To improve code organization, reusability, and to avoid potential circular dependencies, it's best practice to move this data class to its own file in a more suitable package, for example, com.google.android.samples.socialite.model or a new com.google.android.samples.socialite.ui.chat.model package.
| maven { | ||
| url = uri("https://androidx.dev/snapshots/builds/13508953/artifacts/repository") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using hardcoded snapshot repository URLs with specific build numbers is risky for long-term maintenance and build reproducibility. These snapshot builds can be removed from the server at any time, which would break the build for anyone trying to build this project in the future.
If these snapshot dependencies are essential, consider adding a comment explaining why they are needed and which dependencies they are for. For a more stable solution, it would be better to wait for these dependencies to be released to a stable repository like Google's Maven repository or Maven Central.
| maven { | ||
| url = uri("https://androidx.dev/snapshots/builds/13496827/artifacts/repository") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
madebymozart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Chiko and I have made several improvements to Socialite without affecting existing functionality:
We've tested this branch thoroughly and used it during I/O Connect in Berlin. It includes all existing changes from main plus our enhancements.