Skip to content

Commit 8161fe8

Browse files
committed
Example project updated.
1 parent 0b0ba4c commit 8161fe8

File tree

3 files changed

+39
-7
lines changed

3 files changed

+39
-7
lines changed

Example/ChatExample/AppDelegate.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
3737

3838
private func setupNotifications() {
3939
Notifications.shared.logsEnabled = true
40+
Notifications.shared.clearApplicationIconBadgeNumberOnAppActive = true
4041

4142
Notifications.shared.showNewMessage = { [weak self] messageReference in
4243
if let tabBarController = self?.window?.rootViewController as? UITabBarController,

Example/ChatExample/Base.lproj/Main.storyboard

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
114114
<state key="normal" title="Show #general chat"/>
115115
<connections>
116-
<segue destination="Z71-Wp-boH" kind="presentation" modalPresentationStyle="fullScreen" id="Z6X-IU-Iab"/>
116+
<segue destination="rzG-dX-Wof" kind="presentation" modalPresentationStyle="fullScreen" id="Z6X-IU-Iab"/>
117117
</connections>
118118
</button>
119119
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qr4-mI-Aca">
@@ -294,14 +294,14 @@ badge</string>
294294
<navigationItem key="navigationItem" id="M29-wa-tVT">
295295
<barButtonItem key="rightBarButtonItem" systemItem="stop" id="2ar-d7-vJl">
296296
<connections>
297-
<segue destination="Z71-Wp-boH" kind="custom" customClass="DismissSegue" customModule="StreamChat" id="qnB-bf-sHX"/>
297+
<segue destination="rzG-dX-Wof" kind="custom" customClass="DismissSegue" customModule="StreamChat" id="qnB-bf-sHX"/>
298298
</connections>
299299
</barButtonItem>
300300
</navigationItem>
301301
</viewController>
302302
<placeholder placeholderIdentifier="IBFirstResponder" id="oEb-lB-XXV" userLabel="First Responder" sceneMemberID="firstResponder"/>
303303
</objects>
304-
<point key="canvasLocation" x="1134" y="681"/>
304+
<point key="canvasLocation" x="2072.8000000000002" y="680.5097451274363"/>
305305
</scene>
306306
<!--Navigation Controller-->
307307
<scene sceneID="FFK-m4-8Eg">
@@ -320,7 +320,7 @@ badge</string>
320320
</navigationController>
321321
<placeholder placeholderIdentifier="IBFirstResponder" id="PRt-da-fZL" userLabel="First Responder" sceneMemberID="firstResponder"/>
322322
</objects>
323-
<point key="canvasLocation" x="381.60000000000002" y="680.5097451274363"/>
323+
<point key="canvasLocation" x="1320.8" y="680.5097451274363"/>
324324
</scene>
325325
<!--Navigation Controller-->
326326
<scene sceneID="OsV-rf-E6A">
@@ -359,10 +359,27 @@ badge</string>
359359
</objects>
360360
<point key="canvasLocation" x="-1281" y="-63"/>
361361
</scene>
362+
<!--Tab Bar Controller-->
363+
<scene sceneID="2hy-ym-0fX">
364+
<objects>
365+
<tabBarController automaticallyAdjustsScrollViewInsets="NO" id="rzG-dX-Wof" sceneMemberID="viewController">
366+
<toolbarItems/>
367+
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="k8B-25-9Jc">
368+
<autoresizingMask key="autoresizingMask"/>
369+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
370+
</tabBar>
371+
<connections>
372+
<segue destination="Z71-Wp-boH" kind="relationship" relationship="viewControllers" id="x4V-vX-mKE"/>
373+
</connections>
374+
</tabBarController>
375+
<placeholder placeholderIdentifier="IBFirstResponder" id="yWn-do-Ou1" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
376+
</objects>
377+
<point key="canvasLocation" x="381.60000000000002" y="680.5097451274363"/>
378+
</scene>
362379
</scenes>
363380
<inferredMetricsTieBreakers>
381+
<segue reference="qnB-bf-sHX"/>
364382
<segue reference="elX-bx-MbU"/>
365-
<segue reference="Z6X-IU-Iab"/>
366383
<segue reference="seW-P6-fEX"/>
367384
</inferredMetricsTieBreakers>
368385
</document>

Example/ChatExample/DarkChannelsViewController.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,32 @@ final class DarkChannelsViewController: ChannelsViewController {
4242

4343
@IBAction func addChannel(_ sender: Any) {
4444
let number = Int.random(in: 100...999)
45-
let channel = Channel(type: .messaging, id: "new_channel_\(number)", name: "Channel \(number)")
45+
46+
let channel = Channel(type: .messaging,
47+
id: "new_channel_\(number)",
48+
name: "Channel \(number)",
49+
members: [User.user1.asMember, User.user2.asMember])
4650

4751
channel.create()
4852
.flatMapLatest({ channelResponse in
49-
channelResponse.channel.send(message: Message(text: "A new channel created"))
53+
channelResponse.channel.send(message: Message(text: "A new channel #\(number) created"))
5054
})
5155
.subscribe(onNext: {
5256
print($0)
5357
})
5458
.disposed(by: disposeBag)
5559
}
5660

61+
override func channelCell(at indexPath: IndexPath, channelPresenter: ChannelPresenter) -> UITableViewCell {
62+
let cell = super.channelCell(at: indexPath, channelPresenter: channelPresenter)
63+
64+
if let cell = cell as? ChannelTableViewCell {
65+
cell.nameLabel.text = "\(cell.nameLabel.text ?? "") (\(channelPresenter.channel.members.count))"
66+
}
67+
68+
return cell
69+
}
70+
5771
@IBAction func logout(_ sender: Any) {
5872
if logoutButton.title == "Logout" {
5973
Client.shared.disconnect()

0 commit comments

Comments
 (0)