Skip to content

Commit 39af212

Browse files
committed
fix tests
1 parent 5e29ca5 commit 39af212

File tree

3 files changed

+58
-4
lines changed

3 files changed

+58
-4
lines changed

apps/example/ios/Tests/SkipTests.swift

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import FamilyControls
12
import XCTest
23

34
class NeverTriggerBeforeTests: XCTestCase {
@@ -19,6 +20,9 @@ class NeverTriggerBeforeTests: XCTestCase {
1920
skipIfAlreadyTriggeredBefore: nil,
2021
skipIfAlreadyTriggeredBetweenFromDate: nil,
2122
skipIfAlreadyTriggeredBetweenToDate: nil,
23+
skipIfWhitelistOrBlacklistIsUnchanged: false,
24+
originalWhitelist: FamilyActivitySelection(),
25+
originalBlocklist: FamilyActivitySelection(),
2226
activityName: activityName,
2327
callbackName: callbackName,
2428
eventName: eventName
@@ -34,6 +38,9 @@ class NeverTriggerBeforeTests: XCTestCase {
3438
skipIfAlreadyTriggeredBefore: nil,
3539
skipIfAlreadyTriggeredBetweenFromDate: nil,
3640
skipIfAlreadyTriggeredBetweenToDate: nil,
41+
skipIfWhitelistOrBlacklistIsUnchanged: false,
42+
originalWhitelist: FamilyActivitySelection(),
43+
originalBlocklist: FamilyActivitySelection(),
3744
activityName: activityName,
3845
callbackName: callbackName,
3946
eventName: eventName
@@ -69,6 +76,9 @@ class SkipIfTriggeredBeforeTests: XCTestCase {
6976
skipIfAlreadyTriggeredBefore: 1001,
7077
skipIfAlreadyTriggeredBetweenFromDate: nil,
7178
skipIfAlreadyTriggeredBetweenToDate: nil,
79+
skipIfWhitelistOrBlacklistIsUnchanged: false,
80+
originalWhitelist: FamilyActivitySelection(),
81+
originalBlocklist: FamilyActivitySelection(),
7282
activityName: activityName,
7383
callbackName: callbackName,
7484
eventName: eventName
@@ -84,6 +94,9 @@ class SkipIfTriggeredBeforeTests: XCTestCase {
8494
skipIfAlreadyTriggeredBefore: 1000,
8595
skipIfAlreadyTriggeredBetweenFromDate: nil,
8696
skipIfAlreadyTriggeredBetweenToDate: nil,
97+
skipIfWhitelistOrBlacklistIsUnchanged: false,
98+
originalWhitelist: FamilyActivitySelection(),
99+
originalBlocklist: FamilyActivitySelection(),
87100
activityName: activityName,
88101
callbackName: callbackName,
89102
eventName: eventName
@@ -118,6 +131,9 @@ class SkipIfAlreadyTriggeredBetweenTests: XCTestCase {
118131
skipIfAlreadyTriggeredBefore: nil,
119132
skipIfAlreadyTriggeredBetweenFromDate: 500,
120133
skipIfAlreadyTriggeredBetweenToDate: 1500,
134+
skipIfWhitelistOrBlacklistIsUnchanged: false,
135+
originalWhitelist: FamilyActivitySelection(),
136+
originalBlocklist: FamilyActivitySelection(),
121137
activityName: activityName,
122138
callbackName: callbackName,
123139
eventName: eventName
@@ -133,6 +149,9 @@ class SkipIfAlreadyTriggeredBetweenTests: XCTestCase {
133149
skipIfAlreadyTriggeredBefore: nil,
134150
skipIfAlreadyTriggeredBetweenFromDate: 1001,
135151
skipIfAlreadyTriggeredBetweenToDate: 1500,
152+
skipIfWhitelistOrBlacklistIsUnchanged: false,
153+
originalWhitelist: FamilyActivitySelection(),
154+
originalBlocklist: FamilyActivitySelection(),
136155
activityName: activityName,
137156
callbackName: callbackName,
138157
eventName: eventName
@@ -148,6 +167,9 @@ class SkipIfAlreadyTriggeredBetweenTests: XCTestCase {
148167
skipIfAlreadyTriggeredBefore: nil,
149168
skipIfAlreadyTriggeredBetweenFromDate: 500,
150169
skipIfAlreadyTriggeredBetweenToDate: 999,
170+
skipIfWhitelistOrBlacklistIsUnchanged: false,
171+
originalWhitelist: FamilyActivitySelection(),
172+
originalBlocklist: FamilyActivitySelection(),
151173
activityName: activityName,
152174
callbackName: callbackName,
153175
eventName: eventName
@@ -180,6 +202,9 @@ class SkipIfAlreadyTriggeredBetweenTests: XCTestCase {
180202
skipIfAlreadyTriggeredBefore: nil,
181203
skipIfAlreadyTriggeredBetweenFromDate: nil,
182204
skipIfAlreadyTriggeredBetweenToDate: nil,
205+
skipIfWhitelistOrBlacklistIsUnchanged: false,
206+
originalWhitelist: FamilyActivitySelection(),
207+
originalBlocklist: FamilyActivitySelection(),
183208
activityName: activityName,
184209
callbackName: callbackName,
185210
eventName: eventName
@@ -195,6 +220,9 @@ class SkipIfAlreadyTriggeredBetweenTests: XCTestCase {
195220
skipIfAlreadyTriggeredBefore: nil,
196221
skipIfAlreadyTriggeredBetweenFromDate: nil,
197222
skipIfAlreadyTriggeredBetweenToDate: nil,
223+
skipIfWhitelistOrBlacklistIsUnchanged: false,
224+
originalWhitelist: FamilyActivitySelection(),
225+
originalBlocklist: FamilyActivitySelection(),
198226
activityName: activityName,
199227
callbackName: callbackName,
200228
eventName: eventName
@@ -228,6 +256,9 @@ class SkipIfAlreadyTriggeredBetweenTests: XCTestCase {
228256
skipIfAlreadyTriggeredBefore: nil,
229257
skipIfAlreadyTriggeredBetweenFromDate: nil,
230258
skipIfAlreadyTriggeredBetweenToDate: nil,
259+
skipIfWhitelistOrBlacklistIsUnchanged: false,
260+
originalWhitelist: FamilyActivitySelection(),
261+
originalBlocklist: FamilyActivitySelection(),
231262
activityName: activityName,
232263
callbackName: callbackName,
233264
eventName: eventName
@@ -243,6 +274,9 @@ class SkipIfAlreadyTriggeredBetweenTests: XCTestCase {
243274
skipIfAlreadyTriggeredBefore: nil,
244275
skipIfAlreadyTriggeredBetweenFromDate: nil,
245276
skipIfAlreadyTriggeredBetweenToDate: nil,
277+
skipIfWhitelistOrBlacklistIsUnchanged: false,
278+
originalWhitelist: FamilyActivitySelection(),
279+
originalBlocklist: FamilyActivitySelection(),
246280
activityName: activityName,
247281
callbackName: callbackName,
248282
eventName: eventName
@@ -277,6 +311,9 @@ class SkipIfAlreadyTriggeredBetweenTests: XCTestCase {
277311
skipIfAlreadyTriggeredBefore: nil,
278312
skipIfAlreadyTriggeredBetweenFromDate: nil,
279313
skipIfAlreadyTriggeredBetweenToDate: nil,
314+
skipIfWhitelistOrBlacklistIsUnchanged: false,
315+
originalWhitelist: FamilyActivitySelection(),
316+
originalBlocklist: FamilyActivitySelection(),
280317
activityName: activityName,
281318
callbackName: callbackName,
282319
eventName: eventName
@@ -292,6 +329,9 @@ class SkipIfAlreadyTriggeredBetweenTests: XCTestCase {
292329
skipIfAlreadyTriggeredBefore: nil,
293330
skipIfAlreadyTriggeredBetweenFromDate: nil,
294331
skipIfAlreadyTriggeredBetweenToDate: nil,
332+
skipIfWhitelistOrBlacklistIsUnchanged: false,
333+
originalWhitelist: FamilyActivitySelection(),
334+
originalBlocklist: FamilyActivitySelection(),
295335
activityName: activityName,
296336
callbackName: callbackName,
297337
eventName: eventName
@@ -332,6 +372,9 @@ class SkipIfLargerTests: XCTestCase {
332372
skipIfAlreadyTriggeredBefore: nil,
333373
skipIfAlreadyTriggeredBetweenFromDate: nil,
334374
skipIfAlreadyTriggeredBetweenToDate: nil,
375+
skipIfWhitelistOrBlacklistIsUnchanged: false,
376+
originalWhitelist: FamilyActivitySelection(),
377+
originalBlocklist: FamilyActivitySelection(),
335378
activityName: activityName,
336379
callbackName: callbackName,
337380
eventName: eventName
@@ -347,6 +390,9 @@ class SkipIfLargerTests: XCTestCase {
347390
skipIfAlreadyTriggeredBefore: nil,
348391
skipIfAlreadyTriggeredBetweenFromDate: nil,
349392
skipIfAlreadyTriggeredBetweenToDate: nil,
393+
skipIfWhitelistOrBlacklistIsUnchanged: false,
394+
originalWhitelist: FamilyActivitySelection(),
395+
originalBlocklist: FamilyActivitySelection(),
350396
activityName: activityName,
351397
callbackName: callbackName,
352398
eventName: eventName
@@ -390,6 +436,9 @@ class SkipIfLargerTests: XCTestCase {
390436
skipIfAlreadyTriggeredBefore: nil,
391437
skipIfAlreadyTriggeredBetweenFromDate: nil,
392438
skipIfAlreadyTriggeredBetweenToDate: nil,
439+
skipIfWhitelistOrBlacklistIsUnchanged: false,
440+
originalWhitelist: FamilyActivitySelection(),
441+
originalBlocklist: FamilyActivitySelection(),
393442
activityName: activityName,
394443
callbackName: callbackName,
395444
eventName: "15"
@@ -405,6 +454,9 @@ class SkipIfLargerTests: XCTestCase {
405454
skipIfAlreadyTriggeredBefore: nil,
406455
skipIfAlreadyTriggeredBetweenFromDate: nil,
407456
skipIfAlreadyTriggeredBetweenToDate: nil,
457+
skipIfWhitelistOrBlacklistIsUnchanged: false,
458+
originalWhitelist: FamilyActivitySelection(),
459+
originalBlocklist: FamilyActivitySelection(),
408460
activityName: activityName,
409461
callbackName: callbackName,
410462
eventName: "5"

packages/react-native-device-activity/ios/Shared.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,8 @@ func isEqual(
12381238
_ selection2: FamilyActivitySelection,
12391239
) -> Bool {
12401240
let diff = symmetricDifference(selection1, selection2)
1241-
return diff.categoryTokens.isEmpty && diff.applicationTokens.isEmpty && diff.webDomainTokens.isEmpty
1241+
return diff.categoryTokens.isEmpty && diff.applicationTokens.isEmpty
1242+
&& diff.webDomainTokens.isEmpty
12421243
}
12431244

12441245
func shouldExecuteAction(
@@ -1266,10 +1267,10 @@ func shouldExecuteAction(
12661267
}
12671268

12681269
if let skipIfWhitelistOrBlacklistIsUnchanged = skipIfWhitelistOrBlacklistIsUnchanged {
1269-
if(skipIfWhitelistOrBlacklistIsUnchanged){
1270+
if skipIfWhitelistOrBlacklistIsUnchanged {
12701271
let whitelistIsEqual = isEqual(originalWhitelist, getCurrentWhitelist())
12711272
let blocklistIsEqual = isEqual(originalBlocklist, getCurrentBlocklist())
1272-
if(whitelistIsEqual && blocklistIsEqual){
1273+
if whitelistIsEqual && blocklistIsEqual {
12731274
return false
12741275
}
12751276
}

packages/react-native-device-activity/targets/ActivityMonitorExtension/DeviceActivityMonitorExtension.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ class DeviceActivityMonitorExtension: DeviceActivityMonitor {
8888
let skipIfAlreadyTriggeredBetweenToDate =
8989
action["skipIfAlreadyTriggeredBetweenToDate"] as? Double
9090

91-
let skipIfWhitelistOrBlacklistIsUnchanged = action["skipIfWhitelistOrBlacklistIsUnchanged"] as? Bool
91+
let skipIfWhitelistOrBlacklistIsUnchanged =
92+
action["skipIfWhitelistOrBlacklistIsUnchanged"] as? Bool
9293

9394
if shouldExecuteAction(
9495
skipIfAlreadyTriggeredAfter: skipIfAlreadyTriggeredAfter,

0 commit comments

Comments
 (0)