Skip to content

Commit

Permalink
Merge pull request #159 from erkanyildiz/master
Browse files Browse the repository at this point in the history
For 20.04
  • Loading branch information
erkanyildiz authored Apr 30, 2020
2 parents 4fc7b82 + 43be58e commit ae42d43
Show file tree
Hide file tree
Showing 28 changed files with 779 additions and 322 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## 20.04
- Added crash reporting feature for tvOS
- Added crash reporting feature for macOS
- Added crash reporting feature for watchOS
- Added optional crash reporting dependency PLCrashReporter for iOS
- Added UI orientation tracking
- Added crash filtering with regex
- Updated dSYM uploader script for accepting custom dSYM paths
- Updated enableAppleWatch flag default value for independent watchOS apps
- Fixed push notification consent method for macOS targets
- Fixed not appearing rich push notification buttons for some cases
- Discarded OpenGL ES version info in crash reports

- Other various improvements
- Deleted an unnecessary UIKit import
- Added precaution for possible nil lines in backtrace
- Added precaution for possible nil OS name value
- Replaced scheduledTimerWithTimeInterval call with timerWithTimeInterval (thanks @mt-rpranata)
- Updated architerture method for crash reports
- Updated CocoaPods podspec for core subspec approach
- Updated feature, consent and push test mode specifiers as NSString typedefs
- Updated HeaderDocs, internal logs, inline notes and pragma marks



## 19.08
- Added temporary device ID mode
- Added support for Carthage
Expand Down
18 changes: 8 additions & 10 deletions Countly.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)endSession;

#if TARGET_OS_WATCH
#if (TARGET_OS_WATCH)
/**
* Suspends Countly, adds recorded events to request queue and ends current session.
* @discussion This method needs to be called manually only on @c watchOS, on other platforms it will be called automatically.
Expand All @@ -112,15 +112,15 @@ NS_ASSUME_NONNULL_BEGIN
* @discussion If @c requiresConsent flag is not set on initial configuration, calling this method will have no effect.
* @param featureName Feature name to give consent to
*/
- (void)giveConsentForFeature:(NSString *)featureName;
- (void)giveConsentForFeature:(CLYConsent)featureName;

/**
* Grants consent to given features and starts them.
* @discussion This is a convenience method for grating consent for multiple features at once.
* @discussion Inner workings of @c giveConsentForFeature: method applies for this method as well.
* @param features Array of feature names to give consent to
*/
- (void)giveConsentForFeatures:(NSArray *)features;
- (void)giveConsentForFeatures:(NSArray<CLYConsent> *)features;

/**
* Grants consent to all features and starts them.
Expand All @@ -136,15 +136,15 @@ NS_ASSUME_NONNULL_BEGIN
* @discussion If @c requiresConsent flag is not set on initial configuration, calling this method will have no effect.
* @param featureName Feature name to cancel consent to
*/
- (void)cancelConsentForFeature:(NSString *)featureName;
- (void)cancelConsentForFeature:(CLYConsent)featureName;

/**
* Cancels consent to given features and stops them.
* @discussion This is a convenience method for cancelling consent for multiple features at once.
* @discussion Inner workings of @c cancelConsentForFeature: method applies for this method as well.
* @param features Array of feature names to cancel consent to
*/
- (void)cancelConsentForFeatures:(NSArray *)features;
- (void)cancelConsentForFeatures:(NSArray<CLYConsent> *)features;

