Skip to content

Commit d5c79ff

Browse files
authored
Merge pull request #167 from erkanyildiz/master
For 20.04.3
2 parents a982db6 + c9c79d5 commit d5c79ff

15 files changed

+219
-116
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
## 20.04.3
2+
- Deprecated `recordLocation:`, `recordCity:andISOCountryCode:`, `recordIP:` methods
3+
- Added new combined `recordLocation:city:ISOCountryCode:IP:` method for recording location related info
4+
- Deprecated `enableAttribution` initial config flag
5+
- Added `attributionID` initial config property
6+
- Added `recordAttributionID:` method
7+
- Discarded IDFA usage on optional attribution feature
8+
- Discarded `COUNTLY_EXCLUDE_IDFA` preprocessor flag
9+
- Updated `PLCrashReporter` subspec dependency version specifier as `~> 1`
10+
11+
- Other various improvements
12+
- Updated HeaderDocs, internal logs, inline notes and pragma marks
13+
- Updated some initial config property modifiers as `copy`
14+
- Treated empty string `city`, `ISOCountryCode` and `IP` values as `nil`
15+
- Added warnings for the cases where `city` and `ISOCountryCode` code are not set as a pair
16+
17+
18+
119
## 20.04.2
220
- Implemented overriding default metrics and adding custom ones
321
- Fixed advertising tracking enabled check

Countly.h

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,29 @@ NS_ASSUME_NONNULL_BEGIN
328328

329329
#pragma mark - Location
330330

331+
/**
332+
* Records user's location, city, country and IP address to be used for geo-location based push notifications and advanced user segmentation.
333+
* @discussion By default, Countly Server uses a geo-ip database for acquiring user's location.
334+
* @discussion If the app uses Core Location services and granted permission, a location with better accuracy can be provided using this method.
335+
* @discussion If the app has information about user's city and/or country, these information can be provided using this method.
336+
* @discussion If the app needs to explicitly specify the IP address due to network requirements, it can be provided using this method.
337+
* @discussion This method overrides all location related properties specified on initial configuration or on a previous call to this method, and sends an immediate request.
338+
* @discussion City and country code information should be provided together. If one of them is missing while the other one is present, there will be a warning logged.
339+
* @param location User's location with latitude and longitude
340+
* @param city User's city
341+
* @param ISOCountryCode User's country code in ISO 3166-1 alpha-2 format
342+
* @param IP User's explicit IP address
343+
*/
344+
- (void)recordLocation:(CLLocationCoordinate2D)location city:(NSString * _Nullable)city ISOCountryCode:(NSString * _Nullable)ISOCountryCode IP:(NSString * _Nullable)IP;
345+
331346
/**
332347
* Records user's location info to be used for geo-location based push notifications and advanced user segmentation.
333348
* @discussion By default, Countly Server uses a geo-ip database for acquiring user's location.
334349
* @discussion If the app uses Core Location services and granted permission, a location with better accuracy can be provided using this method.
335350
* @discussion This method overrides @c location property specified on initial configuration, and sends an immediate request.
336351
* @param location User's location with latitude and longitude
337352
*/
338-
- (void)recordLocation:(CLLocationCoordinate2D)location;
353+
- (void)recordLocation:(CLLocationCoordinate2D)location DEPRECATED_MSG_ATTRIBUTE("Use 'recordLocation:city:ISOCountryCode:IP:' method instead!");
339354

340355
/**
341356
* Records user's city and country info to be used for geo-location based push notifications and advanced user segmentation.
@@ -345,7 +360,7 @@ NS_ASSUME_NONNULL_BEGIN
345360
* @param city User's city
346361
* @param ISOCountryCode User's ISO country code in ISO 3166-1 alpha-2 format
347362
*/
348-
- (void)recordCity:(NSString *)city andISOCountryCode:(NSString *)ISOCountryCode;
363+
- (void)recordCity:(NSString *)city andISOCountryCode:(NSString *)ISOCountryCode DEPRECATED_MSG_ATTRIBUTE("Use 'recordLocation:city:ISOCountryCode:IP:' method instead!");
349364

