2020-07-29 08:13:43 +00:00
|
|
|
//
|
|
|
|
// Copyright 2020 Vector Creations Ltd
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
/// AppConfiguration is CommonConfiguration plus configurations dedicated to the app
|
|
|
|
class AppConfiguration: CommonConfiguration {
|
|
|
|
|
|
|
|
// MARK: - Global settings
|
|
|
|
|
|
|
|
override func setupSettings() {
|
|
|
|
super.setupSettings()
|
|
|
|
setupAppSettings()
|
|
|
|
}
|
|
|
|
|
|
|
|
private func setupAppSettings() {
|
2020-08-10 15:16:07 +00:00
|
|
|
// Enable CallKit for app
|
|
|
|
MXKAppSettings.standard()?.isCallKitEnabled = true
|
|
|
|
|
2022-10-12 09:30:38 +00:00
|
|
|
// Get additional events (modular widget, voice broadcast...)
|
2020-11-30 13:05:30 +00:00
|
|
|
MXKAppSettings.standard()?.addSupportedEventTypes([kWidgetMatrixEventTypeString,
|
2022-10-12 09:30:38 +00:00
|
|
|
kWidgetModularEventTypeString,
|
2022-10-19 11:10:59 +00:00
|
|
|
VoiceBroadcastSettings.voiceBroadcastInfoContentKeyType])
|
2020-11-30 13:05:30 +00:00
|
|
|
|
2020-09-17 14:56:42 +00:00
|
|
|
// Hide undecryptable messages that were sent while the user was not in the room
|
|
|
|
MXKAppSettings.standard()?.hidePreJoinedUndecryptableEvents = true
|
|
|
|
|
2020-07-29 08:13:43 +00:00
|
|
|
// Enable long press on event in bubble cells
|
|
|
|
MXKRoomBubbleTableViewCell.disableLongPressGesture(onEvent: false)
|
|
|
|
|
|
|
|
// Each room member will be considered as a potential contact.
|
|
|
|
MXKContactManager.shared().contactManagerMXRoomSource = MXKContactManagerMXRoomSource.all
|
2020-08-24 15:23:16 +00:00
|
|
|
|
2021-04-29 07:21:16 +00:00
|
|
|
// Use UIKit BackgroundTask for handling background tasks in the SDK
|
|
|
|
MXSDKOptions.sharedInstance().backgroundModeHandler = MXUIKitBackgroundModeHandler()
|
|
|
|
|
2020-08-24 15:23:16 +00:00
|
|
|
// Enable key backup on app
|
|
|
|
MXSDKOptions.sharedInstance().enableKeyBackupWhenStartingMXCrypto = true
|
2020-07-29 08:13:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: - Per matrix session settings
|
|
|
|
|
|
|
|
override func setupSettings(for matrixSession: MXSession) {
|
|
|
|
super.setupSettings(for: matrixSession)
|
|
|
|
setupWidgetReadReceipts(for: matrixSession)
|
|
|
|
}
|
|
|
|
|
|
|
|
private func setupWidgetReadReceipts(for matrixSession: MXSession) {
|
|
|
|
var acknowledgableEventTypes = matrixSession.acknowledgableEventTypes ?? []
|
|
|
|
acknowledgableEventTypes.append(kWidgetMatrixEventTypeString)
|
|
|
|
acknowledgableEventTypes.append(kWidgetModularEventTypeString)
|
|
|
|
|
|
|
|
matrixSession.acknowledgableEventTypes = acknowledgableEventTypes
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|