Loading app/src/main/java/foundation/e/apps/data/install/AppManagerWrapper.kt +3 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package foundation.e.apps.data.install import android.content.Context import androidx.lifecycle.LiveData import foundation.e.apps.BuildConfig import foundation.e.apps.OpenForTesting import foundation.e.apps.data.Constants.MIN_VALID_RATING import foundation.e.apps.data.application.data.Application Loading Loading @@ -141,9 +142,10 @@ class AppManagerWrapper @Inject constructor( .values .sum() return ((downloadedSoFar / totalSizeBytes.toDouble()) * 100) val percent = ((downloadedSoFar / totalSizeBytes.toDouble()) * 100) .toInt() .coerceIn(0, 100) return percent } private suspend fun isProgressValidForApp( Loading app/src/main/java/foundation/e/apps/ui/search/v2/SearchFragmentV2.kt +12 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ import foundation.e.apps.ui.compose.state.mapAppToInstallState import foundation.e.apps.ui.compose.theme.AppTheme import foundation.e.apps.ui.AppProgressViewModel import foundation.e.apps.ui.AppInfoFetchViewModel import androidx.lifecycle.lifecycleScope import androidx.lifecycle.asFlow import kotlinx.coroutines.launch @AndroidEntryPoint class SearchFragmentV2 : Fragment(R.layout.fragment_search_v2) { Loading @@ -44,6 +47,14 @@ class SearchFragmentV2 : Fragment(R.layout.fragment_search_v2) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { val composeView = view.findViewById<ComposeView>(R.id.composeView) composeView.setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) // Ensure DownloadProgress emissions reach the ViewModel even if Compose does not recompose. viewLifecycleOwner.lifecycleScope.launch { appProgressViewModel.downloadProgress.asFlow().collect { progress -> searchViewModelV2.updateDownloadProgress(copyProgress(progress)) } } composeView.setContent { AppTheme { val uiState by searchViewModelV2.uiState.collectAsState() Loading @@ -54,6 +65,7 @@ class SearchFragmentV2 : Fragment(R.layout.fragment_search_v2) { val statusByKey by searchViewModelV2.statusByKey.collectAsState() LaunchedEffect(downloadProgress) { // Retain Compose-based updates as a secondary path for safety. downloadProgress?.let { searchViewModelV2.updateDownloadProgress(copyProgress(it)) } Loading Loading
app/src/main/java/foundation/e/apps/data/install/AppManagerWrapper.kt +3 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package foundation.e.apps.data.install import android.content.Context import androidx.lifecycle.LiveData import foundation.e.apps.BuildConfig import foundation.e.apps.OpenForTesting import foundation.e.apps.data.Constants.MIN_VALID_RATING import foundation.e.apps.data.application.data.Application Loading Loading @@ -141,9 +142,10 @@ class AppManagerWrapper @Inject constructor( .values .sum() return ((downloadedSoFar / totalSizeBytes.toDouble()) * 100) val percent = ((downloadedSoFar / totalSizeBytes.toDouble()) * 100) .toInt() .coerceIn(0, 100) return percent } private suspend fun isProgressValidForApp( Loading
app/src/main/java/foundation/e/apps/ui/search/v2/SearchFragmentV2.kt +12 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ import foundation.e.apps.ui.compose.state.mapAppToInstallState import foundation.e.apps.ui.compose.theme.AppTheme import foundation.e.apps.ui.AppProgressViewModel import foundation.e.apps.ui.AppInfoFetchViewModel import androidx.lifecycle.lifecycleScope import androidx.lifecycle.asFlow import kotlinx.coroutines.launch @AndroidEntryPoint class SearchFragmentV2 : Fragment(R.layout.fragment_search_v2) { Loading @@ -44,6 +47,14 @@ class SearchFragmentV2 : Fragment(R.layout.fragment_search_v2) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { val composeView = view.findViewById<ComposeView>(R.id.composeView) composeView.setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) // Ensure DownloadProgress emissions reach the ViewModel even if Compose does not recompose. viewLifecycleOwner.lifecycleScope.launch { appProgressViewModel.downloadProgress.asFlow().collect { progress -> searchViewModelV2.updateDownloadProgress(copyProgress(progress)) } } composeView.setContent { AppTheme { val uiState by searchViewModelV2.uiState.collectAsState() Loading @@ -54,6 +65,7 @@ class SearchFragmentV2 : Fragment(R.layout.fragment_search_v2) { val statusByKey by searchViewModelV2.statusByKey.collectAsState() LaunchedEffect(downloadProgress) { // Retain Compose-based updates as a secondary path for safety. downloadProgress?.let { searchViewModelV2.updateDownloadProgress(copyProgress(it)) } Loading