ChatViewController: Always show audio call button

For more context, see https://github.com/snikket-im/snikket-server/issues/86
This commit is contained in:
Matthew Wild 2023-06-05 12:43:56 +01:00
parent 20049ffc24
commit e2c0004c0c

View File

@ -377,7 +377,8 @@ class ChatViewController : BaseChatViewControllerWithDataSourceAndContextMenuAnd
#if targetEnvironment(simulator)
#else
let jingleSupported = CallManager.isAvailable ? JingleManager.instance.support(for: JID(self.jid), on: self.account) : [];
var count = jingleSupported.contains(.audio) ? 1 : 0;
let alwaysShowAudio = true // TODO: Make this configurable (at build or runtime?)
var count = (alwaysShowAudio || jingleSupported.contains(.audio)) ? 1 : 0;
if jingleSupported.contains(.video) {
count = count + 1;
}
@ -390,7 +391,7 @@ class ChatViewController : BaseChatViewControllerWithDataSourceAndContextMenuAnd
//buttons.append(UIBarButtonItem(image: UIImage(named: "videoCall"), style: .plain, target: self, action: #selector(self.videoCall)));
buttons.append(self.smallBarButtonItem(image: UIImage(named: "videoCall")!, action: #selector(self.videoCall)));
}
if jingleSupported.contains(.audio) {
if alwaysShowAudio || jingleSupported.contains(.audio) {
//buttons.append(UIBarButtonItem(image: UIImage(named: "audioCall"), style: .plain, target: self, action: #selector(self.audioCall)));
buttons.append(self.smallBarButtonItem(image: UIImage(named: "audioCall")!, action: #selector(self.audioCall)));
}