Commit 6db5ce55 authored by Jose Blaya's avatar Jose Blaya
Browse files

Merge branch '295-piax-fix-touch-zones-in-quick-settings-tile' into 'release/3.0.0'

Resolve "PIAX. Fix touch zones in Quick Settings tile"

See merge request ios/vpn-ios!404
parents a25bc258 746888b0
This diff is collapsed.
......@@ -37,8 +37,9 @@ class AboutNoticeCell: UITableViewCell, Restylable {
func viewShouldRestyle() {
Theme.current.applySecondaryBackground(self)
buttonName.style(style: TextStyle.textStyle9)
Theme.current.applySmallInfo(labelCopyright, appearance: .dark)
Theme.current.applySmallInfo(labelNotice, appearance: .dark)
Theme.current.applySubtitle(labelCopyright)
Theme.current.applySubtitle(labelNotice)
}
}
......@@ -155,8 +156,8 @@ class AboutLicenseCell: UITableViewCell, Restylable {
Theme.current.applySecondaryBackground(self)
Theme.current.applyPrincipalBackground(textLicense)
buttonName.style(style: TextStyle.textStyle9)
Theme.current.applySmallInfo(labelCopyright, appearance: .dark)
Theme.current.applyBody1Monospace(textLicense, appearance: .dark)
Theme.current.applySubtitle(labelCopyright)
Theme.current.applyLicenseMonospaceFontAndColor(textLicense, appearance: .dark)
buttonMore.tintColor = textLicense.textColor
gradientLicense?.removeFromSuperview()
......
......@@ -94,7 +94,7 @@ class AboutViewController: AutolayoutViewController {
DispatchQueue.main.async {
self.licenseByComponentName[component.name] = license
guard let index = self.components.licenses.index(of: component) else {
guard let index = self.components.licenses.firstIndex(of: component) else {
return
}
self.tableView.reloadRows(at: [IndexPath(row: index, section: 1)], with: .none)
......
......@@ -68,6 +68,7 @@ class DashboardViewController: AutolayoutViewController {
nc.addObserver(self, selector: #selector(updateCurrentStatus), name: .PIAThemeDidChange, object: nil)
nc.addObserver(self, selector: #selector(updateTiles), name: .PIATilesDidChange, object: nil)
nc.addObserver(self, selector: #selector(vpnShouldReconnect), name: .PIASettingsHaveChanged, object: nil)
nc.addObserver(self, selector: #selector(presentKillSwitchAlert), name: .PIAPersistentConnectionTileHaveChanged, object: nil)
#if !TARGET_IPHONE_SIMULATOR
let types: UIUserNotificationType = [.alert, .badge, .sound]
......@@ -399,6 +400,20 @@ class DashboardViewController: AutolayoutViewController {
performSelector(onMainThread: #selector(updateCurrentStatusWithUserInfo(_:)), with: notification.userInfo, waitUntilDone: false)
}
@objc private func presentKillSwitchAlert() {
let alert = Macros.alert(nil, L10n.Settings.Nmt.Killswitch.disabled)
alert.addCancelAction(L10n.Global.close)
alert.addActionWithTitle(L10n.Global.enable) {
let preferences = Client.preferences.editable()
preferences.isPersistentConnection = true
preferences.commit()
NotificationCenter.default.post(name: .PIASettingsHaveChanged,
object: self,
userInfo: nil)
}
present(alert, animated: true, completion: nil)
}
@objc private func vpnShouldReconnect() {
if Client.providers.vpnProvider.vpnStatus != .disconnected {
let alert = Macros.alert(
......
......@@ -2,7 +2,7 @@
"images" : [
{
"idiom" : "universal",
"filename" : "fill128.pdf"
"filename" : "fill119Copy3.pdf"
}
],
"info" : {
......
......@@ -2,7 +2,7 @@
"images" : [
{
"idiom" : "universal",
"filename" : "fill119Copy3.pdf"
"filename" : "fill128.pdf"
}
],
"info" : {
......
......@@ -250,6 +250,9 @@ class SettingsViewController: AutolayoutViewController {
redisplaySettings()
NotificationCenter.default.addObserver(self, selector: #selector(refreshContentBlockerState), name: UIApplication.didBecomeActiveNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(refreshPersistentConnectionValue),
name: .PIAPersistentConnectionSettingHaveChanged,
object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(viewHasRotated), name: UIDevice.orientationDidChangeNotification, object: nil)
}
......@@ -381,6 +384,11 @@ class SettingsViewController: AutolayoutViewController {
}
}
@objc private func refreshPersistentConnectionValue() {
pendingPreferences.isPersistentConnection = Client.preferences.isPersistentConnection
tableView.reloadData()
}
private func refreshContentBlockerRules() {
self.showLoadingAnimation()
SFContentBlockerManager.reloadContentBlocker(withIdentifier: AppConstants.Extensions.adBlockerBundleIdentifier) { (error) in
......
......@@ -158,6 +158,8 @@ internal enum L10n {
internal static let disabled = L10n.tr("Localizable", "global.disabled")
/// Edit
internal static let edit = L10n.tr("Localizable", "global.edit")
/// Enable
internal static let enable = L10n.tr("Localizable", "global.enable")
/// Enabled
internal static let enabled = L10n.tr("Localizable", "global.enabled")
/// Error
......@@ -498,6 +500,12 @@ internal enum L10n {
}
}
}
internal enum Nmt {
internal enum Killswitch {
/// The VPN kill switch is currently disabled. In order to ensure that the Network Management Tool is functioning, and that you are able to reconnect when switching networks, please enable the VPN kill switch in your settings.
internal static let disabled = L10n.tr("Localizable", "settings.nmt.killswitch.disabled")
}
}
internal enum Reset {
/// This will reset all of the above settings to default.
internal static let footer = L10n.tr("Localizable", "settings.reset.footer")
......@@ -537,7 +545,7 @@ internal enum L10n {
internal enum Rule {
/// Disconnect from PIA VPN
internal static let action = L10n.tr("Localizable", "settings.trusted.networks.sections.trusted.rule.action")
/// Perform actions when joining trusted networks.
/// Enable this feature, with the VPN kill switch enabled, to customize how PIA will behave on WiFi and cellular networks. Please be aware, functionality of the Network Management Tool will be disabled if you manually disconnect.
internal static let description = L10n.tr("Localizable", "settings.trusted.networks.sections.trusted.rule.description")
}
}
......
......@@ -184,4 +184,12 @@ extension Theme {
Asset.Piax.Global.eyeInactiveLight.image
}
public func applyLicenseMonospaceFontAndColor(_ textView: UITextView,
appearance: Appearance) {
textView.font = typeface.monospaceFont(size: 14.0)
textView.textColor = palette.appearance == .dark ?
.white :
palette.textColor(forRelevance: 2, appearance: appearance)
}
}
......@@ -126,6 +126,13 @@ class QuickSettingsTile: UIView, Tileable {
updateProfile()
updateButtons()
if !Client.preferences.isPersistentConnection,
Client.preferences.nmtRulesEnabled {
NotificationCenter.default.post(name: .PIAPersistentConnectionTileHaveChanged,
object: self,
userInfo: nil)
}
}
private func updateProfile() {
......
......@@ -50,6 +50,11 @@ class TrustedNetworksViewController: AutolayoutViewController {
NotificationCenter.default.addObserver(self, selector: #selector(filterAvailableNetworks), name: UIApplication.didBecomeActiveNotification, object: nil)
configureTableView()
if !Client.preferences.isPersistentConnection,
Client.preferences.nmtRulesEnabled {
presentKillSwitchAlert()
}
}
override func viewWillAppear(_ animated: Bool) {
......@@ -114,6 +119,9 @@ class TrustedNetworksViewController: AutolayoutViewController {
}
@objc private func toggleRules(_ sender: UISwitch) {
if sender.isOn {
presentKillSwitchAlert()
}
let preferences = Client.preferences.editable()
preferences.nmtRulesEnabled = sender.isOn
preferences.commit()
......@@ -123,6 +131,20 @@ class TrustedNetworksViewController: AutolayoutViewController {
// MARK: Private Methods
private func presentKillSwitchAlert() {
let alert = Macros.alert(nil, L10n.Settings.Nmt.Killswitch.disabled)
alert.addCancelAction(L10n.Global.close)
alert.addActionWithTitle(L10n.Global.enable) {
let preferences = Client.preferences.editable()
preferences.isPersistentConnection = true
preferences.commit()
NotificationCenter.default.post(name: .PIAPersistentConnectionSettingHaveChanged,
object: self,
userInfo: nil)
}
present(alert, animated: true, completion: nil)
}
private func configureTableView() {
if #available(iOS 11, *) {
tableView.sectionFooterHeight = UITableView.automaticDimension
......
......@@ -13,6 +13,7 @@
"global.unreachable" = "No internet connection found. Please confirm that you have an internet connection.";
"global.enabled" = "Enabled";
"global.disabled" = "Disabled";
"global.enable" = "Enable";
// NOTIFICATIONS
......@@ -217,9 +218,10 @@
"settings.hotspothelper.wifi.networks" = "WiFi networks";
"settings.trusted.networks.sections.untrusted" = "Untrusted networks";
"settings.hotspothelper.rules.title" = "Rules";
"settings.trusted.networks.sections.trusted.rule.description"= "Perform actions when joining trusted networks.";
"settings.trusted.networks.sections.trusted.rule.description"= "Enable this feature, with the VPN kill switch enabled, to customize how PIA will behave on WiFi and cellular networks. Please be aware, functionality of the Network Management Tool will be disabled if you manually disconnect.";
"settings.trusted.networks.sections.trusted.rule.action"= "Disconnect from PIA VPN";
"tiles.quicksetting.nmt.title" = "Network Management";
"settings.nmt.killswitch.disabled" = "The VPN kill switch is currently disabled. In order to ensure that the Network Management Tool is functioning, and that you are able to reconnect when switching networks, please enable the VPN kill switch in your settings.";
// REGION
......
......@@ -56,7 +56,7 @@ end
def shared_main_pods
pod 'AlamofireImage'
#library_by_path('')
library_by_git('7d09a9a')
library_by_git('d1e8121')
#library_by_version('~> 1.1.3')
end
......
......@@ -114,10 +114,10 @@ DEPENDENCIES:
- FXPageControl
- HockeySDK
- iRate
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `7d09a9a`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `7d09a9a`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `7d09a9a`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `7d09a9a`)
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `d1e8121`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `d1e8121`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `d1e8121`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `d1e8121`)
- PIATunnel (from `https://github.com/pia-foss/tunnel-apple`, commit `257296c`)
- PopupDialog
- SideMenu (= 3.1.5)
......@@ -154,7 +154,7 @@ SPEC REPOS:
EXTERNAL SOURCES:
PIALibrary:
:commit: 7d09a9a
:commit: d1e8121
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 257296c
......@@ -162,7 +162,7 @@ EXTERNAL SOURCES:
CHECKOUT OPTIONS:
PIALibrary:
:commit: 7d09a9a
:commit: d1e8121
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 257296c
......@@ -198,6 +198,6 @@ SPEC CHECKSUMS:
SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165
TPKeyboardAvoiding: cb69d5ddbe90ce0170e4bc2db1e5e41d4a3ad9a4
PODFILE CHECKSUM: a2746f6d6030e7ba16ce0996314b761685d4011b
PODFILE CHECKSUM: b24bf5326926c4c8cfe1727a5839d1d0df21363d
COCOAPODS: 1.5.3
......@@ -25,49 +25,6 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="89"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="0Qp-uW-eAj">
<rect key="frame" x="20" y="20" width="335" height="30"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="KWs-z3-TeP">
<rect key="frame" x="0.0" y="0.0" width="98.5" height="30"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5Bu-uZ-L11">
<rect key="frame" x="0.0" y="0.0" width="98.5" height="30"/>
<state key="normal" image="theme-dark-active"/>
<connections>
<action selector="changeTheme:" destination="-1" eventType="touchUpInside" id="yMQ-vt-Pvt"/>
</connections>
</button>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Wag-UL-Rel">
<rect key="frame" x="118.5" y="0.0" width="98" height="30"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aBB-hV-AgG">
<rect key="frame" x="0.0" y="0.0" width="98" height="30"/>
<state key="normal" image="killswitch-dark-active"/>
<connections>
<action selector="updateKillSwitchSetting:" destination="-1" eventType="touchUpInside" id="ELb-to-qnb"/>
</connections>
</button>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="JhW-YA-L3b">
<rect key="frame" x="236.5" y="0.0" width="98.5" height="30"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gaA-K4-g4k">
<rect key="frame" x="0.0" y="0.0" width="98.5" height="30"/>
<connections>
<action selector="updateNMTSetting:" destination="-1" eventType="touchUpInside" id="BKD-oU-Cab"/>
</connections>
</button>
</subviews>
</stackView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="30" id="u9s-HP-1rj"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="3rE-WN-iPM">
<rect key="frame" x="20" y="40" width="335" height="49"/>
<subviews>
......@@ -106,13 +63,56 @@
</stackView>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="0Qp-uW-eAj">
<rect key="frame" x="20" y="0.0" width="335" height="50"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="KWs-z3-TeP">
<rect key="frame" x="0.0" y="0.0" width="98.5" height="50"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="bottom" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5Bu-uZ-L11">
<rect key="frame" x="0.0" y="0.0" width="98.5" height="50"/>
<state key="normal" image="theme-dark-active"/>
<connections>
<action selector="changeTheme:" destination="-1" eventType="touchUpInside" id="yMQ-vt-Pvt"/>
</connections>
</button>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Wag-UL-Rel">
<rect key="frame" x="118.5" y="0.0" width="98" height="50"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="bottom" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aBB-hV-AgG">
<rect key="frame" x="0.0" y="0.0" width="98" height="50"/>
<state key="normal" image="killswitch-dark-active"/>
<connections>
<action selector="updateKillSwitchSetting:" destination="-1" eventType="touchUpInside" id="ELb-to-qnb"/>
</connections>
</button>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="JhW-YA-L3b">
<rect key="frame" x="236.5" y="0.0" width="98.5" height="50"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="bottom" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gaA-K4-g4k">
<rect key="frame" x="0.0" y="0.0" width="98.5" height="50"/>
<connections>
<action selector="updateNMTSetting:" destination="-1" eventType="touchUpInside" id="BKD-oU-Cab"/>
</connections>
</button>
</subviews>
</stackView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="50" id="u9s-HP-1rj"/>
</constraints>
</stackView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="3rE-WN-iPM" secondAttribute="trailing" constant="20" id="2jF-Y3-p2e"/>
<constraint firstItem="3rE-WN-iPM" firstAttribute="top" secondItem="0Qp-uW-eAj" secondAttribute="bottom" constant="-10" id="L7O-d9-WTg"/>
<constraint firstItem="3rE-WN-iPM" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="OQV-cq-0dd"/>
<constraint firstItem="0Qp-uW-eAj" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="20" id="XiF-Dl-GOz"/>
<constraint firstItem="0Qp-uW-eAj" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="XiF-Dl-GOz"/>
<constraint firstItem="0Qp-uW-eAj" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="csA-Ky-er2"/>
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="0Qp-uW-eAj" secondAttribute="trailing" constant="20" id="oOS-xB-q3f"/>
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="3rE-WN-iPM" secondAttribute="bottom" id="vUh-Q0-fmE"/>
......
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