Commit e5d88b3e authored by Thomas Markiewicz's avatar Thomas Markiewicz
Browse files

Added runtime check to disable all app functionality if it is running in China

parent 2d87851f
......@@ -101,8 +101,19 @@ class DashboardViewController: AutolayoutViewController {
UIApplication.shared.registerUserNotificationSettings(settings)
#endif
if Client.providers.accountProvider.isLoggedIn {
Client.providers.accountProvider.refreshAndLogoutUnauthorized()
// Check if app is running in China and if so disable all functionality
if let countryCode = (Locale.current as NSLocale).object(forKey: .countryCode) as? String {
if countryCode == "CN" {
let alert = UIAlertController(title: "Invalid Region", message: "This app cannot run in China", preferredStyle: .alert)
self.present(alert, animated: true)
if Client.providers.accountProvider.isLoggedIn {
Client.providers.accountProvider.logout(nil)
}
} else {
if Client.providers.accountProvider.isLoggedIn {
Client.providers.accountProvider.refreshAndLogoutUnauthorized()
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment