Create Passepartout-Core framework target

Move all sources to this target, out of Passepartout-iOS.

FIXME: TrustedNetworks uses ServiceViewController.RowType
FIXME: make iOS target depend on Core.
This commit is contained in:
Davide De Rosa 2019-03-18 10:51:16 +01:00
parent 8adc125f9b
commit c7f522f55e
12 changed files with 655 additions and 280 deletions

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
</plist>

View File

@ -0,0 +1,36 @@
//
// Passepartout_Core.h
// Passepartout-Core
//
// Created by Davide De Rosa on 3/18/19.
// Copyright (c) 2019 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of Passepartout.
//
// Passepartout is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Passepartout is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
//
#import <UIKit/UIKit.h>
//! Project version number for Passepartout_Core.
FOUNDATION_EXPORT double Passepartout_CoreVersionNumber;
//! Project version string for Passepartout_Core.
FOUNDATION_EXPORT const unsigned char Passepartout_CoreVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <Passepartout_Core/PublicHeader.h>

View File

@ -1,6 +1,6 @@
//
// ConnectionServiceTests.swift
// PassepartoutTests-iOS
// Passepartout-CoreTests
//
// Created by Davide De Rosa on 10/25/18.
// Copyright (c) 2019 Davide De Rosa. All rights reserved.
@ -25,7 +25,7 @@
import XCTest
import TunnelKit
@testable import Passepartout
@testable import Passepartout_Core
class ConnectionServiceTests: XCTestCase {
let url = Bundle(for: ConnectionServiceTests.self).url(forResource: "ConnectionService", withExtension: "json")!

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0</string>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>

View File

@ -1,6 +1,6 @@
//
// InfrastructureTests.swift
// PassepartoutTests-iOS
// Passepartout-CoreTests
//
// Created by Davide De Rosa on 6/11/18.
// Copyright (c) 2019 Davide De Rosa. All rights reserved.
@ -24,7 +24,7 @@
//
import XCTest
@testable import Passepartout
@testable import Passepartout_Core
import TunnelKit
class InfrastructureTests: XCTestCase {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E31529A223F9EF400F61841"
BuildableName = "Passepartout_Core.framework"
BlueprintName = "Passepartout-Core"
ReferencedContainer = "container:Passepartout.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E3152A2223F9EF500F61841"
BuildableName = "Passepartout-CoreTests.xctest"
BlueprintName = "Passepartout-CoreTests"
ReferencedContainer = "container:Passepartout.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E31529A223F9EF400F61841"
BuildableName = "Passepartout_Core.framework"
BlueprintName = "Passepartout-Core"
ReferencedContainer = "container:Passepartout.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E31529A223F9EF400F61841"
BuildableName = "Passepartout_Core.framework"
BlueprintName = "Passepartout-Core"
ReferencedContainer = "container:Passepartout.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E31529A223F9EF400F61841"
BuildableName = "Passepartout_Core.framework"
BlueprintName = "Passepartout-Core"
ReferencedContainer = "container:Passepartout.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -52,6 +52,16 @@
ReferencedContainer = "container:Passepartout.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E3152A2223F9EF500F61841"
BuildableName = "Passepartout-CoreTests.xctest"
BlueprintName = "Passepartout-CoreTests"
ReferencedContainer = "container:Passepartout.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference

View File

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

13
Podfile
View File

@ -7,6 +7,15 @@ def shared_pods
#pod 'TunnelKit', :path => '../../personal/tunnelkit'
end
target 'Passepartout-Core' do
platform :ios, '11.0'
shared_pods
end
target 'Passepartout-CoreTests' do
platform :ios, '11.0'
shared_pods
end
target 'Passepartout-iOS' do
platform :ios, '11.0'
shared_pods
@ -16,7 +25,3 @@ target 'Passepartout-iOS-Tunnel' do
platform :ios, '11.0'
shared_pods
end
target 'PassepartoutTests-iOS' do
platform :ios, '11.0'
shared_pods
end

View File

@ -38,6 +38,6 @@ SPEC CHECKSUMS:
SwiftyBeaver: 8e67ab3cd94389cbbb7a9c7cc02748d98bfee68e
TunnelKit: 194e6f60cf5cbddfee1a24be6c7c540f70bdeb5f
PODFILE CHECKSUM: f04a8e2af82ae2ca7466dc8a0972f249a3f9686b
PODFILE CHECKSUM: 64da54acbd606b0276608ce8645845fd78836149
COCOAPODS: 1.6.1