Import Core framework into iOS target

This commit is contained in:
Davide De Rosa 2019-03-18 11:52:19 +01:00
parent f661008679
commit 5237aa3916
22 changed files with 55 additions and 17 deletions

View File

@ -25,6 +25,7 @@
import UIKit
import TunnelKit
import Passepartout_Core
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {

View File

@ -26,6 +26,7 @@
import Foundation
import TunnelKit
import MessageUI
import Passepartout_Core
class IssueReporter: NSObject {
struct Attachments {

View File

@ -27,6 +27,7 @@ import Foundation
import UIKit
import TunnelKit
import SwiftyBeaver
import Passepartout_Core
private let log = SwiftyBeaver.self

View File

@ -25,6 +25,7 @@
import UIKit
import TunnelKit
import Passepartout_Core
extension UITableViewCell {
func applyChecked(_ checked: Bool, _ theme: Theme) {

View File

@ -25,6 +25,7 @@
import UIKit
import MessageUI
import Passepartout_Core
extension UIColor {
convenience init(rgb: UInt32, alpha: CGFloat) {

View File

@ -26,6 +26,7 @@
import Foundation
import Intents
import SwiftyBeaver
import Passepartout_Core
private let log = SwiftyBeaver.self

View File

@ -24,6 +24,7 @@
//
import UIKit
import Passepartout_Core
protocol AccountViewControllerDelegate: class {
func accountController(_: AccountViewController, didEnterCredentials credentials: Credentials)

View File

@ -26,6 +26,7 @@
import UIKit
import TunnelKit
import SwiftyBeaver
import Passepartout_Core
private let log = SwiftyBeaver.self

View File

@ -25,6 +25,7 @@
import UIKit
import SwiftyBeaver
import Passepartout_Core
private let log = SwiftyBeaver.self

View File

@ -25,6 +25,7 @@
import UIKit
import TunnelKit
import Passepartout_Core
protocol EndpointViewControllerDelegate: class {
func endpointController(_: EndpointViewController, didUpdateWithNewAddress newAddress: String?, newProtocol: EndpointProtocol?)

View File

@ -24,6 +24,7 @@
//
import UIKit
import Passepartout_Core
class AboutViewController: UITableViewController, TableModelHost {

View File

@ -24,6 +24,7 @@
//
import UIKit
import Passepartout_Core
class CreditsViewController: UITableViewController, TableModelHost {
private let licenses = AppConstants.License.all

View File

@ -26,6 +26,7 @@
import UIKit
import TunnelKit
import SwiftyBeaver
import Passepartout_Core
private let log = SwiftyBeaver.self

View File

@ -24,6 +24,7 @@
//
import UIKit
import Passepartout_Core
class LabelViewController: UIViewController {
@IBOutlet private weak var scrollView: UIScrollView?

View File

@ -24,6 +24,7 @@
//
import UIKit
import Passepartout_Core
// XXX: convoluted due to the separation of provider/host profiles

View File

@ -24,6 +24,7 @@
//
import UIKit
import Passepartout_Core
class VersionViewController: UIViewController {
@IBOutlet private weak var scrollView: UIScrollView?

View File

@ -26,6 +26,7 @@
import UIKit
import TunnelKit
import SwiftyBeaver
import Passepartout_Core
private let log = SwiftyBeaver.self

View File

@ -24,6 +24,7 @@
//
import UIKit
import Passepartout_Core
class WizardProviderViewController: UITableViewController {
var availableNames: [Infrastructure.Name] = []

View File

@ -24,6 +24,7 @@
//
import UIKit
import Passepartout_Core
protocol ProviderPoolViewControllerDelegate: class {
func providerPoolController(_: ProviderPoolViewController, didSelectPool pool: Pool)

View File

@ -24,6 +24,7 @@
//
import UIKit
import Passepartout_Core
protocol ProviderPresetViewControllerDelegate: class {
func providerPresetController(_: ProviderPresetViewController, didSelectPreset preset: InfrastructurePreset)

View File

@ -27,6 +27,7 @@ import UIKit
import NetworkExtension
import CoreTelephony
import TunnelKit
import Passepartout_Core
class ServiceViewController: UIViewController, TableModelHost {
@IBOutlet private weak var tableView: UITableView!
@ -511,6 +512,19 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
return ip
}
private func mappedTrustedNetworksRow(_ from: TrustedNetworksModel.RowType) -> RowType {
switch from {
case .trustsMobile:
return .trustedMobile
case .trustedWiFi:
return .trustedWiFi
case .addCurrentWiFi:
return .trustedAddCurrentWiFi
}
}
func numberOfSections(in tableView: UITableView) -> Int {
return model.count
}
@ -938,7 +952,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
trustedNetworks.delegate = self
trustedNetworks.load(from: service.preferences)
model.set(trustedNetworks.rows, in: .trusted)
model.set(trustedNetworks.rows.map { mappedTrustedNetworksRow($0) }, in: .trusted)
}
private func reloadVpnStatus() {
@ -1005,7 +1019,7 @@ extension ServiceViewController: TrustedNetworksModelDelegate {
}
func trustedNetworks(_: TrustedNetworksModel, shouldInsertWifiAt rowIndex: Int) {
model.set(trustedNetworks.rows, in: .trusted)
model.set(trustedNetworks.rows.map { mappedTrustedNetworksRow($0) }, in: .trusted)
tableView.insertRows(at: [IndexPath(row: rowIndex, section: trustedSectionIndex)], with: .bottom)
}
@ -1021,7 +1035,7 @@ extension ServiceViewController: TrustedNetworksModelDelegate {
}
func trustedNetworks(_: TrustedNetworksModel, shouldDeleteWifiAt rowIndex: Int) {
model.set(trustedNetworks.rows, in: .trusted)
model.set(trustedNetworks.rows.map { mappedTrustedNetworksRow($0) }, in: .trusted)
tableView.deleteRows(at: [IndexPath(row: rowIndex, section: trustedSectionIndex)], with: .top)
}

View File

@ -40,6 +40,14 @@ public protocol TrustedNetworksModelDelegate: class {
}
public class TrustedNetworksModel {
public enum RowType {
case trustsMobile
case trustedWiFi
case addCurrentWiFi
}
public private(set) var trustedWifis: [String: Bool]
public private(set) var sortedWifis: [String]
@ -49,9 +57,7 @@ public class TrustedNetworksModel {
public private(set) var trustsMobileNetwork: Bool
// FIXME
// public private(set) var rows: [ServiceViewController.RowType]
public private(set) var rows: [Int]
public private(set) var rows: [RowType]
#endif
public weak var delegate: TrustedNetworksModelDelegate?
@ -73,15 +79,14 @@ public class TrustedNetworksModel {
#if os(iOS)
trustsMobileNetwork = preferences.trustsMobileNetwork
// FIXME
// rows.removeAll()
// if hasMobileNetwork {
// rows.append(.trustedMobile)
// }
// for _ in sortedWifis {
// rows.append(.trustedWiFi)
// }
// rows.append(.trustedAddCurrentWiFi)
rows.removeAll()
if hasMobileNetwork {
rows.append(.trustsMobile)
}
for _ in sortedWifis {
rows.append(.trustedWiFi)
}
rows.append(.addCurrentWiFi)
#endif
}
@ -139,8 +144,7 @@ public class TrustedNetworksModel {
if !isDuplicate {
sortedWifis.insert(wifiToAdd, at: index)
#if os(iOS)
// FIXME
// rows.insert(.trustedWiFi, at: rowIndex)
rows.insert(.trustedWiFi, at: rowIndex)
#endif
delegate?.trustedNetworks(self, shouldInsertWifiAt: rowIndex)
} else {