Loading app/src/androidTest/java/foundation/e/apps/ui/compose/components/SearchResultsContentTest.kt +12 −6 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import androidx.compose.ui.test.onNodeWithTag import androidx.compose.ui.test.onAllNodesWithText import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick import androidx.core.os.ConfigurationCompat import androidx.paging.LoadState import androidx.paging.LoadStates import androidx.paging.PagingData Loading @@ -53,6 +54,7 @@ import foundation.e.apps.ui.compose.state.InstallButtonAction import foundation.e.apps.ui.compose.state.InstallButtonState import foundation.e.apps.ui.compose.theme.AppTheme import foundation.e.apps.ui.search.v2.SearchTabType import foundation.e.apps.ui.utils.AppUserRatingFormatter import java.util.Locale @RunWith(AndroidJUnit4::class) Loading Loading @@ -137,13 +139,17 @@ class SearchResultsContentTest { fun applicationMapping_setsAuthorRatingAndPrimaryAction() { val notAvailable = composeRule.activity.getString(R.string.not_available) val openLabel = composeRule.activity.getString(R.string.open) val expectedRating = String.format(Locale.getDefault(), "%.1f", 4.4) val unexpectedRating = String.format(Locale.getDefault(), "%.1f", 4.9) val locale = ConfigurationCompat.getLocales( composeRule.activity.resources.configuration ).get(0) ?: Locale.getDefault() val expectedRating = AppUserRatingFormatter.format(4.4, locale) ?: notAvailable val hiddenRating = AppUserRatingFormatter.format(4.9, locale) ?: notAvailable renderSearchResults( tabs = listOf(SearchTabType.OPEN_SOURCE), selectedTab = SearchTabType.OPEN_SOURCE, fossPagingData = pagingData( tabs = listOf(SearchTabType.COMMON_APPS), selectedTab = SearchTabType.COMMON_APPS, fossPagingData = PagingData.empty(), playStorePagingData = pagingData( listOf( Application( name = "Rated App", Loading Loading @@ -184,7 +190,7 @@ class SearchResultsContentTest { composeRule.onNodeWithText(expectedRating).assertIsDisplayed() composeRule.onNodeWithText(openLabel).assertIsDisplayed() composeRule.onNodeWithText(notAvailable).assertIsDisplayed() composeRule.onAllNodesWithText(unexpectedRating).assertCountEquals(0) composeRule.onAllNodesWithText(hiddenRating).assertCountEquals(0) } @Test Loading app/src/main/java/foundation/e/apps/data/Constants.kt +0 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,4 @@ object Constants { "${BuildConfig.PACKAGE_NAME_PARENTAL_CONTROL}.action.APP_LOUNGE_LOGIN" const val REQUEST_GPLAY_LOGIN = "request_gplay_login" const val MIN_VALID_RATING = 0.1 } app/src/main/java/foundation/e/apps/data/application/data/Ratings.kt +0 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,5 @@ package foundation.e.apps.data.application.data data class Ratings( val privacyScore: Double = -1.0, val usageQualityScore: Double = -1.0 ) app/src/main/java/foundation/e/apps/data/install/AppManagerWrapper.kt +0 −13 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.content.Context import androidx.lifecycle.LiveData import dagger.hilt.android.qualifiers.ApplicationContext import foundation.e.apps.OpenForTesting import foundation.e.apps.data.Constants.MIN_VALID_RATING import foundation.e.apps.data.application.data.Application import foundation.e.apps.data.fdroid.FDroidRepository import foundation.e.apps.data.install.download.data.DownloadProgress Loading Loading @@ -171,18 +170,6 @@ class AppManagerWrapper @Inject constructor( return percent } fun handleRatingFormat(rating: Double): String? { return if (rating >= MIN_VALID_RATING) { if (rating % 1 == 0.0) { rating.toInt().toString() } else { rating.toString() } } else { null } } suspend fun getCalculateProgressWithTotalSize( application: Application?, progress: DownloadProgress Loading app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt +0 −4 Original line number Diff line number Diff line Loading @@ -397,8 +397,4 @@ class MainActivityViewModel @Inject constructor( fun launchPwa(homeApp: ApplicationDomain) { launchPwa(homeApp.toApplication()) } fun handleRatingFormat(rating: Double): String? { return appManagerWrapper.handleRatingFormat(rating) } } Loading
app/src/androidTest/java/foundation/e/apps/ui/compose/components/SearchResultsContentTest.kt +12 −6 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import androidx.compose.ui.test.onNodeWithTag import androidx.compose.ui.test.onAllNodesWithText import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick import androidx.core.os.ConfigurationCompat import androidx.paging.LoadState import androidx.paging.LoadStates import androidx.paging.PagingData Loading @@ -53,6 +54,7 @@ import foundation.e.apps.ui.compose.state.InstallButtonAction import foundation.e.apps.ui.compose.state.InstallButtonState import foundation.e.apps.ui.compose.theme.AppTheme import foundation.e.apps.ui.search.v2.SearchTabType import foundation.e.apps.ui.utils.AppUserRatingFormatter import java.util.Locale @RunWith(AndroidJUnit4::class) Loading Loading @@ -137,13 +139,17 @@ class SearchResultsContentTest { fun applicationMapping_setsAuthorRatingAndPrimaryAction() { val notAvailable = composeRule.activity.getString(R.string.not_available) val openLabel = composeRule.activity.getString(R.string.open) val expectedRating = String.format(Locale.getDefault(), "%.1f", 4.4) val unexpectedRating = String.format(Locale.getDefault(), "%.1f", 4.9) val locale = ConfigurationCompat.getLocales( composeRule.activity.resources.configuration ).get(0) ?: Locale.getDefault() val expectedRating = AppUserRatingFormatter.format(4.4, locale) ?: notAvailable val hiddenRating = AppUserRatingFormatter.format(4.9, locale) ?: notAvailable renderSearchResults( tabs = listOf(SearchTabType.OPEN_SOURCE), selectedTab = SearchTabType.OPEN_SOURCE, fossPagingData = pagingData( tabs = listOf(SearchTabType.COMMON_APPS), selectedTab = SearchTabType.COMMON_APPS, fossPagingData = PagingData.empty(), playStorePagingData = pagingData( listOf( Application( name = "Rated App", Loading Loading @@ -184,7 +190,7 @@ class SearchResultsContentTest { composeRule.onNodeWithText(expectedRating).assertIsDisplayed() composeRule.onNodeWithText(openLabel).assertIsDisplayed() composeRule.onNodeWithText(notAvailable).assertIsDisplayed() composeRule.onAllNodesWithText(unexpectedRating).assertCountEquals(0) composeRule.onAllNodesWithText(hiddenRating).assertCountEquals(0) } @Test Loading
app/src/main/java/foundation/e/apps/data/Constants.kt +0 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,4 @@ object Constants { "${BuildConfig.PACKAGE_NAME_PARENTAL_CONTROL}.action.APP_LOUNGE_LOGIN" const val REQUEST_GPLAY_LOGIN = "request_gplay_login" const val MIN_VALID_RATING = 0.1 }
app/src/main/java/foundation/e/apps/data/application/data/Ratings.kt +0 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,5 @@ package foundation.e.apps.data.application.data data class Ratings( val privacyScore: Double = -1.0, val usageQualityScore: Double = -1.0 )
app/src/main/java/foundation/e/apps/data/install/AppManagerWrapper.kt +0 −13 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.content.Context import androidx.lifecycle.LiveData import dagger.hilt.android.qualifiers.ApplicationContext import foundation.e.apps.OpenForTesting import foundation.e.apps.data.Constants.MIN_VALID_RATING import foundation.e.apps.data.application.data.Application import foundation.e.apps.data.fdroid.FDroidRepository import foundation.e.apps.data.install.download.data.DownloadProgress Loading Loading @@ -171,18 +170,6 @@ class AppManagerWrapper @Inject constructor( return percent } fun handleRatingFormat(rating: Double): String? { return if (rating >= MIN_VALID_RATING) { if (rating % 1 == 0.0) { rating.toInt().toString() } else { rating.toString() } } else { null } } suspend fun getCalculateProgressWithTotalSize( application: Application?, progress: DownloadProgress Loading
app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt +0 −4 Original line number Diff line number Diff line Loading @@ -397,8 +397,4 @@ class MainActivityViewModel @Inject constructor( fun launchPwa(homeApp: ApplicationDomain) { launchPwa(homeApp.toApplication()) } fun handleRatingFormat(rating: Double): String? { return appManagerWrapper.handleRatingFormat(rating) } }