Skip to content

ADB commands#501

Draft
rteyssandier wants to merge 2 commits intomainfrom
feat/commands
Draft

ADB commands#501
rteyssandier wants to merge 2 commits intomainfrom
feat/commands

Conversation

@rteyssandier
Copy link
Contributor

No description provided.

@rteyssandier rteyssandier self-assigned this Feb 16, 2026
@rteyssandier rteyssandier added the enhancement New feature or request label Feb 16, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @rteyssandier, 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 delivers a new 'ADB Commands' feature, enhancing the application's utility by providing a centralized interface for executing and managing Android Debug Bridge commands. The changes span across the data, domain, and presentation layers, ensuring a robust and integrated experience for users to interact with their connected Android devices through custom commands.

Highlights

  • New Feature: ADB Commands: Introduced a dedicated screen for managing and executing ADB commands, allowing users to save frequently used commands and view their execution history.
  • Database Schema Update: The database schema has been updated to version 79, incorporating a new AdbCommandEntity to persist saved ADB commands.
  • UI and Navigation Integration: Integrated the new ADB Commands feature into the application's main navigation, including new menu items and UI components for command input, display, and interaction.
  • Dependency Injection Setup: Configured Koin modules across app, data/core, data/local, and domain layers to properly manage dependencies for the new ADB command functionality.
