Skip to content

Commit c0736f0

Browse files
Merge pull request #507 from Iterable/tapash/mob-2832-network-session
[MOB-2832] - Do not expose networkSession from InternalAPI.
2 parents e05a6ef + 7344794 commit c0736f0

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

swift-sdk/Internal/InboxViewControllerViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class InboxViewControllerViewModel: InboxViewControllerViewModelProtocol {
134134
}
135135

136136
private func loadImage(forMessageId messageId: String, fromUrl url: URL) {
137-
if let networkSession = internalAPI?.networkSession {
137+
if let networkSession = internalAPI?.dependencyContainer.networkSession {
138138
NetworkHelper.getData(fromUrl: url, usingSession: networkSession).onSuccess { [weak self] in
139139
self?.setImageData($0, forMessageId: messageId)
140140
}.onError {

swift-sdk/Internal/InternalIterableAPI.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
5858
var auth: Auth {
5959
Auth(userId: userId, email: email, authToken: authManager.getAuthToken())
6060
}
61+
62+
var dependencyContainer: DependencyContainerProtocol
6163

6264
lazy var inAppManager: IterableInternalInAppManagerProtocol = {
6365
self.dependencyContainer.createInAppManager(config: self.config,
@@ -376,9 +378,8 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
376378
private let inAppDisplayer: InAppDisplayerProtocol
377379
private var notificationStateProvider: NotificationStateProviderProtocol
378380
private var localStorage: LocalStorageProtocol
379-
var networkSession: NetworkSessionProtocol
381+
private var networkSession: NetworkSessionProtocol
380382
private var urlOpener: UrlOpenerProtocol
381-
private var dependencyContainer: DependencyContainerProtocol
382383

383384
private var deepLinkManager: IterableDeepLinkManager
384385

tests/common/CommonMocks.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,6 @@ class MockWebView: WebViewProtocol {
561561
}
562562
}
563563

564-
struct MockInjectedDependencyModule {
565-
let webView: WebViewProtocol
566-
}
567-
568564
class MockLocalStorage: LocalStorageProtocol {
569565
var userId: String? = nil
570566

tests/offline-events-tests/TaskProcessorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class TaskProcessorTests: XCTestCase {
4747
let found = try persistenceProvider.mainQueueContext().findTask(withId: taskId)!
4848

4949
// process data
50-
let processor = IterableAPICallTaskProcessor(networkSession: internalAPI.networkSession)
50+
let processor = IterableAPICallTaskProcessor(networkSession: networkSession)
5151
try processor.process(task: found).onSuccess { _ in
5252
let request = networkSession.getRequest(withEndPoint: Const.Path.trackEvent)!
5353
let body = request.httpBody!.json() as! [String: Any]

0 commit comments

Comments
 (0)