Skip to content

Commit 5d21e8e

Browse files
committed
ios
1 parent 9cd0f75 commit 5d21e8e

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

ios/src/CountlyContentConfig.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@ - (instancetype)init
2727
#if (TARGET_OS_IOS)
2828
-(void)setGlobalContentCallback:(ContentCallback) callback
2929
{
30-
self.contentCallback = callback;
30+
_contentCallback = callback;
3131
}
3232

3333
- (ContentCallback) getGlobalContentCallback
3434
{
35-
return self.contentCallback;
35+
return _contentCallback;
3636
}
3737

3838

3939
-(void)setZoneTimerInterval:(NSUInteger)zoneTimerIntervalSeconds
4040
{
4141
if (zoneTimerIntervalSeconds > 15) {
42-
self.zoneTimerInterval = zoneTimerIntervalSeconds;
42+
_zoneTimerInterval = zoneTimerIntervalSeconds;
4343
}
4444
}
4545

4646
- (NSUInteger) getZoneTimerInterval
4747
{
48-
return self.zoneTimerInterval;
48+
return _zoneTimerInterval;
4949
}
5050
#endif
5151

ios/src/CountlyReactNative.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,22 @@ - (void) populateConfig:(id) json {
174174
[config.sdkInternalLimits setMaxStackTraceLinesPerThread:[maxStackTraceLinesPerThread intValue]];
175175
}
176176
// Limits End -------------------------------------------
177+
NSNumber *setZoneTimerInterval = json[@"setZoneTimerInterval"];
178+
if (setZoneTimerInterval) {
179+
config.content.zoneTimerInterval = [setZoneTimerInterval intValue];
180+
}
181+
if(json[@"setGlobalContentCallback"]) {
182+
[config.content setGlobalContentCallback:^(ContentStatus contentStatus, NSDictionary<NSString *,id> * _Nonnull contentData) {
183+
NSMutableDictionary *contentDataDict = [[NSMutableDictionary alloc] init];
184+
[contentDataDict setObject:[NSNumber numberWithInt:contentStatus] forKey:@"status"];
185+
[contentDataDict setObject:contentData forKey:@"data"];
186+
NSError *error;
187+
NSData *contentDataJson = [NSJSONSerialization dataWithJSONObject:contentDataDict options:0 error:&error];
188+
NSString *contentDataString = [[NSString alloc] initWithData:contentDataJson encoding:NSUTF8StringEncoding];
189+
190+
[self sendEventWithName:@"globalContentCallback" body:contentDataString];
191+
}];
192+
}
177193
// APM ------------------------------------------------
178194
NSNumber *enableForegroundBackground = json[@"enableForegroundBackground"];
179195
if (enableForegroundBackground) {

0 commit comments

Comments
 (0)