Skip to content

Conversation

mwshubham
Copy link

@mwshubham mwshubham commented Aug 31, 2025

Please refer to the individual commits for description

This commit replaces the custom `Result` sealed class with Kotlin's built-in `kotlin.Result` type.

This change simplifies the codebase by removing custom result handling and leveraging the standard library's implementation. All usages of the custom `Result` have been updated to use `kotlin.Result` and its associated functions like `isSuccess`, `isFailure`, `getOrNull`, `exceptionOrNull`, `map`, `onSuccess`, and `onFailure`.
The SyncWork class, responsible for background data synchronization, has been relocated from the `presentation` module to the `data` module. This change improves the separation of concerns by placing data-related operations within the appropriate module.

Key changes:
- Moved `SyncWork.kt` to `data/src/main/kotlin/com/aliasadi/data/workers/`.
- Added a `LOG_TAG` constant in `SyncWork` for consistent logging.
- Removed WorkManager dependency from `presentation/build.gradle.kts`.
- Added WorkManager and Hilt dependencies to `data/build.gradle.kts` to support `SyncWork` and its Hilt injection.
@mwshubham mwshubham changed the title Refactor: Use Kotlin's Result type Refactor: Use Kotlin's Result type & Move SyncWork from presentation to data module Aug 31, 2025
…not needed.

The `MovieDataMapper.kt` file, which contained an extension function `toDbData()` to convert `MovieEntity` to `MovieDbData`, has been deleted.
It is required by com.aliasadi.data.util.NetworkMonitorImpl

The `ACCESS_NETWORK_STATE` permission is added to the `AndroidManifest.xml` file. This allows the application to access information about networks.
The `safeApiCall` utility function has been removed.
All usages of `safeApiCall` in `MovieRemoteDataSource` have been replaced with the standard Kotlin `runCatching` function.
@mwshubham mwshubham changed the title Refactor: Use Kotlin's Result type & Move SyncWork from presentation to data module Refactor: Use Kotlin's Result type, Move SyncWork from presentation to data module and other misc actions Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant