mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-12 02:45:52 +02:00
Merge pull request #7360 from vector-im/release/1.10.2/release
Release 1.10.2
This commit is contained in:
@@ -4,9 +4,7 @@ on:
|
||||
|
||||
# Triggers the workflow on any pull request
|
||||
pull_request:
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
types: [ labeled, synchronize, opened, reopened ]
|
||||
|
||||
env:
|
||||
# Make the git branch for a PR available to our Fastfile
|
||||
@@ -14,11 +12,9 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Don't run for forks as secrets are unavailable.
|
||||
if: |
|
||||
github.event.pull_request.head.repo.full_name == github.repository &&
|
||||
(github.event_name == 'push' ||
|
||||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Trigger-PR-Build')))
|
||||
# Only run for PRs that contain the trigger label. The action will fail for forks due to
|
||||
# missing secrets, but there's no need to handle this as it won't run automatically.
|
||||
if: contains(github.event.pull_request.labels.*.name, 'Trigger-PR-Build')
|
||||
|
||||
name: Release
|
||||
runs-on: macos-12
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
## Changes in 1.10.2 (2023-02-10)
|
||||
|
||||
🐛 Bugfixes
|
||||
|
||||
- Fixes #7350 - Fix green dot only to appear for marked action ([#7530](https://github.com/vector-im/element-ios/issues/7530))
|
||||
|
||||
|
||||
## Changes in 1.10.1 (2023-02-07)
|
||||
|
||||
✨ Features
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
//
|
||||
|
||||
// Version
|
||||
MARKETING_VERSION = 1.10.1
|
||||
CURRENT_PROJECT_VERSION = 1.10.1
|
||||
MARKETING_VERSION = 1.10.2
|
||||
CURRENT_PROJECT_VERSION = 1.10.2
|
||||
|
||||
@@ -46,10 +46,10 @@ extension MXBugReportRestClient {
|
||||
// User info (TODO: handle multi-account and find a way to expose them in rageshake API)
|
||||
var userInfo = [String: String]()
|
||||
let mainAccount = MXKAccountManager.shared().accounts.first
|
||||
if let userId = mainAccount?.mxSession.myUser.userId {
|
||||
if let userId = mainAccount?.mxSession?.myUser?.userId {
|
||||
userInfo["user_id"] = userId
|
||||
}
|
||||
if let deviceId = mainAccount?.mxSession.matrixRestClient.credentials.deviceId {
|
||||
if let deviceId = mainAccount?.mxSession?.myDeviceId {
|
||||
userInfo["device_id"] = deviceId
|
||||
}
|
||||
|
||||
|
||||
@@ -92,12 +92,17 @@
|
||||
self.lastEventDecriptionLabelTrailingConstraint.constant = self.unsentImageView.hidden ? 10 : 30;
|
||||
|
||||
// Notify unreads and bing
|
||||
if (roomCellData.hasUnread)
|
||||
if (roomCellData.isRoomMarkedAsUnread)
|
||||
{
|
||||
|
||||
self.missedNotifAndUnreadBadgeBgView.hidden = NO;
|
||||
self.missedNotifAndUnreadBadgeBgView.backgroundColor = ThemeService.shared.theme.tintColor;
|
||||
self.missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = 20;
|
||||
}
|
||||
else if (roomCellData.hasUnread)
|
||||
{
|
||||
self.missedNotifAndUnreadIndicator.hidden = NO;
|
||||
if (0 < roomCellData.notificationCount)
|
||||
{
|
||||
self.missedNotifAndUnreadIndicator.hidden = NO;
|
||||
self.missedNotifAndUnreadIndicator.backgroundColor = roomCellData.highlightCount ? ThemeService.shared.theme.noticeColor : ThemeService.shared.theme.noticeSecondaryColor;
|
||||
|
||||
self.missedNotifAndUnreadBadgeBgView.hidden = NO;
|
||||
@@ -110,9 +115,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
self.missedNotifAndUnreadBadgeBgView.hidden = NO;
|
||||
self.missedNotifAndUnreadBadgeBgView.backgroundColor = ThemeService.shared.theme.tintColor;
|
||||
self.missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = 20;
|
||||
self.missedNotifAndUnreadIndicator.backgroundColor = ThemeService.shared.theme.unreadRoomIndentColor;
|
||||
}
|
||||
|
||||
// Use bold font for the room title
|
||||
|
||||
@@ -196,7 +196,7 @@ class AllChatsViewController: HomeViewController {
|
||||
searchController.isActive = false
|
||||
|
||||
guard let spaceId = spaceId else {
|
||||
self.dataSource?.currentSpace = nil
|
||||
dataSource?.currentSpace = nil
|
||||
updateUI()
|
||||
|
||||
return
|
||||
@@ -207,7 +207,7 @@ class AllChatsViewController: HomeViewController {
|
||||
return
|
||||
}
|
||||
|
||||
self.dataSource.currentSpace = space
|
||||
dataSource?.currentSpace = space
|
||||
updateUI()
|
||||
|
||||
self.recentsTableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: true)
|
||||
@@ -288,7 +288,7 @@ class AllChatsViewController: HomeViewController {
|
||||
|
||||
@objc private func showSpaceSelectorAction(sender: AnyObject) {
|
||||
Analytics.shared.viewRoomTrigger = .roomList
|
||||
let currentSpaceId = self.dataSource.currentSpace?.spaceId ?? SpaceSelectorConstants.homeSpaceId
|
||||
let currentSpaceId = dataSource?.currentSpace?.spaceId ?? SpaceSelectorConstants.homeSpaceId
|
||||
let spaceSelectorBridgePresenter = SpaceSelectorBottomSheetCoordinatorBridgePresenter(session: self.mainSession, selectedSpaceId: currentSpaceId, showHomeSpace: true)
|
||||
spaceSelectorBridgePresenter.present(from: self, animated: true)
|
||||
spaceSelectorBridgePresenter.delegate = self
|
||||
@@ -310,7 +310,7 @@ class AllChatsViewController: HomeViewController {
|
||||
return super.tableView(tableView, numberOfRowsInSection: section)
|
||||
}
|
||||
|
||||
return dataSource.tableView(tableView, numberOfRowsInSection: section)
|
||||
return dataSource?.tableView(tableView, numberOfRowsInSection: section) ?? 0
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
@@ -318,6 +318,10 @@ class AllChatsViewController: HomeViewController {
|
||||
return super.tableView(tableView, cellForRowAt: indexPath)
|
||||
}
|
||||
|
||||
guard let dataSource = dataSource else {
|
||||
MXLog.failure("Missing data source")
|
||||
return UITableViewCell()
|
||||
}
|
||||
return dataSource.tableView(tableView, cellForRowAt: indexPath)
|
||||
}
|
||||
|
||||
@@ -328,7 +332,7 @@ class AllChatsViewController: HomeViewController {
|
||||
return super.tableView(tableView, heightForRowAt: indexPath)
|
||||
}
|
||||
|
||||
return dataSource.cellHeight(at: indexPath)
|
||||
return dataSource?.cellHeight(at: indexPath) ?? 0
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
@@ -583,7 +587,7 @@ class AllChatsViewController: HomeViewController {
|
||||
}
|
||||
|
||||
private func showSpaceInvite() {
|
||||
guard let session = mainSession, let spaceRoom = dataSource.currentSpace?.room else {
|
||||
guard let session = mainSession, let spaceRoom = dataSource?.currentSpace?.room else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -595,7 +599,7 @@ class AllChatsViewController: HomeViewController {
|
||||
}
|
||||
|
||||
private func showSpaceMembers() {
|
||||
guard let session = mainSession, let spaceId = dataSource.currentSpace?.spaceId else {
|
||||
guard let session = mainSession, let spaceId = dataSource?.currentSpace?.spaceId else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -609,7 +613,7 @@ class AllChatsViewController: HomeViewController {
|
||||
}
|
||||
|
||||
private func showSpaceSettings() {
|
||||
guard let session = mainSession, let spaceId = dataSource.currentSpace?.spaceId else {
|
||||
guard let session = mainSession, let spaceId = dataSource?.currentSpace?.spaceId else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -630,7 +634,7 @@ class AllChatsViewController: HomeViewController {
|
||||
}
|
||||
|
||||
private func showLeaveSpace() {
|
||||
guard let session = mainSession, let spaceSummary = dataSource.currentSpace?.summary else {
|
||||
guard let session = mainSession, let spaceSummary = dataSource?.currentSpace?.summary else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -714,11 +718,11 @@ extension AllChatsViewController: SpaceSelectorBottomSheetCoordinatorBridgePrese
|
||||
extension AllChatsViewController: UISearchResultsUpdating {
|
||||
func updateSearchResults(for searchController: UISearchController) {
|
||||
guard let searchText = searchController.searchBar.text, !searchText.isEmpty else {
|
||||
self.dataSource.search(withPatterns: nil)
|
||||
self.dataSource?.search(withPatterns: nil)
|
||||
return
|
||||
}
|
||||
|
||||
self.dataSource.search(withPatterns: [searchText])
|
||||
self.dataSource?.search(withPatterns: [searchText])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -754,7 +758,7 @@ extension AllChatsViewController: AllChatsEditActionProviderDelegate {
|
||||
case .startChat:
|
||||
startChat()
|
||||
case .createSpace:
|
||||
showCreateSpace(parentSpaceId: dataSource.currentSpace?.spaceId)
|
||||
showCreateSpace(parentSpaceId: dataSource?.currentSpace?.spaceId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -25,7 +25,6 @@ final class KeyVerificationSelfVerifyWaitCoordinator: KeyVerificationSelfVerifyW
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private let session: MXSession
|
||||
private var keyVerificationSelfVerifyWaitViewModel: KeyVerificationSelfVerifyWaitViewModelType
|
||||
private let keyVerificationSelfVerifyWaitViewController: KeyVerificationSelfVerifyWaitViewController
|
||||
private let cancellable: Bool
|
||||
@@ -40,9 +39,7 @@ final class KeyVerificationSelfVerifyWaitCoordinator: KeyVerificationSelfVerifyW
|
||||
// MARK: - Setup
|
||||
|
||||
init(session: MXSession, isNewSignIn: Bool, cancellable: Bool) {
|
||||
self.session = session
|
||||
|
||||
let keyVerificationSelfVerifyWaitViewModel = KeyVerificationSelfVerifyWaitViewModel(session: self.session, isNewSignIn: isNewSignIn)
|
||||
let keyVerificationSelfVerifyWaitViewModel = KeyVerificationSelfVerifyWaitViewModel(session: session, isNewSignIn: isNewSignIn)
|
||||
let keyVerificationSelfVerifyWaitViewController = KeyVerificationSelfVerifyWaitViewController.instantiate(with: keyVerificationSelfVerifyWaitViewModel, cancellable: cancellable)
|
||||
self.keyVerificationSelfVerifyWaitViewModel = keyVerificationSelfVerifyWaitViewModel
|
||||
self.keyVerificationSelfVerifyWaitViewController = keyVerificationSelfVerifyWaitViewController
|
||||
|
||||
+37
-12
@@ -26,11 +26,19 @@ final class KeyVerificationSelfVerifyWaitViewModel: KeyVerificationSelfVerifyWai
|
||||
|
||||
private let session: MXSession
|
||||
private let keyVerificationService: KeyVerificationService
|
||||
private let verificationManager: MXKeyVerificationManager
|
||||
private let verificationManager: MXKeyVerificationManager?
|
||||
private let isNewSignIn: Bool
|
||||
private var secretsRecoveryAvailability: SecretsRecoveryAvailability
|
||||
private var secretsRecoveryAvailability: SecretsRecoveryAvailability?
|
||||
private var keyVerificationRequest: MXKeyVerificationRequest?
|
||||
|
||||
private var myUserId: String {
|
||||
guard let userId = session.myUserId else {
|
||||
MXLog.error("[KeyVerificationSelfVerifyWaitViewModel] userId is missing")
|
||||
return ""
|
||||
}
|
||||
return userId
|
||||
}
|
||||
|
||||
// MARK: Public
|
||||
|
||||
weak var viewDelegate: KeyVerificationSelfVerifyWaitViewModelViewDelegate?
|
||||
@@ -40,10 +48,10 @@ final class KeyVerificationSelfVerifyWaitViewModel: KeyVerificationSelfVerifyWai
|
||||
|
||||
init(session: MXSession, isNewSignIn: Bool) {
|
||||
self.session = session
|
||||
self.verificationManager = session.crypto.keyVerificationManager
|
||||
self.verificationManager = session.crypto?.keyVerificationManager
|
||||
self.keyVerificationService = KeyVerificationService()
|
||||
self.isNewSignIn = isNewSignIn
|
||||
self.secretsRecoveryAvailability = session.crypto.recoveryService.vc_availability
|
||||
self.secretsRecoveryAvailability = session.crypto?.recoveryService.vc_availability
|
||||
}
|
||||
|
||||
deinit {
|
||||
@@ -59,9 +67,16 @@ final class KeyVerificationSelfVerifyWaitViewModel: KeyVerificationSelfVerifyWai
|
||||
case .cancel:
|
||||
self.cancel()
|
||||
case .recoverSecrets:
|
||||
switch self.secretsRecoveryAvailability {
|
||||
guard let availability = secretsRecoveryAvailability else {
|
||||
MXLog.error("[KeyVerificationSelfVerifyWaitViewModel] process: secretsRecoveryAvailability not set")
|
||||
self.cancel()
|
||||
return
|
||||
}
|
||||
|
||||
switch availability {
|
||||
case .notAvailable:
|
||||
fatalError("Should not happen: When recovery is not available button is hidden")
|
||||
MXLog.error("Should not happen: When recovery is not available button is hidden")
|
||||
self.cancel()
|
||||
case .available(let secretsRecoveryMode):
|
||||
self.coordinatorDelegate?.keyVerificationSelfVerifyWaitViewModel(self, wantsToRecoverSecretsWith: secretsRecoveryMode)
|
||||
}
|
||||
@@ -71,12 +86,16 @@ final class KeyVerificationSelfVerifyWaitViewModel: KeyVerificationSelfVerifyWai
|
||||
// MARK: - Private
|
||||
|
||||
private func loadData() {
|
||||
guard let verificationManager = verificationManager else {
|
||||
MXLog.failure("Verification manager is not set")
|
||||
return
|
||||
}
|
||||
|
||||
if !self.isNewSignIn {
|
||||
MXLog.debug("[KeyVerificationSelfVerifyWaitViewModel] loadData: Send a verification request to all devices")
|
||||
|
||||
let keyVerificationService = KeyVerificationService()
|
||||
self.verificationManager.requestVerificationByToDevice(withUserId: self.session.myUserId, deviceIds: nil, methods: keyVerificationService.supportedKeyVerificationMethods(), success: { [weak self] (keyVerificationRequest) in
|
||||
verificationManager.requestVerificationByToDevice(withUserId: self.myUserId, deviceIds: nil, methods: keyVerificationService.supportedKeyVerificationMethods(), success: { [weak self] (keyVerificationRequest) in
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
@@ -103,7 +122,7 @@ final class KeyVerificationSelfVerifyWaitViewModel: KeyVerificationSelfVerifyWai
|
||||
MXLog.debug("[KeyVerificationSelfVerifyWaitViewModel] loadData: Send a verification request to all devices instead of waiting")
|
||||
|
||||
let keyVerificationService = KeyVerificationService()
|
||||
self.verificationManager.requestVerificationByToDevice(withUserId: self.session.myUserId, deviceIds: nil, methods: keyVerificationService.supportedKeyVerificationMethods(), success: { [weak self] (keyVerificationRequest) in
|
||||
verificationManager.requestVerificationByToDevice(withUserId: self.myUserId, deviceIds: nil, methods: keyVerificationService.supportedKeyVerificationMethods(), success: { [weak self] (keyVerificationRequest) in
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
@@ -132,12 +151,18 @@ final class KeyVerificationSelfVerifyWaitViewModel: KeyVerificationSelfVerifyWai
|
||||
}
|
||||
|
||||
private func continueLoadData() {
|
||||
guard let verificationManager = verificationManager, let recoveryService = session.crypto?.recoveryService else {
|
||||
MXLog.error("[KeyVerificationSelfVerifyWaitViewModel] continueLoadData: Missing dependencies")
|
||||
return
|
||||
}
|
||||
|
||||
// update availability again
|
||||
self.secretsRecoveryAvailability = session.crypto.recoveryService.vc_availability
|
||||
let availability = recoveryService.vc_availability
|
||||
self.secretsRecoveryAvailability = availability
|
||||
|
||||
let viewData = KeyVerificationSelfVerifyWaitViewData(isNewSignIn: self.isNewSignIn, secretsRecoveryAvailability: self.secretsRecoveryAvailability)
|
||||
let viewData = KeyVerificationSelfVerifyWaitViewData(isNewSignIn: self.isNewSignIn, secretsRecoveryAvailability: availability)
|
||||
|
||||
self.registerKeyVerificationManagerNewRequestNotification(for: self.verificationManager)
|
||||
self.registerKeyVerificationManagerNewRequestNotification(for: verificationManager)
|
||||
self.update(viewState: .loaded(viewData))
|
||||
self.registerTransactionDidStateChangeNotification()
|
||||
self.registerKeyVerificationRequestChangeNotification()
|
||||
@@ -251,7 +276,7 @@ final class KeyVerificationSelfVerifyWaitViewModel: KeyVerificationSelfVerifyWai
|
||||
|
||||
@objc private func transactionDidStateChange(notification: Notification) {
|
||||
guard let sasTransaction = notification.object as? MXSASTransaction,
|
||||
sasTransaction.isIncoming, sasTransaction.otherUserId == self.session.myUserId else {
|
||||
sasTransaction.isIncoming, sasTransaction.otherUserId == self.myUserId else {
|
||||
return
|
||||
}
|
||||
self.sasTransactionDidStateChange(sasTransaction)
|
||||
|
||||
@@ -2150,7 +2150,10 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
}
|
||||
else
|
||||
{
|
||||
failure([NSError errorWithDomain:MXKRoomDataSourceErrorDomain code:MXKRoomDataSourceErrorResendGeneric userInfo:nil]);
|
||||
if (failure)
|
||||
{
|
||||
failure([NSError errorWithDomain:MXKRoomDataSourceErrorDomain code:MXKRoomDataSourceErrorResendGeneric userInfo:nil]);
|
||||
}
|
||||
MXLogWarning(@"[MXKRoomDataSource][%p] resendEventWithEventId: Warning - Unable to resend room message of type: %@", self, msgType);
|
||||
}
|
||||
}
|
||||
@@ -2177,7 +2180,10 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
NSURL *localFileURL = [NSURL URLWithString:localFilePath];
|
||||
|
||||
if (![NSFileManager.defaultManager fileExistsAtPath:localFilePath]) {
|
||||
failure([NSError errorWithDomain:MXKRoomDataSourceErrorDomain code:MXKRoomDataSourceErrorResendInvalidLocalFilePath userInfo:nil]);
|
||||
if (failure)
|
||||
{
|
||||
failure([NSError errorWithDomain:MXKRoomDataSourceErrorDomain code:MXKRoomDataSourceErrorResendInvalidLocalFilePath userInfo:nil]);
|
||||
}
|
||||
MXLogWarning(@"[MXKRoomDataSource][%p] resendEventWithEventId: Warning - Unable to resend voice message, invalid file path.", self);
|
||||
return;
|
||||
}
|
||||
@@ -2247,7 +2253,10 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
}
|
||||
else
|
||||
{
|
||||
failure([NSError errorWithDomain:MXKRoomDataSourceErrorDomain code:MXKRoomDataSourceErrorResendGeneric userInfo:nil]);
|
||||
if (failure)
|
||||
{
|
||||
failure([NSError errorWithDomain:MXKRoomDataSourceErrorDomain code:MXKRoomDataSourceErrorResendGeneric userInfo:nil]);
|
||||
}
|
||||
MXLogWarning(@"[MXKRoomDataSource][%p] resendEventWithEventId: Warning - Unable to resend room message of type: %@", self, msgType);
|
||||
}
|
||||
}
|
||||
@@ -2259,13 +2268,19 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
}
|
||||
else
|
||||
{
|
||||
failure([NSError errorWithDomain:MXKRoomDataSourceErrorDomain code:MXKRoomDataSourceErrorResendInvalidMessageType userInfo:nil]);
|
||||
if (failure)
|
||||
{
|
||||
failure([NSError errorWithDomain:MXKRoomDataSourceErrorDomain code:MXKRoomDataSourceErrorResendInvalidMessageType userInfo:nil]);
|
||||
}
|
||||
MXLogWarning(@"[MXKRoomDataSource][%p] resendEventWithEventId: Warning - Unable to resend room message of type: %@", self, msgType);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
failure([NSError errorWithDomain:MXKRoomDataSourceErrorDomain code:MXKRoomDataSourceErrorResendInvalidMessageType userInfo:nil]);
|
||||
if (failure)
|
||||
{
|
||||
failure([NSError errorWithDomain:MXKRoomDataSourceErrorDomain code:MXKRoomDataSourceErrorResendInvalidMessageType userInfo:nil]);
|
||||
}
|
||||
MXLogWarning(@"[MXKRoomDataSource][%p] MXKRoomDataSource: Warning - Only resend of MXEventTypeRoomMessage is allowed. Event.type: %@", self, event.type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,8 +63,12 @@
|
||||
|
||||
- (BOOL)hasUnread
|
||||
{
|
||||
bool isRoomUnread = [[self mxSession] isRoomMarkedAsUnread:roomSummary.roomId];
|
||||
return (roomSummary.localUnreadEventCount != 0 || isRoomUnread);
|
||||
return (roomSummary.localUnreadEventCount != 0);
|
||||
}
|
||||
|
||||
- (BOOL)isRoomMarkedAsUnread
|
||||
{
|
||||
return [[self mxSession] isRoomMarkedAsUnread:roomSummary.roomId];;
|
||||
}
|
||||
|
||||
- (NSString *)roomIdentifier
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
@property (nonatomic, readonly) NSString *lastEventDate;
|
||||
|
||||
@property (nonatomic, readonly) BOOL hasUnread;
|
||||
@property (nonatomic, readonly) BOOL isRoomMarkedAsUnread;
|
||||
@property (nonatomic, readonly) NSUInteger notificationCount;
|
||||
@property (nonatomic, readonly) NSUInteger highlightCount;
|
||||
@property (nonatomic, readonly) NSString *notificationCountStringValue;
|
||||
|
||||
+11
-7
@@ -30,6 +30,10 @@ final class MXRoomNotificationSettingsService: RoomNotificationSettingsServiceTy
|
||||
|
||||
private var observers: [ObjectIdentifier] = []
|
||||
|
||||
private var notificationCenter: MXNotificationCenter? {
|
||||
room.mxSession?.notificationCenter
|
||||
}
|
||||
|
||||
// MARK: Public
|
||||
|
||||
var notificationState: RoomNotificationState {
|
||||
@@ -166,7 +170,7 @@ final class MXRoomNotificationSettingsService: RoomNotificationSettingsServiceTy
|
||||
}
|
||||
handleFailureCallback(completion)
|
||||
|
||||
room.mxSession.notificationCenter.addRoomRule(
|
||||
notificationCenter?.addRoomRule(
|
||||
room.roomId,
|
||||
notify: false,
|
||||
sound: false,
|
||||
@@ -184,7 +188,7 @@ final class MXRoomNotificationSettingsService: RoomNotificationSettingsServiceTy
|
||||
}
|
||||
handleFailureCallback(completion)
|
||||
|
||||
room.mxSession.notificationCenter.addOverrideRule(
|
||||
notificationCenter?.addOverrideRule(
|
||||
withId: roomId,
|
||||
conditions: [["kind": "event_match", "key": "room_id", "pattern": roomId]],
|
||||
notify: false,
|
||||
@@ -196,11 +200,11 @@ final class MXRoomNotificationSettingsService: RoomNotificationSettingsServiceTy
|
||||
private func removePushRule(rule: MXPushRule, completion: @escaping Completion) {
|
||||
handleUpdateCallback(completion) { [weak self] in
|
||||
guard let self = self else { return true }
|
||||
return self.room.mxSession.notificationCenter.rule(byId: rule.ruleId) == nil
|
||||
return self.notificationCenter?.rule(byId: rule.ruleId) == nil
|
||||
}
|
||||
handleFailureCallback(completion)
|
||||
|
||||
room.mxSession.notificationCenter.removeRule(rule)
|
||||
notificationCenter?.removeRule(rule)
|
||||
}
|
||||
|
||||
private func enablePushRule(rule: MXPushRule, completion: @escaping Completion) {
|
||||
@@ -210,7 +214,7 @@ final class MXRoomNotificationSettingsService: RoomNotificationSettingsServiceTy
|
||||
}
|
||||
handleFailureCallback(completion)
|
||||
|
||||
room.mxSession.notificationCenter.enableRule(rule, isEnabled: true)
|
||||
notificationCenter?.enableRule(rule, isEnabled: true)
|
||||
}
|
||||
|
||||
private func handleUpdateCallback(_ completion: @escaping Completion, releaseCheck: @escaping () -> Bool) {
|
||||
@@ -283,14 +287,14 @@ private extension MXRoom {
|
||||
}
|
||||
|
||||
var overridePushRule: MXPushRule? {
|
||||
guard let overrideRules = mxSession.notificationCenter.rules.global.override else {
|
||||
guard let overrideRules = mxSession?.notificationCenter?.rules?.global?.override else {
|
||||
return nil
|
||||
}
|
||||
return getRoomRule(from: overrideRules)
|
||||
}
|
||||
|
||||
var roomPushRule: MXPushRule? {
|
||||
guard let roomRules = mxSession.notificationCenter.rules.global.room else {
|
||||
guard let roomRules = mxSession?.notificationCenter?.rules?.global?.room else {
|
||||
return nil
|
||||
}
|
||||
return getRoomRule(from: roomRules)
|
||||
|
||||
Reference in New Issue
Block a user