Loading app/src/main/java/foundation/e/apps/services/InstallAppService.kt +15 −15 Original line number Diff line number Diff line Loading @@ -71,8 +71,9 @@ class InstallAppService : LifecycleService() { super.onBind(intent) return binder } } private fun Status?.toAppInstallationStatus(): AppInstallationStatus { fun Status?.toAppInstallationStatus(): AppInstallationStatus { return when (this) { Status.UPDATABLE, Status.INSTALLED -> AppInstallationStatus.INSTALLED Loading @@ -92,4 +93,3 @@ class InstallAppService : LifecycleService() { null -> AppInstallationStatus.UNKNOWN } } } app/src/test/java/foundation/e/apps/data/cleanapk/repositories/CleanApkAppsRepositoryTest.kt +45 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ class CleanApkAppsRepositoryTest { val architectures = listOf("arm64-v8a") val packageName = "com.example.app" val appId = "id-123" val expectedApp = Application(_id = appId, name = "Example") val expectedApp = Application(_id = appId, name = "Example", is_pwa = false, source = Source.OPEN_SOURCE) every { SystemInfoProvider.getSupportedArchitectureList() } returns architectures coEvery { Loading Loading @@ -244,6 +244,50 @@ class CleanApkAppsRepositoryTest { assertThat(result).isEqualTo(Application()) } @Test fun `getAppDetails set source=OPEN_SOURCE for not pwa App`() = runTest { val packageName = "com.example.app" val appId = "id-123" val expectedApp = Application(_id = appId, name = "Example", is_pwa = false, source = Source.OPEN_SOURCE) every { SystemInfoProvider.getSupportedArchitectureList() } returns listOf("arm64-v8a") coEvery { cleanApkRetrofit.checkAvailablePackages(any(), any(), any()) } returns Response.success(Search(apps = listOf(Application(_id = appId)))) coEvery { cleanApkRetrofit.getAppOrPWADetailsByID(any(), any(), any()) } returns Response.success(CleanApkApplication( app = Application(_id = appId, name = "Example", is_pwa = false), success = true )) val result = repository.getAppDetails(packageName) assertThat(result).isEqualTo(expectedApp) } @Test fun `getAppDetails set source=PWA for pwa App`() = runTest { val packageName = "com.example.app" val appId = "id-123" val expectedApp = Application(_id = appId, name = "Example", is_pwa = true, source = Source.PWA) every { SystemInfoProvider.getSupportedArchitectureList() } returns listOf("arm64-v8a") coEvery { cleanApkRetrofit.checkAvailablePackages(any(), any(), any()) } returns Response.success(Search(apps = listOf(Application(_id = appId)))) coEvery { cleanApkRetrofit.getAppOrPWADetailsByID(any(), any(), any()) } returns Response.success(CleanApkApplication( app = Application(_id = appId, name = "Example", is_pwa = true), success = true )) val result = repository.getAppDetails(packageName) assertThat(result).isEqualTo(expectedApp) } @Test fun `getDownloadInfo forwards single supported architecture`() = runTest { every { SystemInfoProvider.getSupportedArchitecture() } returns "arm64-v8a" Loading app/src/test/java/foundation/e/apps/domain/install/GetAppDetailsUseCaseTest.kt +20 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ */ package foundation.e.apps.domain.install import android.view.KeyCharacterMap import com.aurora.gplayapi.exceptions.InternalException import foundation.e.apps.data.Stores import foundation.e.apps.data.application.data.Application import foundation.e.apps.data.blockedApps.BlockedAppRepository Loading Loading @@ -116,6 +118,24 @@ class GetAppDetailsUseCaseTest { coVerify(exactly = 0) { playStoreRepository.getAppDetails("pkg") } } @Test fun invoke_throwsUnavailableWhenUnavailableInAllSource() = runTest { every { stores.getEnabledSearchSources() } returns listOf(Source.PLAY_STORE, Source.OPEN_SOURCE, Source.PWA) val emptyApp = Application() coEvery { cleanApkAppsRepository.getAppDetails("pkg") } returns emptyApp coEvery { cleanApkPwaRepository.getAppDetails("pkg") } returns emptyApp coEvery { playStoreRepository.getAppDetails("pkg") } throws InternalException.AppNotFound() assertFailsWith<UnavailableApp> { useCase("pkg") } coVerify { cleanApkAppsRepository.getAppDetails("pkg") } coVerify { cleanApkPwaRepository.getAppDetails("pkg") } coVerify { playStoreRepository.getAppDetails("pkg") } } @Test fun invoke_throwsStoreNotConfiguredWhenSourceNotEnabled() = runTest { every { stores.getEnabledSearchSources() } returns listOf(Source.OPEN_SOURCE) Loading install-app-lib/src/main/kotlin/foundation/e/apps/installapp/AppInstallationStatus.kt +0 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ enum class AppInstallationStatus { SERVICE_BUSY; companion object { fun parse(raw: String): AppInstallationStatus { return runCatching { AppInstallationStatus.valueOf(raw) Loading Loading
app/src/main/java/foundation/e/apps/services/InstallAppService.kt +15 −15 Original line number Diff line number Diff line Loading @@ -71,8 +71,9 @@ class InstallAppService : LifecycleService() { super.onBind(intent) return binder } } private fun Status?.toAppInstallationStatus(): AppInstallationStatus { fun Status?.toAppInstallationStatus(): AppInstallationStatus { return when (this) { Status.UPDATABLE, Status.INSTALLED -> AppInstallationStatus.INSTALLED Loading @@ -92,4 +93,3 @@ class InstallAppService : LifecycleService() { null -> AppInstallationStatus.UNKNOWN } } }
app/src/test/java/foundation/e/apps/data/cleanapk/repositories/CleanApkAppsRepositoryTest.kt +45 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ class CleanApkAppsRepositoryTest { val architectures = listOf("arm64-v8a") val packageName = "com.example.app" val appId = "id-123" val expectedApp = Application(_id = appId, name = "Example") val expectedApp = Application(_id = appId, name = "Example", is_pwa = false, source = Source.OPEN_SOURCE) every { SystemInfoProvider.getSupportedArchitectureList() } returns architectures coEvery { Loading Loading @@ -244,6 +244,50 @@ class CleanApkAppsRepositoryTest { assertThat(result).isEqualTo(Application()) } @Test fun `getAppDetails set source=OPEN_SOURCE for not pwa App`() = runTest { val packageName = "com.example.app" val appId = "id-123" val expectedApp = Application(_id = appId, name = "Example", is_pwa = false, source = Source.OPEN_SOURCE) every { SystemInfoProvider.getSupportedArchitectureList() } returns listOf("arm64-v8a") coEvery { cleanApkRetrofit.checkAvailablePackages(any(), any(), any()) } returns Response.success(Search(apps = listOf(Application(_id = appId)))) coEvery { cleanApkRetrofit.getAppOrPWADetailsByID(any(), any(), any()) } returns Response.success(CleanApkApplication( app = Application(_id = appId, name = "Example", is_pwa = false), success = true )) val result = repository.getAppDetails(packageName) assertThat(result).isEqualTo(expectedApp) } @Test fun `getAppDetails set source=PWA for pwa App`() = runTest { val packageName = "com.example.app" val appId = "id-123" val expectedApp = Application(_id = appId, name = "Example", is_pwa = true, source = Source.PWA) every { SystemInfoProvider.getSupportedArchitectureList() } returns listOf("arm64-v8a") coEvery { cleanApkRetrofit.checkAvailablePackages(any(), any(), any()) } returns Response.success(Search(apps = listOf(Application(_id = appId)))) coEvery { cleanApkRetrofit.getAppOrPWADetailsByID(any(), any(), any()) } returns Response.success(CleanApkApplication( app = Application(_id = appId, name = "Example", is_pwa = true), success = true )) val result = repository.getAppDetails(packageName) assertThat(result).isEqualTo(expectedApp) } @Test fun `getDownloadInfo forwards single supported architecture`() = runTest { every { SystemInfoProvider.getSupportedArchitecture() } returns "arm64-v8a" Loading
app/src/test/java/foundation/e/apps/domain/install/GetAppDetailsUseCaseTest.kt +20 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ */ package foundation.e.apps.domain.install import android.view.KeyCharacterMap import com.aurora.gplayapi.exceptions.InternalException import foundation.e.apps.data.Stores import foundation.e.apps.data.application.data.Application import foundation.e.apps.data.blockedApps.BlockedAppRepository Loading Loading @@ -116,6 +118,24 @@ class GetAppDetailsUseCaseTest { coVerify(exactly = 0) { playStoreRepository.getAppDetails("pkg") } } @Test fun invoke_throwsUnavailableWhenUnavailableInAllSource() = runTest { every { stores.getEnabledSearchSources() } returns listOf(Source.PLAY_STORE, Source.OPEN_SOURCE, Source.PWA) val emptyApp = Application() coEvery { cleanApkAppsRepository.getAppDetails("pkg") } returns emptyApp coEvery { cleanApkPwaRepository.getAppDetails("pkg") } returns emptyApp coEvery { playStoreRepository.getAppDetails("pkg") } throws InternalException.AppNotFound() assertFailsWith<UnavailableApp> { useCase("pkg") } coVerify { cleanApkAppsRepository.getAppDetails("pkg") } coVerify { cleanApkPwaRepository.getAppDetails("pkg") } coVerify { playStoreRepository.getAppDetails("pkg") } } @Test fun invoke_throwsStoreNotConfiguredWhenSourceNotEnabled() = runTest { every { stores.getEnabledSearchSources() } returns listOf(Source.OPEN_SOURCE) Loading
install-app-lib/src/main/kotlin/foundation/e/apps/installapp/AppInstallationStatus.kt +0 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ enum class AppInstallationStatus { SERVICE_BUSY; companion object { fun parse(raw: String): AppInstallationStatus { return runCatching { AppInstallationStatus.valueOf(raw) Loading