implement UI models and immutable collections#335
Conversation
…anguages - Add `update_failed` string resource to the default `strings.xml`. - Provide localized translations for Arabic, Bengali, Chinese (Simplified), French, Hindi, Italian, Japanese, Korean, Polish, Russian, Spanish, and Turkish.
- Implement `Ui` model counterparts for `InstalledApp`, `DeviceApp`, `GithubAsset`, `GithubUser`, and `GithubRepoInfo` to decouple the presentation layer from the domain layer. - Add mapper functions (`toUi`, `toDomain`) for all new UI models. - Update `AppsState`, `AppsAction`, and `AppsViewModel` to use the new UI models instead of domain models. - Integrate `kotlinx.collections.immutable` (e.g., `ImmutableList`, `persistentListOf`) across the presentation layer to improve performance and ensure state stability. - Refactor `UpdateState` from a sealed interface to a sealed class. - Clean up `AppsRoot` by removing unused imports and streamlining event handling for app linking and importing. - Improve `AppsViewModel` logic for filtering and sorting apps, ensuring the results are returned as immutable lists.
- Create `GithubDeviceStartUi` and a corresponding mapper to decouple domain models from the presentation layer. - Update `AuthenticationViewModel`, `AuthenticationAction`, and `AuthLoginState` to use `GithubDeviceStartUi` instead of the domain `GithubDeviceStart`. - Refactor `AuthLoginState` from a sealed interface to a sealed class. - Clean up resource imports in `AuthenticationRoot` and update the preview data to use the new UI model.
- Replace the standard Material3 `Button` with the custom `GithubStoreButton` component. - Update imports to include `GithubStoreButton` and remove the unused `androidx.compose.material3.Button` import.
…d home features - Introduce `GithubRepoSummaryUi`, `GithubUserUi`, and `DiscoveryRepositoryUi` to separate domain models from the presentation layer. - Refactor `SearchState` and `HomeState` to use `ImmutableList` and `persistentListOf` for better performance and stability. - Add UI-specific enums (`ProgrammingLanguageUi`, `SearchPlatformUi`, `SortByUi`, `SortOrderUi`) and corresponding mappers to handle UI-to-domain transformations. - Update `RepositoryCard` and other UI components to consume the new UI models. - Refactor navigation to pass repository IDs instead of full summary objects. - Move `ParsedGithubLink` and `GithubUrlParser` into the search presentation model package. - Add `kotlinx.collections.immutable` dependency to core and search presentation modules.
- Update `HomeState` to use `ImmutableList` instead of `List` for `repos` and `installedApps` to improve stability and performance in Compose. - Refactor `HomeViewModel` to use `persistentListOf()` for initial states and `toImmutableList()` when updating repository lists. - Ensure all repository list transformations (filtering, mapping, and pagination) return immutable collections.
- Add validation logic to `DetailsViewModel` to ensure the downloaded APK package name matches the installed application before proceeding with an update. - Enhance `AutoUpdateWorker` to perform package name verification, throwing an exception and skipping the update if a mismatch is detected. - Introduce new localized string resources for "Package mismatch" and "Signing key mismatch" errors across multiple languages (Arabic, Bengali, Chinese, English, French, Hindi, Italian, Japanese, Korean, Polish, Russian, Spanish, Turkish). - Update error handling UI to display specific mismatch messages and block invalid updates.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (73)
WalkthroughThis PR introduces a presentation layer abstraction by creating UI model variants of domain models and migrating state management to use immutable collections. Additionally, it adds APK package-name validation, converts sealed interfaces to sealed classes, updates navigation to pass repository IDs, and adds localized error messages across 15 languages. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip CodeRabbit can suggest fixes for GitHub Check annotations.Configure the |
Summary by CodeRabbit
New Features
Bug Fixes
Localization
Refactor