Changelog
  • FloconDesktop/composeApp/schemas/io.github.openflocon.flocondesktop.common.db.AppDatabase/79.json
    • Added AdbCommandEntity to the database schema.
    • Incremented database version to 79.
  • FloconDesktop/composeApp/src/commonMain/composeResources/values/strings.xml
    • Added string resources for 'Utils' menu and 'ADB Commands' menu item.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/AppScreen.kt
    • Imported adbCommandRoutes.
    • Added adbCommandRoutes to the application's navigation graph.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/AppViewModel.kt
    • Imported AdbCommandRoutes.
    • Mapped SubScreen.Commands to AdbCommandRoutes.Main for navigation.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/ui/model/SubScreen.kt
    • Added Commands data object to SubScreen.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/ui/model/leftpanel/MenuUiState.kt
    • Updated MenuUiState to include a new 'Utils' section with an 'ADB Commands' menu item.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/ui/view/SubScreenSelectorItem.kt
    • Added display name and icon mapping for SubScreen.Commands.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/common/db/AppDatabase.kt
    • Imported AutoMigration, AdbCommandDao, and AdbCommandEntity.
    • Incremented database version to 79 and added AdbCommandEntity.
    • Included an AutoMigration from version 78 to 79.
    • Added adbCommandDao abstract property.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/common/db/RoomModule.kt
    • Added adbCommandDao to the Koin dependency injection module.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/FeaturesModule.kt
    • Imported adbCommandModule and added it to the featuresModule list.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/command/AdbCommandAction.kt
    • Added new file defining AdbCommandAction sealed interface for command operations.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/command/AdbCommandScreen.kt
    • Added new file defining the Composable UI for the ADB Command screen.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/command/AdbCommandViewModel.kt
    • Added new file defining the ViewModel for the ADB Command screen.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/command/AdbUiState.kt
    • Added new file defining AdbUiState and AdbCommandUi data classes.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/command/DI.kt
    • Added new file defining the Koin module for AdbCommandViewModel.
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/command/Navigation.kt
    • Added new file defining navigation routes for the ADB Commands feature.
  • FloconDesktop/data/core/src/commonMain/kotlin/io/github/openflocon/data/core/DI.kt
    • Imported adbCommandModule and added it to the dataCoreModule list.
  • FloconDesktop/data/core/src/commonMain/kotlin/io/github/openflocon/data/core/commands/AdbCommandLocalDataSource.kt
    • Added new file defining the AdbCommandLocalDataSource interface.
  • FloconDesktop/data/core/src/commonMain/kotlin/io/github/openflocon/data/core/commands/DI.kt
    • Added new file defining the Koin module for AdbCommandRepositoryImpl.
  • FloconDesktop/data/core/src/commonMain/kotlin/io/github/openflocon/data/core/commands/repository/AdbCommandRepositoryImpl.kt
    • Added new file implementing AdbCommandRepository.
  • FloconDesktop/data/local/src/commonMain/kotlin/io/github/openflocon/data/local/DI.kt
    • Imported adbCommandModule and added it to the dataLocalModule list.
  • FloconDesktop/data/local/src/commonMain/kotlin/io/github/openflocon/data/local/commands/DI.kt
    • Added new file defining the Koin module for AdbCommandLocalDataSourceImpl.
  • FloconDesktop/data/local/src/commonMain/kotlin/io/github/openflocon/data/local/commands/dao/AdbCommandDao.kt
    • Added new file defining the Room DAO for AdbCommandEntity.
  • FloconDesktop/data/local/src/commonMain/kotlin/io/github/openflocon/data/local/commands/datasource/AdbCommandLocalDataSourceImpl.kt
    • Added new file implementing AdbCommandLocalDataSource.
  • FloconDesktop/data/local/src/commonMain/kotlin/io/github/openflocon/data/local/commands/mapper/AdbCommandMapper.kt
    • Added new file defining mapping functions for AdbCommandEntity.
  • FloconDesktop/data/local/src/commonMain/kotlin/io/github/openflocon/data/local/commands/model/AdbCommandEntity.kt
    • Added new file defining the Room entity AdbCommandEntity.
  • FloconDesktop/domain/src/commonMain/kotlin/io/github.openflocon/domain/commands/usecase/GetAdbCommandUseCase.kt
    • Added new file defining the use case for getting an ADB command by ID.
  • FloconDesktop/domain/src/commonMain/kotlin/io/github/openflocon/domain/DI.kt
    • Imported adbCommandModule and added it to the domainModule list.
  • FloconDesktop/domain/src/commonMain/kotlin/io/github/openflocon/domain/commands/DI.kt
    • Added new file defining the Koin module for ADB command use cases.
  • FloconDesktop/domain/src/commonMain/kotlin/io/github/openflocon/domain/commands/models/AdbCommand.kt
    • Added new file defining the AdbCommand domain model.
  • FloconDesktop/domain/src/commonMain/kotlin/io/github/openflocon/domain/commands/repository/AdbCommandRepository.kt
    • Added new file defining the AdbCommandRepository interface.
  • FloconDesktop/domain/src/commonMain/kotlin/io/github/openflocon/domain/commands/usecase/DeleteAdbCommandUseCase.kt
    • Added new file defining the use case for deleting an ADB command.
  • FloconDesktop/domain/src/commonMain/kotlin/io/github/openflocon/domain/commands/usecase/InsertOrUpdateAdbCommandUseCase.kt
    • Added new file defining the use case for inserting or updating an ADB command.
  • FloconDesktop/domain/src/commonMain/kotlin/io/github/openflocon/domain/commands/usecase/ObserveAdbCommandsUseCase.kt
    • Added new file defining the use case for observing all ADB commands.
  • FloconDesktop/gradle/libs.versions.toml
    • Updated composeMultiplatform version to 1.11.0-alpha02.
    • Updated nav3Core version to 1.1.0-alpha02.
    • Updated material3-adaptive version to 1.3.0-alpha04.
  • FloconDesktop/library/designsystem/src/commonMain/kotlin/io/github/openflocon/library/designsystem/components/FloconScaffold.kt
    • Added floatingActionButton and floatingActionButtonPosition parameters to FloconScaffold.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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

  1. 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 new feature for executing ADB commands, which is a great addition. The implementation follows a clean architecture, separating concerns into presentation, domain, and data layers, and includes database persistence for saved commands. My review focuses on improving UI theme adherence for colors, which will enhance robustness against future theme changes, and some minor code refinements for better clarity and use of idiomatic Kotlin. Overall, this is a solid contribution.

Comment on lines +132 to +142
Text(
"Saved Commands",
color = FloconTheme.colorPalette.onSurface,
style =
FloconTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold
),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The background of this component is FloconTheme.colorPalette.primary, but the text color is set to FloconTheme.colorPalette.onSurface. According to the project's general rules, content on a primary background should use the onPrimary color to ensure proper contrast and theme consistency.

Suggested change
Text(
"Saved Commands",
color = FloconTheme.colorPalette.onSurface,
style =
FloconTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold
),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f)
)
Text(
"Saved Commands",
color = FloconTheme.colorPalette.onPrimary,
style =
FloconTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold
),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f)
)
References
  1. When a component's background color is primary, its content color should be onPrimary for semantic correctness and to ensure robustness against future theme changes.

