This repository was archived by the owner on Jun 7, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
Rocket.Chat.ShareExtension
Subscriptions/SubscriptionsList Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 <key >CFBundlePackageType </key >
1818 <string >XPC! </string >
1919 <key >CFBundleShortVersionString </key >
20- <string >3.3.0 </string >
20+ <string >3.3.1 </string >
2121 <key >CFBundleVersion </key >
22- <string >236 </string >
22+ <string >237 </string >
2323 <key >ITSEncryptionExportComplianceCode </key >
2424 <string ></string >
2525 <key >NSExtension </key >
Original file line number Diff line number Diff line change @@ -63,14 +63,24 @@ final class MessagesViewController: RocketChatViewController {
6363 var unmanagedSubscription : UnmanagedSubscription ?
6464 var subscription : Subscription ! {
6565 didSet {
66- let sub : Subscription ? = subscription
67- let unmanaged = sub? . unmanaged
66+ guard let subscription = subscription else { return }
67+
68+ if subscription. rid. isEmpty {
69+ subscription. fetchRoomIdentifier ( { [ weak self] ( subscription) in
70+ self ? . subscription = subscription
71+ self ? . chatTitleView? . subscription = subscription? . unmanaged
72+ } )
73+
74+ return
75+ }
76+
77+ let unmanaged = subscription. unmanaged
6878
6979 viewModel. onRequestingDataChanged = { [ weak self] requesting in
7080 self ? . chatTitleView? . updateConnectionState ( isRequestingMessages: requesting == . initialRequest)
7181 }
7282
73- viewModel. subscription = sub
83+ viewModel. subscription = subscription
7484 viewSubscriptionModel. subscription = unmanaged
7585 unmanagedSubscription = unmanaged
7686
Original file line number Diff line number Diff line change @@ -508,18 +508,17 @@ extension SubscriptionsViewController: UITableViewDelegate {
508508 return
509509 }
510510
511+ controller. subscription = subscription
512+
511513 // When using iPads, we override the detail controller creating
512514 // a new instance.
513515 if parent? . parent? . traitCollection. horizontalSizeClass == . compact {
514516 guard navigationController? . topViewController == self else {
515517 return
516518 }
517519
518- controller. subscription = subscription
519520 navigationController? . pushViewController ( controller, animated: true )
520521 } else {
521- controller. subscription = subscription
522-
523522 let nav = BaseNavigationController ( rootViewController: controller)
524523 splitViewController? . showDetailViewController ( nav, sender: self )
525524 }
Original file line number Diff line number Diff line change 206206 <key >CFBundlePackageType </key >
207207 <string >APPL </string >
208208 <key >CFBundleShortVersionString </key >
209- <string >3.3.0 </string >
209+ <string >3.3.1 </string >
210210 <key >CFBundleSignature </key >
211211 <string >???? </string >
212212 <key >CFBundleURLTypes </key >
222222 </dict >
223223 </array >
224224 <key >CFBundleVersion </key >
225- <string >236 </string >
225+ <string >237 </string >
226226 <key >Fabric </key >
227227 <dict >
228228 <key >APIKey </key >
Original file line number Diff line number Diff line change @@ -130,6 +130,10 @@ final class Subscription: BaseModel {
130130 static func find( rid: String , realm: Realm ? = Realm . current) -> Subscription ? {
131131 return realm? . objects ( Subscription . self) . filter ( " rid == ' \( rid) ' " ) . first
132132 }
133+
134+ static func find( name: String , realm: Realm ? = Realm . current) -> Subscription ? {
135+ return realm? . objects ( Subscription . self) . filter ( " name == ' \( name) ' " ) . first
136+ }
133137}
134138
135139final class RoomRoles : Object {
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ extension Subscription {
5151 private func fetchDirectMessageIdentifier( _ completion: @escaping MessageCompletionObject < Subscription > ) {
5252 guard let identifier = self . identifier else { return }
5353
54+ let name = self . name
55+
5456 SubscriptionManager . createDirectMessage ( name, completion: { ( response) in
5557 guard !response. isError ( ) else { return }
5658 guard let rid = response. result [ " result " ] [ " rid " ] . string else { return }
@@ -72,8 +74,10 @@ extension Subscription {
7274 }
7375 }
7476 } , completion: {
75- if let subscription = Subscription . find ( rid: rid) {
76- completion ( subscription)
77+ DispatchQueue . main. async {
78+ if let subscription = Subscription . find ( name: name) {
79+ completion ( subscription)
80+ }
7781 }
7882 } )
7983 } )
You can’t perform that action at this time.
0 commit comments