Skip to content
This repository was archived by the owner on Jun 7, 2020. It is now read-only.

Commit 03c4eda

Browse files
authored
Merge pull request #2536 from RocketChat/chore/disable_callkit_china
[CHORE] Disable Video/Audio call (CallKit) in China region
2 parents 60c26b8 + 307d583 commit 03c4eda

6 files changed

Lines changed: 21 additions & 5 deletions

File tree

Rocket.Chat.ShareExtension/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleShortVersionString</key>
2020
<string>3.3.0</string>
2121
<key>CFBundleVersion</key>
22-
<string>235</string>
22+
<string>236</string>
2323
<key>ITSEncryptionExportComplianceCode</key>
2424
<string></string>
2525
<key>NSExtension</key>

Rocket.Chat/Controllers/Chat/ChannelActionsViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import UIKit
1010

1111
private typealias ListSegueData = (title: String, query: String?, isListingMentions: Bool)
1212

13+
// swiftlint:disable file_length
1314
class ChannelActionsViewController: BaseViewController {
1415

1516
internal let kShareRoomSection = 2
@@ -42,7 +43,6 @@ class ChannelActionsViewController: BaseViewController {
4243

4344
header = [ChannelInfoBasicCellData(title: "#\(subscription.name)")]
4445

45-
4646
if hasDescription {
4747
header?.append(ChannelInfoDescriptionCellData(
4848
title: localized("chat.info.item.description"),
@@ -139,7 +139,7 @@ class ChannelActionsViewController: BaseViewController {
139139
updateButtonFavoriteImage()
140140
}
141141

142-
if settings.isJitsiEnabled {
142+
if settings.isJitsiEnabled && AppManager.isVideoCallAvailable {
143143
buttons.append(UIBarButtonItem(
144144
image: UIImage(named: "UserDetail_VideoCall"),
145145
style: .plain,

Rocket.Chat/Controllers/User/UserDetail/UserDetailViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class UserDetailViewController: BaseViewController, StoryboardInitializable {
6868
messageButton?.setTitle(model.messageButtonText, for: .normal)
6969
voiceCallButton?.setTitle(model.voiceCallButtonText, for: .normal)
7070

71-
videoCallButton?.isHidden = !(AuthSettingsManager.settings?.isJitsiEnabled ?? false)
71+
videoCallButton?.isHidden = !(AuthSettingsManager.settings?.isJitsiEnabled ?? false && AppManager.isVideoCallAvailable)
7272
videoCallButton?.setTitle(model.videoCallButtonText, for: .normal)
7373

7474
updateButtonsInsets()

Rocket.Chat/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
</dict>
223223
</array>
224224
<key>CFBundleVersion</key>
225-
<string>235</string>
225+
<string>236</string>
226226
<key>Fabric</key>
227227
<dict>
228228
<key>APIKey</key>

Rocket.Chat/Managers/AppManager.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ struct AppManager {
113113
Default language
114114
*/
115115
static var defaultLanguage = "en"
116+
117+
// MARK: Video & Audio Call
118+
119+
static var isVideoCallAvailable: Bool {
120+
return (NSLocale.current as NSLocale).countryCode != "CN"
121+
}
116122
}
117123

118124
extension AppManager {

Rocket.Chat/Views/Chat/New Chat/Cells/MessageVideoCallCell.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ class MessageVideoCallCell: BaseMessageCell, SizingCell {
4545
return
4646
}
4747

48+
if !AppManager.isVideoCallAvailable {
49+
let alert = Alert(
50+
title: "Video Call Unavailable",
51+
message: "Video and Audio calls on your region are not available."
52+
)
53+
54+
alert.present()
55+
return
56+
}
57+
4858
AppManager.openVideoCall(room: subscription)
4959
}
5060
}

0 commit comments

Comments
 (0)