Skip to content

Commit 641350b

Browse files
authored
[MOBILE-4653] Fix resuming display not displaying IAX (#1491)
* [MOBILE-4653] Fix resuming display not displaying IAX * Release 18.1.6
1 parent a2616b5 commit 641350b

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
[Migration Guides](https://github.com/urbanairship/android-library/tree/main/documentation/migration)
44

5+
6+
## Version 18.1.6 August 9, 2024
7+
Patch release that fixes in-app experience displays when resuming from a paused state. Apps that use in-app experiences are encouraged to update.
8+
9+
### Changes
10+
- Fixed Automation Engine updates when pause state changes.
11+
512
## Version 18.1.5, August 06, 2024
613
Patch release that fixes test devices audience check and holdout group experiments displays.
714

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
buildscript {
22
ext {
33
// Airship Version - major.minor.patch
4-
airshipVersion = '18.1.5'
4+
airshipVersion = '18.1.6'
55

66
// Airship Version Qualifier beta, release, etc...
77
// airshipVersionQualifier = "alpha"

urbanairship-automation/src/main/java/com/urbanairship/automation/engine/AutomationEngine.kt

+14
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ import kotlinx.coroutines.SupervisorJob
2222
import kotlinx.coroutines.async
2323
import kotlinx.coroutines.cancelChildren
2424
import kotlinx.coroutines.flow.MutableStateFlow
25+
import kotlinx.coroutines.flow.combine
26+
import kotlinx.coroutines.flow.distinctUntilChanged
27+
import kotlinx.coroutines.flow.drop
2528
import kotlinx.coroutines.flow.first
29+
import kotlinx.coroutines.flow.skip
2630
import kotlinx.coroutines.flow.update
2731
import kotlinx.coroutines.isActive
2832
import kotlinx.coroutines.launch
@@ -122,6 +126,16 @@ internal class AutomationEngine(
122126
}
123127
}
124128
}
129+
130+
launch {
131+
combine(isPaused, isExecutionPaused) { enginePaused, executionPaused ->
132+
enginePaused || executionPaused
133+
}.distinctUntilChanged().collect { paused ->
134+
if (isActive && !paused) {
135+
scheduleConditionsChangedNotifier.notifyChanged()
136+
}
137+
}
138+
}
125139
}
126140
}
127141

urbanairship-automation/src/test/java/com/urbanairship/automation/AutomationEngineTest.kt

+30-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import io.mockk.coVerifyOrder
3030
import io.mockk.coVerifySequence
3131
import io.mockk.every
3232
import io.mockk.mockk
33+
import io.mockk.verify
3334
import junit.framework.TestCase.assertFalse
3435
import junit.framework.TestCase.assertNotNull
3536
import junit.framework.TestCase.assertNull
@@ -95,6 +96,8 @@ public class AutomationEngineTest {
9596

9697
private val delayProcessor: AutomationDelayProcessor = mockk(relaxed = true)
9798

99+
private val scheduleConditionsChangedNotifier: ScheduleConditionsChangedNotifier = mockk(relaxed = true)
100+
98101
private val sleeper = TestTaskSleeper(clock) { sleep ->
99102
clock.currentTimeMillis += sleep.inWholeMilliseconds
100103
}
@@ -103,7 +106,7 @@ public class AutomationEngineTest {
103106
store = store,
104107
executor = executor,
105108
preparer = preparer,
106-
scheduleConditionsChangedNotifier = ScheduleConditionsChangedNotifier(),
109+
scheduleConditionsChangedNotifier = scheduleConditionsChangedNotifier,
107110
eventsFeed = eventsFeed,
108111
triggerProcessor = triggerProcessor,
109112
delayProcessor = delayProcessor,
@@ -196,6 +199,32 @@ public class AutomationEngineTest {
196199
assertFalse(engine.isPaused())
197200
}
198201

202+
@Test
203+
public fun testResumeNotifiesScheduleConditionsChanged(): TestResult = runTest {
204+
engine.setExecutionPaused(true)
205+
engine.setEnginePaused(true)
206+
engine.start()
207+
advanceUntilIdle()
208+
209+
verify(exactly = 0) {
210+
scheduleConditionsChangedNotifier.notifyChanged()
211+
}
212+
213+
engine.setExecutionPaused(false)
214+
advanceUntilIdle()
215+
216+
verify(exactly = 0) {
217+
scheduleConditionsChangedNotifier.notifyChanged()
218+
}
219+
220+
engine.setEnginePaused(false)
221+
advanceUntilIdle()
222+
223+
verify(exactly = 1) {
224+
scheduleConditionsChangedNotifier.notifyChanged()
225+
}
226+
}
227+
199228
@Test
200229
public fun testSetExecutionPaused(): TestResult = runTest {
201230
coEvery { store.updateSchedule(eq("test"), any()) } answers { scheduleData }

0 commit comments

Comments
 (0)