Skip to content

Commit d0e0390

Browse files
committed
Merge branch 'master' into jay/MOB-4239-updateEmail-withToken
2 parents 4cbb35c + 5f061a9 commit d0e0390

18 files changed

+94
-241
lines changed

swift-sdk.xcodeproj/project.pbxproj

Lines changed: 53 additions & 37 deletions
Large diffs are not rendered by default.

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

Lines changed: 0 additions & 157 deletions
This file was deleted.

swift-sdk/Internal/IterableActionRunner.swift renamed to swift-sdk/Internal/ActionRunner.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AppUrlOpener: UrlOpenerProtocol {
2020
}
2121
}
2222

23-
struct IterableActionRunner {
23+
struct ActionRunner {
2424
// returns true if an action is performed either by us or by the calling app.
2525
@discardableResult
2626
static func execute(action: IterableAction,

swift-sdk/Internal/ApiClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class ApiClient {
8282
return .failure(IterableError.general(description: "authProvider is missing"))
8383
}
8484

85-
return .success(RequestCreator(apiKey: apiKey, auth: authProvider.auth, deviceMetadata: deviceMetadata))
85+
return .success(RequestCreator(auth: authProvider.auth, deviceMetadata: deviceMetadata))
8686
}
8787

8888
private let apiKey: String

swift-sdk/Internal/IterableDeepLinkManager.swift renamed to swift-sdk/Internal/DeepLinkManager.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
import Foundation
66

7-
class IterableDeepLinkManager: NSObject {
7+
class DeepLinkManager: NSObject {
88
init(redirectNetworkSessionProvider: RedirectNetworkSessionProvider) {
99
self.redirectNetworkSessionProvider = redirectNetworkSessionProvider
1010
}
11+
1112
/// Handles a Universal Link
1213
/// For Iterable links, it will track the click and retrieve the original URL,
1314
/// pass it to `IterableURLDelegate` for handling
@@ -28,7 +29,7 @@ class IterableDeepLinkManager: NSObject {
2829
if let action = IterableAction.actionOpenUrl(fromUrlString: resolvedUrlString) {
2930
let context = IterableActionContext(action: action, source: .universalLink)
3031

31-
IterableActionRunner.execute(action: action,
32+
ActionRunner.execute(action: action,
3233
context: context,
3334
urlHandler: IterableUtil.urlHandler(fromUrlDelegate: urlDelegate,
3435
inContext: context),
@@ -45,7 +46,7 @@ class IterableDeepLinkManager: NSObject {
4546
if let action = IterableAction.actionOpenUrl(fromUrlString: url.absoluteString) {
4647
let context = IterableActionContext(action: action, source: .universalLink)
4748

48-
IterableActionRunner.execute(action: action,
49+
ActionRunner.execute(action: action,
4950
context: context,
5051
urlHandler: IterableUtil.urlHandler(fromUrlDelegate: urlDelegate,
5152
inContext: context),
@@ -107,7 +108,7 @@ class IterableDeepLinkManager: NSObject {
107108
private var deepLinkMessageId: String?
108109
}
109110

110-
extension IterableDeepLinkManager: RedirectNetworkSessionDelegate {
111+
extension DeepLinkManager: RedirectNetworkSessionDelegate {
111112
func onRedirect(deepLinkLocation: URL?, campaignId: NSNumber?, templateId: NSNumber?, messageId: String?) {
112113
self.deepLinkLocation = deepLinkLocation
113114
self.deepLinkCampaignId = campaignId

swift-sdk/Internal/InAppManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ class InAppManager: NSObject, IterableInternalInAppManagerProtocol {
433433

434434
let context = IterableActionContext(action: action, source: .inApp)
435435
DispatchQueue.main.async { [weak self] in
436-
IterableActionRunner.execute(action: action,
436+
ActionRunner.execute(action: action,
437437
context: context,
438438
urlHandler: IterableUtil.urlHandler(fromUrlDelegate: self?.urlDelegate, inContext: context),
439439
customActionHandler: IterableUtil.customActionHandler(fromCustomActionDelegate: self?.customActionDelegate, inContext: context),

swift-sdk/Internal/InternalIterableAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
397397
private var networkSession: NetworkSessionProtocol
398398
private var urlOpener: UrlOpenerProtocol
399399

400-
private var deepLinkManager: IterableDeepLinkManager
400+
private var deepLinkManager: DeepLinkManager
401401

402402
private var _email: String?
403403
private var _userId: String?
@@ -547,7 +547,7 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
547547
localStorage = dependencyContainer.localStorage
548548
inAppDisplayer = dependencyContainer.inAppDisplayer
549549
urlOpener = dependencyContainer.urlOpener
550-
deepLinkManager = IterableDeepLinkManager(redirectNetworkSessionProvider: dependencyContainer)
550+
deepLinkManager = DeepLinkManager(redirectNetworkSessionProvider: dependencyContainer)
551551
}
552552

553553
func start() -> Pending<Bool, Error> {

swift-sdk/Internal/InternalIterableAppIntegration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ struct InternalIterableAppIntegration {
194194
// Execute the action
195195
if let action = action {
196196
let context = IterableActionContext(action: action, source: .push)
197-
IterableActionRunner.execute(action: action,
197+
ActionRunner.execute(action: action,
198198
context: context,
199199
urlHandler: IterableUtil.urlHandler(fromUrlDelegate: urlDelegate, inContext: context),
200200
customActionHandler: IterableUtil.customActionHandler(fromCustomActionDelegate: customActionDelegate, inContext: context),
@@ -289,7 +289,7 @@ struct InternalIterableAppIntegration {
289289
if let action = InternalIterableAppIntegration.createDefaultAction(userInfo: userInfo, iterableElement: itbl) {
290290
let context = IterableActionContext(action: action, source: .push)
291291

292-
IterableActionRunner.execute(action: action,
292+
ActionRunner.execute(action: action,
293293
context: context,
294294
urlHandler: IterableUtil.urlHandler(fromUrlDelegate: urlDelegate, inContext: context),
295295
customActionHandler: IterableUtil.customActionHandler(fromCustomActionDelegate: customActionDelegate, inContext: context),

swift-sdk/Internal/OfflineRequestProcessor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ struct OfflineRequestProcessor: RequestProcessorProtocol {
246246
private let taskRunner: IterableTaskRunner
247247

248248
private func createRequestCreator(authProvider: AuthProvider) -> RequestCreator {
249-
return RequestCreator(apiKey: apiKey, auth: authProvider.auth, deviceMetadata: deviceMetadata)
249+
return RequestCreator(auth: authProvider.auth, deviceMetadata: deviceMetadata)
250250
}
251251

252252
private func sendIterableRequest(requestGenerator: (RequestCreator) -> Result<IterableRequest, IterableError>,

swift-sdk/Internal/RequestCreator.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import UIKit
99
/// This will create IterableRequest
1010
/// The API Endpoint and request endpoint is not defined yet
1111
struct RequestCreator {
12-
let apiKey: String
1312
let auth: Auth
1413
let deviceMetadata: DeviceMetadata
1514

@@ -449,7 +448,7 @@ struct RequestCreator {
449448

450449
private func createPostRequest(path: String, body: [AnyHashable: Any]? = nil) -> PostRequest {
451450
PostRequest(path: path,
452-
args: [JsonKey.Header.apiKey: apiKey],
451+
args: nil,
453452
body: body)
454453
}
455454

tests/offline-events-tests/TaskProcessorTests.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class TaskProcessorTests: XCTestCase {
1919
let networkSession = MockNetworkSession()
2020
let internalAPI = InternalIterableAPI.initializeForTesting(apiKey: apiKey, config: config, networkSession: networkSession)
2121

22-
let requestCreator = RequestCreator(apiKey: apiKey,
23-
auth: auth,
22+
let requestCreator = RequestCreator(auth: auth,
2423
deviceMetadata: internalAPI.deviceMetadata)
2524
guard case let Result.success(trackEventRequest) = requestCreator.createTrackEventRequest(eventName, dataFields: dataFields) else {
2625
XCTFail("Could not create trackEvent request")
@@ -223,8 +222,7 @@ class TaskProcessorTests: XCTestCase {
223222
let dataFields = ["var1": "val1", "var2": "val2"]
224223

225224
let auth = Auth(userId: nil, email: email, authToken: nil)
226-
let requestCreator = RequestCreator(apiKey: apiKey,
227-
auth: auth,
225+
let requestCreator = RequestCreator(auth: auth,
228226
deviceMetadata: deviceMetadata)
229227
guard case let Result.success(trackEventRequest) = requestCreator.createTrackEventRequest(eventName, dataFields: dataFields) else {
230228
XCTFail("Could not create trackEvent request")

tests/offline-events-tests/TaskRunnerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class TaskRunnerTests: XCTestCase {
328328
let eventName = "CustomEvent1"
329329
let dataFields = ["var1": "val1", "var2": "val2"]
330330

331-
let requestCreator = RequestCreator(apiKey: apiKey, auth: auth, deviceMetadata: deviceMetadata)
331+
let requestCreator = RequestCreator(auth: auth, deviceMetadata: deviceMetadata)
332332
guard case let Result.success(trackEventRequest) = requestCreator.createTrackEventRequest(eventName, dataFields: dataFields) else {
333333
throw IterableError.general(description: "Could not create trackEvent request")
334334
}

tests/offline-events-tests/TaskSchedulerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TaskSchedulerTests: XCTestCase {
3131
expectation1.fulfill()
3232
}
3333
XCTAssertNotNil(reference)
34-
let requestCreator = RequestCreator(apiKey: apiKey, auth: auth, deviceMetadata: deviceMetadata)
34+
let requestCreator = RequestCreator(auth: auth, deviceMetadata: deviceMetadata)
3535
guard case let Result.success(trackEventRequest) = requestCreator.createTrackEventRequest(eventName, dataFields: dataFields) else {
3636
throw IterableError.general(description: "Could not create trackEvent request")
3737
}

tests/unit-tests/IterableActionRunnerTests.swift renamed to tests/unit-tests/ActionRunnerTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import XCTest
99
let testExpectationTimeout = 15.0 // How long to wait when we expect to succeed
1010
let testExpectationTimeoutForInverted = 1.0 // How long to wait when we expect to fail
1111

12-
class IterableActionRunnerTests: XCTestCase {
12+
class ActionRunnerTests: XCTestCase {
1313
func testUrlOpenAction() {
1414
validateUrlOpenAction(source: .push)
1515
validateUrlOpenAction(source: .inApp)
@@ -28,7 +28,7 @@ class IterableActionRunnerTests: XCTestCase {
2828
return true
2929
}
3030

31-
let handled = IterableActionRunner.execute(action: action,
31+
let handled = ActionRunner.execute(action: action,
3232
context: context,
3333
urlHandler: urlHandler,
3434
urlOpener: urlOpener)
@@ -50,7 +50,7 @@ class IterableActionRunnerTests: XCTestCase {
5050
return true
5151
}
5252

53-
let handled = IterableActionRunner.execute(action: action,
53+
let handled = ActionRunner.execute(action: action,
5454
context: context,
5555
customActionHandler: customActionHandler)
5656

@@ -69,7 +69,7 @@ class IterableActionRunnerTests: XCTestCase {
6969
return false
7070
}
7171

72-
let handled = IterableActionRunner.execute(action: action,
72+
let handled = ActionRunner.execute(action: action,
7373
context: context,
7474
customActionHandler: customActionHandler)
7575

@@ -94,7 +94,7 @@ class IterableActionRunnerTests: XCTestCase {
9494
expectation1.fulfill()
9595
}
9696

97-
let handled = IterableActionRunner.execute(action: action,
97+
let handled = ActionRunner.execute(action: action,
9898
context: context,
9999
urlHandler: nil,
100100
urlOpener: urlOpener)
@@ -115,7 +115,7 @@ class IterableActionRunnerTests: XCTestCase {
115115
expectation1.fulfill()
116116
}
117117

118-
IterableActionRunner.execute(action: action,
118+
ActionRunner.execute(action: action,
119119
context: context,
120120
urlHandler: nil,
121121
urlOpener: urlOpener)
@@ -134,7 +134,7 @@ class IterableActionRunnerTests: XCTestCase {
134134
expectation1.fulfill()
135135
}
136136

137-
IterableActionRunner.execute(action: action,
137+
ActionRunner.execute(action: action,
138138
context: context,
139139
urlHandler: nil,
140140
urlOpener: urlOpener,
@@ -155,7 +155,7 @@ class IterableActionRunnerTests: XCTestCase {
155155
return false
156156
}
157157

158-
let handled = IterableActionRunner.execute(action: action,
158+
let handled = ActionRunner.execute(action: action,
159159
context: context,
160160
urlHandler: urlHandler,
161161
urlOpener: urlOpener)

0 commit comments

Comments
 (0)