Skip to content

Commit c4fcc04

Browse files
committed
Add opt out of IDFA collection
* developing * Add OptOut of idfa tracking * Release 0.7.5
1 parent 60cca86 commit c4fcc04

File tree

6 files changed

+32
-6
lines changed

6 files changed

+32
-6
lines changed

ApphudSDK.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 = 'ApphudSDK'
3-
s.version = '0.7.4'
3+
s.version = '0.7.5'
44
s.summary = 'Track and control iOS auto-renewable subscriptions.'
55

66
s.description = 'Track, control and analyze iOS auto-renewable subscriptions with Apphud.'
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
1010
s.source = { :git => 'https://github.com/apphud/ApphudSDK.git', :tag => s.version.to_s }
1111
s.frameworks = 'StoreKit'
1212
s.ios.deployment_target = '11.2'
13-
s.swift_version = '5.0'
13+
s.swift_version = '4.2'
1414
s.source_files = 'Source/*.swift'
1515

1616
end

Source/Apphud.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ public typealias ApphudBoolCallback = ((Bool) -> Void)
7171
/// List of available attribution providers
7272
@objc public enum ApphudAttributionProvider : Int {
7373
case appsFlyer
74+
75+
/**
76+
Branch is implemented and doesn't required any additional code from Apphud SDK
77+
More details: https://docs.apphud.com/integrations/attribution/branch
78+
79+
case branch
80+
*/
7481
}
7582

7683
//MARK:- Initialization
@@ -342,4 +349,13 @@ final public class Apphud: NSObject {
342349
@objc public static func setIntegrationsTestMode(){
343350
ApphudInternal.shared.isIntegrationsTestMode = true
344351
}
352+
353+
/**
354+
Opt out of IDFA collection. Currently we collect IDFA to match users between Apphud and attribution platforms (AppsFlyer, Branch). If you don't use and not planning to use such services, you can call this method.
355+
356+
__Note__: This method must be called before Apphud SDK initialization.
357+
*/
358+
@objc public static func disableIDFACollection(){
359+
ApphudUtils.shared.optOutOfIDFACollection = true
360+
}
345361
}

Source/ApphudExtensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ internal func currentDeviceParameters() -> [String : String]{
7474
params["idfv"] = idfv
7575
}
7676

77-
if let idfa = identifierForAdvertising() {
77+
if !ApphudUtils.shared.optOutOfIDFACollection, let idfa = identifierForAdvertising(){
7878
params["idfa"] = idfa
7979
}
8080

Source/ApphudInternal.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
import AdSupport
1111
import StoreKit
1212

13-
let sdk_version = "0.7.4"
13+
let sdk_version = "0.7.5"
1414

1515
final class ApphudInternal {
1616

@@ -40,10 +40,15 @@ final class ApphudInternal {
4040

4141
private var restoreSubscriptionCallback : (([ApphudSubscription]?) -> Void)?
4242

43+
private var allowInitialize = true
44+
4345
internal func initialize(apiKey: String, userID : String?, deviceIdentifier : String? = nil){
4446

4547
apphudLog("Started Apphud SDK (\(sdk_version))", forceDisplay: true)
4648

49+
if !allowInitialize {return}
50+
allowInitialize = false
51+
4752
ApphudStoreKitWrapper.shared.setupObserver()
4853

4954
var deviceID = ApphudKeychain.loadDeviceID()
@@ -79,6 +84,9 @@ final class ApphudInternal {
7984

8085
private func continueToRegisteringUser(){
8186
createOrGetUser { success in
87+
88+
self.allowInitialize = !success
89+
8290
if success {
8391
apphudLog("User successfully registered")
8492
self.performAllUserRegisteredBlocks()

Source/ApphudUtils.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ public class ApphudUtils : NSObject {
2222

2323
internal static let shared = ApphudUtils()
2424
private(set) var isLoggingEnabled = false
25+
26+
internal var optOutOfIDFACollection = false
2527
}
2628

apphud.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@
395395
PRODUCT_BUNDLE_IDENTIFIER = com.apphud.subscriptionstest;
396396
PRODUCT_NAME = "$(TARGET_NAME)";
397397
PROVISIONING_PROFILE_SPECIFIER = "";
398-
SWIFT_VERSION = 5.0;
398+
SWIFT_VERSION = 4.2;
399399
TARGETED_DEVICE_FAMILY = "1,2";
400400
};
401401
name = Debug;
@@ -416,7 +416,7 @@
416416
PRODUCT_BUNDLE_IDENTIFIER = com.apphud.subscriptionstest;
417417
PRODUCT_NAME = "$(TARGET_NAME)";
418418
PROVISIONING_PROFILE_SPECIFIER = "";
419-
SWIFT_VERSION = 5.0;
419+
SWIFT_VERSION = 4.2;
420420
TARGETED_DEVICE_FAMILY = "1,2";
421421
};
422422
name = Release;

0 commit comments

Comments
 (0)