From d254fcedabf5519a48b92ebfa5ee8a14ad2e3704 Mon Sep 17 00:00:00 2001 From: Nikita Kulikov Date: Thu, 1 Aug 2024 17:43:08 +0100 Subject: [PATCH] Remove ktorfit (#909) **Background** Ktorfit is unnecessary complexity that the project doesn't need. Since Ktorfit switched to the compiler plugin it has become very difficult to maintain **Changes** - Remove ktorfit and migrate to manual ktor usage **Test plan** Try open apps tab --- CHANGELOG.md | 1 + .../plugins/convention/build.gradle.kts | 1 - .../flipper.ktorfit-multiplatform.gradle.kts | 19 ------ .../main/kotlin/flipper.ktorfit.gradle.kts | 10 --- .../metric/impl/countly/CountlyApiImpl.kt | 3 + .../faphub/dao/network/build.gradle.kts | 2 +- .../dao/network/api/FapDownloadApiImpl.kt | 4 +- .../dao/network/api/FapNetworkApiImpl.kt | 16 ++--- .../dao/network/api/FapReportApiImpl.kt | 8 +-- .../dao/network/api/FapVersionApiImpl.kt | 8 +-- .../helper/FapApplicationReceiveHelper.kt | 22 +++---- .../dao/network/ktorfit/KtorfitModule.kt | 62 ------------------ .../ktorfit/api/KtorfitApplicationApi.kt | 38 ----------- .../network/ktorfit/api/KtorfitBundleApi.kt | 18 ------ .../network/ktorfit/api/KtorfitCategoryApi.kt | 13 ---- .../network/ktorfit/api/KtorfitVersionApi.kt | 13 ---- .../network/ktorfit/model/KtorfitException.kt | 10 --- .../network/ktorfit/utils/HostUrlBuilder.kt | 22 ------- .../dao/network/network/FapNetworkModule.kt | 28 +++++++++ .../network/api/FapNetworkApplicationApi.kt | 63 +++++++++++++++++++ .../network/api/FapNetworkBundleApi.kt | 30 +++++++++ .../network/api/FapNetworkCategoryApi.kt | 29 +++++++++ .../network/api/FapNetworkVersionApi.kt | 29 +++++++++ .../network/model/FapNetworkHostEnum.kt | 8 +++ .../model/KtorfitApplicationShort.kt | 4 +- .../model/KtorfitBuildState.kt | 2 +- .../model/KtorfitCategory.kt | 2 +- .../model/KtorfitCurrentVersionShort.kt | 2 +- .../model/KtorfitDetailedVersion.kt | 2 +- .../model/KtorfitExceptionCode.kt | 2 +- .../model/KtorfitReport.kt | 2 +- .../network/network/model/NetworkException.kt | 10 +++ .../model/NetworkExceptionDetail.kt} | 4 +- .../detailed/KtorfitApplicationDetailed.kt | 4 +- .../model/detailed/KtorfitBundle.kt | 2 +- .../model/detailed/KtorfitDetailedBuild.kt | 2 +- .../model/detailed/KtorfitLinks.kt | 2 +- .../model/detailed/KtorfitMetadata.kt | 2 +- .../model/detailed/KtorfitSdk.kt | 2 +- .../model/detailed/KtorfitSourceCodeLinks.kt | 2 +- .../model/detailed/KtorfitVersionDetailed.kt | 4 +- .../requests/KtorfitApplicationApiRequest.kt | 6 +- .../requests/KtorfitDetailedVersionRequest.kt | 2 +- .../model/types/ApplicationSortType.kt | 2 +- .../model/types/SortOrderType.kt | 2 +- .../utils/DateSerializer.kt | 2 +- .../utils/FapCachedCategoryApi.kt} | 17 +++-- gradle/libs.versions.toml | 7 --- instances/android/app/build.gradle.kts | 1 - instances/android/app/proguard-rules.pro | 5 +- 50 files changed, 271 insertions(+), 280 deletions(-) delete mode 100644 build-logic/plugins/convention/src/main/kotlin/flipper.ktorfit-multiplatform.gradle.kts delete mode 100644 build-logic/plugins/convention/src/main/kotlin/flipper.ktorfit.gradle.kts delete mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/KtorfitModule.kt delete mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitApplicationApi.kt delete mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitBundleApi.kt delete mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitCategoryApi.kt delete mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitVersionApi.kt delete mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitException.kt delete mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/utils/HostUrlBuilder.kt create mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/FapNetworkModule.kt create mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkApplicationApi.kt create mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkBundleApi.kt create mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkCategoryApi.kt create mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkVersionApi.kt create mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/FapNetworkHostEnum.kt rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/KtorfitApplicationShort.kt (93%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/KtorfitBuildState.kt (95%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/KtorfitCategory.kt (92%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/KtorfitCurrentVersionShort.kt (89%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/KtorfitDetailedVersion.kt (89%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/KtorfitExceptionCode.kt (94%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/KtorfitReport.kt (80%) create mode 100644 components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/NetworkException.kt rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit/model/KtorfitExceptionDetail.kt => network/model/NetworkExceptionDetail.kt} (71%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/detailed/KtorfitApplicationDetailed.kt (95%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/detailed/KtorfitBundle.kt (80%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/detailed/KtorfitDetailedBuild.kt (81%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/detailed/KtorfitLinks.kt (82%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/detailed/KtorfitMetadata.kt (74%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/detailed/KtorfitSdk.kt (82%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/detailed/KtorfitSourceCodeLinks.kt (77%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/detailed/KtorfitVersionDetailed.kt (85%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/requests/KtorfitApplicationApiRequest.kt (91%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/requests/KtorfitDetailedVersionRequest.kt (83%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/types/ApplicationSortType.kt (93%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/model/types/SortOrderType.kt (91%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit => network}/utils/DateSerializer.kt (94%) rename components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/{ktorfit/utils/FapHubNetworkCategoryApi.kt => network/utils/FapCachedCategoryApi.kt} (81%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 726232b81e..f1e20d6bca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Attention: don't forget to add the flag for F-Droid before release - [Refactor] Update to Kotlin 2.0 - [Refactor] Replace Ktorfit with Ktor requests in remote-controls - [Refactor] Migrate :core:preference to KMP +- [Refactor] Remove ktorfit - [FIX] Distinct fap items by id in paging sources - [FIX] Battery level charge - [FIX] Button arrow tint diff --git a/build-logic/plugins/convention/build.gradle.kts b/build-logic/plugins/convention/build.gradle.kts index 5fb40a9b08..18d3027be8 100644 --- a/build-logic/plugins/convention/build.gradle.kts +++ b/build-logic/plugins/convention/build.gradle.kts @@ -12,7 +12,6 @@ dependencies { implementation(libs.grgit.gradle) implementation(libs.kotlin.ksp.gradle) implementation(libs.square.anvil.gradle) - implementation(libs.ktorfit.gradle) implementation(libs.compose.multiplatform.gradle) implementation(libs.compose.gradle) implementation(libs.kotlin.jvm.gradle) diff --git a/build-logic/plugins/convention/src/main/kotlin/flipper.ktorfit-multiplatform.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/flipper.ktorfit-multiplatform.gradle.kts deleted file mode 100644 index eecf7c8951..0000000000 --- a/build-logic/plugins/convention/src/main/kotlin/flipper.ktorfit-multiplatform.gradle.kts +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - id("flipper.multiplatform") - id("com.google.devtools.ksp") - id("de.jensklingenberg.ktorfit") -} -kotlin { - sourceSets { - @Suppress("UnusedPrivateProperty") - val commonMain by getting { - dependencies { - implementation(libs.ktorfit.lib) - } - } - } -} - -dependencies { - add("kspCommonMainMetadata", libs.ktorfit.ksp) -} diff --git a/build-logic/plugins/convention/src/main/kotlin/flipper.ktorfit.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/flipper.ktorfit.gradle.kts deleted file mode 100644 index b92c1bd662..0000000000 --- a/build-logic/plugins/convention/src/main/kotlin/flipper.ktorfit.gradle.kts +++ /dev/null @@ -1,10 +0,0 @@ -plugins { - id("flipper.android-lib") - id("com.google.devtools.ksp") - id("de.jensklingenberg.ktorfit") -} - -dependencies { - "implementation"(libs.ktorfit.lib) - ksp(libs.ktorfit.ksp) -} diff --git a/components/analytics/metric/impl/src/main/java/com/flipperdevices/metric/impl/countly/CountlyApiImpl.kt b/components/analytics/metric/impl/src/main/java/com/flipperdevices/metric/impl/countly/CountlyApiImpl.kt index fd9e3a7ae5..e0570ba0e9 100644 --- a/components/analytics/metric/impl/src/main/java/com/flipperdevices/metric/impl/countly/CountlyApiImpl.kt +++ b/components/analytics/metric/impl/src/main/java/com/flipperdevices/metric/impl/countly/CountlyApiImpl.kt @@ -60,6 +60,9 @@ class CountlyApiImpl @Inject constructor( id: String, params: Map? ) { + if (countly.events() == null) { + return + } verbose { "Report event $id with $params" } if (params == null) { countly.events().recordEvent(id) diff --git a/components/faphub/dao/network/build.gradle.kts b/components/faphub/dao/network/build.gradle.kts index b04e4adf35..e732cfdcd5 100644 --- a/components/faphub/dao/network/build.gradle.kts +++ b/components/faphub/dao/network/build.gradle.kts @@ -2,7 +2,6 @@ plugins { id("flipper.android-lib") id("flipper.anvil") id("kotlinx-serialization") - id("flipper.ktorfit") } android.namespace = "com.flipperdevices.faphub.dao.network" @@ -25,6 +24,7 @@ dependencies { implementation(libs.kotlin.coroutines) implementation(libs.kotlin.immutable.collections) implementation(libs.kotlin.datetime) + implementation(libs.ktor.client) implementation(libs.annotations) } diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapDownloadApiImpl.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapDownloadApiImpl.kt index 40e9de8ebc..13d484bed1 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapDownloadApiImpl.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapDownloadApiImpl.kt @@ -8,7 +8,7 @@ import com.flipperdevices.core.preference.FlipperStorageProvider import com.flipperdevices.core.progress.ProgressListener import com.flipperdevices.core.progress.ProgressWrapperTracker import com.flipperdevices.faphub.dao.api.FapDownloadApi -import com.flipperdevices.faphub.dao.network.ktorfit.api.KtorfitBundleApi +import com.flipperdevices.faphub.dao.network.network.api.FapNetworkBundleApi import com.flipperdevices.faphub.target.model.FlipperTarget import com.squareup.anvil.annotations.ContributesBinding import io.ktor.client.call.body @@ -22,7 +22,7 @@ import javax.inject.Inject @ContributesBinding(AppGraph::class, FapDownloadApi::class) class FapDownloadApiImpl @Inject constructor( - private val bundleApi: KtorfitBundleApi, + private val bundleApi: FapNetworkBundleApi, private val context: Context ) : FapDownloadApi, LogTagProvider { override val TAG = "FapDownloadApi" diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapNetworkApiImpl.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapNetworkApiImpl.kt index 80f5858373..22c9f1e352 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapNetworkApiImpl.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapNetworkApiImpl.kt @@ -9,10 +9,10 @@ import com.flipperdevices.faphub.dao.api.FapNetworkApi import com.flipperdevices.faphub.dao.api.model.FapCategory import com.flipperdevices.faphub.dao.api.model.SortType import com.flipperdevices.faphub.dao.network.helper.FapApplicationReceiveHelper -import com.flipperdevices.faphub.dao.network.ktorfit.api.KtorfitApplicationApi -import com.flipperdevices.faphub.dao.network.ktorfit.model.requests.KtorfitApplicationApiRequest -import com.flipperdevices.faphub.dao.network.ktorfit.utils.FapHubNetworkCategoryApi -import com.flipperdevices.faphub.dao.network.ktorfit.utils.HostUrlBuilder +import com.flipperdevices.faphub.dao.network.network.api.FapNetworkApplicationApi +import com.flipperdevices.faphub.dao.network.network.model.FapNetworkHostEnum +import com.flipperdevices.faphub.dao.network.network.model.requests.KtorfitApplicationApiRequest +import com.flipperdevices.faphub.dao.network.network.utils.FapCachedCategoryApi import com.flipperdevices.faphub.errors.api.throwable.FirmwareNotSupported import com.flipperdevices.faphub.target.model.FlipperTarget import com.squareup.anvil.annotations.ContributesBinding @@ -21,14 +21,14 @@ import javax.inject.Inject @ContributesBinding(AppGraph::class, FapNetworkApi::class) class FapNetworkApiImpl @Inject constructor( - private val applicationApi: KtorfitApplicationApi, - private val categoryApi: FapHubNetworkCategoryApi, - private val hostUrlBuilder: HostUrlBuilder, + private val applicationApi: FapNetworkApplicationApi, + private val categoryApi: FapCachedCategoryApi, + private val networkHost: FapNetworkHostEnum, private val fapApplicationReceiveHelper: FapApplicationReceiveHelper ) : FapNetworkApi, LogTagProvider { override val TAG = "FapNetworkApi" - override suspend fun getHostUrl() = hostUrlBuilder.getHostUrl() + override suspend fun getHostUrl() = networkHost.hostUrl override suspend fun getFeaturedItem(target: FlipperTarget) = catchWithDispatcher { debug { "Request featured item" } diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapReportApiImpl.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapReportApiImpl.kt index ff472b0f99..83706b092f 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapReportApiImpl.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapReportApiImpl.kt @@ -2,8 +2,8 @@ package com.flipperdevices.faphub.dao.network.api import com.flipperdevices.core.di.AppGraph import com.flipperdevices.faphub.dao.api.FapReportApi -import com.flipperdevices.faphub.dao.network.ktorfit.api.KtorfitApplicationApi -import com.flipperdevices.faphub.dao.network.ktorfit.model.KtorfitReport +import com.flipperdevices.faphub.dao.network.network.api.FapNetworkApplicationApi +import com.flipperdevices.faphub.dao.network.network.model.KtorfitReport import com.squareup.anvil.annotations.ContributesBinding import javax.inject.Inject @@ -11,10 +11,10 @@ private const val DEFAULT_TYPE = "default_android" @ContributesBinding(AppGraph::class, FapReportApi::class) class FapReportApiImpl @Inject constructor( - val ktorfitApplicationApi: KtorfitApplicationApi + val fapNetworkApplicationApi: FapNetworkApplicationApi ) : FapReportApi { override suspend fun report(applicationUid: String, description: String) { - ktorfitApplicationApi.report( + fapNetworkApplicationApi.report( applicationUid, KtorfitReport( description = description, diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapVersionApiImpl.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapVersionApiImpl.kt index 63dd6cd543..243dc03c64 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapVersionApiImpl.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/api/FapVersionApiImpl.kt @@ -5,8 +5,8 @@ import com.flipperdevices.core.di.AppGraph import com.flipperdevices.core.ktx.jre.pmap import com.flipperdevices.core.log.LogTagProvider import com.flipperdevices.faphub.dao.api.FapVersionApi -import com.flipperdevices.faphub.dao.network.ktorfit.api.KtorfitVersionApi -import com.flipperdevices.faphub.dao.network.ktorfit.model.requests.KtorfitDetailedVersionRequest +import com.flipperdevices.faphub.dao.network.network.api.FapNetworkVersionApi +import com.flipperdevices.faphub.dao.network.network.model.requests.KtorfitDetailedVersionRequest import com.squareup.anvil.annotations.ContributesBinding import javax.inject.Inject @@ -14,14 +14,14 @@ private const val MAX_QUERY_ARRAY_SIZE = 500 @ContributesBinding(AppGraph::class, FapVersionApi::class) class FapVersionApiImpl @Inject constructor( - private val ktorfitVersionApi: KtorfitVersionApi + private val fapNetworkVersionApi: FapNetworkVersionApi ) : FapVersionApi, LogTagProvider { override val TAG = "FapVersionApi" override suspend fun getVersionsMap(versions: List): Map { val fetchedVersions = versions.chunked(MAX_QUERY_ARRAY_SIZE) .pmap { - ktorfitVersionApi.getVersions( + fapNetworkVersionApi.getVersions( KtorfitDetailedVersionRequest( applicationVersions = it, limit = it.size, diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/helper/FapApplicationReceiveHelper.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/helper/FapApplicationReceiveHelper.kt index 2d89d27651..532ced2a4e 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/helper/FapApplicationReceiveHelper.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/helper/FapApplicationReceiveHelper.kt @@ -5,13 +5,13 @@ import com.flipperdevices.core.log.LogTagProvider import com.flipperdevices.core.log.warn import com.flipperdevices.faphub.dao.api.model.FapCategory import com.flipperdevices.faphub.dao.api.model.SortType -import com.flipperdevices.faphub.dao.network.ktorfit.api.KtorfitApplicationApi -import com.flipperdevices.faphub.dao.network.ktorfit.model.KtorfitApplicationShort -import com.flipperdevices.faphub.dao.network.ktorfit.model.KtorfitException -import com.flipperdevices.faphub.dao.network.ktorfit.model.KtorfitExceptionCode -import com.flipperdevices.faphub.dao.network.ktorfit.model.requests.KtorfitApplicationApiRequest -import com.flipperdevices.faphub.dao.network.ktorfit.model.types.ApplicationSortType -import com.flipperdevices.faphub.dao.network.ktorfit.model.types.SortOrderType +import com.flipperdevices.faphub.dao.network.network.api.FapNetworkApplicationApi +import com.flipperdevices.faphub.dao.network.network.model.KtorfitApplicationShort +import com.flipperdevices.faphub.dao.network.network.model.KtorfitExceptionCode +import com.flipperdevices.faphub.dao.network.network.model.NetworkException +import com.flipperdevices.faphub.dao.network.network.model.requests.KtorfitApplicationApiRequest +import com.flipperdevices.faphub.dao.network.network.model.types.ApplicationSortType +import com.flipperdevices.faphub.dao.network.network.model.types.SortOrderType import com.flipperdevices.faphub.errors.api.throwable.FirmwareNotSupported import com.flipperdevices.faphub.target.model.FlipperTarget import io.ktor.client.call.body @@ -22,7 +22,7 @@ private const val MAX_QUERY_ARRAY_SIZE = 500 @Suppress("LongParameterList") class FapApplicationReceiveHelper @Inject constructor( - private val applicationApi: KtorfitApplicationApi, + private val applicationApi: FapNetworkApplicationApi, ) : LogTagProvider { override val TAG = "FapApplicationReceiveHelper" suspend fun get( @@ -46,10 +46,10 @@ class FapApplicationReceiveHelper @Inject constructor( applicationIds = applicationIds ) } catch (requestException: ClientRequestException) { - val ktorfitException = runCatching { - requestException.response.body() + val networkException = runCatching { + requestException.response.body() }.getOrNull() ?: throw requestException - val exceptionCode = KtorfitExceptionCode.fromCode(ktorfitException.detail.code) + val exceptionCode = KtorfitExceptionCode.fromCode(networkException.detail.code) throw if (exceptionCode == KtorfitExceptionCode.UNKNOWN_SDK) { FirmwareNotSupported(requestException) } else { diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/KtorfitModule.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/KtorfitModule.kt deleted file mode 100644 index f1050a26f5..0000000000 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/KtorfitModule.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.flipperdevices.faphub.dao.network.ktorfit - -import com.flipperdevices.core.di.AppGraph -import com.flipperdevices.faphub.dao.network.ktorfit.api.KtorfitApplicationApi -import com.flipperdevices.faphub.dao.network.ktorfit.api.KtorfitBundleApi -import com.flipperdevices.faphub.dao.network.ktorfit.api.KtorfitVersionApi -import com.flipperdevices.faphub.dao.network.ktorfit.api.createKtorfitApplicationApi -import com.flipperdevices.faphub.dao.network.ktorfit.api.createKtorfitBundleApi -import com.flipperdevices.faphub.dao.network.ktorfit.api.createKtorfitCategoryApi -import com.flipperdevices.faphub.dao.network.ktorfit.api.createKtorfitVersionApi -import com.flipperdevices.faphub.dao.network.ktorfit.utils.FapHubNetworkCategoryApi -import com.flipperdevices.faphub.dao.network.ktorfit.utils.HostUrlBuilder -import com.squareup.anvil.annotations.ContributesTo -import dagger.Module -import dagger.Provides -import dagger.Reusable -import de.jensklingenberg.ktorfit.Ktorfit -import io.ktor.client.HttpClient -import kotlinx.coroutines.runBlocking - -@Module -@ContributesTo(AppGraph::class) -class KtorfitModule { - @Provides - @Reusable - fun provideRetrofit( - httpClient: HttpClient, - hostUrlBuilder: HostUrlBuilder - ): Ktorfit { - val hostUrl = runBlocking { hostUrlBuilder.getHostUrl() } - val url = "$hostUrl/api/" - return Ktorfit.Builder() - .baseUrl(url) - .httpClient(httpClient) - .build() - } - - @Provides - @Reusable - fun provideApplicationApi(ktorfit: Ktorfit): KtorfitApplicationApi { - return ktorfit.createKtorfitApplicationApi() - } - - @Provides - @Reusable - fun provideNetworkCategoryApi(ktorfit: Ktorfit): FapHubNetworkCategoryApi { - val categoryApi = ktorfit.createKtorfitCategoryApi() - return FapHubNetworkCategoryApi(categoryApi) - } - - @Provides - @Reusable - fun provideBundleApi(ktorfit: Ktorfit): KtorfitBundleApi { - return ktorfit.createKtorfitBundleApi() - } - - @Provides - @Reusable - fun provideVersionApi(ktorfit: Ktorfit): KtorfitVersionApi { - return ktorfit.createKtorfitVersionApi() - } -} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitApplicationApi.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitApplicationApi.kt deleted file mode 100644 index dacdfc66db..0000000000 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitApplicationApi.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.api - -import com.flipperdevices.faphub.dao.network.ktorfit.model.KtorfitApplicationShort -import com.flipperdevices.faphub.dao.network.ktorfit.model.KtorfitReport -import com.flipperdevices.faphub.dao.network.ktorfit.model.detailed.KtorfitApplicationDetailed -import com.flipperdevices.faphub.dao.network.ktorfit.model.requests.KtorfitApplicationApiRequest -import de.jensklingenberg.ktorfit.http.Body -import de.jensklingenberg.ktorfit.http.GET -import de.jensklingenberg.ktorfit.http.POST -import de.jensklingenberg.ktorfit.http.Path -import de.jensklingenberg.ktorfit.http.Query - -@Suppress("LongParameterList") -interface KtorfitApplicationApi { - @POST("v0/1/application") - suspend fun getAll( - @Body applicationApiRequest: KtorfitApplicationApiRequest - ): List - - @GET("v0/0/application/featured") - suspend fun getFeaturedApps( - @Query("limit") limit: Int = 50, - @Query("offset") offset: Int = 0 - ): List - - @GET("v0/0/application/{uid}") - suspend fun get( - @Path("uid") - id: String, - @Query("target") - target: String? = null, - @Query("api") - sdkApiVersion: String? = null, - ): KtorfitApplicationDetailed - - @POST("v0/0/application/{uid}/issue") - suspend fun report(@Path("uid") applicationUid: String, @Body report: KtorfitReport) -} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitBundleApi.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitBundleApi.kt deleted file mode 100644 index 5984ab6638..0000000000 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitBundleApi.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.api - -import de.jensklingenberg.ktorfit.http.GET -import de.jensklingenberg.ktorfit.http.Path -import de.jensklingenberg.ktorfit.http.Query -import de.jensklingenberg.ktorfit.http.Streaming -import io.ktor.client.statement.HttpStatement - -interface KtorfitBundleApi { - - @Streaming - @GET("v0/0/application/version/{uid}/build/compatible") - suspend fun downloadBundle( - @Path("uid") versionUid: String, - @Query("target") target: String, - @Query("api") sdkApi: String - ): HttpStatement -} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitCategoryApi.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitCategoryApi.kt deleted file mode 100644 index 5c228ef369..0000000000 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitCategoryApi.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.api - -import com.flipperdevices.faphub.dao.network.ktorfit.model.KtorfitCategory -import de.jensklingenberg.ktorfit.http.GET -import de.jensklingenberg.ktorfit.http.Query - -interface KtorfitCategoryApi { - @GET("v0/0/category") - suspend fun getAll( - @Query("api") sdkApi: String?, - @Query("target") target: String? - ): List -} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitVersionApi.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitVersionApi.kt deleted file mode 100644 index e3c416b394..0000000000 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/api/KtorfitVersionApi.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.api - -import com.flipperdevices.faphub.dao.network.ktorfit.model.KtorfitDetailedVersion -import com.flipperdevices.faphub.dao.network.ktorfit.model.requests.KtorfitDetailedVersionRequest -import de.jensklingenberg.ktorfit.http.Body -import de.jensklingenberg.ktorfit.http.POST - -interface KtorfitVersionApi { - @POST("v0/1/application/versions") - suspend fun getVersions( - @Body versionRequest: KtorfitDetailedVersionRequest - ): List -} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitException.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitException.kt deleted file mode 100644 index eddeb69bf4..0000000000 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitException.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model - -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -@Serializable -data class KtorfitException( - @SerialName("detail") - val detail: KtorfitExceptionDetail -) diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/utils/HostUrlBuilder.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/utils/HostUrlBuilder.kt deleted file mode 100644 index 2818f21a14..0000000000 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/utils/HostUrlBuilder.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.utils - -import androidx.datastore.core.DataStore -import com.flipperdevices.core.preference.pb.Settings -import kotlinx.coroutines.flow.first -import javax.inject.Inject - -private const val FAP_URL_DEV = "https://catalog.flipp.dev" -private const val FAP_URL = "https://catalog.flipperzero.one" - -class HostUrlBuilder @Inject constructor( - private val settings: DataStore -) { - suspend fun getHostUrl(): String { - val useDevCatalog = settings.data.first().use_dev_catalog - return if (useDevCatalog) { - FAP_URL_DEV - } else { - FAP_URL - } - } -} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/FapNetworkModule.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/FapNetworkModule.kt new file mode 100644 index 0000000000..a9a7b0e67e --- /dev/null +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/FapNetworkModule.kt @@ -0,0 +1,28 @@ +package com.flipperdevices.faphub.dao.network.network + +import androidx.datastore.core.DataStore +import com.flipperdevices.core.di.AppGraph +import com.flipperdevices.core.preference.pb.Settings +import com.flipperdevices.faphub.dao.network.network.model.FapNetworkHostEnum +import com.squareup.anvil.annotations.ContributesTo +import dagger.Module +import dagger.Provides +import dagger.Reusable +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.runBlocking + +@Module +@ContributesTo(AppGraph::class) +class FapNetworkModule { + @Provides + @Reusable + fun provideFapNetworkHostEnum( + settings: DataStore + ): FapNetworkHostEnum { + val useDevCatalog = runBlocking { settings.data.first().use_dev_catalog } + return when (useDevCatalog) { + true -> FapNetworkHostEnum.DEV + false -> FapNetworkHostEnum.PROD + } + } +} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkApplicationApi.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkApplicationApi.kt new file mode 100644 index 0000000000..a8a31ebfe6 --- /dev/null +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkApplicationApi.kt @@ -0,0 +1,63 @@ +package com.flipperdevices.faphub.dao.network.network.api + +import com.flipperdevices.core.di.provideDelegate +import com.flipperdevices.faphub.dao.network.network.model.FapNetworkHostEnum +import com.flipperdevices.faphub.dao.network.network.model.KtorfitApplicationShort +import com.flipperdevices.faphub.dao.network.network.model.KtorfitReport +import com.flipperdevices.faphub.dao.network.network.model.detailed.KtorfitApplicationDetailed +import com.flipperdevices.faphub.dao.network.network.model.requests.KtorfitApplicationApiRequest +import io.ktor.client.HttpClient +import io.ktor.client.call.body +import io.ktor.client.request.get +import io.ktor.client.request.parameter +import io.ktor.client.request.post +import io.ktor.client.request.setBody +import io.ktor.client.request.url +import javax.inject.Inject +import javax.inject.Provider + +class FapNetworkApplicationApi @Inject constructor( + private val httpClient: HttpClient, + fapHostProvider: Provider, +) { + private val fapHost by fapHostProvider + + suspend fun getAll( + applicationApiRequest: KtorfitApplicationApiRequest + ): List { + return httpClient.post { + url("${fapHost.baseUrl}/v0/1/application") + setBody(applicationApiRequest) + }.body() + } + + suspend fun getFeaturedApps( + limit: Int = 50, + offset: Int = 0 + ): List { + return httpClient.get { + url("${fapHost.baseUrl}/v0/0/application/featured") + parameter("limit", limit) + parameter("offset", offset) + }.body() + } + + suspend fun get( + id: String, + target: String? = null, + sdkApiVersion: String? = null, + ): KtorfitApplicationDetailed { + return httpClient.get { + url("${fapHost.baseUrl}/v0/0/application/$id") + parameter("target", target) + parameter("api", sdkApiVersion) + }.body() + } + + suspend fun report(applicationUid: String, report: KtorfitReport) { + httpClient.post { + url("${fapHost.baseUrl}/v0/0/application/$applicationUid/issue") + setBody(report) + } + } +} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkBundleApi.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkBundleApi.kt new file mode 100644 index 0000000000..14c0256968 --- /dev/null +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkBundleApi.kt @@ -0,0 +1,30 @@ +package com.flipperdevices.faphub.dao.network.network.api + +import com.flipperdevices.core.di.provideDelegate +import com.flipperdevices.faphub.dao.network.network.model.FapNetworkHostEnum +import io.ktor.client.HttpClient +import io.ktor.client.request.parameter +import io.ktor.client.request.prepareGet +import io.ktor.client.request.url +import io.ktor.client.statement.HttpStatement +import javax.inject.Inject +import javax.inject.Provider + +class FapNetworkBundleApi @Inject constructor( + private val httpClient: HttpClient, + fapHostProvider: Provider, +) { + private val fapHost by fapHostProvider + + suspend fun downloadBundle( + versionUid: String, + target: String, + sdkApi: String + ): HttpStatement { + return httpClient.prepareGet { + url("${fapHost.baseUrl}/v0/0/application/version/$versionUid/build/compatible") + parameter("target", target) + parameter("api", sdkApi) + } + } +} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkCategoryApi.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkCategoryApi.kt new file mode 100644 index 0000000000..cdf01dc485 --- /dev/null +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkCategoryApi.kt @@ -0,0 +1,29 @@ +package com.flipperdevices.faphub.dao.network.network.api + +import com.flipperdevices.core.di.provideDelegate +import com.flipperdevices.faphub.dao.network.network.model.FapNetworkHostEnum +import com.flipperdevices.faphub.dao.network.network.model.KtorfitCategory +import io.ktor.client.HttpClient +import io.ktor.client.call.body +import io.ktor.client.request.get +import io.ktor.client.request.parameter +import io.ktor.client.request.url +import javax.inject.Provider + +class FapNetworkCategoryApi( + private val httpClient: HttpClient, + fapHostProvider: Provider, +) { + private val fapHost by fapHostProvider + + suspend fun getAll( + sdkApi: String?, + target: String? + ): List { + return httpClient.get { + url("${fapHost.baseUrl}/v0/0/category") + parameter("api", sdkApi) + parameter("target", target) + }.body() + } +} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkVersionApi.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkVersionApi.kt new file mode 100644 index 0000000000..8c252b55d9 --- /dev/null +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/api/FapNetworkVersionApi.kt @@ -0,0 +1,29 @@ +package com.flipperdevices.faphub.dao.network.network.api + +import com.flipperdevices.core.di.provideDelegate +import com.flipperdevices.faphub.dao.network.network.model.FapNetworkHostEnum +import com.flipperdevices.faphub.dao.network.network.model.KtorfitDetailedVersion +import com.flipperdevices.faphub.dao.network.network.model.requests.KtorfitDetailedVersionRequest +import io.ktor.client.HttpClient +import io.ktor.client.call.body +import io.ktor.client.request.post +import io.ktor.client.request.setBody +import io.ktor.client.request.url +import javax.inject.Inject +import javax.inject.Provider + +class FapNetworkVersionApi @Inject constructor( + private val httpClient: HttpClient, + fapHostProvider: Provider, +) { + private val fapHost by fapHostProvider + + suspend fun getVersions( + versionRequest: KtorfitDetailedVersionRequest + ): List { + return httpClient.post { + url("${fapHost.baseUrl}/v0/1/application/versions") + setBody(versionRequest) + }.body() + } +} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/FapNetworkHostEnum.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/FapNetworkHostEnum.kt new file mode 100644 index 0000000000..a9af5af85c --- /dev/null +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/FapNetworkHostEnum.kt @@ -0,0 +1,8 @@ +package com.flipperdevices.faphub.dao.network.network.model + +enum class FapNetworkHostEnum(val hostUrl: String) { + PROD("https://catalog.flipperzero.one"), + DEV("https://catalog.flipp.dev"); + + val baseUrl = "$hostUrl/api" +} diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitApplicationShort.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitApplicationShort.kt similarity index 93% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitApplicationShort.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitApplicationShort.kt index 28d2ff48e6..fbc32f8f48 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitApplicationShort.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitApplicationShort.kt @@ -1,10 +1,10 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model +package com.flipperdevices.faphub.dao.network.network.model import com.flipperdevices.core.data.SemVer import com.flipperdevices.faphub.dao.api.model.FapCategory import com.flipperdevices.faphub.dao.api.model.FapItemShort import com.flipperdevices.faphub.dao.api.model.FapItemVersion -import com.flipperdevices.faphub.dao.network.ktorfit.utils.DateSerializer +import com.flipperdevices.faphub.dao.network.network.utils.DateSerializer import com.flipperdevices.faphub.target.model.FlipperTarget import kotlinx.collections.immutable.toImmutableList import kotlinx.datetime.LocalDateTime diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitBuildState.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitBuildState.kt similarity index 95% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitBuildState.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitBuildState.kt index 11c7b38738..5fc2d6729c 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitBuildState.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitBuildState.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model +package com.flipperdevices.faphub.dao.network.network.model import com.flipperdevices.faphub.dao.api.model.FapBuildState import com.flipperdevices.faphub.target.model.FlipperTarget diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitCategory.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitCategory.kt similarity index 92% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitCategory.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitCategory.kt index d658dacf07..af2f11544c 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitCategory.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitCategory.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model +package com.flipperdevices.faphub.dao.network.network.model import android.graphics.Color import com.flipperdevices.faphub.dao.api.model.FapCategory diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitCurrentVersionShort.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitCurrentVersionShort.kt similarity index 89% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitCurrentVersionShort.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitCurrentVersionShort.kt index 65e1f6a118..7ec845287e 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitCurrentVersionShort.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitCurrentVersionShort.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model +package com.flipperdevices.faphub.dao.network.network.model import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitDetailedVersion.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitDetailedVersion.kt similarity index 89% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitDetailedVersion.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitDetailedVersion.kt index 019f85baed..250823a63d 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitDetailedVersion.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitDetailedVersion.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model +package com.flipperdevices.faphub.dao.network.network.model import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitExceptionCode.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitExceptionCode.kt similarity index 94% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitExceptionCode.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitExceptionCode.kt index bdad1ac929..58d6070b47 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitExceptionCode.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitExceptionCode.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model +package com.flipperdevices.faphub.dao.network.network.model enum class KtorfitExceptionCode(val code: Int) { UNDEFINED(code = 0), diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitReport.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitReport.kt similarity index 80% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitReport.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitReport.kt index 840ea39c69..8f21e35946 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitReport.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/KtorfitReport.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model +package com.flipperdevices.faphub.dao.network.network.model import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/NetworkException.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/NetworkException.kt new file mode 100644 index 0000000000..88a666ef25 --- /dev/null +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/NetworkException.kt @@ -0,0 +1,10 @@ +package com.flipperdevices.faphub.dao.network.network.model + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class NetworkException( + @SerialName("detail") + val detail: NetworkExceptionDetail +) diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitExceptionDetail.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/NetworkExceptionDetail.kt similarity index 71% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitExceptionDetail.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/NetworkExceptionDetail.kt index 21fd7a4c16..b17977391a 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/KtorfitExceptionDetail.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/NetworkExceptionDetail.kt @@ -1,10 +1,10 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model +package com.flipperdevices.faphub.dao.network.network.model import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class KtorfitExceptionDetail( +data class NetworkExceptionDetail( @SerialName("status") val status: String, @SerialName("code") diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitApplicationDetailed.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitApplicationDetailed.kt similarity index 95% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitApplicationDetailed.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitApplicationDetailed.kt index 428d50642a..6483adccb1 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitApplicationDetailed.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitApplicationDetailed.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.detailed +package com.flipperdevices.faphub.dao.network.network.model.detailed import com.flipperdevices.core.data.SemVer import com.flipperdevices.faphub.dao.api.model.FapCategory @@ -6,7 +6,7 @@ import com.flipperdevices.faphub.dao.api.model.FapDeveloperInformation import com.flipperdevices.faphub.dao.api.model.FapItem import com.flipperdevices.faphub.dao.api.model.FapItemVersion import com.flipperdevices.faphub.dao.api.model.FapMetaInformation -import com.flipperdevices.faphub.dao.network.ktorfit.utils.DateSerializer +import com.flipperdevices.faphub.dao.network.network.utils.DateSerializer import com.flipperdevices.faphub.target.model.FlipperTarget import kotlinx.collections.immutable.toImmutableList import kotlinx.datetime.LocalDateTime diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitBundle.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitBundle.kt similarity index 80% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitBundle.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitBundle.kt index 0f7ffbd0a9..7a6ddcaa0e 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitBundle.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitBundle.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.detailed +package com.flipperdevices.faphub.dao.network.network.model.detailed import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitDetailedBuild.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitDetailedBuild.kt similarity index 81% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitDetailedBuild.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitDetailedBuild.kt index b4954698c1..6678e71e13 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitDetailedBuild.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitDetailedBuild.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.detailed +package com.flipperdevices.faphub.dao.network.network.model.detailed import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitLinks.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitLinks.kt similarity index 82% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitLinks.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitLinks.kt index c4a29927ac..3613408611 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitLinks.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitLinks.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.detailed +package com.flipperdevices.faphub.dao.network.network.model.detailed import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitMetadata.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitMetadata.kt similarity index 74% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitMetadata.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitMetadata.kt index 91dd696417..29193ad8e4 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitMetadata.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitMetadata.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.detailed +package com.flipperdevices.faphub.dao.network.network.model.detailed import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitSdk.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitSdk.kt similarity index 82% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitSdk.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitSdk.kt index d519163570..aa60136a09 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitSdk.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitSdk.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.detailed +package com.flipperdevices.faphub.dao.network.network.model.detailed import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitSourceCodeLinks.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitSourceCodeLinks.kt similarity index 77% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitSourceCodeLinks.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitSourceCodeLinks.kt index c3a3172d01..edecd6f445 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitSourceCodeLinks.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitSourceCodeLinks.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.detailed +package com.flipperdevices.faphub.dao.network.network.model.detailed import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitVersionDetailed.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitVersionDetailed.kt similarity index 85% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitVersionDetailed.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitVersionDetailed.kt index 070aa78ddd..3ef8c0f6dc 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/detailed/KtorfitVersionDetailed.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/detailed/KtorfitVersionDetailed.kt @@ -1,6 +1,6 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.detailed +package com.flipperdevices.faphub.dao.network.network.model.detailed -import com.flipperdevices.faphub.dao.network.ktorfit.model.KtorfitBuildState +import com.flipperdevices.faphub.dao.network.network.model.KtorfitBuildState import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/requests/KtorfitApplicationApiRequest.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/requests/KtorfitApplicationApiRequest.kt similarity index 91% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/requests/KtorfitApplicationApiRequest.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/requests/KtorfitApplicationApiRequest.kt index 742694f891..c2b4d0a4a2 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/requests/KtorfitApplicationApiRequest.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/requests/KtorfitApplicationApiRequest.kt @@ -1,7 +1,7 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.requests +package com.flipperdevices.faphub.dao.network.network.model.requests -import com.flipperdevices.faphub.dao.network.ktorfit.model.types.ApplicationSortType -import com.flipperdevices.faphub.dao.network.ktorfit.model.types.SortOrderType +import com.flipperdevices.faphub.dao.network.network.model.types.ApplicationSortType +import com.flipperdevices.faphub.dao.network.network.model.types.SortOrderType import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/requests/KtorfitDetailedVersionRequest.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/requests/KtorfitDetailedVersionRequest.kt similarity index 83% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/requests/KtorfitDetailedVersionRequest.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/requests/KtorfitDetailedVersionRequest.kt index 076e0e5bda..d1d14404d8 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/requests/KtorfitDetailedVersionRequest.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/requests/KtorfitDetailedVersionRequest.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.requests +package com.flipperdevices.faphub.dao.network.network.model.requests import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/types/ApplicationSortType.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/types/ApplicationSortType.kt similarity index 93% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/types/ApplicationSortType.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/types/ApplicationSortType.kt index c994bfe333..7c74535170 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/types/ApplicationSortType.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/types/ApplicationSortType.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.types +package com.flipperdevices.faphub.dao.network.network.model.types import androidx.annotation.StringDef import com.flipperdevices.faphub.dao.api.model.SortType diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/types/SortOrderType.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/types/SortOrderType.kt similarity index 91% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/types/SortOrderType.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/types/SortOrderType.kt index 0ef24c7fc5..6f047b6c59 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/model/types/SortOrderType.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/model/types/SortOrderType.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.model.types +package com.flipperdevices.faphub.dao.network.network.model.types import androidx.annotation.IntDef import com.flipperdevices.faphub.dao.api.model.SortType diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/utils/DateSerializer.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/utils/DateSerializer.kt similarity index 94% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/utils/DateSerializer.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/utils/DateSerializer.kt index f5289ef9d6..45018b1ddd 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/utils/DateSerializer.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/utils/DateSerializer.kt @@ -1,4 +1,4 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.utils +package com.flipperdevices.faphub.dao.network.network.utils import kotlinx.datetime.Instant import kotlinx.datetime.LocalDateTime diff --git a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/utils/FapHubNetworkCategoryApi.kt b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/utils/FapCachedCategoryApi.kt similarity index 81% rename from components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/utils/FapHubNetworkCategoryApi.kt rename to components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/utils/FapCachedCategoryApi.kt index 1c626b636d..2db7111eef 100644 --- a/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/ktorfit/utils/FapHubNetworkCategoryApi.kt +++ b/components/faphub/dao/network/src/main/java/com/flipperdevices/faphub/dao/network/network/utils/FapCachedCategoryApi.kt @@ -1,18 +1,25 @@ -package com.flipperdevices.faphub.dao.network.ktorfit.utils +package com.flipperdevices.faphub.dao.network.network.utils import com.flipperdevices.core.ktx.jre.withLock import com.flipperdevices.core.log.LogTagProvider import com.flipperdevices.core.log.error import com.flipperdevices.core.log.info import com.flipperdevices.faphub.dao.api.model.FapCategory -import com.flipperdevices.faphub.dao.network.ktorfit.api.KtorfitCategoryApi -import com.flipperdevices.faphub.dao.network.ktorfit.model.KtorfitCategory +import com.flipperdevices.faphub.dao.network.network.api.FapNetworkCategoryApi +import com.flipperdevices.faphub.dao.network.network.model.FapNetworkHostEnum +import com.flipperdevices.faphub.dao.network.network.model.KtorfitCategory import com.flipperdevices.faphub.target.model.FlipperTarget +import io.ktor.client.HttpClient import kotlinx.coroutines.sync.Mutex +import javax.inject.Inject +import javax.inject.Provider -class FapHubNetworkCategoryApi( - private val categoryApi: KtorfitCategoryApi +class FapCachedCategoryApi @Inject constructor( + httpClient: HttpClient, + fapHostProvider: Provider, ) : LogTagProvider { + private val categoryApi = FapNetworkCategoryApi(httpClient, fapHostProvider) + override val TAG = "FapHubNetworkCategoryApi" private val mutex = Mutex() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ab1f31f417..0d1ad5c8d6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -63,8 +63,6 @@ grgit-gradle = "8d818b74b9" work = "2.9.0" # https://developer.android.com/jetpack/androidx/releases/work coil = "2.7.0" # https://github.com/coil-kt/coil/releases play-core = "2.1.0" # https://developer.android.com/guide/playcore#java-kotlin-in-app-update -ktorfit = "a004d528f1" # https://github.com/Foso/Ktorfit/releases -ktorfit-ksp = "e1872c34ae" decompose = "3.1.0" # https://github.com/arkivanov/Decompose/releases essenty = "2.1.0" # https://github.com/arkivanov/Essenty/releases zoomable = "1.6.1" #https://github.com/usuiat/Zoomable @@ -226,11 +224,6 @@ ktor-serialization = { module = "io.ktor:ktor-serialization-kotlinx-json", versi ktor-logging = { module = "io.ktor:ktor-client-logging-jvm", version.ref = "ktor" } ktor-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" } -# Ktorfit -ktorfit-ksp = { module = "com.github.LionZXY.Ktorfit:ktorfit-ksp", version.ref = "ktorfit-ksp" } -ktorfit-lib = { module = "com.github.LionZXY.Ktorfit:ktorfit-lib", version.ref = "ktorfit" } -ktorfit-gradle = { module = "com.github.LionZXY.Ktorfit:ktorfit-gradle-plugin", version.ref = "ktorfit" } - # Apache commons apache-compress = { module = "org.apache.commons:commons-compress", version.ref = "apache-compress" } apache-codec = { module = "commons-codec:commons-codec", version.ref = "apache-codec" } diff --git a/instances/android/app/build.gradle.kts b/instances/android/app/build.gradle.kts index e03623cb1d..9971e5edb1 100644 --- a/instances/android/app/build.gradle.kts +++ b/instances/android/app/build.gradle.kts @@ -262,7 +262,6 @@ dependencies { implementation(libs.appcompat) implementation(libs.material) implementation(libs.work.ktx) - implementation(libs.ktorfit.lib) implementation(libs.bundles.decompose) diff --git a/instances/android/app/proguard-rules.pro b/instances/android/app/proguard-rules.pro index f239ceed0d..d21b4c0ff4 100644 --- a/instances/android/app/proguard-rules.pro +++ b/instances/android/app/proguard-rules.pro @@ -32,10 +32,7 @@ -dontwarn org.bouncycastle.** -dontwarn org.openjsse.** --keep class de.jensklingenberg.ktorfit.** { *; } --keepclassmembers class de.jensklingenberg.ktorfit.** { *; } - -# Fix for some strange bug with ktorfit +# Fix for some strange bug with ktor -keep class io.ktor.http.* { *; } # With R8 full mode generic signatures are stripped for classes that are not