Skip to content

Commit

Permalink
Merge pull request #200 from erkanyildiz/master
Browse files Browse the repository at this point in the history
For 22.06.0
  • Loading branch information
ArtursKadikis committed Aug 7, 2022
2 parents 51a22dc + 4cef6d1 commit 8c3d4e4
Show file tree
Hide file tree
Showing 17 changed files with 206 additions and 147 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 22.06.0
- Added `CountlyAutoViewTrackingName` protocol for supporting custom view titles with AutoViewTracking
- Added `setNewURLSessionConfiguration:` method to be able change URL session configuraion on the go (thanks @angelix)
- Added ability to save user details on SDK initialization
- Added device ID type to every request being sent
- Fixed missing remote config consent
- Fixed auto view tracking for iOS 13+ PageSheet modal presentations
- Deleted previously deprecated and inoperative methods and config flags

- Other various improvements
- Updated HeaderDocs, internal logs, inline notes and pragma marks
- Updated Countly project settings for Xcode 13.4.1 (13F100)



## 21.11.2
- Added direct and indirect attribution
- Added platform info to default segmentation of push action events
Expand Down
2 changes: 1 addition & 1 deletion Countly-PL.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Countly-PL'
s.version = '21.11.2'
s.version = '22.06.0'
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'
Expand Down
40 changes: 6 additions & 34 deletions Countly.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)setNewHost:(NSString *)newHost;

/**
* Sets a new URL session configuration to be used with all requests.
* @param newURLSessionConfiguration The new URL session configuration
*/
- (void)setNewURLSessionConfiguration:(NSURLSessionConfiguration *)newURLSessionConfiguration;

/**
* Sets a new app key to be used in new requests.
* @discussion Before switching to the new app key, this method suspends Countly and resumes it immediately after.
Expand All @@ -50,12 +56,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)setNewAppKey:(NSString *)newAppKey;

/**
* @c setCustomHeaderFieldValue: method is deprecated. Please use @c URLSessionConfiguration property on @c CountlyConfig instead.
* @discussion Calling this method will have no effect.
*/
- (void)setCustomHeaderFieldValue:(NSString *)customHeaderFieldValue DEPRECATED_MSG_ATTRIBUTE("Use 'URLSessionConfiguration' property on CountlyConfig instead!");

/**
* Flushes request and event queues.
* @discussion Flushes persistently stored request queue and events recorded but not converted to a request so far.
Expand Down Expand Up @@ -381,34 +381,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)recordLocation:(CLLocationCoordinate2D)location city:(NSString * _Nullable)city ISOCountryCode:(NSString * _Nullable)ISOCountryCode IP:(NSString * _Nullable)IP;

/**
* Records user's location info to be used for geo-location based push notifications and advanced user segmentation.
* @discussion By default, Countly Server uses a geo-ip database for acquiring user's location.
* @discussion If the app uses Core Location services and granted permission, a location with better accuracy can be provided using this method.
* @discussion This method overrides @c location property specified on initial configuration, and sends an immediate request.
* @param location User's location with latitude and longitude
*/
- (void)recordLocation:(CLLocationCoordinate2D)location DEPRECATED_MSG_ATTRIBUTE("Use 'recordLocation:city:ISOCountryCode:IP:' method instead!");

/**
* Records user's city and country info to be used for geo-location based push notifications and advanced user segmentation.
* @discussion By default, Countly Server uses a geo-ip database for acquiring user's location.
* @discussion If the app has information about user's city and/or country, these information can be provided using this method.
* @discussion This method overrides @c city and @c ISOCountryCode properties specified on initial configuration, and sends an immediate request.
* @param city User's city
* @param ISOCountryCode User's ISO country code in ISO 3166-1 alpha-2 format
*/
- (void)recordCity:(NSString *)city andISOCountryCode:(NSString *)ISOCountryCode DEPRECATED_MSG_ATTRIBUTE("Use 'recordLocation:city:ISOCountryCode:IP:' method instead!");

/**
* Records user's IP address to be used for geo-location based push notifications and advanced user segmentation.
* @discussion By default, Countly Server uses a geo-ip database for acquiring user's location.
* @discussion If the app needs to explicitly specify the IP address due to network requirements, it can be provided using this method.
* @discussion This method overrides @c IP property specified on initial configuration, and sends an immediate request.
* @param IP User's explicit IP address
*/
- (void)recordIP:(NSString *)IP DEPRECATED_MSG_ATTRIBUTE("Use 'recordLocation:city:ISOCountryCode:IP:' method instead!");

