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

Commit

Permalink
Merge pull request #2551 from RocketChat/beta
Browse files Browse the repository at this point in the history
[RELEASE] Merge BETA into MASTER
  • Loading branch information
rafaelks committed Feb 13, 2019
2 parents 02df552 + 931b9e8 commit 34bf834
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Rocket.Chat.ShareExtension/Info.plist
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>3.3.0</string>
<string>3.3.1</string>
<key>CFBundleVersion</key>
<string>236</string>
<string>237</string>
<key>ITSEncryptionExportComplianceCode</key>
<string></string>
<key>NSExtension</key>
Expand Down
16 changes: 13 additions & 3 deletions Rocket.Chat/Controllers/Chat/MessagesViewController.swift
Expand Up @@ -63,14 +63,24 @@ final class MessagesViewController: RocketChatViewController {
var unmanagedSubscription: UnmanagedSubscription?
var subscription: Subscription! {
didSet {
let sub: Subscription? = subscription
let unmanaged = sub?.unmanaged
guard let subscription = subscription else { return }

if subscription.rid.isEmpty {
subscription.fetchRoomIdentifier({ [weak self] (subscription) in
self?.subscription = subscription
self?.chatTitleView?.subscription = subscription?.unmanaged
})

return
}

let unmanaged = subscription.unmanaged

viewModel.onRequestingDataChanged = { [weak self] requesting in
self?.chatTitleView?.updateConnectionState(isRequestingMessages: requesting == .initialRequest)
}

viewModel.subscription = sub
viewModel.subscription = subscription
viewSubscriptionModel.subscription = unmanaged
unmanagedSubscription = unmanaged

Expand Down
Expand Up @@ -508,18 +508,17 @@ extension SubscriptionsViewController: UITableViewDelegate {
return
}

controller.subscription = subscription

// When using iPads, we override the detail controller creating
// a new instance.
if parent?.parent?.traitCollection.horizontalSizeClass == .compact {
guard navigationController?.topViewController == self else {
return
}

controller.subscription = subscription
navigationController?.pushViewController(controller, animated: true)
} else {
controller.subscription = subscription

let nav = BaseNavigationController(rootViewController: controller)
splitViewController?.showDetailViewController(nav, sender: self)
}
Expand Down
4 changes: 2 additions & 2 deletions Rocket.Chat/Info.plist
Expand Up @@ -206,7 +206,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.3.0</string>
<string>3.3.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -222,7 +222,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>236</string>
<string>237</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
4 changes: 4 additions & 0 deletions Rocket.Chat/Models/Subscription/Subscription.swift
Expand Up @@ -130,6 +130,10 @@ final class Subscription: BaseModel {
static func find(rid: String, realm: Realm? = Realm.current) -> Subscription? {
return realm?.objects(Subscription.self).filter("rid == '\(rid)'").first
}

static func find(name: String, realm: Realm? = Realm.current) -> Subscription? {
return realm?.objects(Subscription.self).filter("name == '\(name)'").first
}
}

final class RoomRoles: Object {
Expand Down
8 changes: 6 additions & 2 deletions Rocket.Chat/Models/Subscription/SubscriptionUtils.swift
Expand Up @@ -51,6 +51,8 @@ extension Subscription {
private func fetchDirectMessageIdentifier(_ completion: @escaping MessageCompletionObject <Subscription>) {
guard let identifier = self.identifier else { return }

let name = self.name

SubscriptionManager.createDirectMessage(name, completion: { (response) in
guard !response.isError() else { return }
guard let rid = response.result["result"]["rid"].string else { return }
Expand All @@ -72,8 +74,10 @@ extension Subscription {
}
}
}, completion: {
if let subscription = Subscription.find(rid: rid) {
completion(subscription)
DispatchQueue.main.async {
if let subscription = Subscription.find(name: name) {
completion(subscription)
}
}
})
})
Expand Down

0 comments on commit 34bf834

Please sign in to comment.