further fix on app state issues

pull/1053/head
Ryan ZHAO 5 months ago
parent 1dddedf3eb
commit 8f10f43494

@ -7778,7 +7778,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 503; CURRENT_PROJECT_VERSION = 504;
DEVELOPMENT_TEAM = SUQ8J2PCT7; DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -7849,7 +7849,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 503; CURRENT_PROJECT_VERSION = 504;
DEVELOPMENT_TEAM = SUQ8J2PCT7; DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",

@ -145,7 +145,7 @@ public final class SessionCallManager: NSObject, CallManagerProtocol {
UserDefaults.sharedLokiProject?[.isCallOngoing] = false UserDefaults.sharedLokiProject?[.isCallOngoing] = false
UserDefaults.sharedLokiProject?[.lastCallPreOffer] = nil UserDefaults.sharedLokiProject?[.lastCallPreOffer] = nil
if Singleton.hasAppContext && Singleton.appContext.isInBackground { if Singleton.hasAppContext && Singleton.appContext.isNotInForeground {
(UIApplication.shared.delegate as? AppDelegate)?.stopPollers() (UIApplication.shared.delegate as? AppDelegate)?.stopPollers()
Log.flush() Log.flush()
} }

@ -353,8 +353,7 @@ final class HomeVC: BaseVC, LibSessionRespondingViewController, UITableViewDataS
) )
// Start polling if needed (i.e. if the user just created or restored their Session ID) // Start polling if needed (i.e. if the user just created or restored their Session ID)
if Identity.userExists(), let appDelegate: AppDelegate = UIApplication.shared.delegate as? AppDelegate, Singleton.appContext.isInBackground == false { if Identity.userExists(), let appDelegate: AppDelegate = UIApplication.shared.delegate as? AppDelegate, !Singleton.appContext.isNotInForeground {
SNLog("[HomeVC]: Starting pollers...")
appDelegate.startPollersIfNeeded() appDelegate.startPollersIfNeeded()
} }

@ -46,9 +46,9 @@ public extension AppContext {
var frontmostViewController: UIViewController? { nil } var frontmostViewController: UIViewController? { nil }
var backgroundTimeRemaining: TimeInterval { 0 } var backgroundTimeRemaining: TimeInterval { 0 }
// Note: .inactive is a strange state, if the app is activated by VOIP and CallKit is up in the front, // Note: CallKit will make the app state as .inactive
// the app will report .inactive state var isInBackground: Bool { reportedApplicationState == .background }
var isInBackground: Bool { reportedApplicationState == .background || reportedApplicationState == .inactive } var isNotInForeground: Bool { reportedApplicationState != .active }
var isAppForegroundAndActive: Bool { reportedApplicationState == .active } var isAppForegroundAndActive: Bool { reportedApplicationState == .active }
// MARK: - Paths // MARK: - Paths

Loading…
Cancel
Save