Loading app/src/main/java/foundation/e/apps/MainActivity.kt +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Timber.d("### oncreate 125") binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) Loading app/src/main/java/foundation/e/apps/applicationlist/ApplicationListFragment.kt +26 −27 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import foundation.e.apps.utils.exceptions.GPlayLoginException import foundation.e.apps.utils.modules.PWAManagerModule import foundation.e.apps.utils.parentFragment.TimeoutFragment import kotlinx.coroutines.launch import timber.log.Timber import javax.inject.Inject @AndroidEntryPoint Loading Loading @@ -116,12 +117,20 @@ class ApplicationListFragment : } } private fun observeDownloadList(adapter: ApplicationListRVAdapter) { private fun observeDownloadList( adapter: ApplicationListRVAdapter, fusedAppResult: ResultSupreme<List<FusedApp>> ) { mainActivityViewModel.downloadList.removeObservers(viewLifecycleOwner) mainActivityViewModel.downloadList.observe(viewLifecycleOwner) { list -> Timber.d("### downloadlist observer responded: ${list.firstOrNull()?.name + ": " + list.firstOrNull()?.status}") val appList = viewModel.appListLiveData.value?.data?.toMutableList() ?: emptyList() appList.let { mainActivityViewModel.updateStatusOfFusedApps(it, list) adapter.setData(it) if (isFusedAppsUpdated(fusedAppResult, listAdapter.currentList)) { adapter.setData(it, args.translation) } } } } Loading @@ -134,26 +143,31 @@ class ApplicationListFragment : override fun onResume() { super.onResume() if (listAdapter.currentList.isNotEmpty() && viewModel.hasAnyAppInstallStatusChanged(listAdapter.currentList)) { addDownloadProgressObserver() if (listAdapter.currentList.isNotEmpty() && viewModel.hasAnyAppInstallStatusChanged( listAdapter.currentList ) ) { /*mainActivityViewModel.authData.value?.let { refreshData(it) }*/ repostAuthObjects() } } private fun addDownloadProgressObserver() { appProgressViewModel.downloadProgress.removeObservers(viewLifecycleOwner) appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) { updateProgressOfDownloadingItems(binding.recyclerView, it) } } private fun observeAppListLiveData() { viewModel.appListLiveData.observe(viewLifecycleOwner) { stopLoadingUI() if (it.isSuccess()) { if (!isFusedAppsUpdated(it)) { return@observe } updateAppListRecyclerView(listAdapter, it) appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) { updateProgressOfDownloadingItems(binding.recyclerView, it) } observeDownloadList(listAdapter, it) } } } Loading Loading @@ -203,21 +217,6 @@ class ApplicationListFragment : return recyclerView } private fun updateAppListRecyclerView( listAdapter: ApplicationListRVAdapter?, fusedAppResult: ResultSupreme<List<FusedApp>> ) { val currentList = listAdapter?.currentList if (!isFusedAppsUpdated(fusedAppResult, currentList) ) { return } listAdapter?.setData(fusedAppResult.data!!, args.translation) listAdapter?.let { adapter -> observeDownloadList(adapter) } } private fun isFusedAppsUpdated( fusedAppResult: ResultSupreme<List<FusedApp>>, currentList: MutableList<FusedApp>? Loading Loading @@ -340,7 +339,7 @@ class ApplicationListFragment : override fun onPause() { binding.shimmerLayout.stopShimmer() mainActivityViewModel.downloadList.removeObservers(viewLifecycleOwner) // mainActivityViewModel.downloadList.removeObservers(viewLifecycleOwner) super.onPause() } Loading app/src/main/java/foundation/e/apps/manager/database/DatabaseRepository.kt +2 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ import foundation.e.apps.OpenForTesting import foundation.e.apps.manager.database.fusedDownload.FusedDownload import foundation.e.apps.manager.database.fusedDownload.FusedDownloadDAO import kotlinx.coroutines.flow.Flow import timber.log.Timber import javax.inject.Inject import javax.inject.Singleton Loading @@ -28,6 +29,7 @@ class DatabaseRepository @Inject constructor( } suspend fun updateDownload(fusedDownload: FusedDownload) { Timber.d("### fusedownload updated: ${fusedDownload.name + ": " + fusedDownload.status}") fusedDownloadDAO.updateDownload(fusedDownload) } Loading app/src/main/java/foundation/e/apps/search/SearchFragment.kt +10 −4 Original line number Diff line number Diff line Loading @@ -122,7 +122,8 @@ class SearchFragment : setupListening() authObjects.observe(viewLifecycleOwner) { if (it == null) return@observe val currentQuery = searchView?.query?.toString() ?: "" if (it == null || (currentQuery.isNotEmpty() && lastSearch == currentQuery)) return@observe loadData(it) } Loading Loading @@ -326,9 +327,7 @@ class SearchFragment : override fun onResume() { super.onResume() binding.shimmerLayout.startShimmer() appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) { updateProgressOfInstallingApps(it) } addDownloadProgressObservers() if (shouldRefreshData()) { repostAuthObjects() Loading @@ -340,6 +339,13 @@ class SearchFragment : } } private fun addDownloadProgressObservers() { appProgressViewModel.downloadProgress.removeObservers(viewLifecycleOwner) appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) { updateProgressOfInstallingApps(it) } } private fun shouldRefreshData() = searchText.isNotEmpty() && recyclerView?.adapter != null && searchViewModel.hasAnyAppInstallStatusChanged( (recyclerView?.adapter as ApplicationListRVAdapter).currentList Loading Loading
app/src/main/java/foundation/e/apps/MainActivity.kt +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Timber.d("### oncreate 125") binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) Loading
app/src/main/java/foundation/e/apps/applicationlist/ApplicationListFragment.kt +26 −27 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import foundation.e.apps.utils.exceptions.GPlayLoginException import foundation.e.apps.utils.modules.PWAManagerModule import foundation.e.apps.utils.parentFragment.TimeoutFragment import kotlinx.coroutines.launch import timber.log.Timber import javax.inject.Inject @AndroidEntryPoint Loading Loading @@ -116,12 +117,20 @@ class ApplicationListFragment : } } private fun observeDownloadList(adapter: ApplicationListRVAdapter) { private fun observeDownloadList( adapter: ApplicationListRVAdapter, fusedAppResult: ResultSupreme<List<FusedApp>> ) { mainActivityViewModel.downloadList.removeObservers(viewLifecycleOwner) mainActivityViewModel.downloadList.observe(viewLifecycleOwner) { list -> Timber.d("### downloadlist observer responded: ${list.firstOrNull()?.name + ": " + list.firstOrNull()?.status}") val appList = viewModel.appListLiveData.value?.data?.toMutableList() ?: emptyList() appList.let { mainActivityViewModel.updateStatusOfFusedApps(it, list) adapter.setData(it) if (isFusedAppsUpdated(fusedAppResult, listAdapter.currentList)) { adapter.setData(it, args.translation) } } } } Loading @@ -134,26 +143,31 @@ class ApplicationListFragment : override fun onResume() { super.onResume() if (listAdapter.currentList.isNotEmpty() && viewModel.hasAnyAppInstallStatusChanged(listAdapter.currentList)) { addDownloadProgressObserver() if (listAdapter.currentList.isNotEmpty() && viewModel.hasAnyAppInstallStatusChanged( listAdapter.currentList ) ) { /*mainActivityViewModel.authData.value?.let { refreshData(it) }*/ repostAuthObjects() } } private fun addDownloadProgressObserver() { appProgressViewModel.downloadProgress.removeObservers(viewLifecycleOwner) appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) { updateProgressOfDownloadingItems(binding.recyclerView, it) } } private fun observeAppListLiveData() { viewModel.appListLiveData.observe(viewLifecycleOwner) { stopLoadingUI() if (it.isSuccess()) { if (!isFusedAppsUpdated(it)) { return@observe } updateAppListRecyclerView(listAdapter, it) appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) { updateProgressOfDownloadingItems(binding.recyclerView, it) } observeDownloadList(listAdapter, it) } } } Loading Loading @@ -203,21 +217,6 @@ class ApplicationListFragment : return recyclerView } private fun updateAppListRecyclerView( listAdapter: ApplicationListRVAdapter?, fusedAppResult: ResultSupreme<List<FusedApp>> ) { val currentList = listAdapter?.currentList if (!isFusedAppsUpdated(fusedAppResult, currentList) ) { return } listAdapter?.setData(fusedAppResult.data!!, args.translation) listAdapter?.let { adapter -> observeDownloadList(adapter) } } private fun isFusedAppsUpdated( fusedAppResult: ResultSupreme<List<FusedApp>>, currentList: MutableList<FusedApp>? Loading Loading @@ -340,7 +339,7 @@ class ApplicationListFragment : override fun onPause() { binding.shimmerLayout.stopShimmer() mainActivityViewModel.downloadList.removeObservers(viewLifecycleOwner) // mainActivityViewModel.downloadList.removeObservers(viewLifecycleOwner) super.onPause() } Loading
app/src/main/java/foundation/e/apps/manager/database/DatabaseRepository.kt +2 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ import foundation.e.apps.OpenForTesting import foundation.e.apps.manager.database.fusedDownload.FusedDownload import foundation.e.apps.manager.database.fusedDownload.FusedDownloadDAO import kotlinx.coroutines.flow.Flow import timber.log.Timber import javax.inject.Inject import javax.inject.Singleton Loading @@ -28,6 +29,7 @@ class DatabaseRepository @Inject constructor( } suspend fun updateDownload(fusedDownload: FusedDownload) { Timber.d("### fusedownload updated: ${fusedDownload.name + ": " + fusedDownload.status}") fusedDownloadDAO.updateDownload(fusedDownload) } Loading
app/src/main/java/foundation/e/apps/search/SearchFragment.kt +10 −4 Original line number Diff line number Diff line Loading @@ -122,7 +122,8 @@ class SearchFragment : setupListening() authObjects.observe(viewLifecycleOwner) { if (it == null) return@observe val currentQuery = searchView?.query?.toString() ?: "" if (it == null || (currentQuery.isNotEmpty() && lastSearch == currentQuery)) return@observe loadData(it) } Loading Loading @@ -326,9 +327,7 @@ class SearchFragment : override fun onResume() { super.onResume() binding.shimmerLayout.startShimmer() appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) { updateProgressOfInstallingApps(it) } addDownloadProgressObservers() if (shouldRefreshData()) { repostAuthObjects() Loading @@ -340,6 +339,13 @@ class SearchFragment : } } private fun addDownloadProgressObservers() { appProgressViewModel.downloadProgress.removeObservers(viewLifecycleOwner) appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) { updateProgressOfInstallingApps(it) } } private fun shouldRefreshData() = searchText.isNotEmpty() && recyclerView?.adapter != null && searchViewModel.hasAnyAppInstallStatusChanged( (recyclerView?.adapter as ApplicationListRVAdapter).currentList Loading