Skip to content

Commit

Permalink
fixes merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Greer committed Nov 17, 2023
2 parents 3e10675 + d9aa189 commit 482eedc
Show file tree
Hide file tree
Showing 23 changed files with 516 additions and 62 deletions.
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,47 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## 6.4.16
### Added
- `sendRequestWithRetries` function added as part of the `NetworkHelperclass`
- For an API request that results in a 500-level error response, the SDK now executes up to five retries. Before each of the final three attempts, there is a two-second delay.

### Changed
- updates `sendRequest` in `RequestProcessorUtil` to retry the API request that resulted in a 401 response upon receipt of a new JWT
- updates `NetworkHelper` class logic to use `sendRequestWithRetries`method which wraps the original `networkSession.makeRequest`
- When an API request fails with a 401 because of an invalid JWT token, the SDK now immediately requests a new JWT token for the signed-in user.

## 6.4.15
### Added
- This release allows you to use projects hosted on Iterable's EU data center. If your project is hosted on Iterable's [European data center (EUDC)](https://support.iterable.com/hc/articles/17572750887444), configure the SDK to use Iterable's EU-based API endpoints:

_Swift_

```swift
let config = IterableConfig()
config.dataRegion = IterableDataRegion.EU
IterableAPI.initialize(apiKey: "<YOUR_API_KEY>", launchOptions: launchOptions, config: config)
```

_Objective-C_

```objectivec
IterableConfig *config = [[IterableConfig alloc] init];
config.dataRegion = IterableDataRegion.EU;
[IterableAPI initializeWithApiKey:@"<YOUR_API_KEY>" launchOptions:launchOptions config:config];
```
### Fixed
- Offline Mode is now off by default. Offline mode components will only load when the `offlineMode` configuration for RequestHandler is set to true.
### Changed
- Offline mode configuration now persists throughout the current app session. Changes will take effect from the next app session.
## 6.4.14
### Added
- Success and Failure handlers can now be passed to following functions:
`InAppManager.remove`, `InAppManager.setRead`, `IterableAPI.setEmail` and `IterableAPI.setUserId`
## 6.4.13
### Added
- `ITBNotificationServiceExtension` has a new optional delegate in the scenario of wanting to receive and pass along push information (e.g. Firebase)
Expand Down
2 changes: 1 addition & 1 deletion Iterable-iOS-AppExtensions.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "Iterable-iOS-AppExtensions"
s.module_name = "IterableAppExtensions"
s.version = "6.4.13"
s.version = "6.4.16"
s.summary = "App Extensions for Iterable SDK"

s.description = <<-DESC
Expand Down
2 changes: 1 addition & 1 deletion Iterable-iOS-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "Iterable-iOS-SDK"
s.module_name = "IterableSDK"
s.version = "6.4.13"
s.version = "6.4.16"
s.summary = "Iterable's official SDK for iOS"

s.description = <<-DESC
Expand Down
16 changes: 16 additions & 0 deletions swift-sdk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@
5B5AA717284F1A6D0093FED4 /* MockNetworkSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B5AA710284F1A6D0093FED4 /* MockNetworkSession.swift */; };
5B6C3C1127CE871F00B9A753 /* NavInboxSessionUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B6C3C1027CE871F00B9A753 /* NavInboxSessionUITests.swift */; };
5B88BC482805D09D004016E5 /* NetworkSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B88BC472805D09D004016E5 /* NetworkSession.swift */; };
9FF05EAC2AFEA5FA005311F7 /* MockAuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */; };
9FF05EAD2AFEA5FA005311F7 /* MockAuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */; };
9FF05EAE2AFEA5FA005311F7 /* MockAuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */; };
9FF05EAF2AFEA5FA005311F7 /* MockAuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */; };
9FF05EB02AFEA5FA005311F7 /* MockAuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */; };
9FF05EB12AFEA5FA005311F7 /* MockAuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */; };
9FF05EB22AFEA5FA005311F7 /* MockAuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */; };
AC02480822791E2100495FB9 /* IterableInboxNavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC02480722791E2100495FB9 /* IterableInboxNavigationViewController.swift */; };
AC02CAA6234E50B5006617E0 /* RegistrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC02CAA5234E50B5006617E0 /* RegistrationTests.swift */; };
AC03094B21E532470003A288 /* InAppPersistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC03094A21E532470003A288 /* InAppPersistence.swift */; };
Expand Down Expand Up @@ -594,6 +601,7 @@
5B6C3C1027CE871F00B9A753 /* NavInboxSessionUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavInboxSessionUITests.swift; sourceTree = "<group>"; };
5B88BC472805D09D004016E5 /* NetworkSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkSession.swift; sourceTree = "<group>"; };
5BFC7CED27FC9AF300E77479 /* inbox-ui-tests-app.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "inbox-ui-tests-app.entitlements"; sourceTree = "<group>"; };
9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAuthManager.swift; sourceTree = "<group>"; };
AC02480722791E2100495FB9 /* IterableInboxNavigationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IterableInboxNavigationViewController.swift; sourceTree = "<group>"; };
AC02CAA5234E50B5006617E0 /* RegistrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegistrationTests.swift; sourceTree = "<group>"; };
AC03094A21E532470003A288 /* InAppPersistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppPersistence.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1415,6 +1423,7 @@
5588DF7D28C04494000697D7 /* MockUrlDelegate.swift */,
5588DF8D28C044DE000697D7 /* MockUrlOpener.swift */,
5588DFD528C04683000697D7 /* MockWebView.swift */,
9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */,
);
path = common;
sourceTree = "<group>";
Expand Down Expand Up @@ -2153,6 +2162,7 @@
ACA2A91A24AB266F001DFD17 /* Mocks.swift in Sources */,
5588DFAB28C045AE000697D7 /* MockInAppFetcher.swift in Sources */,
AC29D05C24B5A7E000A9E019 /* CI.swift in Sources */,
9FF05EB12AFEA5FA005311F7 /* MockAuthManager.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -2166,6 +2176,7 @@
AC2C668720D3435700D46CC9 /* ActionRunnerTests.swift in Sources */,
00CB31B621096129004ACDEC /* TestUtils.swift in Sources */,
AC89661E2124FBCE0051A6CD /* AutoRegistrationTests.swift in Sources */,
9FF05EAF2AFEA5FA005311F7 /* MockAuthManager.swift in Sources */,
ACA8D1A921965B7D001B1332 /* InAppTests.swift in Sources */,
5588DFB928C045E3000697D7 /* MockInAppDelegate.swift in Sources */,
5588DFD128C0465E000697D7 /* MockAPNSTypeChecker.swift in Sources */,
Expand Down Expand Up @@ -2266,6 +2277,7 @@
buildActionMask = 2147483647;
files = (
5588DFB828C045E3000697D7 /* MockInAppDelegate.swift in Sources */,
9FF05EAE2AFEA5FA005311F7 /* MockAuthManager.swift in Sources */,
5588DF7028C0442D000697D7 /* MockDateProvider.swift in Sources */,
5588DFF028C046FF000697D7 /* MockMessageViewControllerEventTracker.swift in Sources */,
ACB37AB124026C1E0093A8EA /* SampleInboxViewDelegateImplementations.swift in Sources */,
Expand Down Expand Up @@ -2329,6 +2341,7 @@
ACC6A8502323910D003CC4BE /* UITestsHelper.swift in Sources */,
5588DFAA28C045AE000697D7 /* MockInAppFetcher.swift in Sources */,
ACFF4287246569D300FDF10D /* CommonExtensions.swift in Sources */,
9FF05EB02AFEA5FA005311F7 /* MockAuthManager.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -2355,6 +2368,7 @@
5588DFCE28C0465E000697D7 /* MockAPNSTypeChecker.swift in Sources */,
5588DFDE28C046B7000697D7 /* MockLocalStorage.swift in Sources */,
ACA8D1A52196309C001B1332 /* Common.swift in Sources */,
9FF05EAC2AFEA5FA005311F7 /* MockAuthManager.swift in Sources */,
5588DFB628C045E3000697D7 /* MockInAppDelegate.swift in Sources */,
5588DF8628C044BE000697D7 /* MockCustomActionDelegate.swift in Sources */,
AC995F992166EE490099A184 /* CommonMocks.swift in Sources */,
Expand Down Expand Up @@ -2393,6 +2407,7 @@
5588DF7C28C04463000697D7 /* MockNotificationResponse.swift in Sources */,
5588DFD428C0465E000697D7 /* MockAPNSTypeChecker.swift in Sources */,
5588DFE428C046B7000697D7 /* MockLocalStorage.swift in Sources */,
9FF05EB22AFEA5FA005311F7 /* MockAuthManager.swift in Sources */,
ACC362C924D2CA8C002C67BA /* Common.swift in Sources */,
ACC362C524D2C190002C67BA /* TaskProcessorTests.swift in Sources */,
AC2AED4224EBC60C000EE5F3 /* TaskRunnerTests.swift in Sources */,
Expand All @@ -2411,6 +2426,7 @@
5588DFE728C046D7000697D7 /* MockInboxState.swift in Sources */,
ACFF42A424656CCE00FDF10D /* ViewController.swift in Sources */,
5588DF7F28C04494000697D7 /* MockUrlDelegate.swift in Sources */,
9FF05EAD2AFEA5FA005311F7 /* MockAuthManager.swift in Sources */,
5588DF8728C044BE000697D7 /* MockCustomActionDelegate.swift in Sources */,
5588DFD728C04683000697D7 /* MockWebView.swift in Sources */,
5588DFEF28C046FF000697D7 /* MockMessageViewControllerEventTracker.swift in Sources */,
Expand Down
5 changes: 5 additions & 0 deletions swift-sdk.xcodeproj/xcshareddata/xcschemes/swift-sdk.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@
BlueprintName = "offline-events-tests"
ReferencedContainer = "container:swift-sdk.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "RequestHandlerTests/testFeatureFlagTurnOnOfflineMode()">
</Test>
</SkippedTests>
</TestableReference>
</Testables>
</TestAction>
Expand Down
5 changes: 5 additions & 0 deletions swift-sdk/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ enum JsonValue {
}
}

