diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2019-12-06 10:35:29 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2019-12-06 10:35:29 +0100 |
| commit | b94cdac690cbb51cbee07d5bd2f011e80a7f2ef0 (patch) | |
| tree | 7f0ce4a934217f44bd5264a37c021ea31fbbf583 | |
| parent | e7e70df17f472be16460a2bcea41c5925f537dff (diff) | |
| parent | f0e08152b60cae8a4c65c9c4e1361d0c52791d43 (diff) | |
| download | mullvadvpn-b94cdac690cbb51cbee07d5bd2f011e80a7f2ef0.tar.xz mullvadvpn-b94cdac690cbb51cbee07d5bd2f011e80a7f2ef0.zip | |
Merge branch 'add-version-suffix-ios'
| -rw-r--r-- | ios/MullvadVPN/Bundle+MullvadVersion.swift | 24 | ||||
| -rw-r--r-- | ios/MullvadVPN/Info.plist | 10 | ||||
| -rw-r--r-- | ios/MullvadVPN/SettingsAccountCell.swift | 7 | ||||
| -rw-r--r-- | ios/MullvadVPN/SettingsCell.swift | 27 | ||||
| -rw-r--r-- | ios/MullvadVPN/SettingsViewController.swift | 3 |
5 files changed, 59 insertions, 12 deletions
diff --git a/ios/MullvadVPN/Bundle+MullvadVersion.swift b/ios/MullvadVPN/Bundle+MullvadVersion.swift new file mode 100644 index 0000000000..0ab1e1da4a --- /dev/null +++ b/ios/MullvadVPN/Bundle+MullvadVersion.swift @@ -0,0 +1,24 @@ +// +// Bundle+MullvadVersion.swift +// MullvadVPN +// +// Created by pronebird on 29/11/2019. +// Copyright © 2019 Amagicom AB. All rights reserved. +// + +import Foundation + +private let kInfoDictionaryMullvadVersionSuffixKey = "MullvadVersionSuffix" + +extension Bundle { + + var mullvadVersion: String? { + let shortVersion = infoDictionary?["CFBundleShortVersionString"] as? String + let versionSuffix = infoDictionary?[kInfoDictionaryMullvadVersionSuffixKey] as? String + + return [shortVersion, versionSuffix] + .compactMap { $0 } + .joined(separator: "-") + } + +} diff --git a/ios/MullvadVPN/Info.plist b/ios/MullvadVPN/Info.plist index 89d7858b37..1b75b96fe1 100644 --- a/ios/MullvadVPN/Info.plist +++ b/ios/MullvadVPN/Info.plist @@ -4,6 +4,8 @@ <dict> <key>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleDisplayName</key> + <string>Mullvad VPN</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> @@ -15,11 +17,15 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>1.0</string> + <string>$(MARKETING_VERSION)</string> <key>CFBundleVersion</key> - <string>1</string> + <string>$(CURRENT_PROJECT_VERSION)</string> + <key>ITSAppUsesNonExemptEncryption</key> + <false/> <key>LSRequiresIPhoneOS</key> <true/> + <key>MullvadVersionSuffix</key> + <string>dev1</string> <key>UILaunchStoryboardName</key> <string>LaunchScreen</string> <key>UIMainStoryboardFile</key> diff --git a/ios/MullvadVPN/SettingsAccountCell.swift b/ios/MullvadVPN/SettingsAccountCell.swift index f938b26df2..cc959c7c46 100644 --- a/ios/MullvadVPN/SettingsAccountCell.swift +++ b/ios/MullvadVPN/SettingsAccountCell.swift @@ -19,13 +19,6 @@ class SettingsAccountCell: SettingsCell { } } - override func awakeFromNib() { - super.awakeFromNib() - - // Remove the right margin since the accessory view adds it automatically - contentView.layoutMargins.right = 0 - } - private func didUpdateAccountExpiry() { if let accountExpiryDate = accountExpiryDate { let accountExpiry = AccountExpiry(date: accountExpiryDate) diff --git a/ios/MullvadVPN/SettingsCell.swift b/ios/MullvadVPN/SettingsCell.swift index 4d09e52651..754cba03e9 100644 --- a/ios/MullvadVPN/SettingsCell.swift +++ b/ios/MullvadVPN/SettingsCell.swift @@ -7,10 +7,12 @@ // import UIKit +import Combine class SettingsCell: BasicTableViewCell { - private let preferredMargins = UIEdgeInsets(top: 14, left: 24, bottom: 14, right: 12) + private let preferredMargins = UIEdgeInsets(top: 16, left: 24, bottom: 16, right: 12) + private var appDidBecomeActiveSubscriber: AnyCancellable? override func awakeFromNib() { super.awakeFromNib() @@ -19,6 +21,29 @@ class SettingsCell: BasicTableViewCell { selectedBackgroundView?.backgroundColor = UIColor.Cell.selectedAltBackgroundColor contentView.layoutMargins = preferredMargins + + enableDisclosureViewTintColorFix() } + /// `UITableViewCell` resets the disclosure view image when the app goes in background + /// This fix ensures that the image is tinted when the app becomes active again. + private func enableDisclosureViewTintColorFix() { + appDidBecomeActiveSubscriber = NotificationCenter.default + .publisher(for: UIApplication.didBecomeActiveNotification, object: nil) + .sink { [weak self] (_) in + self?.updateDisclosureViewTintColor() + } + + updateDisclosureViewTintColor() + } + + /// For some reason the `tintColor` is not applied to standard accessory views. + /// Fix this by looking for the accessory button and changing the image rendering mode + private func updateDisclosureViewTintColor() { + for case let button as UIButton in subviews { + if let image = button.backgroundImage(for: .normal)?.withRenderingMode(.alwaysTemplate) { + button.setBackgroundImage(image, for: .normal) + } + } + } } diff --git a/ios/MullvadVPN/SettingsViewController.swift b/ios/MullvadVPN/SettingsViewController.swift index 50273c39d9..fe6b11743d 100644 --- a/ios/MullvadVPN/SettingsViewController.swift +++ b/ios/MullvadVPN/SettingsViewController.swift @@ -52,9 +52,8 @@ class SettingsViewController: UITableViewController { let middleSection = StaticTableViewSection() let versionRow = StaticTableViewRow(reuseIdentifier: CellIdentifier.appVersion.rawValue) { (_, cell) in let cell = cell as! SettingsAppVersionCell - let versionString = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String - cell.versionLabel.text = versionString + cell.versionLabel.text = Bundle.main.mullvadVersion } versionRow.isSelectable = false |
