mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-23 08:40:59 +00:00
Debounce refresh when resuming from background
This commit is contained in:
parent
bdd63e2cfb
commit
ce6d55042d
1 changed files with 2 additions and 0 deletions
|
@ -55,6 +55,7 @@ final class MainNavigationViewController: UITabBarController {
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
NotificationCenter.default.publisher(for: UIScene.willEnterForegroundNotification)
|
NotificationCenter.default.publisher(for: UIScene.willEnterForegroundNotification)
|
||||||
|
.debounce(for: .seconds(Self.refreshFromBackgroundDebounceInterval), scheduler: DispatchQueue.main)
|
||||||
.sink { [weak self] _ in self?.viewModel.refreshIdentity() }
|
.sink { [weak self] _ in self?.viewModel.refreshIdentity() }
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
}
|
}
|
||||||
|
@ -106,6 +107,7 @@ extension MainNavigationViewController: NavigationHandling {
|
||||||
private extension MainNavigationViewController {
|
private extension MainNavigationViewController {
|
||||||
static let secondaryNavigationViewTag = UUID().hashValue
|
static let secondaryNavigationViewTag = UUID().hashValue
|
||||||
static let newStatusViewTag = UUID().hashValue
|
static let newStatusViewTag = UUID().hashValue
|
||||||
|
static let refreshFromBackgroundDebounceInterval: TimeInterval = 30
|
||||||
|
|
||||||
func setupViewControllers(pending: Bool) {
|
func setupViewControllers(pending: Bool) {
|
||||||
var controllers: [UIViewController] = [
|
var controllers: [UIViewController] = [
|
||||||
|
|
Loading…
Reference in a new issue