Skip to content

chore(core): adapt to omnifeed changes#42

Merged
lackary merged 7 commits intomainfrom
chore/41-adapt-to-omnifeed-changes
Feb 9, 2026
Merged

chore(core): adapt to omnifeed changes#42
lackary merged 7 commits intomainfrom
chore/41-adapt-to-omnifeed-changes

Conversation

@lackary
Copy link
Owner

@lackary lackary commented Feb 9, 2026

Related Issues

[Please link to any related issue numbers, e.g., Closes #123, Fixes #456.]

Type of Change

  • feat: New feature
  • fix: Bug fix
  • refactor: Code refactoring
  • docs: Documentation update
  • chore: Chore (e.g., updating dependencies, build tooling)
  • style: Style changes (e.g., formatting, no code logic changes)
  • test: Adding or modifying tests

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

  • Integrated touchlab-kermit and implemented an AppLog wrapper to provide preview-safe logging and lazy message evaluation.
  • Refactored KoinInit.kt into DiHelper.kt and integrated OmniFeedConfig to centralize configurations, including Unsplash API keys.
  • Introduced LocalLogger via CompositionLocalProvider and implemented a rememberLogger(tag) utility for UI components.
  • Configured logback.xml for the JVM platform to include the Process ID (PID) in log patterns for better traceability.

2. Error Monitoring & Enhanced UI Tracking

  • Added the MonitorErrorStates component to automatically log errors from multiple AppUiState sources using LaunchedEffect.
  • Integrated detailed lifecycle, navigation, and interaction logging across GalleryScreen and all detail screens (Topic, Collection, User, Photo).
  • Enhanced ViewModels to log all intents (e.g., LoadData, Refresh, LoadMore) and execution contexts for Use Case calls.

3. Infrastructure Improvements

  • Deep Link Handling: Set Android MainActivity launchMode to singleTask to ensure correct intent handling for deep links without recreating the activity.
  • UnsplashLinks: Refactored to use Environment dynamic constants instead of hardcoded strings and standardized UTM parameters across all generated URLs.
  • Utilities: Replaced manual println statements with AppLog in DeepLinkBuffer and added error logging for ISO date parsing in DateExtensions.

4. Build & Dependency Updates

  • Upgraded ktor to 3.4.0 and kotlinxSerialization to 1.10.0.
  • Refined omnifeed composite build substitution logic in settings.gradle.kts for more precise module mapping (e.g., using :omnifeed-core instead of :core).

How to test it?

Tested Platforms:

  • Android
  • iOS
  • Desktop (JVM)
  • Web (Wasm/JS)
  • Shared Logic (Unit Tests)

Test Details:

  • Logging Verification: Launch the app on Android and JVM to confirm that formatted logs with PID are correctly output to the console.
  • Deep Link Testing: Trigger a deep link while the app is in the background to verify singleTask behavior and log tracking in the buffer.
  • Error Monitoring: Simulate network or Use Case failures to ensure MonitorErrorStates captures and logs errors as expected.

Review Checklist

  • My code follows the project's coding style guidelines.
  • I have added sufficient comments to my code, especially in complex areas.
  • I have updated the relevant documentation.
  • My changes don't introduce new bugs.
  • I have tested my code locally.

…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.
@lackary lackary self-assigned this Feb 9, 2026
@lackary lackary added the chore Maintenance, build config, or dependency updates (no src code label Feb 9, 2026
@lackary lackary linked an issue Feb 9, 2026 that may be closed by this pull request
@lackary lackary changed the title chore: adapt to omnifeed changes chore(core): adapt to omnifeed changes Feb 9, 2026
@lackary lackary merged commit 1580ca2 into main Feb 9, 2026
2 checks passed
@lackary lackary deleted the chore/41-adapt-to-omnifeed-changes branch February 10, 2026 00:07
@github-actions
Copy link

🎉 This PR is included in version 0.14.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

chore Maintenance, build config, or dependency updates (no src code released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: Sync with OmniFeed: Refactor DI Architecture & Update ViewModels'

1 participant