ios: CallKit changed reporting logic (#2019)

* ios: CallKit changed reporting logic

* refactor, suspend chat after call when app is in background

---------

Co-authored-by: Avently <7953703+avently@users.noreply.github.com>
This commit is contained in:
Evgeny Poberezkin 2023-03-16 19:57:43 +00:00 committed by GitHub
parent 063440e735
commit 8145387f77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 86 additions and 51 deletions

View file

@ -909,7 +909,7 @@ func apiGetVersion() throws -> CoreVersionInfo {
throw r
}
func initializeChat(start: Bool, dbKey: String? = nil) throws {
func initializeChat(start: Bool, dbKey: String? = nil, refreshInvitations: Bool = true) throws {
logger.debug("initializeChat")
let m = ChatModel.shared
(m.chatDbEncrypted, m.chatDbStatus) = chatMigrateInit(dbKey)
@ -925,13 +925,13 @@ func initializeChat(start: Bool, dbKey: String? = nil) throws {
if m.currentUser == nil {
m.onboardingStage = .step1_SimpleXInfo
} else if start {
try startChat()
try startChat(refreshInvitations: refreshInvitations)
} else {
m.chatRunning = false
}
}
func startChat() throws {
func startChat(refreshInvitations: Bool = true) throws {
logger.debug("startChat")
let m = ChatModel.shared
try setNetworkConfig(getNetCfg())
@ -940,7 +940,9 @@ func startChat() throws {
if justStarted {
try getUserChatData()
NtfManager.shared.setNtfBadgeCount(m.totalUnreadCountForAllUsers())
try refreshCallInvitations()
if (refreshInvitations) {
try refreshCallInvitations()
}
(m.savedToken, m.tokenStatus, m.notificationMode) = apiGetNtfToken()
if let token = m.deviceToken {
registerToken(token: token)