diff --git a/Podfile b/Podfile
index 8de931653b..e767d18835 100644
--- a/Podfile
+++ b/Podfile
@@ -11,6 +11,7 @@ def shared_pods
# Code utilities
pod 'SwiftyJSON'
+ pod 'semver'
# UI
pod 'SideMenuController'
diff --git a/Podfile.lock b/Podfile.lock
index f747be4a30..c6bb9c405e 100644
--- a/Podfile.lock
+++ b/Podfile.lock
@@ -52,6 +52,7 @@ PODS:
- SDWebImage (3.8.2):
- SDWebImage/Core (= 3.8.2)
- SDWebImage/Core (3.8.2)
+ - semver (1.0.0)
- SideMenuController (0.2.4)
- SlackTextViewController (1.9.5)
- Starscream (2.0.3)
@@ -69,6 +70,7 @@ DEPENDENCIES:
- NVActivityIndicatorView
- RealmSwift
- SDWebImage (~> 3.8)
+ - semver
- SideMenuController
- SlackTextViewController
- Starscream (~> 2.0.0)
@@ -95,6 +97,7 @@ SPEC CHECKSUMS:
Realm: d27b758e12d62a3371879a065d4c40aa212c5a54
RealmSwift: 9556c0fe0f0cfecacfb755ae9e68ff379fc6bead
SDWebImage: 098e97e6176540799c27e804c96653ee0833d13c
+ semver: efe6bf4af25bffab18d442592771be392210b5ce
SideMenuController: b463d2b3aa58e2afe57f57a07938fa9a647894ca
SlackTextViewController: fbcdadbb8090673f604484ff5b6eb8d77baed42a
Starscream: 3fdd5c277e57cca6b5c406d274e3f34a7c88f2ce
@@ -102,6 +105,6 @@ SPEC CHECKSUMS:
TSMarkdownParser: 114779f14d46e7fc6d9880d4797e5abcc01f92c3
URBMediaFocusViewController: 26779e301fe75ec0152fbe8b476bd06ccee9f9b3
-PODFILE CHECKSUM: ddb7c3e672b9fde92752fcd4b57fa8a2c6116722
+PODFILE CHECKSUM: ba9d77b7ee1abf5cb7a1edf9ef743f9b8dfefe5c
COCOAPODS: 1.1.1
diff --git a/Rocket.Chat/Controllers/Auth/ConnectServerViewController.swift b/Rocket.Chat/Controllers/Auth/ConnectServerViewController.swift
index 1273f35be5..9db158fed7 100644
--- a/Rocket.Chat/Controllers/Auth/ConnectServerViewController.swift
+++ b/Rocket.Chat/Controllers/Auth/ConnectServerViewController.swift
@@ -8,6 +8,7 @@
import UIKit
import SwiftyJSON
+import semver
final class ConnectServerViewController: BaseViewController {
@@ -149,10 +150,25 @@ final class ConnectServerViewController: BaseViewController {
let json = JSON(data: data)
Log.debug(json.rawString())
- guard json["version"].string != nil else {
+ guard let version = json["version"].string else {
return completion(nil, true)
}
+ if let minVersion = Bundle.main.object(forInfoDictionaryKey: "RC_MIN_SERVER_VERSION") as? String {
+ if Semver.lt(version, minVersion) {
+ let alert = UIAlertController(
+ title: localized("alert.connection.invalid_version.title"),
+ message: String(format: localized("alert.connection.invalid_version.message"), version, minVersion),
+ preferredStyle: .alert
+ )
+
+ alert.addAction(UIAlertAction(title: localized("global.ok"), style: .default, handler: nil))
+ self.present(alert, animated: true, completion: nil)
+
+ return completion(nil, true)
+ }
+ }
+
completion(json, false)
} else {
completion(nil, true)
diff --git a/Rocket.Chat/Info.plist b/Rocket.Chat/Info.plist
index 48d5d76ba5..9bf74b1828 100644
--- a/Rocket.Chat/Info.plist
+++ b/Rocket.Chat/Info.plist
@@ -95,5 +95,7 @@
UIViewControllerBasedStatusBarAppearance
+ RC_MIN_SERVER_VERSION
+ 0.54.0
diff --git a/Rocket.Chat/en.lproj/Localizable.strings b/Rocket.Chat/en.lproj/Localizable.strings
index af3c627814..ceed02d2e2 100644
--- a/Rocket.Chat/en.lproj/Localizable.strings
+++ b/Rocket.Chat/en.lproj/Localizable.strings
@@ -19,6 +19,9 @@
"alert.connection.invalid_url.title" = "Oops!";
"alert.connection.invalid_url.message" = "The URL you entered is invalid. Check it and try again, please!";
+"alert.connection.invalid_version.title" = "Oops!";
+"alert.connection.invalid_version.message" = "The server you're trying to connect is using a version that's not supported by the app anymore: %@.\n\nWe require version %@.";
+
// Socket Connection
"connection.offline.banner.message" = "You're offline, try connecting again";