Skip to content

Commit e1e8678

Browse files
committed
* Fixed - Incorrect operator check logic in frozen group channel
1 parent 671b0d3 commit e1e8678

33 files changed

+109
-58
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Change Log
22

3-
### v1.0.9 (Jun 8, 2020)
3+
### v1.0.10 (Jun 18, 2020)
4+
* Fixed - Incorrect operator check logic in frozen group channel
45

6+
### v1.0.9 (Jun 8, 2020)
57
* Supported customized params, Changed access control
68
* **`SBUChannelViewController`**
79
* `channel`, `messageList`, `resendableMessages` properties

SendBirdUIKit.framework.dSYM/Contents/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<key>CFBundleSignature</key>
1414
<string>????</string>
1515
<key>CFBundleShortVersionString</key>
16-
<string>1.0.9</string>
16+
<string>1.0.10</string>
1717
<key>CFBundleVersion</key>
1818
<string>1</string>
1919
</dict>
23.3 KB
Binary file not shown.

SendBirdUIKit.framework/Assets.car

0 Bytes
Binary file not shown.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// SBUChannelManager.swift
3+
// SendBirdUIKit
4+
//
5+
// Created by Tez Park on 2020/06/18.
6+
// Copyright © 2020 SendBird, Inc. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class SBUChannelManager: NSObject {
12+
13+
/// This function can check whether a specific UserId is an operator in the channel.
14+
/// - Parameters:
15+
/// - channel: GroupChannel object
16+
/// - userId: used to verify that it is an operator
17+
/// - Returns: Returns `true` if it is an operator.
18+
/// - Since: 1.0.10
19+
static func isOperator(channel: SBDGroupChannel?, userId: String?) -> Bool {
20+
guard let channel = channel, let userId = userId else { return false }
21+
22+
if let role = channel.getMember(userId)?.role, role == .operator {
23+
return true
24+
}
25+
else {
26+
return false
27+
}
28+
}
29+
}

SendBirdUIKit.framework/Headers/SBUChannelViewController.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,9 @@ open class SBUChannelViewController: UIViewController, UITableViewDelegate, UITa
727727

728728
self?.titleView.configure(channel: self?.channel, title: self?.channelName)
729729

730-
self?.messageInputView.setFrozenModeState(self?.channel?.isFrozen ?? false)
730+
let isOperator = SBUChannelManager.isOperator(channel: self?.channel, userId: SBUGlobals.CurrentUser?.userId)
731+
let isFrozen = self?.channel?.isFrozen ?? false
732+
self?.messageInputView.setFrozenModeState(!isOperator && isFrozen)
731733
}
732734
}
733735
}
@@ -1462,7 +1464,8 @@ open class SBUChannelViewController: UIViewController, UITableViewDelegate, UITa
14621464
guard let channel = sender as? SBDGroupChannel else { return }
14631465
SBULog.info("Channel was frozen, ChannelUrl:\(channel.channelUrl)")
14641466

1465-
self.messageInputView.setFrozenModeState(true)
1467+
let isOperator = SBUChannelManager.isOperator(channel: channel, userId: SBUGlobals.CurrentUser?.userId)
1468+
self.messageInputView.setFrozenModeState(isOperator == false)
14661469
}
14671470

14681471
public func channelWasUnfrozen(_ sender: SBDBaseChannel) {
@@ -1490,7 +1493,9 @@ open class SBUChannelViewController: UIViewController, UITableViewDelegate, UITa
14901493
SBULog.info("[Succeed] Refresh channel request")
14911494
self?.loadMessageChangeLogs(hasMore: true, token: nil)
14921495

1493-
self?.messageInputView.setFrozenModeState(self?.channel?.isFrozen ?? false)
1496+
let isOperator = SBUChannelManager.isOperator(channel: self?.channel, userId: SBUGlobals.CurrentUser?.userId)
1497+
let isFrozen = self?.channel?.isFrozen ?? false
1498+
self?.messageInputView.setFrozenModeState(!isOperator && isFrozen)
14941499
}
14951500
}
14961501

SendBirdUIKit.framework/Info.plist

1 Byte
Binary file not shown.
96 Bytes
Binary file not shown.
96 Bytes
Binary file not shown.
96 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)