public enum IterableDataRegion {
public static let US = "https://api.iterable.com/api/"
public static let EU = "https://api.eu.iterable.com/api/"
}

public protocol JsonValueRepresentable {
var jsonValue: Any { get }
}
Expand Down
40 changes: 26 additions & 14 deletions swift-sdk/Internal/DependencyContainerProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,33 @@ extension DependencyContainerProtocol {
networkSession: networkSession,
deviceMetadata: deviceMetadata,
dateProvider: dateProvider)
if let persistenceContextProvider = createPersistenceContextProvider() {
lazy var offlineProcessor: OfflineRequestProcessor? = nil
lazy var healthMonitor: HealthMonitor? = nil
guard let persistenceContextProvider = createPersistenceContextProvider() else {
return RequestHandler(onlineProcessor: onlineProcessor,
offlineProcessor: nil,
healthMonitor: nil,
offlineMode: offlineMode)
}
if offlineMode {

let healthMonitorDataProvider = createHealthMonitorDataProvider(persistenceContextProvider: persistenceContextProvider)
let healthMonitor = HealthMonitor(dataProvider: healthMonitorDataProvider,
dateProvider: dateProvider,
networkSession: networkSession)
let offlineProcessor = OfflineRequestProcessor(apiKey: apiKey,
authProvider: authProvider,
authManager: authManager,
endpoint: endpoint,
deviceMetadata: deviceMetadata,
taskScheduler: createTaskScheduler(persistenceContextProvider: persistenceContextProvider,
healthMonitor: healthMonitor),
taskRunner: createTaskRunner(persistenceContextProvider: persistenceContextProvider,
healthMonitor: healthMonitor),
notificationCenter: notificationCenter)

healthMonitor = HealthMonitor(dataProvider: healthMonitorDataProvider,
dateProvider: dateProvider,
networkSession: networkSession)
offlineProcessor = OfflineRequestProcessor(apiKey: apiKey,
authProvider: authProvider,
authManager: authManager,
endpoint: endpoint,
deviceMetadata: deviceMetadata,
taskScheduler: createTaskScheduler(persistenceContextProvider: persistenceContextProvider,
healthMonitor: healthMonitor!),
taskRunner: createTaskRunner(persistenceContextProvider: persistenceContextProvider,
healthMonitor: healthMonitor!),
notificationCenter: notificationCenter)


return RequestHandler(onlineProcessor: onlineProcessor,
offlineProcessor: offlineProcessor,
healthMonitor: healthMonitor,
Expand Down
11 changes: 11 additions & 0 deletions swift-sdk/Internal/EmptyInAppManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Foundation
import UIKit

class EmptyInAppManager: IterableInternalInAppManagerProtocol {

func start() -> Pending<Bool, Error> {
Fulfill<Bool, Error>(value: true)
}
Expand Down Expand Up @@ -34,14 +35,24 @@ class EmptyInAppManager: IterableInternalInAppManagerProtocol {

func remove(message _: IterableInAppMessage) {}

func remove(message _: IterableInAppMessage, successHandler _: OnSuccessHandler?, failureHandler _: OnFailureHandler?) {}

func remove(message _: IterableInAppMessage, location _: InAppLocation) {}

func remove(message _: IterableInAppMessage, location _: InAppLocation, successHandler _: OnSuccessHandler?, failureHandler _: OnFailureHandler?) {}

func remove(message _: IterableInAppMessage, location _: InAppLocation, source _: InAppDeleteSource) {}

func remove(message _: IterableInAppMessage, location _: InAppLocation, source _: InAppDeleteSource, successHandler _: OnSuccessHandler?, failureHandler _: OnFailureHandler?) {}

func remove(message _: IterableInAppMessage, location _: InAppLocation, source _: InAppDeleteSource, inboxSessionId _: String?) {}

func remove(message _: IterableInAppMessage, location _: InAppLocation, source _: InAppDeleteSource, inboxSessionId _: String?, successHandler _: OnSuccessHandler?, failureHandler _: OnFailureHandler?) {}

func set(read _: Bool, forMessage _: IterableInAppMessage) {}

func set(read _: Bool, forMessage _: IterableInAppMessage, successHandler _: OnSuccessHandler?, failureHandler _: OnFailureHandler?) {}

func getMessage(withId _: String) -> IterableInAppMessage? {
nil
}
Expand Down
Loading

0 comments on commit 482eedc

Please sign in to comment.