@@ -102,7 +102,7 @@ class ThreadListFragment : TwoPaneFragment(), SwipeRefreshLayout.OnRefreshListen
102
102
103
103
private val showLoadingTimer: CountDownTimer by lazy { Utils .createRefreshTimer(onTimerFinish = ::showRefreshLayout) }
104
104
105
- private var canRefreshThreads = false
105
+ private var isFirstTimeRefreshingThreads = true
106
106
107
107
@Inject
108
108
lateinit var localSettings: LocalSettings
@@ -234,16 +234,20 @@ class ThreadListFragment : TwoPaneFragment(), SwipeRefreshLayout.OnRefreshListen
234
234
super .onResume()
235
235
refreshThreadsIfNotificationsAreDisabled()
236
236
updateSwipeActionsAccordingToSettings()
237
- canRefreshThreads = true
238
237
}
239
238
240
239
private fun refreshThreadsIfNotificationsAreDisabled () = with (mainViewModel) {
241
- val areGoogleServicesDisabled = ! playServicesUtils.areGooglePlayServicesAvailable()
242
- val areAppNotifsDisabled = ! notificationManagerCompat.areNotificationsEnabled()
243
- val areMailboxNotifsDisabled = currentMailbox.value?.notificationsIsDisabled(notificationManagerCompat) == true
244
- val shouldRefreshThreads = areGoogleServicesDisabled || areAppNotifsDisabled || areMailboxNotifsDisabled
245
240
246
- if (shouldRefreshThreads && canRefreshThreads) forceRefreshThreads()
241
+ if (! isFirstTimeRefreshingThreads) {
242
+ val areGoogleServicesDisabled = ! playServicesUtils.areGooglePlayServicesAvailable()
243
+ val areAppNotifsDisabled = ! notificationManagerCompat.areNotificationsEnabled()
244
+ val areMailboxNotifsDisabled = currentMailbox.value?.notificationsIsDisabled(notificationManagerCompat) == true
245
+ val shouldRefreshThreads = areGoogleServicesDisabled || areAppNotifsDisabled || areMailboxNotifsDisabled
246
+
247
+ if (shouldRefreshThreads) forceRefreshThreads()
248
+ }
249
+
250
+ isFirstTimeRefreshingThreads = false
247
251
}
248
252
249
253
private fun updateSwipeActionsAccordingToSettings () = with (binding.threadsList) {
0 commit comments