-
Notifications
You must be signed in to change notification settings - Fork 263
Reorganize logic into cleaner directories and better separation of concerns in Wear sample. #152
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
Reorganize logic into cleaner directories and better separation of concerns in Wear sample. #152
Conversation
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 @JohnZoellerG, 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 primarily focuses on enhancing the security and maintainability of the Wear OS authentication sample by addressing potential data leakage in the authentication flow and performing significant dependency and code structure updates. I've upgraded the project's Kotlin version to 2.2.0 and refactored the network communication layer to improve clarity and separation of concerns.
Highlights
- Kotlin and Dependency Upgrades: I've updated the project-wide Kotlin version to 2.2.0, along with corresponding updates to KSP and Horologist libraries, ensuring the sample benefits from the latest language features and library improvements.
- Enhanced Authentication Security: I've implemented a crucial fix to prevent data leakage by modifying how credential data is handled between the
CredentialManagerAuthenticator
andAuthenticationServer
. Instead of passing full credential objects, only the necessary, non-sensitive data is now extracted and sent to the server, improving the security posture. - Network Layer Refactoring: I've renamed the
api
package tonetwork
and updated associated classes (e.g.,ApiResult
toNetworkResult
,ApiException
toNetworkException
) to provide a more accurate and consistent naming convention for network-related components. - Codebase Organization: I've restructured the UI and ViewModel packages, moving related files into more logical
ui.navigation
,ui.screens
, andui.viewmodel
directories, which enhances the overall maintainability and navigability of the codebase. - Build Configuration Modernization: I've updated the Wear OS module's
compileSdk
to 36, streamlined Compose build options, and adjusted the application ID, aligning the project with the latest Android development practices.
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 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 or fill out our survey 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 refactors the authentication logic to fix a data leakage issue between the Credential Manager API and the app's server communication layer. This is a great architectural improvement. The PR also updates Kotlin to 2.2.0 and related dependencies, and reorganizes the UI and network packages for better maintainability. The changes are solid. My review includes a few suggestions to address some leftover commented-out code and a potential improvement in the build configuration.
Shrine/wear/src/main/java/com/authentication/shrinewear/ui/screens/HomeScreen.kt
Outdated
Show resolved
Hide resolved
Shrine/wear/src/main/java/com/authentication/shrinewear/ui/screens/HomeScreen.kt
Outdated
Show resolved
Hide resolved
Shrine/wear/src/main/java/com/authentication/shrinewear/ui/screens/OAuthScreen.kt
Outdated
Show resolved
Hide resolved
2a53b37
to
e4f3d0c
Compare
e4f3d0c
to
17a463f
Compare
@@ -87,10 +88,6 @@ android { | |||
buildConfig = true | |||
} | |||
|
|||
composeOptions { |
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.
nice!
minSdk = 30 | ||
targetSdk = 35 | ||
targetSdk = 36 |
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.
wow, bleeding edge https://developer.android.com/training/wearables/versions/6/setup
|
||
private const val TAG = "OkHttpExtension" | ||
|
||
suspend fun Call.await(): Response { |
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.
If you bump to 5.1.0 there is an okhttp-coroutines module with this built in.
composable(ShrineDestinations.HOME_ROUTE) { | ||
val credentialManagerViewModel: CredentialManagerViewModel = viewModel() |
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.
nice catch
17a463f
to
486c3c6
Compare
Increment project-wide Kotlin version up to 2.2.0