Skip to content

Commit 9231662

Browse files
authored
Merge pull request #586 from Iterable/MOB-5337-InAppDisplayInterval-resolution
2 parents 1e25b42 + 9ed89ea commit 9231662

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

swift-sdk/Internal/DependencyContainer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extension DependencyContainerProtocol {
4747
applicationStateProvider: applicationStateProvider,
4848
notificationCenter: notificationCenter,
4949
dateProvider: dateProvider,
50-
retryInterval: config.inAppDisplayInterval)
50+
moveToForegroundSyncInterval: config.inAppDisplayInterval)
5151
}
5252

5353
func createAuthManager(config: IterableConfig) -> IterableAuthManagerProtocol {

swift-sdk/Internal/InAppManager.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class InAppManager: NSObject, IterableInternalInAppManagerProtocol {
4040
applicationStateProvider: ApplicationStateProviderProtocol,
4141
notificationCenter: NotificationCenterProtocol,
4242
dateProvider: DateProviderProtocol,
43-
retryInterval: Double) {
43+
moveToForegroundSyncInterval: Double) {
4444
ITBInfo()
4545

4646
self.requestHandler = requestHandler
@@ -56,7 +56,7 @@ class InAppManager: NSObject, IterableInternalInAppManagerProtocol {
5656
self.applicationStateProvider = applicationStateProvider
5757
self.notificationCenter = notificationCenter
5858
self.dateProvider = dateProvider
59-
self.retryInterval = retryInterval
59+
self.moveToForegroundSyncInterval = moveToForegroundSyncInterval
6060

6161
super.init()
6262

@@ -391,7 +391,7 @@ class InAppManager: NSObject, IterableInternalInAppManagerProtocol {
391391
// How long do we have to wait before showing the message
392392
// > 0 means wait, otherwise we are good to show
393393
private func getInAppShowingWaitTimeInterval() -> TimeInterval {
394-
InAppManager.getWaitTimeInterval(fromLastTime: lastDismissedTime, currentTime: dateProvider.currentDate, gap: retryInterval)
394+
InAppManager.getWaitTimeInterval(fromLastTime: lastDismissedTime, currentTime: dateProvider.currentDate, gap: moveToForegroundSyncInterval)
395395
}
396396

397397
// How long do we have to wait?
@@ -521,7 +521,6 @@ class InAppManager: NSObject, IterableInternalInAppManagerProtocol {
521521
private let persister: InAppPersistenceProtocol
522522
private var messagesMap = OrderedDictionary<String, IterableInAppMessage>()
523523
private let dateProvider: DateProviderProtocol
524-
private let retryInterval: TimeInterval // in seconds, if a message is already showing how long to wait?
525524
private var lastDismissedTime: Date?
526525
private var lastDisplayTime: Date?
527526

@@ -532,7 +531,7 @@ class InAppManager: NSObject, IterableInternalInAppManagerProtocol {
532531

533532
private var syncResult: Pending<Bool, Error>?
534533
private var lastSyncTime: Date?
535-
private let moveToForegroundSyncInterval: Double = 1.0 * 60.0 // don't sync within sixty seconds
534+
private var moveToForegroundSyncInterval: Double = 1.0 * 60.0 // don't sync within sixty seconds
536535
private var autoDisplayPaused = false
537536
}
538537

@@ -621,13 +620,13 @@ extension InAppManager: InAppDisplayChecker {
621620
return false
622621
}
623622

624-
guard InAppManager.getWaitTimeInterval(fromLastTime: lastDismissedTime, currentTime: dateProvider.currentDate, gap: retryInterval) <= 0 else {
625-
ITBInfo("can't display within retryInterval window")
623+
guard InAppManager.getWaitTimeInterval(fromLastTime: lastDismissedTime, currentTime: dateProvider.currentDate, gap: moveToForegroundSyncInterval) <= 0 else {
624+
ITBInfo("can't display within configured In-App display interval window")
626625
return false
627626
}
628627

629-
guard InAppManager.getWaitTimeInterval(fromLastTime: lastDisplayTime, currentTime: dateProvider.currentDate, gap: retryInterval) <= 0 else {
630-
ITBInfo("can't display within retryInterval window")
628+
guard InAppManager.getWaitTimeInterval(fromLastTime: lastDisplayTime, currentTime: dateProvider.currentDate, gap: moveToForegroundSyncInterval) <= 0 else {
629+
ITBInfo("can't display within configured In-App display window")
631630
return false
632631
}
633632

0 commit comments

Comments
 (0)