Skip to content

Commit

Permalink
* Supported - Custom SBDChanngeListQuery in the initialization func…
Browse files Browse the repository at this point in the history
…tion of `SBUChannelListViewController`

* Supported - Custom `SBDMessageListParams` in the initialization function of `SBUChannelViewController`
* Added - Unknown type message
  • Loading branch information
tezpark committed Jun 25, 2020
1 parent e1e8678 commit f13e171
Show file tree
Hide file tree
Showing 56 changed files with 754 additions and 270 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Change Log

### v1.0.11 (Jun 25, 2020)
* Supported - Custom `SBDChanngeListQuery` in the initialization function of `SBUChannelListViewController`
* Supported - Custom `SBDMessageListParams` in the initialization function of `SBUChannelViewController`
* Added - Unknown type message

### 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
* Supported - customized params, Changed access control
* **`SBUChannelViewController`**
* `channel`, `messageList`, `resendableMessages` properties
* `sendUserMessage(messageParams:)`
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The minimum requirements for UIKit for iOS are:

* `iOS 10.3+`
* `Swift 4.2+` / `Objective-C`
* `Sendbird Chat SDK for iOS 3.0.182+`
* `Sendbird Chat SDK for iOS 3.0.186+`

---

Expand Down Expand Up @@ -87,16 +87,16 @@ $ pod install
$ pod update
```

> __Note__: Sendbird UIKit for iOS is Sendbird Chat SDK-dependent. If you install the UIKit, `CocoaPods` will automatically install the Chat SDK for iOS as well. The minimum requirement of the Chat SDK for iOS is 3.0.182 or higher.
> __Note__: Sendbird UIKit for iOS is Sendbird Chat SDK-dependent. If you install the UIKit, `CocoaPods` will automatically install the Chat SDK for iOS as well. The minimum requirement of the Chat SDK for iOS is 3.0.186 or higher.
#### Carthage

1. Add `SendBirdUIKit` and `SendBirdSDK` into your `Cartfile` as below:
> __Note__: Sendbird UIKit for iOS is Sendbird Chat SDK-dependent. The minimum requirement of the Chat SDK for iOS is 3.0.182 or higher.
> __Note__: Sendbird UIKit for iOS is Sendbird Chat SDK-dependent. The minimum requirement of the Chat SDK for iOS is 3.0.186 or higher.
```bash
github "sendbird/sendbird-uikit-ios"
github "sendbird/sendbird-ios-framework" == 3.0.182
github "sendbird/sendbird-ios-framework" == 3.0.186
```

2. Install the `SendBirdUIKit` framework through `Carthage`.
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.10</string>
<string>1.0.11</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.
67 changes: 50 additions & 17 deletions SendBirdUIKit.framework/Headers/SBUChannelListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@
//

import UIKit
import SendBirdSDK

@objcMembers
open class SBUChannelListViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, SBDChannelDelegate, SBDConnectionDelegate, SBUEmptyViewDelegate {

// MARK: - Public property
// for UI
// MARK: - UI properties (Public)
public lazy var leftBarButton: UIBarButtonItem? = _leftBarButton
public lazy var rightBarButton: UIBarButtonItem? = _rightBarButton


// MARK: - Private property
// for UI
// MARK: - UI properties (Private)
var theme: SBUChannelListTheme = SBUTheme.channelListTheme

private lazy var titleView: SBUNavigationTitleView = _titleView
Expand Down Expand Up @@ -52,9 +51,21 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
return emptyView
}()

// for Logic

// MARK: - Logic properties (Public)

/// This object has a list of all channels.
@SBUAtomic public private(set) var channelList: [SBDGroupChannel] = []
var channelListQuery: SBDGroupChannelListQuery?

/// This is a query used to get a list of channels. Only getter is provided, please use initialization function to set query directly.
/// - note: For query properties, see `SBDGroupChannelListQuery` class.
/// - Since: 1.0.11
public private(set) var channelListQuery: SBDGroupChannelListQuery?


// MARK: - Logic properties (Private)
var customizedChannelListQuery: SBDGroupChannelListQuery? = nil

var lastUpdatedTimestamp: Int64 = 0
var lastUpdatedToken: String? = nil
var isLoading = false
Expand All @@ -65,18 +76,31 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
var channelCell: SBUBaseChannelCell? = nil
var customCell: SBUBaseChannelCell? = nil


// MARK: - Lifecycle
@available(*, unavailable, renamed: "SBUChannelListViewController()")
required public init?(coder: NSCoder) {
super.init(coder: coder)
SBULog.info("")
}

/// If you have channel object, use this initialize function.
/// - Parameter channel: Channel object
public init() {
/// You can initialize the class through this function.
/// If you have `channelListQuery`, please set it. If not set, it is used as default value.
///
/// See the example below for query generation.
/// ````
/// let query = SBDGroupChannel.createMyGroupChannelListQuery()
/// query.includeEmptyChannel = false
/// query.includeFrozenChannel = true
/// ...
/// ````
/// - Parameter channelListQuery: Your own `SBDGroupChannelListQuery` object
/// - Since: 1.0.11
public init(channelListQuery: SBDGroupChannelListQuery? = nil) {
super.init(nibName: nil, bundle: nil)
SBULog.info("")

self.customizedChannelListQuery = channelListQuery
}

open override func loadView() {
Expand Down Expand Up @@ -242,10 +266,14 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
}

if self.channelListQuery == nil {
self.channelListQuery = SBDGroupChannel.createMyGroupChannelListQuery()
self.channelListQuery?.order = .latestLastMessage
self.channelListQuery?.limit = self.limit
self.channelListQuery?.includeEmptyChannel = self.includeEmptyChannel
if let query = self.customizedChannelListQuery?.copy() as? SBDGroupChannelListQuery {
self.channelListQuery = query
} else {
self.channelListQuery = SBDGroupChannel.createMyGroupChannelListQuery()
self.channelListQuery?.order = .latestLastMessage
self.channelListQuery?.limit = self.limit
self.channelListQuery?.includeEmptyChannel = self.includeEmptyChannel
}
}

guard self.channelListQuery?.hasNext == true else {
Expand Down Expand Up @@ -281,9 +309,10 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
return
}

let channelLogsParams = SBDGroupChannelChangeLogsParams()
channelLogsParams.includeEmptyChannel = self.includeEmptyChannel
channelLogsParams.includeFrozenChannel = true
var channelLogsParams = SBDGroupChannelChangeLogsParams()
if let channelListQuery = self.channelListQuery {
channelLogsParams = SBDGroupChannelChangeLogsParams.create(with: channelListQuery)
}

if let token = token {
SBULog.info("[Request] Channel change logs with token")
Expand Down Expand Up @@ -407,7 +436,11 @@ open class SBUChannelListViewController: UIViewController, UITableViewDelegate,
/// If you want to use a custom channelViewController, override it and implement it.
/// - Parameter channelUrl: channel url for use in channelViewController.
open func showChannel(channelUrl: String) {
let channelVC = SBUChannelViewController(channelUrl: channelUrl)
let params = SBDMessageListParams()
params.includeMetaArray = true
params.includeReactions = true
params.includeReplies = true
let channelVC = SBUChannelViewController(channelUrl: channelUrl, messageListParams: params)
self.navigationController?.pushViewController(channelVC, animated: true)
}

Expand Down
Loading

0 comments on commit f13e171

Please sign in to comment.