Skip to content

Commit d99ca6f

Browse files
authored
Merge pull request #112 from rudderlabs/develop
chore: pull develop into main
2 parents ecf54cd + 7271cd1 commit d99ca6f

File tree

12 files changed

+410
-24
lines changed

12 files changed

+410
-24
lines changed

Examples/macOSExample/macOSExample/ContentView.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,6 @@ struct ContentView: View {
169169

170170
CustomButton(title: "Shutdown Analytics") {
171171
AnalyticsManager.shared.shutdown()
172-
updateUserInfo()
173-
updateSessionInfo()
174172
}
175173
}
176174
.padding()

Examples/tvOSExample/tvOSExample/ContentView.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ struct ContentView: View {
166166
section("System Management:")
167167
CustomButton(title: "Shutdown Analytics") {
168168
AnalyticsManager.shared.shutdown()
169-
updateUserInfo()
170-
updateSessionInfo()
171169
}
172170
.focused($focusedButton, equals: .shutdown)
173171

Examples/watchOSExample/watchOSExampleWatchKitApp/ContentView.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ struct ContentView: View {
141141
Section("System Management") {
142142
WatchButton(title: "Shutdown Analytics") {
143143
AnalyticsManager.shared.shutdown()
144-
updateUserInfo()
145-
updateSessionInfo()
146144
}
147145
}
148146
}

Package.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ let package = Package(
2020
),
2121
],
2222
targets: [
23-
.target(name: "RudderStackAnalytics"),
23+
.target(
24+
name: "RudderStackAnalytics",
25+
resources: [
26+
.process("Resources")
27+
]
28+
),
2429
.testTarget(
2530
name: "RudderStackAnalyticsTests",
2631
dependencies: ["RudderStackAnalytics"],

RudderStackAnalytics.xcodeproj/project.pbxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
532904F02E05BBDE00C8EFE2 /* SwiftExampleApp.xctestplan in Resources */ = {isa = PBXBuildFile; fileRef = 532904EC2E05BBDE00C8EFE2 /* SwiftExampleApp.xctestplan */; };
1212
532904F12E05BBDE00C8EFE2 /* SwiftUIExampleApp.xctestplan in Resources */ = {isa = PBXBuildFile; fileRef = 532904ED2E05BBDE00C8EFE2 /* SwiftUIExampleApp.xctestplan */; };
1313
539E540E2C98CD7D00982E95 /* RudderStackAnalytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5351AA662C6BE95D003C3C47 /* RudderStackAnalytics.framework */; };
14+
53AC39722E1533F300B8E16C /* RudderOptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53AC39712E1533F300B8E16C /* RudderOptionTests.swift */; };
15+
53AC39B42E16FA6E00B8E16C /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 53AC39B32E16FA6E00B8E16C /* PrivacyInfo.xcprivacy */; };
1416
53DEA5E12E03D05A00D6C371 /* KeyValueStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53DEA5D62E03D05A00D6C371 /* KeyValueStore.swift */; };
1517
53DEA5E22E03D05A00D6C371 /* ResetUserIdentityAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53DEA5CE2E03D05A00D6C371 /* ResetUserIdentityAction.swift */; };
1618
53DEA5E32E03D05A00D6C371 /* NetworkInfoPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53DEA5BE2E03D05A00D6C371 /* NetworkInfoPlugin.swift */; };
@@ -143,6 +145,8 @@
143145
532904ED2E05BBDE00C8EFE2 /* SwiftUIExampleApp.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = SwiftUIExampleApp.xctestplan; sourceTree = "<group>"; };
144146
5351AA662C6BE95D003C3C47 /* RudderStackAnalytics.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RudderStackAnalytics.framework; sourceTree = BUILT_PRODUCTS_DIR; };
145147
539E540A2C98CD7D00982E95 /* RudderStackAnalyticsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RudderStackAnalyticsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
148+
53AC39712E1533F300B8E16C /* RudderOptionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RudderOptionTests.swift; sourceTree = "<group>"; };
149+
53AC39B32E16FA6E00B8E16C /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
146150
53DEA58F2E03D05A00D6C371 /* Analytics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Analytics.swift; sourceTree = "<group>"; };
147151
53DEA5902E03D05A00D6C371 /* Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = "<group>"; };
148152
53DEA5912E03D05A00D6C371 /* EventManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventManager.swift; sourceTree = "<group>"; };
@@ -293,6 +297,7 @@
293297
53DEA5CD2E03D05A00D6C371 /* SessionManagement */,
294298
53DEA5D32E03D05A00D6C371 /* StateManagement */,
295299
53DEA5DD2E03D05A00D6C371 /* Storage */,
300+
53AC39B52E16FA7D00B8E16C /* Resources */,
296301
);
297302
path = RudderStackAnalytics;
298303
sourceTree = "<group>";
@@ -345,6 +350,14 @@
345350
name = Products;
346351
sourceTree = "<group>";
347352
};
353+
53AC39B52E16FA7D00B8E16C /* Resources */ = {
354+
isa = PBXGroup;
355+
children = (
356+
53AC39B32E16FA6E00B8E16C /* PrivacyInfo.xcprivacy */,
357+
);
358+
path = Resources;
359+
sourceTree = "<group>";
360+
};
348361
53DEA5922E03D05A00D6C371 /* Base */ = {
349362
isa = PBXGroup;
350363
children = (
@@ -533,6 +546,7 @@
533546
53DEA6232E03D06F00D6C371 /* IdentifyEventTests.swift */,
534547
53DEA6242E03D06F00D6C371 /* MessageModuleTests.swift */,
535548
53DEA6252E03D06F00D6C371 /* ScreenEventTests.swift */,
549+
53AC39712E1533F300B8E16C /* RudderOptionTests.swift */,
536550
53DEA6262E03D06F00D6C371 /* TrackEventTests.swift */,
537551
);
538552
path = EventTests;
@@ -752,6 +766,7 @@
752766
isa = PBXResourcesBuildPhase;
753767
buildActionMask = 2147483647;
754768
files = (
769+
53AC39B42E16FA6E00B8E16C /* PrivacyInfo.xcprivacy in Resources */,
755770
);
756771
runOnlyForDeploymentPostprocessing = 0;
757772
};
@@ -889,6 +904,7 @@
889904
53DEA6602E03D06F00D6C371 /* ResetUserIdentityActionTests.swift in Sources */,
890905
53DEA6612E03D06F00D6C371 /* SessionInfoTests.swift in Sources */,
891906
53DEA6622E03D06F00D6C371 /* LifecycleObserverTests.swift in Sources */,
907+
53AC39722E1533F300B8E16C /* RudderOptionTests.swift in Sources */,
892908
53DEA6632E03D06F00D6C371 /* UserIdTraitsActionTests.swift in Sources */,
893909
53DEA6642E03D06F00D6C371 /* LifecycleTrackingPluginTests.swift in Sources */,
894910
53DEA6652E03D06F00D6C371 /* DeviceInfoPluginTests.swift in Sources */,

