Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Loop/View Controllers/ChartsTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,14 @@ class ChartsTableViewController: UITableViewController, UIGestureRecognizerDeleg

let notificationCenter = NotificationCenter.default
notificationObservers += [
notificationCenter.addObserver(forName: .UIApplicationWillResignActive, object: UIApplication.shared, queue: .main) { [weak self] _ in
notificationCenter.addObserver(forName: .UIApplicationDidEnterBackground, object: UIApplication.shared, queue: .main) { [weak self] _ in
self?.active = false
},
notificationCenter.addObserver(forName: .UIApplicationDidBecomeActive, object: UIApplication.shared, queue: .main) { [weak self] _ in
self?.active = true
}
]

active = UIApplication.shared.applicationState == .active

let gestureRecognizer = UILongPressGestureRecognizer()
gestureRecognizer.delegate = self
gestureRecognizer.minimumPressDuration = 0.1
Expand Down Expand Up @@ -168,8 +166,11 @@ class ChartsTableViewController: UITableViewController, UIGestureRecognizerDeleg
// References to registered notification center observers
var notificationObservers: [Any] = []

var active: Bool = false {
didSet {
var active: Bool {
get {
return UIApplication.shared.applicationState == .active
}
set {
log.debug("[reloadData] for app change to active: %d", active)
reloadData()
}
Expand Down