diff --git a/androidApp/src/fdroid/kotlin/org/meshtastic/app/di/FDroidNetworkModule.kt b/androidApp/src/fdroid/kotlin/org/meshtastic/app/di/FDroidNetworkModule.kt deleted file mode 100644 index e45e0433a..000000000 --- a/androidApp/src/fdroid/kotlin/org/meshtastic/app/di/FDroidNetworkModule.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2026 Meshtastic LLC - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.meshtastic.app.di - -import org.koin.core.annotation.Module -import org.koin.core.annotation.Single -import org.meshtastic.core.model.EventFirmwareResponse -import org.meshtastic.core.model.NetworkDeviceHardware -import org.meshtastic.core.model.NetworkDeviceLinksResponse -import org.meshtastic.core.model.NetworkFirmwareReleases -import org.meshtastic.core.network.service.ApiService - -@Module -class FDroidNetworkModule { - - /** - * F-Droid builds intentionally avoid network calls to the Meshtastic API. - * - * We throw [UnsupportedOperationException] (an [Exception], not an [Error]) so that `safeCatching {}` in the - * repositories captures the failure and falls back to the bundled JSON assets instead of crashing the app. - */ - @Single - fun provideApiService(): ApiService = object : ApiService { - override suspend fun getDeviceHardware(): List = - throw UnsupportedOperationException("getDeviceHardware is not supported on F-Droid builds.") - - override suspend fun getDeviceLinks(): NetworkDeviceLinksResponse = - throw UnsupportedOperationException("getDeviceLinks is not supported on F-Droid builds.") - - override suspend fun getFirmwareReleases(): NetworkFirmwareReleases = - throw UnsupportedOperationException("getFirmwareReleases is not supported on F-Droid builds.") - - override suspend fun getEventFirmware(): EventFirmwareResponse = - throw UnsupportedOperationException("getEventFirmware is not supported on F-Droid builds.") - } -} diff --git a/androidApp/src/fdroid/kotlin/org/meshtastic/app/di/FlavorModule.kt b/androidApp/src/fdroid/kotlin/org/meshtastic/app/di/FlavorModule.kt index 56ea1f9cc..84d7c201b 100644 --- a/androidApp/src/fdroid/kotlin/org/meshtastic/app/di/FlavorModule.kt +++ b/androidApp/src/fdroid/kotlin/org/meshtastic/app/di/FlavorModule.kt @@ -21,7 +21,7 @@ import org.koin.core.annotation.Named import org.koin.core.annotation.Single import org.meshtastic.core.ui.theme.EventFontResolver -@Module(includes = [FDroidNetworkModule::class, FdroidAiModule::class]) +@Module(includes = [FdroidAiModule::class]) class FlavorModule { @Single @Named("googleServicesAvailable") diff --git a/androidApp/src/google/kotlin/org/meshtastic/app/di/FlavorModule.kt b/androidApp/src/google/kotlin/org/meshtastic/app/di/FlavorModule.kt index 71ea8d1d5..5a155b894 100644 --- a/androidApp/src/google/kotlin/org/meshtastic/app/di/FlavorModule.kt +++ b/androidApp/src/google/kotlin/org/meshtastic/app/di/FlavorModule.kt @@ -26,14 +26,7 @@ import org.meshtastic.core.ui.theme.EventFontResolver import org.meshtastic.feature.car.di.FeatureCarModule @Module( - includes = - [ - GoogleNetworkModule::class, - GoogleMapsKoinModule::class, - GoogleAiModule::class, - AppFunctionsModule::class, - FeatureCarModule::class, - ], + includes = [GoogleMapsKoinModule::class, GoogleAiModule::class, AppFunctionsModule::class, FeatureCarModule::class], ) class FlavorModule { /** Downloadable Google Fonts for event branding — Google flavor only. */ diff --git a/androidApp/src/google/kotlin/org/meshtastic/app/di/GoogleNetworkModule.kt b/androidApp/src/google/kotlin/org/meshtastic/app/di/GoogleNetworkModule.kt deleted file mode 100644 index b3635bd44..000000000 --- a/androidApp/src/google/kotlin/org/meshtastic/app/di/GoogleNetworkModule.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2026 Meshtastic LLC - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.meshtastic.app.di - -import org.koin.core.annotation.Module -import org.koin.core.annotation.Single -import org.meshtastic.core.network.service.ApiService -import org.meshtastic.core.network.service.ApiServiceImpl - -@Module -class GoogleNetworkModule { - - @Single fun bindApiService(apiServiceImpl: ApiServiceImpl): ApiService = apiServiceImpl -} diff --git a/androidApp/src/main/kotlin/org/meshtastic/app/di/NetworkModule.kt b/androidApp/src/main/kotlin/org/meshtastic/app/di/NetworkModule.kt index 5f8725cab..ed50c5f2f 100644 --- a/androidApp/src/main/kotlin/org/meshtastic/app/di/NetworkModule.kt +++ b/androidApp/src/main/kotlin/org/meshtastic/app/di/NetworkModule.kt @@ -49,6 +49,8 @@ import org.meshtastic.core.common.BuildConfigProvider import org.meshtastic.core.network.HttpClientDefaults import org.meshtastic.core.network.KermitHttpLogger import org.meshtastic.core.network.configureDefaultRetry +import org.meshtastic.core.network.service.ApiService +import org.meshtastic.core.network.service.ApiServiceImpl private const val DISK_CACHE_PERCENT = 0.02 private const val MEMORY_CACHE_PERCENT = 0.25 @@ -57,6 +59,8 @@ private const val MEMORY_CACHE_BACKGROUND_PERCENT = 0.1 @Module class NetworkModule { + @Single fun bindApiService(apiServiceImpl: ApiServiceImpl): ApiService = apiServiceImpl + @Single fun provideConnectivityManager(application: Application): ConnectivityManager = application.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager