Modify views to observe changes when active, not just foreground.
This commit is contained in:
parent
812210a63c
commit
fefc9843b1
|
@ -4441,7 +4441,7 @@ typedef enum : NSUInteger {
|
|||
|
||||
- (void)updateShouldObserveDBModifications
|
||||
{
|
||||
BOOL isAppForegroundAndActive = CurrentAppContext().reportedApplicationState == UIApplicationStateActive;
|
||||
BOOL isAppForegroundAndActive = CurrentAppContext().isAppForegroundAndActive;
|
||||
self.shouldObserveDBModifications = self.isViewVisible && isAppForegroundAndActive;
|
||||
}
|
||||
|
||||
|
|
|
@ -485,7 +485,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
|
|||
|
||||
- (void)updateShouldObserveDBModifications
|
||||
{
|
||||
BOOL isAppForegroundAndActive = CurrentAppContext().reportedApplicationState == UIApplicationStateActive;
|
||||
BOOL isAppForegroundAndActive = CurrentAppContext().isAppForegroundAndActive;
|
||||
self.shouldObserveDBModifications = self.isViewVisible && isAppForegroundAndActive;
|
||||
}
|
||||
|
||||
|
|
|
@ -156,6 +156,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return self.reportedApplicationState == UIApplicationStateBackground;
|
||||
}
|
||||
|
||||
- (BOOL)isAppForegroundAndActive
|
||||
{
|
||||
return self.reportedApplicationState == UIApplicationStateActive;
|
||||
}
|
||||
|
||||
- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:
|
||||
(BackgroundTaskExpirationHandler)expirationHandler
|
||||
{
|
||||
|
|
|
@ -79,8 +79,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
- (void)updateShouldObserveDBModifications
|
||||
{
|
||||
BOOL isAppForegroundAndActive = CurrentAppContext().reportedApplicationState == UIApplicationStateActive;
|
||||
self.shouldObserveDBModifications = isAppForegroundAndActive;
|
||||
self.shouldObserveDBModifications = CurrentAppContext().isAppForegroundAndActive;
|
||||
}
|
||||
|
||||
// Don't observe database change notifications when the app is in the background.
|
||||
|
|
|
@ -55,6 +55,11 @@ NSString *NSStringForUIApplicationState(UIApplicationState value);
|
|||
// This method is thread-safe.
|
||||
- (BOOL)isInBackground;
|
||||
|
||||
// A convenience accessor for reportedApplicationState.
|
||||
//
|
||||
// This method is thread-safe.
|
||||
- (BOOL)isAppForegroundAndActive;
|
||||
|
||||
// Should start a background task if isMainApp is YES.
|
||||
// Should just return UIBackgroundTaskInvalid if isMainApp is NO.
|
||||
- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:
|
||||
|
|
|
@ -151,6 +151,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return self.reportedApplicationState == UIApplicationStateBackground;
|
||||
}
|
||||
|
||||
- (BOOL)isAppForegroundAndActive
|
||||
{
|
||||
return self.reportedApplicationState == UIApplicationStateActive;
|
||||
}
|
||||
|
||||
- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:
|
||||
(BackgroundTaskExpirationHandler)expirationHandler
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue