Commit 5834ac6e authored by Jose Blaya's avatar Jose Blaya
Browse files

Hotfix NMT 2.8.1

parent 91083e51
......@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>2.8.0</string>
<string>2.8.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
......
......@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>2.8.0</string>
<string>2.8.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
......
This diff is collapsed.
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.8.0</string>
<string>2.8.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSpokenName</key>
......
......@@ -80,32 +80,6 @@ class PIAHotspotHelper {
log.info("present PIA message for unprotected networks")
}
response.deliver()
} else if cmd.commandType == .evaluate {
if let network = cmd.network,
Client.preferences.useWiFiProtection {
if !Client.providers.vpnProvider.isVPNConnected {
if Client.preferences.shouldConnectForAllNetworks ||
!weakSelf.trustedNetworks().contains(network.ssid) {
network.setConfidence(.high)
Macros.dispatch(after: .milliseconds(200)) {
log.info("connecting VPN because network "+network.ssid+"has passed the filter")
Client.providers.vpnProvider.connect(nil)
}
}
let response = cmd.createResponse(.success)
response.setNetwork(network)
response.deliver()
} else {
let response = cmd.createResponse(.failure)
response.setNetwork(network)
response.deliver()
}
}
}
}
......
......@@ -497,6 +497,7 @@ class SettingsViewController: AutolayoutViewController {
pendingPreferences.shouldConnectForAllNetworks = Client.preferences.shouldConnectForAllNetworks
pendingPreferences.useWiFiProtection = Client.preferences.useWiFiProtection
pendingPreferences.trustCellularData = Client.preferences.trustCellularData
pendingPreferences.disconnectOnTrusted = Client.preferences.disconnectOnTrusted
pendingPreferences.commit()
}
......
......@@ -22,6 +22,7 @@ internal enum StoryboardSegue {
case selectRegionAnimatedSegueIdentifier = "SelectRegionAnimatedSegueIdentifier"
case selectRegionSegueIdentifier = "SelectRegionSegueIdentifier"
case settingsSegueIdentifier = "SettingsSegueIdentifier"
case trustedNetworkRulesSegueIdentifier = "TrustedNetworkRulesSegueIdentifier"
case trustedNetworksSegueIdentifier = "TrustedNetworksSegueIdentifier"
case unwindContentBlockerSegueIdentifier = "UnwindContentBlockerSegueIdentifier"
case unwindRegionsSegueIdentifier = "UnwindRegionsSegueIdentifier"
......
......@@ -478,6 +478,10 @@ internal enum L10n {
/// VPN WiFi Protection automatically enables the VPN when connecting to untrusted networks if this option is enabled.
internal static let description = L10n.tr("Localizable", "settings.hotspothelper.enable.description")
}
internal enum Rules {
/// Rules
internal static let title = L10n.tr("Localizable", "settings.hotspothelper.rules.title")
}
internal enum Wifi {
/// WiFi networks
internal static let networks = L10n.tr("Localizable", "settings.hotspothelper.wifi.networks")
......@@ -520,6 +524,16 @@ internal enum L10n {
internal static let current = L10n.tr("Localizable", "settings.trusted.networks.sections.current")
/// Trusted networks
internal static let trusted = L10n.tr("Localizable", "settings.trusted.networks.sections.trusted")
/// Untrusted networks
internal static let untrusted = L10n.tr("Localizable", "settings.trusted.networks.sections.untrusted")
internal enum Trusted {
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.
internal static let description = L10n.tr("Localizable", "settings.trusted.networks.sections.trusted.rule.description")
}
}
}
}
}
......
//
// TrustedNetworkRulesViewController.swift
// PIA VPN
//
// Created by Jose Antonio Blaya Garcia on 18/02/2019.
// Copyright © 2019 London Trust Media. All rights reserved.
//
import UIKit
import PIALibrary
class TrustedNetworkRulesViewController: AutolayoutViewController {
@IBOutlet private weak var tableView: UITableView!
private lazy var switchTrusted = UISwitch()
private enum Sections: Int, EnumsBuilder {
case trusted = 0
}
private struct Cells {
static let rules = "RulesCell"
}
override func viewDidLoad() {
super.viewDidLoad()
self.title = L10n.Settings.Hotspothelper.Rules.title
self.switchTrusted.addTarget(self, action: #selector(toggleTrusted(_:)), for: .valueChanged)
configureTableView()
}
// MARK: Private Methods
private func configureTableView() {
if #available(iOS 11, *) {
tableView.sectionFooterHeight = UITableViewAutomaticDimension
tableView.estimatedSectionFooterHeight = 1.0
}
}
// MARK: Restylable
override func viewShouldRestyle() {
super.viewShouldRestyle()
if let viewContainer = viewContainer {
Theme.current.applyLightBackground(viewContainer)
}
Theme.current.applyLightBackground(tableView)
Theme.current.applyDividerToSeparator(tableView)
}
@objc private func toggleTrusted(_ sender: UISwitch) {
let preferences = Client.preferences.editable()
preferences.disconnectOnTrusted = sender.isOn
preferences.commit()
}
}
extension TrustedNetworkRulesViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return Sections.countCases()
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
switch Sections.objectIdentifyBy(index: section) {
case .trusted:
return L10n.Settings.Trusted.Networks.Sections.trusted.uppercased()
}
}
func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
switch Sections.objectIdentifyBy(index: section) {
case .trusted:
return L10n.Settings.Trusted.Networks.Sections.Trusted.Rule.description
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: Cells.rules, for: indexPath)
cell.selectionStyle = .default
cell.accessoryType = .none
cell.accessoryView = nil
cell.isUserInteractionEnabled = true
cell.imageView?.image = Asset.iconWifi.image.withRenderingMode(.alwaysTemplate)
cell.imageView?.tintColor = Theme.current.palette.textColor(forRelevance: 3, appearance: .dark)
switch Sections.objectIdentifyBy(index: indexPath.section) {
case .trusted:
cell.imageView?.image = nil
cell.textLabel?.text = L10n.Settings.Trusted.Networks.Sections.Trusted.Rule.action
cell.accessoryView = switchTrusted
cell.selectionStyle = .none
switchTrusted.isOn = Client.preferences.disconnectOnTrusted
}
cell.textLabel?.backgroundColor = .clear
Theme.current.applySolidLightBackground(cell)
Theme.current.applyDetailTableCell(cell)
return cell
}
func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
Theme.current.applyTableSectionHeader(view)
}
func tableView(_ tableView: UITableView, willDisplayFooterView view: UIView, forSection section: Int) {
Theme.current.applyTableSectionFooter(view)
}
}
......@@ -22,7 +22,8 @@ class TrustedNetworksViewController: AutolayoutViewController {
private enum Sections: Int, EnumsBuilder {
case cellularData = 0
case rules = 0
case cellularData
case useVpnWifiProtection
case autoConnectAllNetworksSettings
case current
......@@ -125,7 +126,7 @@ class TrustedNetworksViewController: AutolayoutViewController {
extension TrustedNetworksViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return Client.preferences.useWiFiProtection ? Sections.countCases() : 2
return Client.preferences.useWiFiProtection ? Sections.countCases() : 3
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
......@@ -181,11 +182,17 @@ extension TrustedNetworksViewController: UITableViewDelegate, UITableViewDataSou
let cell = tableView.dequeueReusableCell(withIdentifier: Cells.network, for: indexPath)
cell.selectionStyle = .default
cell.accessoryView = nil
cell.accessoryType = .none
cell.isUserInteractionEnabled = true
cell.imageView?.image = Asset.iconWifi.image.withRenderingMode(.alwaysTemplate)
cell.imageView?.tintColor = Theme.current.palette.textColor(forRelevance: 3, appearance: .dark)
switch Sections.objectIdentifyBy(index: indexPath.section) {
case .rules:
cell.imageView?.image = nil
cell.textLabel?.text = L10n.Settings.Hotspothelper.Rules.title
cell.accessoryType = .disclosureIndicator
cell.accessoryView = nil
case .current:
if let ssid = hotspotHelper.currentWiFiNetwork() {
if trustedNetworks.contains(ssid) {
......@@ -236,6 +243,8 @@ extension TrustedNetworksViewController: UITableViewDelegate, UITableViewDataSou
if let ssid = hotspotHelper.currentWiFiNetwork() {
hotspotHelper.saveTrustedNetwork(ssid)
}
case .rules:
self.perform(segue: StoryboardSegue.Main.trustedNetworkRulesSegueIdentifier)
case .available:
let ssid = availableNetworks[indexPath.row]
hotspotHelper.saveTrustedNetwork(ssid)
......
......@@ -8,6 +8,7 @@
import Foundation
import SystemConfiguration
import UIKit
extension UIDevice {
......
......@@ -220,4 +220,8 @@
"settings.hotspothelper.cellular.description" = "PIA automatically enables the VPN when connecting to cellular networks if this option is disabled.";
"settings.hotspothelper.cellular.networks" = "Cellular networks";
"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.action"= "Disconnect from PIA VPN";
......@@ -1487,12 +1487,79 @@
<connections>
<outlet property="tableView" destination="Si7-46-a7E" id="xk9-1a-OcZ"/>
<outlet property="viewContainer" destination="p4O-Dy-PbF" id="Aw9-9G-NGH"/>
<segue destination="rm3-o9-GWD" kind="show" identifier="TrustedNetworkRulesSegueIdentifier" id="hI4-2d-INn"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="QBf-Kp-bhx" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2697" y="-1767"/>
</scene>
<!--Trusted Network Rules View Controller-->
<scene sceneID="IPc-P6-8QJ">
<objects>
<viewController id="rm3-o9-GWD" customClass="TrustedNetworkRulesViewController" customModule="PIA_VPN" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="RyS-oo-ZDQ">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PlE-uh-TNn">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="LJD-BG-kcI">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="RulesCell" textLabel="mx8-TC-5A6" style="IBUITableViewCellStyleDefault" id="QcD-sC-gtE">
<rect key="frame" x="0.0" y="55.333333333333343" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="QcD-sC-gtE" id="XTS-QN-iXx">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.666666666666664"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="mx8-TC-5A6">
<rect key="frame" x="15" y="0.0" width="345" height="43.666666666666664"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="rm3-o9-GWD" id="Y9n-oZ-HPz"/>
<outlet property="delegate" destination="rm3-o9-GWD" id="d07-ZE-bFx"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="LJD-BG-kcI" firstAttribute="leading" secondItem="PlE-uh-TNn" secondAttribute="leading" id="FHN-cA-VUD"/>
<constraint firstAttribute="trailing" secondItem="LJD-BG-kcI" secondAttribute="trailing" id="fx0-bh-mZ9"/>
<constraint firstAttribute="bottom" secondItem="LJD-BG-kcI" secondAttribute="bottom" id="pBD-b4-XCc"/>
<constraint firstItem="LJD-BG-kcI" firstAttribute="top" secondItem="PlE-uh-TNn" secondAttribute="top" id="tlv-Ox-qo6"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="PlE-uh-TNn" secondAttribute="bottom" id="1pI-S3-RQR"/>
<constraint firstItem="PlE-uh-TNn" firstAttribute="trailing" secondItem="6ga-rI-w8r" secondAttribute="trailing" id="1vj-Gm-qhR"/>
<constraint firstItem="PlE-uh-TNn" firstAttribute="leading" secondItem="6ga-rI-w8r" secondAttribute="leading" id="H6f-fC-pVR"/>
<constraint firstItem="PlE-uh-TNn" firstAttribute="top" secondItem="RyS-oo-ZDQ" secondAttribute="top" id="OPk-3n-hSA"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6ga-rI-w8r"/>
</view>
<connections>
<outlet property="tableView" destination="LJD-BG-kcI" id="Ylf-5i-We0"/>
<outlet property="viewContainer" destination="PlE-uh-TNn" id="cAV-ql-YvU"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="sHO-g1-rLB" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3985" y="-1766"/>
</scene>
<!--CustomDNS Settings View Controller-->
<scene sceneID="TrO-qA-66V">
<objects>
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>2.8.0</string>
<string>2.8.1</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>2.8.0</string>
<string>2.8.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -53,7 +53,7 @@ end
def shared_main_pods
pod 'AlamofireImage'
#library_by_path('')
library_by_git('ac359ff')
library_by_git('948e86d')
#library_by_version('~> 1.1.3')
end
......
......@@ -62,23 +62,23 @@ PODS:
- nanopb/decode (0.3.901)
- nanopb/encode (0.3.901)
- OpenSSL-Apple (1.1.0h)
- PIALibrary/Core (1.1.8)
- PIALibrary/Library (1.1.8):
- PIALibrary/Core (1.1.9)
- PIALibrary/Library (1.1.9):
- Alamofire (~> 4)
- Gloss (~> 2)
- PIALibrary/Core
- PIALibrary/Util
- ReachabilitySwift
- SwiftyBeaver
- PIALibrary/Mock (1.1.8):
- PIALibrary/Mock (1.1.9):
- PIALibrary/Library
- PIALibrary/UI (1.1.8):
- PIALibrary/UI (1.1.9):
- PIALibrary/Library
- SwiftyBeaver
- TPKeyboardAvoiding
- PIALibrary/Util (1.1.8):
- PIALibrary/Util (1.1.9):
- PIALibrary/Core
- PIALibrary/VPN (1.1.8):
- PIALibrary/VPN (1.1.9):
- PIALibrary/Library
- PIATunnel (~> 1.1.8)
- PIATunnel (1.1.8):
......@@ -104,10 +104,10 @@ DEPENDENCIES:
- HockeySDK
- iRate
- MBProgressHUD
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `ac359ff`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `ac359ff`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `ac359ff`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `ac359ff`)
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `948e86d`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `948e86d`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `948e86d`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `948e86d`)
- PIATunnel (from `https://github.com/pia-foss/tunnel-apple`, commit `269d6d1`)
- SideMenu (= 3.1.5)
- TPKeyboardAvoiding
......@@ -138,7 +138,7 @@ SPEC REPOS:
EXTERNAL SOURCES:
PIALibrary:
:commit: ac359ff
:commit: 948e86d
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 269d6d1
......@@ -146,7 +146,7 @@ EXTERNAL SOURCES:
CHECKOUT OPTIONS:
PIALibrary:
:commit: ac359ff
:commit: 948e86d
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 269d6d1
......@@ -170,13 +170,13 @@ SPEC CHECKSUMS:
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48
OpenSSL-Apple: cd153d705ef350eb834ae7ff5f21f792b51ed208
PIALibrary: fa60f1bd9ab48fadd5367fabc06137b209897063
PIALibrary: 5c005e56e85f4798ae67bb47d4a5d6fe2457f101
PIATunnel: 3cd5dfd24ebe20f093e07cd19acf5072bb44a72e
ReachabilitySwift: 408477d1b6ed9779dba301953171e017c31241f3
SideMenu: 47dbf9e4d878062d8994aed43f6e4bf6c1fea30b
SwiftyBeaver: ccfcdf85a04d429f1633f668650b0ce8020bda3a
TPKeyboardAvoiding: cb69d5ddbe90ce0170e4bc2db1e5e41d4a3ad9a4
PODFILE CHECKSUM: fd1f74fcd0bc1d386d0b411a7cd071a62f2bc0e7
PODFILE CHECKSUM: 2001675b51758036389fa59720323ca708ac3e81
COCOAPODS: 1.5.3
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