350365
/**
351366
* Records user's IP address to be used for geo-location based push notifications and advanced user segmentation.
@@ -354,7 +369,7 @@ NS_ASSUME_NONNULL_BEGIN
354369
* @discussion This method overrides @c IP property specified on initial configuration, and sends an immediate request.
355370
* @param IP User's explicit IP address
356371
*/
357-
- (void)recordIP:(NSString *)IP;
372+
- (void)recordIP:(NSString *)IP DEPRECATED_MSG_ATTRIBUTE("Use 'recordLocation:city:ISOCountryCode:IP:' method instead!");
358373

359374
/**
360375
* Disables geo-location based push notifications by clearing all existing location info.
@@ -518,6 +533,18 @@ NS_ASSUME_NONNULL_BEGIN
518533

519534

520535

536+
#pragma mark - Attribution
537+
538+
/**
539+
* Records attribution ID (IDFA) for campaign attribution.
540+
* @discussion This method overrides @c attributionID property specified on initial configuration, and sends an immediate request.
541+
* @discussion Also, this attribution ID will be sent with all @c begin_session requests.
542+
* @param attributionID Attribution ID (IDFA)
543+
*/
544+
- (void)recordAttributionID:(NSString *)attributionID;
545+
546+
547+
521548
#pragma mark - Remote Config
522549
/**
523550
* Returns last retrieved remote config value for given key, if exists.

Countly.m

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,12 @@ - (void)startWithConfig:(CountlyConfig *)config
9797
CountlyPersistency.sharedInstance.storedRequestsLimit = MAX(1, config.storedRequestsLimit);
9898

9999
CountlyCommon.sharedInstance.manualSessionHandling = config.manualSessionHandling;
100+
100101
CountlyCommon.sharedInstance.enableAppleWatch = config.enableAppleWatch;
101-
CountlyCommon.sharedInstance.enableAttribution = config.enableAttribution;
102102

103-
CountlyDeviceInfo.sharedInstance.customMetrics = config.customMetrics;
103+
CountlyCommon.sharedInstance.attributionID = config.attributionID;
104104

105-
if (!CountlyCommon.sharedInstance.manualSessionHandling)
106-
[CountlyConnectionManager.sharedInstance beginSession];
105+
CountlyDeviceInfo.sharedInstance.customMetrics = config.customMetrics;
107106

108107
#if (TARGET_OS_IOS)
109108
CountlyStarRating.sharedInstance.message = config.starRatingMessage;
@@ -112,13 +111,19 @@ - (void)startWithConfig:(CountlyConfig *)config
112111
CountlyStarRating.sharedInstance.ratingCompletionForAutoAsk = config.starRatingCompletion;
113112
[CountlyStarRating.sharedInstance checkForAutoAsk];
114113

115-
CountlyLocationManager.sharedInstance.location = CLLocationCoordinate2DIsValid(config.location) ? [NSString stringWithFormat:@"%f,%f", config.location.latitude, config.location.longitude] : nil;
116-
CountlyLocationManager.sharedInstance.city = config.city;
117-
CountlyLocationManager.sharedInstance.ISOCountryCode = config.ISOCountryCode;
118-
CountlyLocationManager.sharedInstance.IP = config.IP;
119-
[CountlyLocationManager.sharedInstance sendLocationInfo];
114+
[CountlyLocationManager.sharedInstance updateLocation:config.location city:config.city ISOCountryCode:config.ISOCountryCode IP:config.IP];
120115
#endif
121116

117+
if (!CountlyCommon.sharedInstance.manualSessionHandling)
118+
[CountlyConnectionManager.sharedInstance beginSession];
119+
120+
//NOTE: If there is no consent for sessions, location info and attribution should be sent separately, as they cannot be sent with begin_session request.
121+
if (!CountlyConsentManager.sharedInstance.consentForSessions)
122+
{
123+
[CountlyLocationManager.sharedInstance sendLocationInfo];
124+
[CountlyConnectionManager.sharedInstance sendAttribution];
125+
}
126+
122127
#if (TARGET_OS_IOS || TARGET_OS_OSX)
123128
#ifndef COUNTLY_EXCLUDE_PUSHNOTIFICATIONS
124129
if ([config.features containsObject:CLYPushNotifications])
@@ -159,8 +164,6 @@ - (void)startWithConfig:(CountlyConfig *)config
159164

160165
[CountlyCommon.sharedInstance startAppleWatchMatching];
161166

162-
[CountlyCommon.sharedInstance startAttribution];
163-
164167
CountlyRemoteConfig.sharedInstance.isEnabledOnInitialConfig = config.enableRemoteConfig;
165168
CountlyRemoteConfig.sharedInstance.remoteConfigCompletionHandler = config.remoteConfigCompletionHandler;
166169
[CountlyRemoteConfig.sharedInstance startRemoteConfig];
@@ -599,25 +602,36 @@ - (void)clearPushNotificationToken
599602

600603
#pragma mark - Location
601604

605+
- (void)recordLocation:(CLLocationCoordinate2D)location city:(NSString * _Nullable)city ISOCountryCode:(NSString * _Nullable)ISOCountryCode IP:(NSString * _Nullable)IP
606+
{
607+
[CountlyLocationManager.sharedInstance recordLocation:location city:city ISOCountryCode:ISOCountryCode IP:IP];
608+
}
609+
602610
- (void)recordLocation:(CLLocationCoordinate2D)location
603611
{
604-
[CountlyLocationManager.sharedInstance recordLocationInfo:location city:nil ISOCountryCode:nil andIP:nil];
612+
COUNTLY_LOG(@"recordLocation: method is deprecated. Please use recordLocation:city:countryCode:IP: method instead.");
613+
614+
[CountlyLocationManager.sharedInstance recordLocation:location city:nil ISOCountryCode:nil IP:nil];
605615
}
606616

607617
- (void)recordCity:(NSString *)city andISOCountryCode:(NSString *)ISOCountryCode
608618
{
619+
COUNTLY_LOG(@"recordCity:andISOCountryCode: method is deprecated. Please use recordLocation:city:countryCode:IP: method instead.");
620+
609621
if (!city.length && !ISOCountryCode.length)
610622
return;
611623

612-
[CountlyLocationManager.sharedInstance recordLocationInfo:kCLLocationCoordinate2DInvalid city:city ISOCountryCode:ISOCountryCode andIP:nil];
624+
[CountlyLocationManager.sharedInstance recordLocation:kCLLocationCoordinate2DInvalid city:city ISOCountryCode:ISOCountryCode IP:nil];
613625
}
614626

615627
- (void)recordIP:(NSString *)IP
616628
{
629+
COUNTLY_LOG(@"recordIP: method is deprecated. Please use recordLocation:city:countryCode:IP: method instead.");
630+
617631
if (!IP.length)
618632
return;
619633

620-
[CountlyLocationManager.sharedInstance recordLocationInfo:kCLLocationCoordinate2DInvalid city:nil ISOCountryCode:nil andIP:IP];
634+
[CountlyLocationManager.sharedInstance recordLocation:kCLLocationCoordinate2DInvalid city:nil ISOCountryCode:nil IP:IP];
621635
}
622636

623637
- (void)disableLocationInfo
@@ -728,6 +742,20 @@ - (void)presentFeedbackWidgetWithID:(NSString *)widgetID completionHandler:(void
728742

729743

730744

745+
#pragma mark - Attribution
746+
747+
- (void)recordAttributionID:(NSString *)attributionID
748+
{
749+
if (!CountlyConsentManager.sharedInstance.consentForAttribution)
750+
return;
751+
752+
CountlyCommon.sharedInstance.attributionID = attributionID;
753+
754+
[CountlyConnectionManager.sharedInstance sendAttribution];
755+
}
756+
757+
758+
731759
#pragma mark - Remote Config
732760

733761
- (id)remoteConfigValueForKey:(NSString *)key

Countly.podspec

Lines changed: 2 additions & 2 deletions
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 = '20.04.2'
3+
s.version = '20.04.3'
44
s.license = { :type => 'MIT', :file => 'LICENSE.md' }
55
s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.'
66
s.homepage = 'https://github.com/Countly/countly-sdk-ios'
@@ -30,7 +30,7 @@ Pod::Spec.new do |s|
3030
s.subspec 'PL' do |pl|
3131
pl.platform = :ios
3232
pl.dependency 'Countly/Core'
33-
pl.dependency 'PLCrashReporter', '1.5.1'
33+
pl.dependency 'PLCrashReporter', '~> 1'
3434

3535
# It is not possible to set static_framework attribute on subspecs.
3636
# So, we have to set it on main spec.

Countly.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@
397397
"@executable_path/Frameworks",
398398
"@loader_path/Frameworks",
399399
);
400+
MARKETING_VERSION = 20.04.3;
400401
PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK;
401402
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
402403
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -423,6 +424,7 @@
423424
"@executable_path/Frameworks",
424425
"@loader_path/Frameworks",
425426
);
427+
MARKETING_VERSION = 20.04.3;
426428
PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK;
427429
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
428430
PROVISIONING_PROFILE_SPECIFIER = "";

CountlyCommon.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030

3131
#if (TARGET_OS_IOS)
3232
#import <UIKit/UIKit.h>
33-
#ifndef COUNTLY_EXCLUDE_IDFA
34-
#import <AdSupport/ASIdentifierManager.h>
35-
#endif
3633
#import "WatchConnectivity/WatchConnectivity.h"
3734
#endif
3835

@@ -43,9 +40,6 @@
4340

4441
#if (TARGET_OS_TV)
4542
#import <UIKit/UIKit.h>
46-
#ifndef COUNTLY_EXCLUDE_IDFA
47-
#import <AdSupport/ASIdentifierManager.h>
48-
#endif
4943
#endif
5044

5145
#import <objc/runtime.h>
@@ -67,7 +61,7 @@ NS_ERROR_ENUM(kCountlyErrorDomain)
6761
@property (nonatomic) BOOL hasStarted;
6862
@property (nonatomic) BOOL enableDebug;
6963
@property (nonatomic) BOOL enableAppleWatch;
70-
@property (nonatomic) BOOL enableAttribution;
64+
@property (nonatomic, copy) NSString* attributionID;
7165
@property (nonatomic) BOOL manualSessionHandling;
7266

7367
void CountlyInternalLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
@@ -89,7 +83,6 @@ void CountlyPrint(NSString *stringToPrint);
8983
#endif
9084

9185
- (void)startAppleWatchMatching;
92-
- (void)startAttribution;
9386

9487
- (void)observeDeviceOrientationChanges;
9588

CountlyCommon.m

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ @interface CountlyCommon ()
3333
#endif
3434
@end
3535

36-
NSString* const kCountlySDKVersion = @"20.04.2";
36+
NSString* const kCountlySDKVersion = @"20.04.3";
3737
NSString* const kCountlySDKName = @"objc-native-ios";
3838

3939
NSString* const kCountlyParentDeviceIDTransferKey = @"kCountlyParentDeviceIDTransferKey";
40-
NSString* const kCountlyAttributionIDFAKey = @"idfa";
4140

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

@@ -169,33 +168,6 @@ - (void)startAppleWatchMatching
169168
#endif
170169
}
171170

172-
#pragma mark - Attribution
173-
174-
- (void)startAttribution
175-
{
176-
if (!self.enableAttribution)
177-
return;
178-
179-
if (!CountlyConsentManager.sharedInstance.consentForAttribution)
180-
return;
181-
182-
NSDictionary* attribution = nil;
183-
184-
#if (TARGET_OS_IOS || TARGET_OS_TV)
185-
#ifndef COUNTLY_EXCLUDE_IDFA
186-
if (!ASIdentifierManager.sharedManager.advertisingTrackingEnabled)
187-
{
188-
attribution = @{kCountlyAttributionIDFAKey: ASIdentifierManager.sharedManager.advertisingIdentifier.UUIDString};
189-
}
190-
#endif
191-
#endif
192-
193-
if (!attribution)
194-
return;
195-
196-
[CountlyConnectionManager.sharedInstance sendAttribution:[attribution cly_JSONify]];
197-
}
198-
199171
#pragma mark - Orientation
200172

201173
- (void)observeDeviceOrientationChanges

0 commit comments

Comments
 (0)