Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added device-id to about settings and show the additional information…

…s when long pressing with two fingers
  • Loading branch information
mahmoud-adam85 committed Apr 2, 2019
1 parent 70c78eb commit 83201ff2b7401defe77c115df7b99962523133d6
@@ -91,7 +91,7 @@ class VPNCredentialsService {
}
}

private class func getDeviceId() -> String? {
class func getDeviceId() -> String? {
let keychain = DAKeychain.shared
if let deviceId = keychain[DeviceIDKey] {
return deviceId
@@ -18,11 +18,11 @@ class AppStatus {
#endif

class func isRelease() -> Bool {
// #if BETA
#if BETA
return false
// #else
// return true
// #endif
#else
return true
#endif
}

class func isDebug() -> Bool {
@@ -15,13 +15,28 @@ class AboutSettingsTableViewController: SubSettingsTableViewController {
private let settings = [CliqzPrivacyPolicySetting(), EulaSetting(), CliqzLicenseAndAcknowledgementsSetting(), imprintSetting()]
#endif
private let info = [(NSLocalizedString("Version", tableName: "Cliqz", comment: "Application Version number"), AppStatus.distVersion()),
(NSLocalizedString("Extension", tableName: "Cliqz", comment: "Extension version number"), AppStatus.extensionVersion())]
(NSLocalizedString("Extension", tableName: "Cliqz", comment: "Extension version number"), AppStatus.extensionVersion()),
(NSLocalizedString("Device Id", tableName: "Cliqz", comment: "Device Id"), VPNCredentialsService.getDeviceId())]

private var showExtraInfo = !AppStatus.isRelease()

override func getViewName() -> String {
return "about"
}

// MARK: - Table view data source
override func viewDidLoad() {
super.viewDidLoad()
let longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPress))
longPressGesture.minimumPressDuration = 2
longPressGesture.numberOfTouchesRequired = 2
self.tableView.addGestureRecognizer(longPressGesture)
}

@objc func handleLongPress() {
showExtraInfo = true
self.tableView.reloadData()
}

override func numberOfSections(in tableView: UITableView) -> Int {
return 2
@@ -31,8 +46,7 @@ class AboutSettingsTableViewController: SubSettingsTableViewController {
if section == 0 {
return settings.count
}
if AppStatus.isRelease() { return 1 }
return 2
return showExtraInfo ? info.count : 1
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
@@ -43,7 +57,7 @@ class AboutSettingsTableViewController: SubSettingsTableViewController {
cell.textLabel?.attributedText = setting.title
cell.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
} else {
cell = getUITableViewCell(style: UITableViewCellStyle.value1)
cell = getUITableViewCell(style: showExtraInfo ? UITableViewCellStyle.subtitle : UITableViewCellStyle.value1)
cell.accessoryType = .none
cell.selectionStyle = .none
let infoTuple = info[indexPath.row]

0 comments on commit 83201ff

Please sign in to comment.