Skip to content

Commit 456c296

Browse files
committed
* Supported customized params, Changed access control ...
* Added - `setFrozenModeState()` method for changing frozen channel UI in `MessageInputView` * Fixed - Update empty view UI after receiving message
1 parent e43a173 commit 456c296

File tree

58 files changed

+1486
-476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1486
-476
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Change Log
22

3+
### v1.0.9 (Jun 8, 2020)
4+
5+
* Supported customized params, Changed access control
6+
* **`SBUChannelViewController`**
7+
* `channel`, `messageList`, `resendableMessages` properties
8+
* `sendUserMessage(messageParams:)`
9+
* `sendFileMessage(messageParams:)`
10+
* `resendMessage(failedMessage:)`
11+
* `updateUserMessage(message:, text:)`
12+
* `updateUserMessage(message:, messageParams:)`
13+
* `deleteMessage(message:)`
14+
* **`SBUChannelViewController`**
15+
* `channelList` property
16+
* `changePushTriggerOption(option:, channel:, completionHandler:)`
17+
* `leaveChannel(channel:, completionHandler:)`
18+
* **`SBUChannelSettingsViewController`**
19+
* `updateChannel(channelName:, coverImage:)`
20+
* `selectChannelImage()`
21+
* `changeChannelName()`
22+
* **`SBUCreateChannelViewController`**
23+
* `createChannel(userIds:)`
24+
* `createChannel(params:)`
25+
* **`SBUInviteUserViewController`**
26+
* `inviteUsers()`
27+
* `inviteUsers(userIds:)`
28+
* Added - `setFrozenModeState()` method for changing frozen channel UI in `MessageInputView`
29+
* Fixed - Update empty view UI after receiving message
30+
331
### v1.0.8 (May 28, 2020)
432
* Modified - File message information in channel preview
533
* Modified - Access control for channel objects

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.8</string>
16+
<string>1.0.9</string>
1717
<key>CFBundleVersion</key>
1818
<string>1</string>
1919
</dict>
272 KB
Binary file not shown.

SendBirdUIKit.framework/Assets.car

0 Bytes
Binary file not shown.

SendBirdUIKit.framework/Headers/SBUChannelListViewController.swift

Lines changed: 79 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
5353
}()
5454

5555
// for Logic
56-
@SBUAtomic var channelList: [SBDGroupChannel] = []
56+
@SBUAtomic public private(set) var channelList: [SBDGroupChannel] = []
5757
var channelListQuery: SBDGroupChannelListQuery?
5858
var lastUpdatedTimestamp: Int64 = 0
5959
var lastUpdatedToken: String? = nil
6060
var isLoading = false
6161
var limit: UInt = 20
62+
var includeEmptyChannel: Bool = false
6263

6364
// for cell
6465
var channelCell: SBUBaseChannelCell? = nil
@@ -78,7 +79,6 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
7879
SBULog.info("")
7980
}
8081

81-
8282
open override func loadView() {
8383
super.loadView()
8484
SBULog.info("")
@@ -121,7 +121,6 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
121121
}
122122

123123
public func setupStyles() {
124-
125124
self.navigationController?.navigationBar.setBackgroundImage(UIImage.from(color: theme.navigationBarTintColor), for: .default)
126125
self.navigationController?.navigationBar.shadowImage = UIImage.from(color: theme.navigationBarShadowColor)
127126

@@ -182,23 +181,52 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
182181
}
183182

184183

185-
// MARK: - Custom viewController relations
184+
// MARK: - SDK Data relations
186185

187-
/// If you want to use a custom channelViewController, override it and implement it.
188-
/// - Parameter channelUrl: channel url for use in channelViewController.
189-
open func showChannel(channelUrl: String) {
190-
let channelVC = SBUChannelViewController(channelUrl: channelUrl)
191-
self.navigationController?.pushViewController(channelVC, animated: true)
186+
/// Changes push trigger option on a channel.
187+
/// - Parameters:
188+
/// - option: Push trigger option to change
189+
/// - channel: Channel to change option
190+
/// - completionHandler: Completion handler
191+
/// - Since: 1.0.9
192+
public func changePushTriggerOption(option: SBDGroupChannelPushTriggerOption, channel: SBDGroupChannel, completionHandler: ((Bool)-> Void)? = nil) {
193+
SBULog.info("[Request] Channel push status : \(option == .off ? "on" : "off"), ChannelUrl:\(channel.channelUrl)")
194+
channel.setMyPushTriggerOption(option) { [weak self] error in
195+
if let error = error {
196+
SBULog.error("[Failed] Channel push status request: \(String(error.localizedDescription))")
197+
completionHandler?(false)
198+
self?.didReceiveError(error.localizedDescription)
199+
return
200+
}
201+
202+
SBULog.info("[Succeed] Channel push status, ChannelUrl:\(channel.channelUrl)")
203+
204+
completionHandler?(true)
205+
}
192206
}
193207

194-
/// If you want to use a custom createChannelViewController, override it and implement it.
195-
open func showCreateChannel() {
196-
let createChannelVC = SBUCreateChannelViewController()
197-
self.navigationController?.pushViewController(createChannelVC, animated: true)
208+
/// Leaves the channel.
209+
/// - Parameters:
210+
/// - channel: Channel to leave
211+
/// - completionHandler: Completion handler
212+
/// - Since: 1.0.9
213+
public func leaveChannel(_ channel: SBDGroupChannel, completionHandler: ((Bool)-> Void)? = nil) {
214+
SBULog.info("[Request] Leave channel, ChannelUrl:\(channel.channelUrl)")
215+
216+
channel.leave { [weak self] error in
217+
if let error = error {
218+
SBULog.error("[Failed] Leave channel request: \(String(error.localizedDescription))")
219+
completionHandler?(false)
220+
self?.didReceiveError(error.localizedDescription)
221+
return
222+
}
223+
224+
SBULog.info("[Succeed] Leave channel request, ChannelUrl:\(channel.channelUrl)")
225+
226+
completionHandler?(true)
227+
}
198228
}
199229

200-
201-
// MARK: - SDK Data relations
202230
func loadNextChannelList(reset: Bool) {
203231
if self.isLoading { return }
204232
self.setLoading(true, false)
@@ -217,7 +245,7 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
217245
self.channelListQuery = SBDGroupChannel.createMyGroupChannelListQuery()
218246
self.channelListQuery?.order = .latestLastMessage
219247
self.channelListQuery?.limit = self.limit
220-
self.channelListQuery?.includeEmptyChannel = false
248+
self.channelListQuery?.includeEmptyChannel = self.includeEmptyChannel
221249
}
222250

223251
guard self.channelListQuery?.hasNext == true else {
@@ -253,9 +281,14 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
253281
return
254282
}
255283

284+
let channelLogsParams = SBDGroupChannelChangeLogsParams()
285+
channelLogsParams.includeEmptyChannel = self.includeEmptyChannel
286+
channelLogsParams.includeFrozenChannel = true
287+
256288
if let token = token {
257289
SBULog.info("[Request] Channel change logs with token")
258-
SBDMain.getMyGroupChannelChangeLogs(byToken: token, customTypes: nil) { [weak self] updatedChannels, deletedChannelUrls, hasMore, token, error in
290+
291+
SBDMain.getMyGroupChannelChangeLogs(byToken: token, params: channelLogsParams) { [weak self] updatedChannels, deletedChannelUrls, hasMore, token, error in
259292
if let error = error {
260293
SBULog.error("[Failed] Channel change logs request : \(error.localizedDescription)")
261294
self?.didReceiveError(error.localizedDescription)
@@ -273,7 +306,7 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
273306
}
274307
else {
275308
SBULog.info("[Request] Channel change logs with last updated timestamp")
276-
SBDMain.getMyGroupChannelChangeLogs(byTimestamp: self.lastUpdatedTimestamp, customTypes: nil) { [weak self] updatedChannels, deletedChannelUrls, hasMore, token, error in
309+
SBDMain.getMyGroupChannelChangeLogs(byTimestamp: self.lastUpdatedTimestamp, params: channelLogsParams) { [weak self] updatedChannels, deletedChannelUrls, hasMore, token, error in
277310
if let error = error {
278311
SBULog.error("[Failed] Channel change logs request : \(error.localizedDescription)")
279312
self?.didReceiveError(error.localizedDescription)
@@ -367,6 +400,22 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
367400

368401
self.sortChannelList(needReload: needReload)
369402
}
403+
404+
405+
// MARK: - Custom viewController relations
406+
407+
/// If you want to use a custom channelViewController, override it and implement it.
408+
/// - Parameter channelUrl: channel url for use in channelViewController.
409+
open func showChannel(channelUrl: String) {
410+
let channelVC = SBUChannelViewController(channelUrl: channelUrl)
411+
self.navigationController?.pushViewController(channelVC, animated: true)
412+
}
413+
414+
/// If you want to use a custom createChannelViewController, override it and implement it.
415+
open func showCreateChannel() {
416+
let createChannelVC = SBUCreateChannelViewController()
417+
self.navigationController?.pushViewController(createChannelVC, animated: true)
418+
}
370419

371420

372421
// MARK: - Common
@@ -488,16 +537,9 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
488537
let size = tableView.visibleCells[0].frame.height
489538
let iconSize: CGFloat = 40.0
490539

491-
let leaveAction = UIContextualAction(style: .normal, title: "") { action, view, success in
492-
SBULog.info("[Request] Leave channel, ChannelUrl:\(channel.channelUrl)")
493-
channel.leave { [weak self] error in
494-
if let error = error {
495-
SBULog.error("[Failed] Leave channel request: \(String(error.localizedDescription))")
496-
self?.didReceiveError(error.localizedDescription)
497-
}
498-
499-
SBULog.info("[Succeed] Leave channel request, ChannelUrl:\(channel.channelUrl)")
500-
success(true)
540+
let leaveAction = UIContextualAction(style: .normal, title: "") { action, view, actionHandler in
541+
self.leaveChannel(channel) { success in
542+
actionHandler(success)
501543
}
502544
}
503545

@@ -509,19 +551,12 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
509551

510552
leaveAction.backgroundColor = UIColor.from(image: leaveIcon, imageView: leaveTypeView, size: size, backgroundColor: theme.alertBackgroundColor)
511553

512-
513554
let pushOption = channel.myPushTriggerOption
514-
515-
let alarmAction = UIContextualAction(style: .normal, title: "") { action, view, success in
516-
SBULog.info("[Request] Channel push status : \(pushOption == .off ? "on" : "off"), ChannelUrl:\(channel.channelUrl)")
517-
channel.setMyPushTriggerOption(pushOption == .off ? .all : .off) { [weak self] error in
518-
if let error = error {
519-
SBULog.error("[Failed] Channel push status request: \(String(error.localizedDescription))")
520-
self?.didReceiveError(error.localizedDescription)
521-
}
522-
523-
SBULog.info("[Succeed] Channel push status, ChannelUrl:\(channel.channelUrl)")
524-
success(true)
555+
let alarmAction = UIContextualAction(style: .normal, title: "") { action, view, actionHandler in
556+
self.changePushTriggerOption(option: (pushOption == .off ? .all : .off), channel: channel) { success in
557+
guard success else { return }
558+
559+
actionHandler(true)
525560

526561
DispatchQueue.main.async {
527562
tableView.reloadRows(at: [indexPath], with: .automatic)
@@ -555,15 +590,7 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
555590
let iconSize: CGFloat = 40.0
556591

557592
let leave = UITableViewRowAction(style: .normal, title: "") { action, indexPath in
558-
SBULog.info("[Request] Leave channel, ChannelUrl:\(channel.channelUrl)")
559-
channel.leave { [weak self] error in
560-
if let error = error {
561-
SBULog.error("[Failed] Leave channel request: \(String(error.localizedDescription))")
562-
self?.didReceiveError(error.localizedDescription)
563-
}
564-
565-
SBULog.info("[Succeed] Leave channel request, ChannelUrl:\(channel.channelUrl)")
566-
}
593+
self.leaveChannel(channel)
567594
}
568595

569596
leave.title = SBUUtils.emptyTitleForRowEditAction(for: CGSize(width: size, height: size))
@@ -575,18 +602,11 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
575602

576603
leave.backgroundColor = UIColor.from(image: leaveIcon, imageView: leaveTypeView, size: size, backgroundColor: theme.alertBackgroundColor)
577604

578-
579605
let pushOption = channel.myPushTriggerOption
580606
let alarm = UITableViewRowAction(style: .normal, title: "") { action, indexPath in
581-
SBULog.info("[Request] Channel push status : \(pushOption == .off ? "on" : "off"), ChannelUrl:\(channel.channelUrl)")
582-
channel.setMyPushTriggerOption(pushOption == .off ? .all : .off) { [weak self] error in
583-
if let error = error {
584-
SBULog.error("[Failed] Channel push status request: \(String(error.localizedDescription))")
585-
self?.didReceiveError(error.localizedDescription)
586-
}
587-
588-
SBULog.info("[Succeed] Channel push status, ChannelUrl:\(channel.channelUrl)")
589-
607+
self.changePushTriggerOption(option: (pushOption == .off ? .all : .off), channel: channel) { success in
608+
guard success else { return }
609+
590610
DispatchQueue.main.async {
591611
tableView.reloadRows(at: [indexPath], with: .automatic)
592612
}

0 commit comments

Comments
 (0)