mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 23:18:27 +02:00
merged element-ios 1.10.5 into 4409_basis_update_1_10_5
This commit is contained in:
@@ -273,11 +273,14 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
MXLog.debug("[NotificationService] setup: MXBackgroundSyncService init: BEFORE")
|
||||
self.logMemory()
|
||||
|
||||
NotificationService.backgroundSyncService = MXBackgroundSyncService(withCredentials: userAccount.mxCredentials, persistTokenDataHandler: { persistTokenDataHandler in
|
||||
MXKAccountManager.shared().readAndWriteCredentials(persistTokenDataHandler)
|
||||
}, unauthenticatedHandler: { error, softLogout, refreshTokenAuth, completion in
|
||||
userAccount.handleUnauthenticatedWithError(error, isSoftLogout: softLogout, isRefreshTokenAuth: refreshTokenAuth, andCompletion: completion)
|
||||
})
|
||||
NotificationService.backgroundSyncService = MXBackgroundSyncService(
|
||||
withCredentials: userAccount.mxCredentials,
|
||||
isCryptoSDKEnabled: isCryptoSDKEnabled,
|
||||
persistTokenDataHandler: { persistTokenDataHandler in
|
||||
MXKAccountManager.shared().readAndWriteCredentials(persistTokenDataHandler)
|
||||
}, unauthenticatedHandler: { error, softLogout, refreshTokenAuth, completion in
|
||||
userAccount.handleUnauthenticatedWithError(error, isSoftLogout: softLogout, isRefreshTokenAuth: refreshTokenAuth, andCompletion: completion)
|
||||
})
|
||||
MXLog.debug("[NotificationService] setup: MXBackgroundSyncService init: AFTER")
|
||||
self.logMemory()
|
||||
}
|
||||
@@ -292,10 +295,10 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
/// Determine whether we have switched from using crypto v1 to v2 or vice versa which will require
|
||||
/// rebuilding `MXBackgroundSyncService`
|
||||
private func hasChangedCryptoSDK() -> Bool {
|
||||
guard isCryptoSDKEnabled != RiotSettings.shared.enableCryptoSDK else {
|
||||
guard isCryptoSDKEnabled != MXSDKOptions.sharedInstance().enableCryptoSDK else {
|
||||
return false
|
||||
}
|
||||
isCryptoSDKEnabled = RiotSettings.shared.enableCryptoSDK
|
||||
isCryptoSDKEnabled = MXSDKOptions.sharedInstance().enableCryptoSDK
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -311,7 +314,7 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
|
||||
// If a room summary is available, use the displayname for the best attempt title.
|
||||
guard let roomSummary = NotificationService.backgroundSyncService.roomSummary(forRoomId: roomId) else { return }
|
||||
guard let roomDisplayName = roomSummary.displayname else { return }
|
||||
guard let roomDisplayName = roomSummary.displayName else { return }
|
||||
bestAttemptContents[eventId]?.title = roomDisplayName
|
||||
|
||||
// At this stage we don't know the message type, so leave the body as set in didReceive.
|
||||
@@ -453,9 +456,15 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
var ignoreBadgeUpdate = false
|
||||
var threadIdentifier: String? = roomId
|
||||
let currentUserId = account.mxCredentials.userId
|
||||
let roomDisplayName = roomSummary?.displayname
|
||||
let roomDisplayName = roomSummary?.displayName
|
||||
let pushRule = NotificationService.backgroundSyncService.pushRule(matching: event, roomState: roomState)
|
||||
|
||||
|
||||
// if the push rule must not be notified we complete and return
|
||||
if pushRule?.dontNotify == true {
|
||||
onComplete(nil, false)
|
||||
return
|
||||
}
|
||||
|
||||
switch event.eventType {
|
||||
case .callInvite:
|
||||
let offer = event.content["offer"] as? [AnyHashable: Any]
|
||||
@@ -1001,3 +1010,10 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
return String(format: format, locale: locale, arguments: args)
|
||||
}
|
||||
}
|
||||
|
||||
private extension MXPushRule {
|
||||
var dontNotify: Bool {
|
||||
let actions = (actions as? [MXPushRuleAction]) ?? []
|
||||
return actions.contains { $0.actionType == MXPushRuleActionTypeDontNotify }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ targets:
|
||||
type: app-extension
|
||||
|
||||
dependencies:
|
||||
- package: AnalyticsEvents
|
||||
- package: DeviceKit
|
||||
- package: DTCoreText
|
||||
|
||||
@@ -56,6 +57,7 @@ targets:
|
||||
- path: ../bwi/UserAgent/UserAgentService.swift
|
||||
- path: ../Riot/Utils/DataProtectionHelper.swift
|
||||
- path: ../Config/CommonConfiguration.swift
|
||||
- path: ../Riot/Experiments/
|
||||
- path: ../Riot/Managers/PushNotification/PushNotificationStore.swift
|
||||
- path: ../Riot/Modules/SetPinCode/PinCodePreferences.swift
|
||||
- path: ../Riot/Modules/SetPinCode/SetupBiometrics/BiometricsAuthenticationPresenter.swift
|
||||
|
||||
Reference in New Issue
Block a user