From 8c88561d4b6b9e246091556186b819f7cd9642c3 Mon Sep 17 00:00:00 2001 From: Christian Sadilek Date: Tue, 16 Nov 2021 17:05:29 -0500 Subject: [PATCH] Update lastAccess timestamp of selected tab when launching to home --- .../main/java/org/mozilla/fenix/home/HomeFragment.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index fe35fc54f..564edf2bc 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -791,6 +791,13 @@ class HomeFragment : Fragment() { } hideToolbar() + + // Whenever a tab is selected its last access timestamp is automatically updated by A-C. + // However, in the case of resuming the app to the home fragment, we already have an + // existing selected tab, but its last access timestamp is outdated. No action is + // triggered to cause an automatic update on warm start (no tab selection occurs). So we + // update it manually here. + requireComponents.useCases.sessionUseCases.updateLastAccess() } override fun onPause() { @@ -805,6 +812,10 @@ class HomeFragment : Fragment() { ) ) } + + // Counterpart to the update in onResume to keep the last access timestamp of the selected + // tab up-to-date. + requireComponents.useCases.sessionUseCases.updateLastAccess() } private fun recommendPrivateBrowsingShortcut() {