/**
* Disables geo-location based push notifications by clearing all existing location info.
* @discussion Once disabled, geo-location based push notifications can be enabled again by calling @c recordLocation: or @c recordCity:andISOCountryCode: or @c recordIP: method.
Expand Down
41 changes: 9 additions & 32 deletions Countly.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ - (void)startWithConfig:(CountlyConfig *)config

CountlyDeviceInfo.sharedInstance.customMetrics = [config.customMetrics cly_truncated:@"Custom metric"];

[Countly.user save];

#if (TARGET_OS_IOS)
CountlyFeedbacks.sharedInstance.message = config.starRatingMessage;
CountlyFeedbacks.sharedInstance.sessionCount = config.starRatingSessionCount;
Expand Down Expand Up @@ -205,6 +207,13 @@ - (void)setNewHost:(NSString *)newHost
CountlyConnectionManager.sharedInstance.host = newHost;
}

- (void)setNewURLSessionConfiguration:(NSURLSessionConfiguration *)newURLSessionConfiguration
{
CLY_LOG_I(@"%s %@", __FUNCTION__, newURLSessionConfiguration);

CountlyConnectionManager.sharedInstance.URLSessionConfiguration = newURLSessionConfiguration;
}

- (void)setNewAppKey:(NSString *)newAppKey
{
CLY_LOG_I(@"%s %@", __FUNCTION__, newAppKey);
Expand All @@ -224,11 +233,6 @@ - (void)setNewAppKey:(NSString *)newAppKey
[self resume];
}

- (void)setCustomHeaderFieldValue:(NSString *)customHeaderFieldValue
{
CLY_LOG_W(@"setCustomHeaderFieldValue: method is deprecated. Please use `URLSessionConfiguration` property on `CountlyConfig` instead.");
}

- (void)flushQueues
{
CLY_LOG_I(@"%s", __FUNCTION__);
Expand Down Expand Up @@ -764,33 +768,6 @@ - (void)recordLocation:(CLLocationCoordinate2D)location city:(NSString * _Nullab
[CountlyLocationManager.sharedInstance recordLocation:location city:city ISOCountryCode:ISOCountryCode IP:IP];
}

- (void)recordLocation:(CLLocationCoordinate2D)location
{
CLY_LOG_W(@"recordLocation: method is deprecated. Please use recordLocation:city:countryCode:IP: method instead.");

[CountlyLocationManager.sharedInstance recordLocation:location city:nil ISOCountryCode:nil IP:nil];
}

- (void)recordCity:(NSString *)city andISOCountryCode:(NSString *)ISOCountryCode
{
CLY_LOG_W(@"recordCity:andISOCountryCode: method is deprecated. Please use recordLocation:city:countryCode:IP: method instead.");

if (!city.length && !ISOCountryCode.length)
return;

[CountlyLocationManager.sharedInstance recordLocation:kCLLocationCoordinate2DInvalid city:city ISOCountryCode:ISOCountryCode IP:nil];
}

- (void)recordIP:(NSString *)IP
{
CLY_LOG_W(@"recordIP: method is deprecated. Please use recordLocation:city:countryCode:IP: method instead.");

if (!IP.length)
return;

[CountlyLocationManager.sharedInstance recordLocation:kCLLocationCoordinate2DInvalid city:nil ISOCountryCode:nil IP:IP];
}

- (void)disableLocationInfo
{
CLY_LOG_I(@"%s", __FUNCTION__);
Expand Down
2 changes: 1 addition & 1 deletion Countly.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Countly'
s.version = '21.11.2'
s.version = '22.06.0'
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'
Expand Down
6 changes: 3 additions & 3 deletions Countly.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
3B20A9792245225A00E3D7AE /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1310;
LastUpgradeCheck = 1340;
ORGANIZATIONNAME = "Alin Radut";
TargetAttributes = {
3B20A9812245225A00E3D7AE = {
Expand Down Expand Up @@ -410,7 +410,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 21.11.2;
MARKETING_VERSION = 22.06.0;
PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -439,7 +439,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 21.11.2;
MARKETING_VERSION = 22.06.0;
PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 1 addition & 1 deletion Countly.xcodeproj/xcshareddata/xcschemes/Countly.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
LastUpgradeVersion = "1340"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion CountlyCommon.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ @interface CountlyCommon ()
#endif
@end

NSString* const kCountlySDKVersion = @"21.11.2";
NSString* const kCountlySDKVersion = @"22.06.0";
NSString* const kCountlySDKName = @"objc-native-ios";

NSString* const kCountlyErrorDomain = @"ly.count.ErrorDomain";
Expand Down
38 changes: 10 additions & 28 deletions CountlyConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>

#if (TARGET_OS_IOS || TARGET_OS_TV)
#import <UIKit/UIKit.h>
#endif


NS_ASSUME_NONNULL_BEGIN

//NOTE: Countly features
Expand Down Expand Up @@ -65,8 +70,6 @@ extern CLYConsent const CLYConsentPushNotifications;
extern CLYConsent const CLYConsentLocation;
extern CLYConsent const CLYConsentViewTracking;
extern CLYConsent const CLYConsentAttribution;
extern CLYConsent const CLYConsentStarRating DEPRECATED_MSG_ATTRIBUTE("Please use CLYConsentFeedback instead!");
extern CLYConsent const CLYConsentAppleWatch DEPRECATED_MSG_ATTRIBUTE("As automatic metrics for Apple Watch is not supported anymore, 'CLYConsentAppleWatch' is now inoperative!");
extern CLYConsent const CLYConsentPerformanceMonitoring;
extern CLYConsent const CLYConsentFeedback;
extern CLYConsent const CLYConsentRemoteConfig;
Expand Down Expand Up @@ -109,8 +112,12 @@ typedef enum : NSUInteger

@protocol CountlyLoggerDelegate<NSObject>
- (void)internalLog:(NSString *)log withLevel:(CLYInternalLogLevel)level;
@end


@protocol CountlyAutoViewTrackingName
@optional
- (void)internalLog:(NSString *)log DEPRECATED_MSG_ATTRIBUTE("Use 'internalLog:withLevel:' method instead!");
- (NSString *)countlyAutoViewTrackingName;
@end


Expand Down Expand Up @@ -353,13 +360,6 @@ typedef enum : NSUInteger
*/
@property (nonatomic) BOOL manualSessionHandling;

