Skip to content

Commit 9e96ed7

Browse files
authored
Merge branch 'master' into privacyinfo-podspec
2 parents 9629c5e + ea91ae9 commit 9e96ed7

File tree

9 files changed

+27
-53
lines changed

9 files changed

+27
-53
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,12 @@ build2/
1818
# needed integration testing
1919
env_vars.sh
2020
CI.swift
21+
*.swiftmodule
22+
*.timestamp
23+
*.modulemap
24+
*.pcm
25+
.build/arm64-apple-macosx/debug/IterableSDK.build/DerivedSources/resource_bundle_accessor.swift
26+
.build/arm64-apple-macosx/debug/index/db/v13/p25195--4de704/lock.mdb
27+
.build/arm64-apple-macosx/debug/index/db/v13/p25195--4de704/data.mdb
28+
.build/workspace-state.json
29+
*.mdb

Iterable-iOS-SDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
1212
s.license = "MIT"
1313
s.author = { "Jay Kim" => "jay.kim@iterable.com" }
1414

15-
s.platform = :ios, "10.0"
15+
s.platform = :ios, "12.0"
1616
s.source = { :git => "https://github.com/Iterable/swift-sdk.git", :tag => s.version }
1717
s.source_files = "swift-sdk/**/*.{h,m,swift}"
1818
s.exclude_files = "swift-sdk/swiftui/**"

swift-sdk.xcodeproj/xcshareddata/xcschemes/swift-sdk.xcscheme

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,18 @@
211211
ReferencedContainer = "container:swift-sdk.xcodeproj">
212212
</BuildableReference>
213213
<SkippedTests>
214+
<Test
215+
Identifier = "NetworkConnectivityManagerTests/testConnectivityChange()">
216+
</Test>
217+
<Test
218+
Identifier = "NetworkConnectivityManagerTests/testPollingNetworkMonitor()">
219+
</Test>
214220
<Test
215221
Identifier = "RequestHandlerTests/testFeatureFlagTurnOnOfflineMode()">
216222
</Test>
223+
<Test
224+
Identifier = "TaskRunnerTests/testResumeWhenNetworkIsBackOnline()">
225+
</Test>
217226
</SkippedTests>
218227
</TestableReference>
219228
</Testables>

swift-sdk/Internal/InAppCalculations.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ struct InAppCalculations {
9595
}
9696

9797
static func safeAreaInsets(for view: UIView) -> UIEdgeInsets {
98-
if #available(iOS 11, *) {
9998
return view.safeAreaInsets
100-
} else {
101-
return .zero
102-
}
10399
}
104100

105101
static func calculateWebViewPosition(safeAreaInsets: UIEdgeInsets,

swift-sdk/Internal/NetworkConnectivityManager.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ class NetworkConnectivityManager: NSObject {
9393
}
9494

9595
private static func createNetworkMonitor() -> NetworkMonitorProtocol {
96-
if #available(iOS 12, *) {
97-
return NetworkMonitor()
98-
} else {
99-
return PollingNetworkMonitor()
100-
}
96+
return NetworkMonitor()
10197
}
10298

10399
private let notificationCenter: NotificationCenterProtocol

swift-sdk/Internal/NetworkMonitor.swift

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ protocol NetworkMonitorProtocol {
1717
var statusUpdatedCallback: (() -> Void)? { get set }
1818
}
1919

