Skip to content
This repository was archived by the owner on Jun 7, 2020. It is now read-only.

Commit a4911cb

Browse files
committed
Fetch and add announcements to header in Actions view
1 parent 6ee5a3f commit a4911cb

4 files changed

Lines changed: 9 additions & 0 deletions

File tree

Rocket.Chat/Controllers/Chat/ChannelActionsViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class ChannelActionsViewController: BaseViewController {
3737
header = [ChannelInfoUserCellData(user: subscription.directMessageUser)]
3838
} else {
3939
let hasDescription = !(subscription.roomDescription?.isEmpty ?? true)
40+
let hasAnnouncement = !(subscription.roomAnnouncement?.isEmpty ?? true)
4041
let hasTopic = !(subscription.roomTopic?.isEmpty ?? true)
4142

4243
header = [
@@ -45,6 +46,10 @@ class ChannelActionsViewController: BaseViewController {
4546
title: localized("chat.info.item.description"),
4647
descriptionText: hasDescription ? subscription.roomDescription : localized("chat.info.item.no_description")
4748
),
49+
ChannelInfoDescriptionCellData(
50+
title: "Announcement",
51+
descriptionText: hasAnnouncement ? subscription.roomAnnouncement : "No announcement"
52+
),
4853
ChannelInfoDescriptionCellData(
4954
title: localized("chat.info.item.topic"),
5055
descriptionText: hasTopic ? subscription.roomTopic : localized("chat.info.item.no_topic")

Rocket.Chat/Models/Mapping/SubscriptionModelMapping.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ extension Subscription: ModelMappeable {
9595

9696
func mapRoom(_ values: JSON, realm: Realm?) {
9797
self.roomDescription = values["description"].stringValue
98+
self.roomAnnouncement = values["announcement"].stringValue
9899
self.roomTopic = values["topic"].stringValue
99100

100101
if let broadcast = values["broadcast"].bool {

Rocket.Chat/Models/Subscription/Subscription.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ final class Subscription: BaseModel {
6767

6868
@objc dynamic var roomTopic: String?
6969
@objc dynamic var roomDescription: String?
70+
@objc dynamic var roomAnnouncement: String?
7071
@objc dynamic var roomReadOnly = false
7172
@objc dynamic var roomUpdatedAt: Date?
7273
@objc dynamic var roomLastMessage: Message?

Rocket.Chat/Models/Subscription/UnmanagedSubscription.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct UnmanagedSubscription: UnmanagedObject, Equatable {
2828
var lastSeen: Date?
2929
var roomTopic: String?
3030
var roomDescription: String?
31+
var roomAnnouncement: String?
3132
var roomReadOnly: Bool
3233
var roomUpdatedAt: Date?
3334
var roomLastMessage: Message?
@@ -82,6 +83,7 @@ extension UnmanagedSubscription {
8283
lastSeen = subscription.lastSeen
8384
roomTopic = subscription.roomTopic
8485
roomDescription = subscription.roomDescription
86+
roomAnnouncement = subscription.roomAnnouncement
8587
roomReadOnly = subscription.roomReadOnly
8688
roomUpdatedAt = subscription.roomUpdatedAt
8789
roomLastMessage = subscription.roomLastMessage

0 commit comments

Comments
 (0)