/**
* Cancels consent to all features and stops them.
Expand Down Expand Up @@ -369,7 +369,7 @@ NS_ASSUME_NONNULL_BEGIN


#pragma mark - Crash Reporting
#if TARGET_OS_IOS

/**
* Records a handled exception manually.
* @param exception Exception to be recorded
Expand Down Expand Up @@ -405,8 +405,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)crashLog:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2) DEPRECATED_MSG_ATTRIBUTE("Use 'recordCrashLog:' method instead!");

#endif



#pragma mark - View Tracking
Expand All @@ -432,7 +430,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)recordView:(NSString *)viewName segmentation:(NSDictionary<NSString *, NSString *> *)segmentation;

#if TARGET_OS_IOS
#if (TARGET_OS_IOS)
/**
* Adds exception for AutoViewTracking.
* @discussion @c UIViewControllers with specified title or class name will be ignored by AutoViewTracking and their appearances and disappearances will not be recorded.
Expand Down Expand Up @@ -490,7 +488,7 @@ NS_ASSUME_NONNULL_BEGIN


#pragma mark - Star Rating
#if TARGET_OS_IOS
#if (TARGET_OS_IOS)
/**
* Shows star-rating dialog manually and executes completion block after user's action.
* @discussion Completion block has a single NSInteger parameter that indicates 1 to 5 star-rating given by user.
Expand Down
37 changes: 21 additions & 16 deletions Countly.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ - (instancetype)init
selector:@selector(willTerminateCallBack:)
name:UIApplicationWillTerminateNotification
object:nil];
#elif TARGET_OS_OSX
#elif (TARGET_OS_OSX)
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(willTerminateCallBack:)
name:NSApplicationWillTerminateNotification
Expand Down Expand Up @@ -95,7 +95,7 @@ - (void)startWithConfig:(CountlyConfig *)config
if (!CountlyCommon.sharedInstance.manualSessionHandling)
[CountlyConnectionManager.sharedInstance beginSession];

#if TARGET_OS_IOS
#if (TARGET_OS_IOS)
CountlyStarRating.sharedInstance.message = config.starRatingMessage;
CountlyStarRating.sharedInstance.sessionCount = config.starRatingSessionCount;
CountlyStarRating.sharedInstance.disableAskingForEachAppVersion = config.starRatingDisableAskingForEachAppVersion;
Expand All @@ -107,14 +107,6 @@ - (void)startWithConfig:(CountlyConfig *)config
CountlyLocationManager.sharedInstance.ISOCountryCode = config.ISOCountryCode;
CountlyLocationManager.sharedInstance.IP = config.IP;
[CountlyLocationManager.sharedInstance sendLocationInfo];

CountlyCrashReporter.sharedInstance.crashSegmentation = config.crashSegmentation;
CountlyCrashReporter.sharedInstance.crashLogLimit = MAX(1, config.crashLogLimit);
if ([config.features containsObject:CLYCrashReporting])
{
CountlyCrashReporter.sharedInstance.isEnabledOnInitialConfig = YES;
[CountlyCrashReporter.sharedInstance startCrashReporting];
}
#endif

#if (TARGET_OS_IOS || TARGET_OS_OSX)
Expand All @@ -129,6 +121,19 @@ - (void)startWithConfig:(CountlyConfig *)config
}
#endif

CountlyCrashReporter.sharedInstance.crashSegmentation = config.crashSegmentation;
CountlyCrashReporter.sharedInstance.crashLogLimit = MAX(1, config.crashLogLimit);
CountlyCrashReporter.sharedInstance.crashFilter = config.crashFilter;
CountlyCrashReporter.sharedInstance.shouldUsePLCrashReporter = config.shouldUsePLCrashReporter;
CountlyCrashReporter.sharedInstance.shouldUseMachSignalHandler = config.shouldUseMachSignalHandler;
CountlyCrashReporter.sharedInstance.crashOccuredOnPreviousSessionCallback = config.crashOccuredOnPreviousSessionCallback;
CountlyCrashReporter.sharedInstance.shouldSendCrashReportCallback = config.shouldSendCrashReportCallback;
if ([config.features containsObject:CLYCrashReporting])
{
CountlyCrashReporter.sharedInstance.isEnabledOnInitialConfig = YES;
[CountlyCrashReporter.sharedInstance startCrashReporting];
}

#if (TARGET_OS_IOS || TARGET_OS_TV)
if ([config.features containsObject:CLYAutoViewTracking])
{
Expand All @@ -137,7 +142,7 @@ - (void)startWithConfig:(CountlyConfig *)config
}
#endif

timer = [NSTimer scheduledTimerWithTimeInterval:config.updateSessionPeriod target:self selector:@selector(onTimer:) userInfo:nil repeats:YES];
timer = [NSTimer timerWithTimeInterval:config.updateSessionPeriod target:self selector:@selector(onTimer:) userInfo:nil repeats:YES];
[NSRunLoop.mainRunLoop addTimer:timer forMode:NSRunLoopCommonModes];

[CountlyCommon.sharedInstance startAppleWatchMatching];
Expand All @@ -148,6 +153,8 @@ - (void)startWithConfig:(CountlyConfig *)config
CountlyRemoteConfig.sharedInstance.remoteConfigCompletionHandler = config.remoteConfigCompletionHandler;
[CountlyRemoteConfig.sharedInstance startRemoteConfig];

[CountlyCommon.sharedInstance observeDeviceOrientationChanges];

[CountlyConnectionManager.sharedInstance proceedOnQueue];
}

Expand Down Expand Up @@ -295,7 +302,7 @@ - (void)resume
if (!CountlyCommon.sharedInstance.hasStarted)
return;

#if TARGET_OS_WATCH
#if (TARGET_OS_WATCH)
//NOTE: Skip first time to prevent double begin session because of applicationDidBecomeActive call on launch of watchOS apps
static BOOL isFirstCall = YES;

Expand Down Expand Up @@ -591,7 +598,6 @@ - (void)disableLocationInfo

#pragma mark - Crash Reporting

#if TARGET_OS_IOS
- (void)recordHandledException:(NSException *)exception
{
[CountlyCrashReporter.sharedInstance recordException:exception withStackTrace:nil isFatal:NO];
Expand All @@ -616,7 +622,6 @@ - (void)crashLog:(NSString *)format, ...
{

}
#endif



Expand All @@ -632,7 +637,7 @@ - (void)recordView:(NSString *)viewName segmentation:(NSDictionary *)segmentatio
[CountlyViewTracking.sharedInstance startView:viewName customSegmentation:segmentation];
}

#if TARGET_OS_IOS
#if (TARGET_OS_IOS)
- (void)addExceptionForAutoViewTracking:(NSString *)exception
{
[CountlyViewTracking.sharedInstance addExceptionForAutoViewTracking:exception.copy];
Expand Down Expand Up @@ -676,7 +681,7 @@ - (void)userLoggedOut


#pragma mark - Star Rating
#if TARGET_OS_IOS
#if (TARGET_OS_IOS)

- (void)askForStarRating:(void(^)(NSInteger rating))completion
{
Expand Down
54 changes: 23 additions & 31 deletions Countly.podspec
Original file line number Diff line number Diff line change
@@ -1,49 +1,41 @@
Pod::Spec.new do |s|
s.name = 'Countly'
s.version = '19.08'
s.license = {
:type => 'COMMUNITY',
:text => <<-LICENSE
COUNTLY MOBILE ANALYTICS COMMUNITY EDITION LICENSE
--------------------------------------------------
Copyright (c) 2012, 2019 Countly
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
LICENSE
}
s.version = '20.04'
s.license = { :type => 'MIT', :file => 'LICENSE.md' }
s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.'
s.homepage = 'https://github.com/Countly/countly-sdk-ios'
s.social_media_url = 'https://twitter.com/gocountly'
s.author = {'Countly' => '[email protected]'}
s.source = { :git => 'https://github.com/Countly/countly-sdk-ios.git', :tag => s.version.to_s }
s.source_files = '*.{h,m}'
s.public_header_files = 'Countly.h', 'CountlyUserDetails.h', 'CountlyConfig.h'
s.preserve_path = 'countly_dsym_uploader.sh'

s.requires_arc = true
s.default_subspecs = 'Core'
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'
s.watchos.deployment_target = '2.0'
s.tvos.deployment_target = '9.0'

s.subspec 'Core' do |core|
core.source_files = '*.{h,m}'
core.public_header_files = 'Countly.h', 'CountlyUserDetails.h', 'CountlyConfig.h'
core.preserve_path = 'countly_dsym_uploader.sh'
end

s.subspec 'NotificationService' do |ns|
ns.source_files = 'CountlyNotificationService.{m,h}'
ns.ios.deployment_target = '10.0'
end

s.subspec 'PL' do |pl|
pl.platform = :ios
pl.dependency 'Countly/Core'
pl.dependency 'PLCrashReporter', '1.5.1'

# It is not possible to set static_framework attribute on subspecs.
# So, we have to set it on main spec.
# But it affects the main spec even when this subspec is not used.
# Asked this on CocoaPods GitHub page: https://github.com/CocoaPods/CocoaPods/issues/7355#issuecomment-619261908
s.static_framework = true
end

end
13 changes: 8 additions & 5 deletions CountlyCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@
#define COUNTLY_LOG(...)
#endif

#if TARGET_OS_IOS
#if (TARGET_OS_IOS)
#import <UIKit/UIKit.h>
#ifndef COUNTLY_EXCLUDE_IDFA
#import <AdSupport/ASIdentifierManager.h>
#endif
#import "WatchConnectivity/WatchConnectivity.h"
#endif

#if TARGET_OS_WATCH
#if (TARGET_OS_WATCH)
#import <WatchKit/WatchKit.h>
#import "WatchConnectivity/WatchConnectivity.h"
#endif

#if TARGET_OS_TV
#if (TARGET_OS_TV)
#import <UIKit/UIKit.h>
#ifndef COUNTLY_EXCLUDE_IDFA
#import <AdSupport/ASIdentifierManager.h>
#endif
#endif

#if TARGET_OS_OSX
#if (TARGET_OS_OSX)
#import <AppKit/AppKit.h>
#endif

Expand All @@ -74,6 +74,7 @@ NS_ERROR_ENUM(kCountlyErrorDomain)
@property (nonatomic) BOOL manualSessionHandling;

void CountlyInternalLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
void CountlyPrint(NSString *stringToPrint);

+ (instancetype)sharedInstance;
- (NSInteger)hourOfDay;
Expand All @@ -92,10 +93,12 @@ void CountlyInternalLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);

- (void)startAppleWatchMatching;
- (void)startAttribution;

- (void)observeDeviceOrientationChanges;
@end


#if TARGET_OS_IOS
#if (TARGET_OS_IOS)
@interface CLYInternalViewController : UIViewController
@end

Expand Down
Loading

0 comments on commit ae42d43

Please sign in to comment.