Comment on lines +182 to +186
Text(
"History",
color = FloconTheme.colorPalette.onSurface,
style = FloconTheme.typography.bodyMedium.copy(fontWeight = FontWeight.Bold),
modifier = Modifier.padding(16.dp)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The background of this component is FloconTheme.colorPalette.primary, but the text color is set to FloconTheme.colorPalette.onSurface. To adhere to the project's theming rules, the text color should be onPrimary when on a primary background.

Suggested change
Text(
"History",
color = FloconTheme.colorPalette.onSurface,
style = FloconTheme.typography.bodyMedium.copy(fontWeight = FontWeight.Bold),
modifier = Modifier.padding(16.dp)
Text(
"History",
color = FloconTheme.colorPalette.onPrimary,
style = FloconTheme.typography.bodyMedium.copy(fontWeight = FontWeight.Bold),
modifier = Modifier.padding(16.dp)
)
References
  1. When a component's background color is primary, its content color should be onPrimary for semantic correctness and to ensure robustness against future theme changes.

Comment on lines +224 to +229
Text(
text = "adb ${item.command}",
style = FloconTheme.typography.labelLarge,
color = FloconTheme.colorPalette.onPrimary,
modifier = Modifier.weight(1f)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The text color is onPrimary, but the background is a variation of the secondary color. For proper theme adherence and to ensure good contrast, the text color should be onSecondary to match the background.

Suggested change
Text(
text = "adb ${item.command}",
style = FloconTheme.typography.labelLarge,
color = FloconTheme.colorPalette.onPrimary,
modifier = Modifier.weight(1f)
)
Text(
text = "adb ${item.command}",
style = FloconTheme.typography.labelLarge,
color = FloconTheme.colorPalette.onSecondary,
modifier = Modifier.weight(1f)
)

Comment on lines +242 to +252
Text(
text = item.output,
style = FloconTheme.typography.bodySmall,
color = FloconTheme.colorPalette.onSecondary,
modifier =
Modifier.fillMaxWidth()
.background(
FloconTheme.colorPalette.primary.copy(alpha = 0.3f)
)
.padding(4.dp)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The background for this text is a variation of the primary color, but the text color is onSecondary. Based on the project's general rules, the text color should be onPrimary to ensure it's readable and consistent with the theme.

Suggested change
Text(
text = item.output,
style = FloconTheme.typography.bodySmall,
color = FloconTheme.colorPalette.onSecondary,
modifier =
Modifier.fillMaxWidth()
.background(
FloconTheme.colorPalette.primary.copy(alpha = 0.3f)
)
.padding(4.dp)
)
Text(
text = item.output,
style = FloconTheme.typography.bodySmall,
color = FloconTheme.colorPalette.onPrimary,
modifier =
Modifier.fillMaxWidth()
.background(
FloconTheme.colorPalette.primary.copy(alpha = 0.3f)
)
.padding(4.dp)
)
References
  1. When a component's background color is primary, its content color should be onPrimary for semantic correctness and to ensure robustness against future theme changes.

viewModelScope.launch(Dispatchers.IO) {
val currentDevice = currentDeviceUseCase()
val isConnected = observeIsCurrentActiveDevicesUseCase().firstOrNull()
if ((isConnected == false) or (currentDevice == null)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The or infix function is being used for a logical condition. While it works here, the idiomatic way to perform a logical OR in Kotlin is with the || operator. The || operator also provides short-circuiting, which is generally safer and more performant for conditional logic.

Suggested change
if ((isConnected == false) or (currentDevice == null)) {
if (isConnected == false || currentDevice == null) {

@Dao
interface AdbCommandDao {

@Upsert suspend fun upsertAll(commands: List<AdbCommandEntity>)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Since the data source method insertOrReplace operates on a single item, it's more direct and efficient for the DAO to have an upsert method for a single entity rather than upsertAll. This avoids the need to wrap a single item in a list in the data source. This change should be applied along with the corresponding change in AdbCommandLocalDataSourceImpl.

Suggested change
@Upsert suspend fun upsertAll(commands: List<AdbCommandEntity>)
@Upsert suspend fun upsert(command: AdbCommandEntity)

AdbCommandLocalDataSource {

override suspend fun insertOrReplace(adbCommand: AdbCommand) {
dao.upsertAll(listOf(adbCommand.toLocal()))
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Following the suggested change in AdbCommandDao to use upsert for a single entity, this call can be simplified to avoid creating an unnecessary list.

Suggested change
dao.upsertAll(listOf(adbCommand.toLocal()))
dao.upsert(adbCommand.toLocal())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant