Merged
Conversation
…utions
This commit updates several library versions and refines the dependency substitution logic for the `omnifeed` composite build.
Key changes:
- **Dependency Substitutions**: Updated `settings.gradle.kts` to map `omnifeed` library modules to their corresponding project paths using more specific naming (e.g., `:omnifeed-core` instead of `:core`). Added a substitution for the root `omnifeed` module.
- **Library Updates**:
- Upgraded `kotlinxSerialization` to `1.10.0`.
- Upgraded `ktor` to `3.4.0`.
- **New Dependencies**:
- Added `touchlab-kermit` for logging.
- Integrated the root `omnifeed` library dependency into the `compose` module.
- **Version Catalog**: Added `kermit` and `omnifeed` definitions to `libs.versions.toml`.
…nitialization
This commit introduces a unified logging abstraction using Kermit and refactors the Koin dependency injection setup to use a centralized configuration object.
Key changes:
- **Logging System**:
- Introduced `AppLog` wrapper for Kermit to provide preview-safe logging and lazy message evaluation.
- Added `LocalLogger` via `CompositionLocalProvider` to allow easy access to logger instances within the Compose hierarchy.
- Implemented `rememberLogger(tag)` utility for creating lifecycle-aware tagged loggers in UI components.
- Configured `logback.xml` for the JVM platform with custom pattern including Process ID (PID).
- **DI Refactoring**:
- Replaced `KoinInit.kt` with `DiHelper.kt`.
- Integrated `OmniFeedConfig` to centralize application and feature configurations (e.g., Unsplash API keys).
- Updated `initKoin` to initialize the global `AppLog` before starting the Koin container.
- **UI Integration**:
- Wrapped the main `App` content in a `CompositionLocalProvider` for the root logger.
- Refactored `App.kt` to split the root entry point from `AppScreen` for better logging scope.
- Added lifecycle logging to `AppScreen` to verify initialization.
- **Platform Specifics**:
- Updated JVM `main` entry point to set the `PID` system property for enhanced log output.
This change ensures that `MainActivity` is not recreated when the application is re-launched via an intent, which is necessary for correctly handling incoming deep links within the same task instance.
…tants and add logging This commit updates the `UnsplashLinks` utility to use centralized environment configurations for hostnames and API paths, while adding debug logging for generated URLs. Key changes: - **Environment Integration**: Replaced hardcoded "unsplash.com" strings with `Environment.HOST_NAME` and utilized `Environment` constants for photo and collection path segments. - **Logging**: Added an `AppLog` instance to the `UnsplashLinks` object to log all generated links for debugging purposes. - **Refactoring**: Updated method signatures and logic in `home()`, `photo()`, `collection()`, `topic()`, and `userProfile()` to ensure consistent UTM parameter appending across all generated URLs.
…sing This commit replaces standard print statements and silent failures with a centralized logging utility (`AppLog`) to improve observability in the common Compose module. Key changes: - **DeepLinkBuffer**: Replaced `println` with `AppLog` for tracking received and consumed deep links. - **DateExtensions**: Added error logging in `toRelativeTimeStr` to capture exceptions during ISO date parsing.
This commit introduces a centralized error monitoring component and comprehensive logging across the gallery feature to improve observability and debugging.
Key changes:
- **Error Monitoring**: Added `MonitorErrorStates` component that automatically logs errors from multiple `AppUiState` sources using `LaunchedEffect`.
- **Gallery Integration**:
- Integrated `MonitorErrorStates` into `GalleryScreen` to track Photos, Collections, and Topics state errors.
- Added lifecycle logging (`ON_RESUME`, `LaunchedEffect`, `onDispose`) to `GalleryScreen`.
- Added logging for UI events, side effects, and navigation transitions.
- **ViewModel Enhancements**:
- Added detailed debug logging for `GalleryIntent` handling, authentication flows, and data fetching.
- Refactored `handleUseCaseCall` and `fetchCategory` to include identifying names for better log traceability.
- Added logging for ViewModel initialization and profile fetch failures.
- **UI & Navigation**:
- Wrapped `rootLogger` in `remember` for stable `CompositionLocal` provision.
- Fixed a bug in `GalleryScreen` where the pager state synchronization used an unstable tab reference; replaced with `rememberUpdatedState`.
- Cleaned up manual `println` statements in favor of the structured `AppLog` system.
This commit integrates comprehensive debug and error logging across the gallery feature to improve traceability of user interactions and data flow. Key changes: - **ViewModels**: Added debug logging for all intents (`LoadData`, `Refresh`, `LoadMore`, etc.) and error logging for use case failures in `TopicViewModel`, `CollectionViewModel`, `UserViewModel`, and `PhotoViewModel`. - **UI Screens**: Integrated `rememberLogger` and added debug logs for back button presses, "View on Unsplash" actions, and pagination triggers in `CollectionScreen`, `UserScreen`, `PhotoScreen`, and `TopicScreen`. - **Navigation**: Enhanced back stack navigation logging in the main `App` composable for all detail routes. - **Infrastructure**: Updated `handleUseCaseCall` invocations to include descriptive names for better log context.
|
🎉 This PR is included in version 0.14.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
[Please link to any related issue numbers, e.g.,
Closes #123,Fixes #456.]Type of Change
Description
This PR introduces a centralized logging system and an error monitoring mechanism, along with comprehensive tracking enhancements across the Gallery feature to improve observability and debugging efficiency.
1. Core Logging System & DI Refactoring
touchlab-kermitand implemented anAppLogwrapper to provide preview-safe logging and lazy message evaluation.KoinInit.ktintoDiHelper.ktand integratedOmniFeedConfigto centralize configurations, including Unsplash API keys.LocalLoggerviaCompositionLocalProviderand implemented arememberLogger(tag)utility for UI components.logback.xmlfor the JVM platform to include the Process ID (PID) in log patterns for better traceability.2. Error Monitoring & Enhanced UI Tracking
MonitorErrorStatescomponent to automatically log errors from multipleAppUiStatesources usingLaunchedEffect.GalleryScreenand all detail screens (Topic, Collection, User, Photo).LoadData,Refresh,LoadMore) and execution contexts for Use Case calls.3. Infrastructure Improvements
MainActivitylaunchMode tosingleTaskto ensure correct intent handling for deep links without recreating the activity.Environmentdynamic constants instead of hardcoded strings and standardized UTM parameters across all generated URLs.printlnstatements withAppLoginDeepLinkBufferand added error logging for ISO date parsing inDateExtensions.4. Build & Dependency Updates
ktorto3.4.0andkotlinxSerializationto1.10.0.omnifeedcomposite build substitution logic insettings.gradle.ktsfor more precise module mapping (e.g., using:omnifeed-coreinstead of:core).How to test it?
Tested Platforms:
Test Details:
singleTaskbehavior and log tracking in the buffer.MonitorErrorStatescaptures and logs errors as expected.Review Checklist