/**
* @c enableAppleWatch property is deprecated.
* @discussion As automatic metrics for Apple Watch is not supported anymore, @c enableAppleWatch is now inoperative.
* @discussion Using this property will have no effect.
*/
@property (nonatomic) BOOL enableAppleWatch DEPRECATED_MSG_ATTRIBUTE("As automatic metrics for Apple Watch is not supported anymore, 'enableAppleWatch' is now inoperative!");

#pragma mark -

/**
Expand All @@ -386,12 +386,6 @@ typedef enum : NSUInteger
*/
@property (nonatomic, copy) NSDictionary<NSString *, NSString *> * indirectAttribution;

/**
* @c enableAttribution property is deprecated. Please use @c recordAttributionID method instead.
* @discussion Using this property will have no effect.
*/
@property (nonatomic) BOOL enableAttribution DEPRECATED_MSG_ATTRIBUTE("Use 'attributionID' property instead!");

#pragma mark -

/**
Expand Down Expand Up @@ -459,18 +453,6 @@ typedef enum : NSUInteger
*/
@property (nonatomic, copy) NSArray* pinnedCertificates;

/**
* @c customHeaderFieldName property is deprecated. Please use @c URLSessionConfiguration property instead.
* @discussion Using this property will have no effect.
*/
@property (nonatomic, copy) NSString* customHeaderFieldName DEPRECATED_MSG_ATTRIBUTE("Use 'URLSessionConfiguration' property instead!");

/**
* @c customHeaderFieldValue property is deprecated. Please use @c URLSessionConfiguration property instead.
* @discussion Using this property will have no effect.
*/
@property (nonatomic, copy) NSString* customHeaderFieldValue DEPRECATED_MSG_ATTRIBUTE("Use 'URLSessionConfiguration' property instead!");