20-
@available(iOS 12.0, *)
2120
class NetworkMonitor: NetworkMonitorProtocol {
2221
init() {
2322
ITBInfo()
@@ -51,37 +50,3 @@ class NetworkMonitor: NetworkMonitorProtocol {
5150
private weak var networkMonitor: NWPathMonitor?
5251
private let queue = DispatchQueue(label: "NetworkMonitor")
5352
}
54-
55-
/// This is used for pre-iOS 12.0 because `NWPathMonitor` is not available.
56-
class PollingNetworkMonitor: NetworkMonitorProtocol {
57-
init(pollingInterval: TimeInterval? = nil) {
58-
ITBInfo()
59-
self.pollingInterval = pollingInterval ?? Self.defaultPollingInterval
60-
}
61-
62-
deinit {
63-
ITBInfo()
64-
}
65-
66-
var statusUpdatedCallback: (() -> Void)?
67-
68-
func start() {
69-
ITBInfo()
70-
timer = DispatchSource.makeTimerSource()
71-
timer?.setEventHandler(handler: {[weak self] in
72-
self?.statusUpdatedCallback?()
73-
})
74-
timer?.schedule(deadline: .now() + pollingInterval, repeating: pollingInterval)
75-
timer?.activate()
76-
}
77-
78-
func stop() {
79-
ITBInfo()
80-
timer?.cancel()
81-
}
82-
83-
private var pollingInterval: TimeInterval
84-
private static let defaultPollingInterval: TimeInterval = 5 * 60
85-
86-
private var timer: DispatchSourceTimer?
87-
}

swift-sdk/IterableInboxNavigationViewController.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ open class IterableInboxNavigationViewController: UINavigationController {
7474
/// This does not have any effect below iOS 11.
7575
@IBInspectable public var largeTitles: Bool = false {
7676
didSet {
77-
if #available(iOS 11.0, *) {
78-
navigationBar.prefersLargeTitles = largeTitles
79-
}
77+
navigationBar.prefersLargeTitles = largeTitles
8078
}
8179
}
8280

tests/offline-events-tests/NetworkConnectivityManagerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class NetworkConnectivityManagerTests: XCTestCase {
5050
func testPollingNetworkMonitor() throws {
5151
let expectation1 = expectation(description: "do not fulfill before start")
5252
expectation1.isInverted = true
53-
let monitor = PollingNetworkMonitor(pollingInterval: 0.2)
53+
let monitor = NetworkMonitor()
5454
monitor.statusUpdatedCallback = {
5555
expectation1.fulfill()
5656
}
@@ -85,7 +85,7 @@ class NetworkConnectivityManagerTests: XCTestCase {
8585
func testConnectivityChange() throws {
8686
let networkSession = MockNetworkSession()
8787
let checker = NetworkConnectivityChecker(networkSession: networkSession)
88-
let monitor = PollingNetworkMonitor(pollingInterval: 0.5)
88+
let monitor = NetworkMonitor()
8989
let notificationCenter = MockNotificationCenter()
9090
let manager = NetworkConnectivityManager(networkMonitor: monitor,
9191
connectivityChecker: checker,

tests/offline-events-tests/TaskRunnerTests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class TaskRunnerTests: XCTestCase {
150150
func testDoNotRunWhenNetworkIsOffline() throws {
151151
let networkSession = MockNetworkSession(statusCode: 401, data: nil, error: IterableError.general(description: "Mock error"))
152152
let checker = NetworkConnectivityChecker(networkSession: networkSession)
153-
let monitor = PollingNetworkMonitor(pollingInterval: 0.2)
153+
let monitor = NetworkMonitor()
154154
let notificationCenter = MockNotificationCenter()
155155
let manager = NetworkConnectivityManager(networkMonitor: monitor,
156156
connectivityChecker: checker,
@@ -185,7 +185,8 @@ class TaskRunnerTests: XCTestCase {
185185
func testResumeWhenNetworkIsBackOnline() throws {
186186
let networkSession = MockNetworkSession(statusCode: 401, json: [:], error: IterableError.general(description: "Mock error"))
187187
let checker = NetworkConnectivityChecker(networkSession: networkSession)
188-
let monitor = PollingNetworkMonitor(pollingInterval: 0.2)
188+
let monitor = NetworkMonitor()
189+
monitor.start()
189190
let notificationCenter = MockNotificationCenter()
190191
let manager = NetworkConnectivityManager(networkMonitor: monitor,
191192
connectivityChecker: checker,
@@ -227,7 +228,7 @@ class TaskRunnerTests: XCTestCase {
227228
func testForegroundBackgroundChange() throws {
228229
let networkSession = MockNetworkSession()
229230
let checker = NetworkConnectivityChecker(networkSession: networkSession)
230-
let monitor = PollingNetworkMonitor(pollingInterval: 0.5)
231+
let monitor = NetworkMonitor()
231232
let notificationCenter = MockNotificationCenter()
232233
let manager = NetworkConnectivityManager(networkMonitor: monitor,
233234
connectivityChecker: checker,

0 commit comments

Comments
 (0)