Skip to content

Commit bb96f5a

Browse files
feat: iOS 25.1.0
1 parent 582de4f commit bb96f5a

12 files changed

+160
-40
lines changed

ios/Classes/CountlyiOS/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 25.1.0
2+
* Added dynamic resizing functionality for the content zone
3+
* Added a config option to content (setZoneTimerInterval) to set content zone timer. (Experimental!)
4+
5+
* Improved management of content zone size for better responsiveness
6+
* Fixed an issue where the build UUID and executable name were missing from crash reports
7+
18
## 24.7.9
29
* Improved view tracking capabilities
310

ios/Classes/CountlyiOS/Countly-PL.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Countly-PL'
3-
s.version = '24.7.9'
3+
s.version = '25.1.0'
44
s.license = { :type => 'MIT', :file => 'LICENSE' }
55
s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.'
66
s.homepage = 'https://github.com/Countly/countly-sdk-ios'

ios/Classes/CountlyiOS/Countly.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ - (void)startWithConfig:(CountlyConfig *)config
275275
if(config.content.getGlobalContentCallback) {
276276
CountlyContentBuilderInternal.sharedInstance.contentCallback = config.content.getGlobalContentCallback;
277277
}
278+
if(config.content.getZoneTimerInterval){
279+
CountlyContentBuilderInternal.sharedInstance.zoneTimerInterval = config.content.getZoneTimerInterval;
280+
}
278281
#endif
279282

280283
[CountlyPerformanceMonitoring.sharedInstance startWithConfig:config.apm];

ios/Classes/CountlyiOS/Countly.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Countly'
3-
s.version = '24.7.9'
3+
s.version = '25.1.0'
44
s.license = { :type => 'MIT', :file => 'LICENSE' }
55
s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.'
66
s.homepage = 'https://github.com/Countly/countly-sdk-ios'

ios/Classes/CountlyiOS/CountlyCommon.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ @interface CountlyCommon ()
2929
#endif
3030
@end
3131

32-
NSString* const kCountlySDKVersion = @"24.7.9";
32+
NSString* const kCountlySDKVersion = @"25.1.0";
3333
NSString* const kCountlySDKName = @"objc-native-ios";
3434

3535
NSString* const kCountlyErrorDomain = @"ly.count.ErrorDomain";

ios/Classes/CountlyiOS/CountlyContentBuilderInternal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
1313
@interface CountlyContentBuilderInternal: NSObject
1414
#if (TARGET_OS_IOS)
1515
@property (nonatomic, strong) NSArray<NSString *> *currentTags;
16-
@property (nonatomic, assign) NSTimeInterval requestInterval;
16+
@property (nonatomic, assign) NSTimeInterval zoneTimerInterval;
1717
@property (nonatomic) ContentCallback contentCallback;
1818

1919
+ (instancetype)sharedInstance;

