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

Commit 324b0c0

Browse files
authored
Merge pull request #703 from RocketChat/develop
[RELEASE] Merge develop into beta
2 parents 1124c09 + 459fd9f commit 324b0c0

File tree

6 files changed

+44
-47
lines changed

6 files changed

+44
-47
lines changed

Rocket.Chat/Controllers/MainViewController.swift

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,62 +30,58 @@ final class MainViewController: BaseViewController {
3030
AuthManager.recoverAuthIfNeeded()
3131
}
3232

33-
override func viewDidAppear(_ animated: Bool) {
34-
super.viewDidAppear(animated)
35-
36-
if AuthManager.isAuthenticated() == nil {
37-
performSegue(withIdentifier: "Auth", sender: nil)
38-
}
39-
40-
if !NetworkManager.isConnected {
41-
openChat()
42-
}
43-
}
44-
4533
override func viewWillAppear(_ animated: Bool) {
4634
super.viewWillAppear(animated)
4735

4836
DatabaseManager.cleanInvalidDatabases()
4937
DatabaseManager.changeDatabaseInstance()
5038

39+
labelAuthenticationStatus.isHidden = true
40+
buttonConnect.isHidden = true
41+
activityIndicator.startAnimating()
42+
}
43+
44+
override func viewDidAppear(_ animated: Bool) {
45+
super.viewDidAppear(animated)
46+
5147
if let auth = AuthManager.isAuthenticated() {
5248
AuthManager.persistAuthInformation(auth)
5349

54-
labelAuthenticationStatus.isHidden = true
55-
buttonConnect.isHidden = true
56-
activityIndicator.startAnimating()
50+
AuthManager.resume(auth, completion: { [weak self] response in
51+
guard !response.isError() else {
52+
self?.labelAuthenticationStatus.isHidden = false
53+
self?.buttonConnect.isHidden = false
54+
self?.activityIndicator.stopAnimating()
5755

58-
if NetworkManager.isConnected {
59-
AuthManager.resume(auth, completion: { [weak self] response in
60-
guard !response.isError() else {
61-
self?.labelAuthenticationStatus.isHidden = false
62-
self?.buttonConnect.isHidden = false
63-
self?.activityIndicator.stopAnimating()
56+
self?.openChat()
6457

65-
self?.openChat()
58+
return
59+
}
6660

67-
return
68-
}
61+
SubscriptionManager.updateSubscriptions(auth, completion: { _ in
62+
AuthSettingsManager.updatePublicSettings(auth, completion: { _ in
6963

70-
SubscriptionManager.updateSubscriptions(auth, completion: { _ in
71-
AuthSettingsManager.updatePublicSettings(auth, completion: { _ in
72-
73-
})
64+
})
7465

75-
UserManager.userDataChanges()
76-
UserManager.changes()
77-
SubscriptionManager.changes(auth)
66+
UserManager.userDataChanges()
67+
UserManager.changes()
68+
SubscriptionManager.changes(auth)
7869

79-
if let userIdentifier = auth.userId {
80-
PushManager.updateUser(userIdentifier)
81-
}
70+
if let userIdentifier = auth.userId {
71+
PushManager.updateUser(userIdentifier)
72+
}
8273

83-
self?.openChat()
84-
})
74+
self?.openChat()
8575
})
86-
}
76+
})
8777
} else {
88-
buttonConnect.isEnabled = true
78+
let storyboardAuth = UIStoryboard(name: "Auth", bundle: Bundle.main)
79+
let controller = storyboardAuth.instantiateInitialViewController()
80+
let application = UIApplication.shared
81+
82+
if let window = application.keyWindow {
83+
window.rootViewController = controller
84+
}
8985
}
9086
}
9187

Rocket.Chat/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</dict>
3333
</array>
3434
<key>CFBundleVersion</key>
35-
<string>98</string>
35+
<string>99</string>
3636
<key>Fabric</key>
3737
<dict>
3838
<key>APIKey</key>

Rocket.Chat/Managers/Model/SubscriptionManager.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ struct SubscriptionManager {
8080

8181
auth.lastSubscriptionFetch = Date.serverDate
8282
realm.add(subscriptions, update: true)
83-
84-
DispatchQueue.main.async {
85-
completion(response)
86-
}
83+
}, completion: {
84+
completion(response)
8785
})
8886
}
8987
}

Rocket.Chat/Managers/Socket/SocketManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ extension SocketManager {
142142
}
143143

144144
static func removeConnectionHandler(token: String) {
145-
sharedInstance.connectionHandlers[token] = nil
145+
sharedInstance.connectionHandlers.removeValue(forKey: token)
146146
}
147147

148148
}

Rocket.Chat/Storyboards/Auth.storyboard

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="17A360a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="eFO-g0-vxH">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="eFO-g0-vxH">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1010
</dependencies>
1111
<scenes>
@@ -14,7 +14,7 @@
1414
<objects>
1515
<navigationController id="eFO-g0-vxH" customClass="BaseNavigationController" customModule="Rocket_Chat" customModuleProvider="target" sceneMemberID="viewController">
1616
<navigationBar key="navigationBar" contentMode="scaleToFill" misplaced="YES" id="F7W-s9-wXu">
17-
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
17+
<rect key="frame" x="0.0" y="20" width="375" height="48"/>
1818
<autoresizingMask key="autoresizingMask"/>
1919
</navigationBar>
2020
<connections>

Rocket.ChatTests/Extensions/StringExtensionSpec.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class StringExtensionSpec: XCTestCase {
3434
XCTAssert(string.sha256() == hash, "String SHA-256 cryptographic is correct")
3535
}
3636

37+
// MARK: Range
38+
3739
func testRangesOf() {
3840
let string = "this word is in position 5 and this word is in position 36"
3941
let ranges = string.ranges(of: "word")
@@ -44,4 +46,5 @@ class StringExtensionSpec: XCTestCase {
4446
XCTAssert(string.distance(from: ranges[0].lowerBound, to: ranges[0].upperBound) == 4, "will word 1 have correct size")
4547
XCTAssert(string.distance(from: ranges[1].lowerBound, to: ranges[1].upperBound) == 4, "will word 2 have correct size")
4648
}
49+
4750
}

0 commit comments

Comments
 (0)