Skip to content

Commit

Permalink
* Fixed - Incorrect operator check logic in frozen group channel
Browse files Browse the repository at this point in the history
  • Loading branch information
tezpark committed Jun 18, 2020
1 parent 671b0d3 commit e1e8678
Show file tree
Hide file tree
Showing 33 changed files with 109 additions and 58 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Change Log

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

### v1.0.9 (Jun 8, 2020)
* Supported customized params, Changed access control
* **`SBUChannelViewController`**
* `channel`, `messageList`, `resendableMessages` properties
Expand Down
2 changes: 1 addition & 1 deletion SendBirdUIKit.framework.dSYM/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0.9</string>
<string>1.0.10</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
Expand Down
Binary file not shown.
Binary file modified SendBirdUIKit.framework/Assets.car
Binary file not shown.
29 changes: 29 additions & 0 deletions SendBirdUIKit.framework/Headers/SBUChannelManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// SBUChannelManager.swift
// SendBirdUIKit
//
// Created by Tez Park on 2020/06/18.
// Copyright © 2020 SendBird, Inc. All rights reserved.
//

import UIKit

class SBUChannelManager: NSObject {

/// This function can check whether a specific UserId is an operator in the channel.
/// - Parameters:
/// - channel: GroupChannel object
/// - userId: used to verify that it is an operator
/// - Returns: Returns `true` if it is an operator.
/// - Since: 1.0.10
static func isOperator(channel: SBDGroupChannel?, userId: String?) -> Bool {
guard let channel = channel, let userId = userId else { return false }

if let role = channel.getMember(userId)?.role, role == .operator {
return true
}
else {
return false
}
}
}
11 changes: 8 additions & 3 deletions SendBirdUIKit.framework/Headers/SBUChannelViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,9 @@ open class SBUChannelViewController: UIViewController, UITableViewDelegate, UITa

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

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

self.messageInputView.setFrozenModeState(true)
let isOperator = SBUChannelManager.isOperator(channel: channel, userId: SBUGlobals.CurrentUser?.userId)
self.messageInputView.setFrozenModeState(isOperator == false)
}

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

self?.messageInputView.setFrozenModeState(self?.channel?.isFrozen ?? false)
let isOperator = SBUChannelManager.isOperator(channel: self?.channel, userId: SBUGlobals.CurrentUser?.userId)
let isFrozen = self?.channel?.isFrozen ?? false
self?.messageInputView.setFrozenModeState(!isOperator && isFrozen)
}
}

Expand Down
Binary file modified SendBirdUIKit.framework/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified SendBirdUIKit.framework/SBUChannelSettingCell.nib/runtime.nib
Binary file not shown.
Binary file not shown.
Binary file modified SendBirdUIKit.framework/SBUMessageInputView.nib/runtime.nib
Binary file not shown.
Binary file modified SendBirdUIKit.framework/SBUUserCell.nib
Binary file not shown.
Binary file modified SendBirdUIKit.framework/SendBirdUIKit
Binary file not shown.
Loading

0 comments on commit e1e8678

Please sign in to comment.