ios/Classes/CountlyiOS/CountlyContentBuilderInternal.m

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ - (instancetype)init
2929
{
3030
if (self = [super init])
3131
{
32-
self.requestInterval = 30.0;
32+
self.zoneTimerInterval = 30.0;
3333
_requestTimer = nil;
3434
}
3535

@@ -55,7 +55,7 @@ - (void)enterContentZone:(NSArray<NSString *> *)tags {
5555
self.currentTags = tags;
5656

5757
[self fetchContents];;
58-
_requestTimer = [NSTimer scheduledTimerWithTimeInterval:self.requestInterval
58+
_requestTimer = [NSTimer scheduledTimerWithTimeInterval:self.zoneTimerInterval
5959
target:self
6060
selector:@selector(fetchContents)
6161
userInfo:nil
@@ -151,30 +151,49 @@ - (NSURLRequest *)fetchContentsRequest
151151
return request;
152152
}
153153

154-
- (NSString *)resolutionJson {
155-
//TODO: check why area is not clickable and safearea things
156-
CGRect screenBounds = [UIScreen mainScreen].bounds;
157-
if (@available(iOS 11.0, *)) {
158-
CGFloat top = UIApplication.sharedApplication.keyWindow.safeAreaInsets.top;
159-
160-
if (top) {
161-
screenBounds.origin.y += top + 5;
162-
screenBounds.size.height -= top + 5;
163-
} else {
164-
screenBounds.origin.y += 20.0;
165-
screenBounds.size.height -= 20.0;
154+
- (CGSize)getWindowSize {
155+
CGSize size = CGSizeZero;
156+
157+
// Attempt to retrieve the size from the connected scenes (for modern apps)
158+
if (@available(iOS 13.0, *)) {
159+
NSSet<UIScene *> *scenes = [[UIApplication sharedApplication] connectedScenes];
160+
for (UIScene *scene in scenes) {
161+
if ([scene isKindOfClass:[UIWindowScene class]]) {
162+
UIWindowScene *windowScene = (UIWindowScene *)scene;
163+
UIWindow *window = windowScene.windows.firstObject;
164+
if (window) {
165+
size = window.bounds.size;
166+
return size; // Return immediately if we find a valid size
167+
}
168+
}
169+
}
170+
}
171+
172+
// Fallback for legacy apps using AppDelegate
173+
id<UIApplicationDelegate> appDelegate = [[UIApplication sharedApplication] delegate];
174+
if ([appDelegate respondsToSelector:@selector(window)]) {
175+
UIWindow *legacyWindow = [appDelegate performSelector:@selector(window)];
176+
if (legacyWindow) {
177+
size = legacyWindow.bounds.size;
166178
}
167-
} else {
168-
screenBounds.origin.y += 20.0;
169-
screenBounds.size.height -= 20.0;
170179
}
180+
181+
return size;
182+
}
183+
184+
- (NSString *)resolutionJson {
185+
//TODO: check why area is not clickable and safearea things
186+
CGSize size = [self getWindowSize];
171187

172-
CGFloat width = screenBounds.size.width;
173-
CGFloat height = screenBounds.size.height;
188+
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
189+
BOOL isLandscape = UIInterfaceOrientationIsLandscape(orientation);
190+
191+
CGFloat lHpW = isLandscape ? size.height : size.width;
192+
CGFloat lWpH = isLandscape ? size.width : size.height;
174193

175194
NSDictionary *resolutionDict = @{
176-
@"portrait": @{@"height": @(height), @"width": @(width)},
177-
@"landscape": @{@"height": @(width), @"width": @(height)}
195+
@"portrait": @{@"height": @(lWpH), @"width": @(lHpW)},
196+
@"landscape": @{@"height": @(lHpW), @"width": @(lWpH)}
178197
};
179198

180199
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:resolutionDict options:0 error:nil];

ios/Classes/CountlyiOS/CountlyContentConfig.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ typedef void (^ContentCallback)(ContentStatus contentStatus, NSDictionary<NSStri
3232
* Get content callback
3333
*/
3434
- (ContentCallback) getGlobalContentCallback;
35+
36+
/**
37+
* This is an experimental feature and it can have breaking changes
38+
* Set the interval for the automatic content update calls
39+
* @param zoneTimerIntervalSeconds in seconds
40+
*
41+
*/
42+
-(void)setZoneTimerInterval:(NSUInteger)zoneTimerIntervalSeconds;
43+
44+
/**
45+
* This is an experimental feature and it can have breaking changes
46+
* Get zone timer interval
47+
*/
48+
- (NSUInteger) getZoneTimerInterval;
3549
#endif
3650

3751
NS_ASSUME_NONNULL_END

ios/Classes/CountlyiOS/CountlyContentConfig.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
@interface CountlyContentConfig ()
1010
#if (TARGET_OS_IOS)
1111
@property (nonatomic) ContentCallback contentCallback;
12+
@property (nonatomic) NSUInteger zoneTimerInterval;
1213
#endif
1314
@end
1415

@@ -33,6 +34,19 @@ - (ContentCallback) getGlobalContentCallback
3334
{
3435
return self.contentCallback;
3536
}
37+
38+
39+
-(void)setZoneTimerInterval:(NSUInteger)zoneTimerIntervalSeconds
40+
{
41+
if (zoneTimerIntervalSeconds > 15) {
42+
self.zoneTimerInterval = zoneTimerIntervalSeconds;
43+
}
44+
}
45+
46+
- (NSUInteger) getZoneTimerInterval
47+
{
48+
return self.zoneTimerInterval;
49+
}
3650
#endif
3751

3852
@end

ios/Classes/CountlyiOS/CountlyCrashReporter.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ void CountlyExceptionHandler(NSException *exception, bool isFatal, bool isAutoDe
288288
NSMutableDictionary* crashReport = [crashData.crashMetrics mutableCopy];
289289
crashReport[kCountlyCRKeyError] = crashData.stackTrace;
290290
crashReport[kCountlyCRKeyBinaryImages] = [CountlyCrashReporter.sharedInstance binaryImagesForStackTrace:stackTrace];
291+
crashReport[kCountlyCRKeyBuildUUID] = CountlyCrashReporter.sharedInstance.buildUUID ?: @"";
292+
crashReport[kCountlyCRKeyExecutableName] = CountlyCrashReporter.sharedInstance.executableName ?: @"";
291293
crashReport[kCountlyCRKeyName] = crashData.crashDescription;
292294
crashReport[kCountlyCRKeyType] = crashData.name;
293295
crashReport[kCountlyCRKeyNonfatal] = @(!crashData.fatal);
@@ -498,8 +500,6 @@ - (NSMutableDictionary*)getCrashMetrics
498500
crashReport[kCountlyCRKeyResolution] = CountlyDeviceInfo.resolution;
499501
crashReport[kCountlyCRKeyAppVersion] = CountlyDeviceInfo.appVersion;
500502
crashReport[kCountlyCRKeyAppBuild] = CountlyDeviceInfo.appBuild;
501-
crashReport[kCountlyCRKeyBuildUUID] = CountlyCrashReporter.sharedInstance.buildUUID ?: @"";
502-
crashReport[kCountlyCRKeyExecutableName] = CountlyCrashReporter.sharedInstance.executableName ?: @"";
503503

504504
crashReport[kCountlyCRKeyRAMCurrent] = @((CountlyDeviceInfo.totalRAM - CountlyDeviceInfo.freeRAM) / kCLYMebibit);
505505
crashReport[kCountlyCRKeyRAMTotal] = @(CountlyDeviceInfo.totalRAM / kCLYMebibit);

0 commit comments

Comments
 (0)