Loading app/src/main/java/foundation/e/apps/feature/main/MainActivity.kt +4 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,10 @@ class MainActivity : AppCompatActivity() { val (bottomNavigationView, navController) = setupBottomNav() if (savedInstanceState == null) { queueFdroidDeepLink(intent) val hasPendingFdroidDeepLink = queueFdroidDeepLink(intent) if (!hasPendingFdroidDeepLink) { navController.handleDeepLink(intent) } } setupViewModels() Loading app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt +23 −2 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) { } private var isDetailsLoaded = false private var hasRequestedInitialAuthRefresh = false private lateinit var screenshotsRVAdapter: ApplicationScreenshotsRVAdapter private var uiRenderer: ApplicationUiRenderer? = null private var installUiBinder: ApplicationInstallUiBinder? = null Loading Loading @@ -112,7 +113,7 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) { setupToolbar(view) setupScreenshotRVAdapter() setupViewBinders() binding.applicationLayout.visibility = View.INVISIBLE showLoadingUI() uiRenderer?.collectState() observeAuthRefreshSnapshot() Loading @@ -134,7 +135,12 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) { viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { sessionViewModel.authRefreshSnapshotFlow.collectLatest { snapshot -> if (snapshot == null || isDetailsLoaded) { if (isDetailsLoaded) { return@collectLatest } if (snapshot == null) { handleMissingAuthRefreshSnapshot() return@collectLatest } Loading @@ -144,7 +150,22 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) { } } private fun handleMissingAuthRefreshSnapshot() { if (isFdroidDeepLink || args.source != Source.PLAY_STORE) { loadDataWhenNetworkAvailable(hasPlayStoreSession = false) return } if (hasRequestedInitialAuthRefresh) { return } hasRequestedInitialAuthRefresh = true sessionViewModel.refreshSessions(listOf(AuthStore.PLAY_STORE)) } private suspend fun handleAuthRefreshSnapshot(snapshot: AuthRefreshSnapshot) { hasRequestedInitialAuthRefresh = false if (isFdroidDeepLink || args.source != Source.PLAY_STORE) { loadDataWhenNetworkAvailable(hasPlayStoreSession = false) return Loading Loading
app/src/main/java/foundation/e/apps/feature/main/MainActivity.kt +4 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,10 @@ class MainActivity : AppCompatActivity() { val (bottomNavigationView, navController) = setupBottomNav() if (savedInstanceState == null) { queueFdroidDeepLink(intent) val hasPendingFdroidDeepLink = queueFdroidDeepLink(intent) if (!hasPendingFdroidDeepLink) { navController.handleDeepLink(intent) } } setupViewModels() Loading
app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt +23 −2 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) { } private var isDetailsLoaded = false private var hasRequestedInitialAuthRefresh = false private lateinit var screenshotsRVAdapter: ApplicationScreenshotsRVAdapter private var uiRenderer: ApplicationUiRenderer? = null private var installUiBinder: ApplicationInstallUiBinder? = null Loading Loading @@ -112,7 +113,7 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) { setupToolbar(view) setupScreenshotRVAdapter() setupViewBinders() binding.applicationLayout.visibility = View.INVISIBLE showLoadingUI() uiRenderer?.collectState() observeAuthRefreshSnapshot() Loading @@ -134,7 +135,12 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) { viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { sessionViewModel.authRefreshSnapshotFlow.collectLatest { snapshot -> if (snapshot == null || isDetailsLoaded) { if (isDetailsLoaded) { return@collectLatest } if (snapshot == null) { handleMissingAuthRefreshSnapshot() return@collectLatest } Loading @@ -144,7 +150,22 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) { } } private fun handleMissingAuthRefreshSnapshot() { if (isFdroidDeepLink || args.source != Source.PLAY_STORE) { loadDataWhenNetworkAvailable(hasPlayStoreSession = false) return } if (hasRequestedInitialAuthRefresh) { return } hasRequestedInitialAuthRefresh = true sessionViewModel.refreshSessions(listOf(AuthStore.PLAY_STORE)) } private suspend fun handleAuthRefreshSnapshot(snapshot: AuthRefreshSnapshot) { hasRequestedInitialAuthRefresh = false if (isFdroidDeepLink || args.source != Source.PLAY_STORE) { loadDataWhenNetworkAvailable(hasPlayStoreSession = false) return Loading