Sources/RudderStackAnalytics/Base/Configuration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class Configuration: NSObject {
3030
var controlPlaneUrl: String
3131

3232
/**
33-
A boolean flag to enable GZip compression for network requests. Defaults to `true`.
33+
A boolean flag to enable GZip compression for network requests. Defaults to `false`.
3434
*/
3535
var gzipEnabled: Bool
3636

Sources/RudderStackAnalytics/Events/RudderOption.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class RudderOption: NSObject {
3838
The initial integrations are set to the default integrations defined in `Constants.payload.integration`.
3939
*/
4040
public init(integrations: [String: Any]? = nil, customContext: [String: Any]? = nil, externalIds: [ExternalId]? = nil) {
41-
self.integrations = (integrations ?? [:]) + Constants.payload.integration
41+
self.integrations = Constants.payload.integration + (integrations ?? [:])
4242
self.customContext = customContext
4343
self.externalIds = externalIds
4444
}

Sources/RudderStackAnalytics/Policies/CountFlushPolicy.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ public final class CountFlushPolicy: FlushPolicy {
4040
/**
4141
Initializes a new `CountFlushPolicy`.
4242

43-
- Parameter flushAt: The number of events required to trigger a flush. Defaults to `Constants.flushEventCount.default`.
44-
- Note: The flush count is clamped between `Constants.flushEventCount.min` and `Constants.flushEventCount.max`.
45-
*/
43+
- Parameter flushAt: The number of events required to trigger a flush. Defaults to `Constants.flushEventCount.default`. */
4644
public init(flushAt: Int = Constants.flushEventCount.default) {
47-
self.flushAt = min(Constants.flushEventCount.max, max(flushAt, Constants.flushEventCount.min))
45+
self.flushAt = (Constants.flushEventCount.min...Constants.flushEventCount.max).contains(flushAt) ? flushAt : Constants.flushEventCount.default
4846
}
4947

5048
/**

Sources/RudderStackAnalytics/Policies/FrequencyFlushPolicy.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ public final class FrequencyFlushPolicy: FlushPolicy {
4343
Initializes a new `FrequencyFlushPolicy`.
4444

4545
- Parameter flushIntervalInMillis: The time interval in milliseconds for triggering flushes. Defaults to `Constants.flushInterval.default`.
46-
- Note: The interval is clamped to `Constants.flushInterval.min` to prevent excessively short durations.
4746
*/
4847
public init(flushIntervalInMillis: UInt64 = Constants.flushInterval.default) {
49-
self.flushIntervalInMillis = max(flushIntervalInMillis, Constants.flushInterval.min)
48+
self.flushIntervalInMillis = flushIntervalInMillis >= Constants.flushInterval.min ? flushIntervalInMillis : Constants.flushInterval.default
5049
}
5150

5251
/**
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>NSPrivacyAccessedAPITypes</key>
6+
<array>
7+
<dict>
8+
<key>NSPrivacyAccessedAPIType</key>
9+
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
10+
<key>NSPrivacyAccessedAPITypeReasons</key>
11+
<array>
12+
<string>35F9.1</string>
13+
</array>
14+
</dict>
15+
<dict>
16+
<key>NSPrivacyAccessedAPIType</key>
17+
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
18+
<key>NSPrivacyAccessedAPITypeReasons</key>
19+
<array>
20+
<string>CA92.1</string>
21+
</array>
22+
</dict>
23+
</array>
24+
<key>NSPrivacyCollectedDataTypes</key>
25+
<array>
26+
<dict>
27+
<key>NSPrivacyCollectedDataType</key>
28+
<string>NSPrivacyCollectedDataTypeDeviceID</string>
29+
<key>NSPrivacyCollectedDataTypeLinked</key>
30+
<false/>
31+
<key>NSPrivacyCollectedDataTypeTracking</key>
32+
<false/>
33+
<key>NSPrivacyCollectedDataTypePurposes</key>
34+
<array>
35+
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
36+
</array>
37+
</dict>
38+
<dict>
39+
<key>NSPrivacyCollectedDataType</key>
40+
<string>App Name</string>
41+
<key>NSPrivacyCollectedDataTypeLinked</key>
42+
<false/>
43+
<key>NSPrivacyCollectedDataTypeTracking</key>
44+
<false/>
45+
<key>NSPrivacyCollectedDataTypePurposes</key>
46+
<array>
47+
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
48+
</array>
49+
</dict>
50+
<dict>
51+
<key>NSPrivacyCollectedDataType</key>
52+
<string>App Version</string>
53+
<key>NSPrivacyCollectedDataTypeLinked</key>
54+
<false/>
55+
<key>NSPrivacyCollectedDataTypeTracking</key>
56+
<false/>
57+
<key>NSPrivacyCollectedDataTypePurposes</key>
58+
<array>
59+
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
60+
</array>
61+
</dict>
62+
<dict>
63+
<key>NSPrivacyCollectedDataType</key>
64+
<string>NSPrivacyCollectedDataTypeProductInteraction</string>
65+
<key>NSPrivacyCollectedDataTypeLinked</key>
66+
<false/>
67+
<key>NSPrivacyCollectedDataTypeTracking</key>
68+
<false/>
69+
<key>NSPrivacyCollectedDataTypePurposes</key>
70+
<array>
71+
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
72+
</array>
73+
</dict>
74+
<dict>
75+
<key>NSPrivacyCollectedDataType</key>
76+
<string>NSPrivacyCollectedDataTypeOtherDataTypes</string>
77+
<key>NSPrivacyCollectedDataTypeLinked</key>
78+
<false/>
79+
<key>NSPrivacyCollectedDataTypeTracking</key>
80+
<false/>
81+
<key>NSPrivacyCollectedDataTypePurposes</key>
82+
<array>
83+
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
84+
</array>
85+
</dict>
86+
</array>
87+
</dict>
88+
</plist>

0 commit comments

Comments
 (0)