Skip to content

Commit

Permalink
Merge pull request #347 from Countly/view-fixes-&-tests
Browse files Browse the repository at this point in the history
Some fixes for view duration and added tests
  • Loading branch information
turtledreams authored Oct 31, 2024
2 parents 101d952 + 150d545 commit 9f9fb38
Show file tree
Hide file tree
Showing 9 changed files with 1,019 additions and 16 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## xx.xx.xx
* Mitigated an issue where pausing a view resulted in a '0' view duration.
* Mitigated an issue where an internal timer was not reset when going to foreground for `autoStoppedViews`
* Mitigated an issue for `autoStoppedViews` could have not started when multiple views were open at the same time while going to foreground

## 24.7.4
* Added visionOS build support
* Added `CountlyFeedbacks:` interface with new view methods (Access with `Countly.sharedInstance.feedback`):
Expand Down
4 changes: 2 additions & 2 deletions Countly.m
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,13 @@ - (void)suspend

isSuspended = YES;

[CountlyViewTrackingInternal.sharedInstance applicationDidEnterBackground];

[CountlyConnectionManager.sharedInstance sendEventsWithSaveIfNeeded];

if (!CountlyCommon.sharedInstance.manualSessionHandling)
[CountlyConnectionManager.sharedInstance endSession];

[CountlyViewTrackingInternal.sharedInstance applicationDidEnterBackground];

[CountlyPersistency.sharedInstance saveToFile];
}

Expand Down
4 changes: 4 additions & 0 deletions Countly.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
3961C6BA2C6633C000DD38BA /* CountlyWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3961C6B42C6633C000DD38BA /* CountlyWebViewManager.m */; };
3964A3E72C2AF8E90091E677 /* CountlySegmentationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3964A3E62C2AF8E90091E677 /* CountlySegmentationTests.swift */; };
3966DBCF2C11EE270002ED97 /* CountlyDeviceIDTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3966DBCE2C11EE270002ED97 /* CountlyDeviceIDTests.swift */; };
3969D0232CB80848000F8A32 /* CountlyViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3969D0222CB80848000F8A32 /* CountlyViewTests.swift */; };
3972EDDB2C08A38D00EB9D3E /* CountlyEventStruct.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3972EDDA2C08A38D00EB9D3E /* CountlyEventStruct.swift */; };
3979E47D2C0760E900FA1CA4 /* CountlyUserProfileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3979E47C2C0760E900FA1CA4 /* CountlyUserProfileTests.swift */; };
399117D12C69F73D00DC4C66 /* CountlyContentBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = 399117CD2C69F73D00DC4C66 /* CountlyContentBuilder.m */; };
Expand Down Expand Up @@ -133,6 +134,7 @@
3961C6B42C6633C000DD38BA /* CountlyWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CountlyWebViewManager.m; sourceTree = "<group>"; };
3964A3E62C2AF8E90091E677 /* CountlySegmentationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountlySegmentationTests.swift; sourceTree = "<group>"; };
3966DBCE2C11EE270002ED97 /* CountlyDeviceIDTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountlyDeviceIDTests.swift; sourceTree = "<group>"; };
3969D0222CB80848000F8A32 /* CountlyViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountlyViewTests.swift; sourceTree = "<group>"; };
3972EDDA2C08A38D00EB9D3E /* CountlyEventStruct.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountlyEventStruct.swift; sourceTree = "<group>"; };
3979E47C2C0760E900FA1CA4 /* CountlyUserProfileTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountlyUserProfileTests.swift; sourceTree = "<group>"; };
399117CD2C69F73D00DC4C66 /* CountlyContentBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CountlyContentBuilder.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -221,6 +223,7 @@
3966DBCE2C11EE270002ED97 /* CountlyDeviceIDTests.swift */,
3964A3E62C2AF8E90091E677 /* CountlySegmentationTests.swift */,
399B464F2C52813700AD384E /* CountlyLocationTests.swift */,
3969D0222CB80848000F8A32 /* CountlyViewTests.swift */,
);
path = CountlyTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -470,6 +473,7 @@
buildActionMask = 2147483647;
files = (
1A5C4C972B35B0850032EE1F /* CountlyTests.swift in Sources */,
3969D0232CB80848000F8A32 /* CountlyViewTests.swift in Sources */,
399B46502C52813700AD384E /* CountlyLocationTests.swift in Sources */,
1A50D7052B3C5AA3009C6938 /* CountlyBaseTestCase.swift in Sources */,
3979E47D2C0760E900FA1CA4 /* CountlyUserProfileTests.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion CountlyTests/CountlyBaseTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CountlyBaseTestCase: XCTestCase {
var countly: Countly!
var deviceID: String = ""
let appKey: String = "appkey"
var host: String = "https://test.count.ly/"
var host: String = "https://testing.count.ly/"

override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
Expand Down
8 changes: 4 additions & 4 deletions CountlyTests/CountlyEventStruct.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ struct AnyCodable: Codable {
struct CountlyEventStruct: Codable {
let key: String
let ID: String
let CVID: String
let CVID: String?
let PVID: String?
let PEID: String
let PEID: String?
let segmentation: [String: Any]?
let count: UInt
let sum: Double
Expand All @@ -81,9 +81,9 @@ struct CountlyEventStruct: Codable {
let container = try decoder.container(keyedBy: CodingKeys.self)
key = try container.decode(String.self, forKey: .key)
ID = try container.decode(String.self, forKey: .ID)
CVID = try container.decode(String.self, forKey: .CVID)
CVID = try container.decodeIfPresent(String.self, forKey: .CVID)
PVID = try container.decodeIfPresent(String.self, forKey: .PVID)
PEID = try container.decode(String.self, forKey: .PEID)
PEID = try container.decodeIfPresent(String.self, forKey: .PEID)
count = try container.decode(UInt.self, forKey: .count)
sum = try container.decode(Double.self, forKey: .sum)
timestamp = try container.decode(TimeInterval.self, forKey: .timestamp)
Expand Down
Loading

0 comments on commit 9f9fb38

Please sign in to comment.