/**
* Salt value to be used for parameter tampering protection.
* @discussion If set, every request sent to Countly Server will have @c checksum256 value generated by SHA256(request + secretSalt)
Expand Down
5 changes: 0 additions & 5 deletions CountlyConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ @implementation CountlyConfig
CLYDeviceIDType const CLYDeviceIDTypeIDFV = @"CLYDeviceIDTypeIDFV";
CLYDeviceIDType const CLYDeviceIDTypeNSUUID = @"CLYDeviceIDTypeNSUUID";

//NOTE: Legacy device ID options. They will fallback to default device ID.
NSString* const CLYIDFA = CLYDefaultDeviceID;
NSString* const CLYIDFV = CLYDefaultDeviceID;
NSString* const CLYOpenUDID = CLYDefaultDeviceID;

- (instancetype)init
{
if (self = [super init])
Expand Down
1 change: 1 addition & 0 deletions CountlyConnectionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

extern NSString* const kCountlyQSKeyAppKey;
extern NSString* const kCountlyQSKeyDeviceID;
extern NSString* const kCountlyQSKeyDeviceIDType;
extern NSString* const kCountlyQSKeySDKVersion;
extern NSString* const kCountlyQSKeySDKName;
extern NSString* const kCountlyQSKeyMethod;
Expand Down
30 changes: 21 additions & 9 deletions CountlyConnectionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ @interface CountlyConnectionManager ()

NSString* const kCountlyQSKeyDeviceID = @"device_id";
NSString* const kCountlyQSKeyDeviceIDOld = @"old_device_id";
NSString* const kCountlyQSKeyDeviceIDType = @"t";

NSString* const kCountlyQSKeyTimestamp = @"timestamp";
NSString* const kCountlyQSKeyTimeZone = @"tz";
Expand Down Expand Up @@ -109,6 +110,16 @@ - (void)setHost:(NSString *)host
}
}

- (void)setURLSessionConfiguration:(NSURLSessionConfiguration *)URLSessionConfiguration
{
if (URLSessionConfiguration != nil)
{
_URLSessionConfiguration = URLSessionConfiguration;
_URLSession = nil;
}
}


- (void)proceedOnQueue
{
CLY_LOG_D(@"Proceeding on queue...");
Expand Down Expand Up @@ -499,15 +510,16 @@ - (void)sendPerformanceMonitoringTrace:(NSString *)trace

- (NSString *)queryEssentials
{
return [NSString stringWithFormat:@"%@=%@&%@=%@&%@=%lld&%@=%d&%@=%d&%@=%d&%@=%@&%@=%@",
kCountlyQSKeyAppKey, self.appKey.cly_URLEscaped,
kCountlyQSKeyDeviceID, CountlyDeviceInfo.sharedInstance.deviceID.cly_URLEscaped,
kCountlyQSKeyTimestamp, (long long)(CountlyCommon.sharedInstance.uniqueTimestamp * 1000),
kCountlyQSKeyTimeHourOfDay, (int)CountlyCommon.sharedInstance.hourOfDay,
kCountlyQSKeyTimeDayOfWeek, (int)CountlyCommon.sharedInstance.dayOfWeek,
kCountlyQSKeyTimeZone, (int)CountlyCommon.sharedInstance.timeZone,
kCountlyQSKeySDKVersion, CountlyCommon.sharedInstance.SDKVersion,
kCountlyQSKeySDKName, CountlyCommon.sharedInstance.SDKName];
return [NSString stringWithFormat:@"%@=%@&%@=%@&%@=%d&%@=%lld&%@=%d&%@=%d&%@=%d&%@=%@&%@=%@",
kCountlyQSKeyAppKey, self.appKey.cly_URLEscaped,
kCountlyQSKeyDeviceID, CountlyDeviceInfo.sharedInstance.deviceID.cly_URLEscaped,
kCountlyQSKeyDeviceIDType, (int)CountlyDeviceInfo.sharedInstance.deviceIDTypeValue,
kCountlyQSKeyTimestamp, (long long)(CountlyCommon.sharedInstance.uniqueTimestamp * 1000),
kCountlyQSKeyTimeHourOfDay, (int)CountlyCommon.sharedInstance.hourOfDay,
kCountlyQSKeyTimeDayOfWeek, (int)CountlyCommon.sharedInstance.dayOfWeek,
kCountlyQSKeyTimeZone, (int)CountlyCommon.sharedInstance.timeZone,
kCountlyQSKeySDKVersion, CountlyCommon.sharedInstance.SDKVersion,
kCountlyQSKeySDKName, CountlyCommon.sharedInstance.SDKName];
}

- (NSString *)locationRelatedInfoQueryString
Expand Down
Loading

0 comments on commit 8c3d4e4

Please sign in to comment.