-
Notifications
You must be signed in to change notification settings - Fork 299
/
Copy pathAdjust.h
328 lines (283 loc) · 10.9 KB
/
Adjust.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
//
// Adjust.h
// Adjust SDK
//
// V5.1.0
// Created by Christian Wellenbrock (@wellle) on 23rd July 2013.
// Copyright (c) 2012-Present Adjust GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@class ADJEvent;
@class ADJConfig;
@class ADJAttribution;
@class ADJAppStoreSubscription;
@class ADJThirdPartySharing;
@class ADJAdRevenue;
@class ADJLinkResolution;
@class ADJAppStorePurchase;
@class ADJPurchaseVerificationResult;
@class ADJDeeplink;
typedef void(^ADJResolvedDeeplinkBlock)(NSString * _Nullable resolvedLink);
typedef void(^ADJAttributionGetterBlock)(ADJAttribution * _Nullable attribution);
typedef void(^ADJIdfaGetterBlock)(NSString * _Nullable idfa);
typedef void(^ADJIdfvGetterBlock)(NSString * _Nullable idfv);
typedef void(^ADJSdkVersionGetterBlock)(NSString * _Nullable sdkVersion);
typedef void(^ADJLastDeeplinkGetterBlock)(NSURL * _Nullable lastDeeplink);
typedef void(^ADJAdidGetterBlock)(NSString * _Nullable adid);
typedef void(^ADJIsEnabledGetterBlock)(BOOL isEnabled);
typedef void(^ADJVerificationResultBlock)(ADJPurchaseVerificationResult * _Nonnull verificationResult);
/**
* Constants for our supported tracking environments.
*/
extern NSString * __nonnull const ADJEnvironmentSandbox;
extern NSString * __nonnull const ADJEnvironmentProduction;
/**
* @brief The main interface to Adjust.
*
* @note Use the methods of this class to tell Adjust about the usage of your app.
* See the README for details.
*/
@interface Adjust : NSObject
/**
* @brief Tell Adjust that the application did launch.
* This is required to initialize Adjust. Call this in the didFinishLaunching
* method of your AppDelegate.
*
* @note See ADJConfig.h for more configuration options
*
* @param adjustConfig The configuration object that includes the environment
* and the App Token of your app. This unique identifier can
* be found it in your dashboard at http://adjust.com and should always
* be 12 characters long.
*/
+ (void)initSdk:(nullable ADJConfig *)adjustConfig;
/**
* @brief Tell Adjust that a particular event has happened.
*
* @note See ADJEvent.h for more event options.
*
* @param event The Event object for this kind of event. It needs a event token
* that is created in the dashboard at http://adjust.com and should be six
* characters long.
*/
+ (void)trackEvent:(nullable ADJEvent *)event;
/**
* @brief Enable Adjust SDK. This setting is saved for future sessions.
*/
+ (void)enable;
/**
* @brief Disable Adjust SDK. This setting is saved for future sessions.
*/
+ (void)disable;
/**
* @brief Check if the SDK is enabled or disabled through a callback.
*
* @param completion Completion block to be pinged with the enabled state of the SDK.
*/
+ (void)isEnabledWithCompletionHandler:(nonnull ADJIsEnabledGetterBlock)completion;
/**
* @brief Read the URL that opened the application to search for an adjust deep link.
*
* @param deeplink Deeplink object which contains info about adjust deep link.
*/
+ (void)processDeeplink:(nonnull ADJDeeplink *)deeplink;
/**
* @brief Process the deep link that has opened an app and potentially get a resolved link.
*
* @param deeplink URL object which contains info about adjust deep link.
* @param completion Completion block where either resolved or echoed deep link will be sent.
*/
+ (void)processAndResolveDeeplink:(nonnull ADJDeeplink *)deeplink
withCompletionHandler:(nonnull ADJResolvedDeeplinkBlock)completion;
/**
* @brief Set the APNs push token.
*
* @param pushToken APNs push token.
*/
+ (void)setPushToken:(nonnull NSData *)pushToken;
/**
* @brief Set the APNs push token as stirng.
* This method is only used by Adjust non native SDKs. Don't use it anywhere else.
*
* @param pushToken APNs push token as string.
*/
+ (void)setPushTokenAsString:(nonnull NSString *)pushToken;
/**
* @brief Enable offline mode. Activities won't be sent but they are saved when
* offline mode is disabled. This feature is not saved for future sessions.
*/
+ (void)switchToOfflineMode;
/**
* @brief Disable offline mode. Activities won't be sent but they are saved when
* offline mode is disabled. This feature is not saved for future sessions.
*/
+ (void)switchBackToOnlineMode;
/**
* @brief Retrieve iOS device IDFA value through a callback.
*
* @param completion Completion block to get IDFA value delivered to.
*/
+ (void)idfaWithCompletionHandler:(nonnull ADJIdfaGetterBlock)completion;
/**
* @brief Retrieve iOS device IDFV value through a callback.
*
* @param completion Completion block to get the IDFV value delivered to.
*/
+ (void)idfvWithCompletionHandler:(nonnull ADJIdfvGetterBlock)completion;
/**
* @brief Get current adjust identifier for the user through a callback.
*
* @param completion Completion block to get the adid value delivered to.
*
* @note Adjust identifier is available only after installation has been successfully tracked.
*/
+ (void)adidWithCompletionHandler:(nonnull ADJAdidGetterBlock)completion;
/**
* @brief Get current attribution for the user through a callback.
*
* @note Attribution information is available only after installation has been successfully tracked
* and attribution information arrived after that from the backend.
*/
+ (void)attributionWithCompletionHandler:(nonnull ADJAttributionGetterBlock)completion;
/**
* @brief Get current Adjust SDK version string through a callback.
*
* @param completion Completion block to get the Adjust SDK version string (iosX.Y.Z) delivered to.
*/
+ (void)sdkVersionWithCompletionHandler:(nonnull ADJSdkVersionGetterBlock)completion;
/**
* @brief Convert a universal link style URL to a deeplink style URL with the corresponding scheme.
*
* @param url URL object which contains info about adjust deep link.
* @param scheme Desired scheme to which you want your resulting URL object to be prefixed with.
*
* @return URL object in custom URL scheme style prefixed with given scheme name.
*/
+ (nullable NSURL *)convertUniversalLink:(nonnull NSURL *)url withScheme:(nonnull NSString *)scheme;
/**
* @brief Add default callback parameter key-value pair which is going to be sent with each tracked session and event.
*
* @param param Default callback parameter value.
* @param key Default callback parameter key.
*/
+ (void)addGlobalCallbackParameter:(nonnull NSString *)param forKey:(nonnull NSString *)key;
/**
* @brief Add default partner parameter key-value pair which is going to be sent with each tracked session.
*
* @param param Default partner parameter value.
* @param key Default partner parameter key.
*/
+ (void)addGlobalPartnerParameter:(nonnull NSString *)param forKey:(nonnull NSString *)key;
/**
* @brief Remove default callback parameter from the tracked session and event packages.
*
* @param key Default callback parameter key.
*/
+ (void)removeGlobalCallbackParameterForKey:(nonnull NSString *)key;
/**
* @brief Remove default partner parameter from the tracked session and event packages.
*
* @param key Default partner parameter key.
*/
+ (void)removeGlobalPartnerParameterForKey:(nonnull NSString *)key;
/**
* @brief Remove all default callback parameters from the tracked session and event packages.
*/
+ (void)removeGlobalCallbackParameters;
/**
* @brief Remove all default partner parameters from the tracked session and event packages.
*/
+ (void)removeGlobalPartnerParameters;
/**
* @brief Give right user to be forgotten in accordance with GDPR law.
*/
+ (void)gdprForgetMe;
/**
* @brief Track third party sharing with possibility to allow or disallow it.
*
* @param thirdPartySharing Third party sharing choice.
*/
+ (void)trackThirdPartySharing:(nonnull ADJThirdPartySharing *)thirdPartySharing;
/**
* @brief Track measurement consent.
*
* @param enabled Value of the consent.
*/
+ (void)trackMeasurementConsent:(BOOL)enabled;
/**
* @brief Track ad revenue.
*
* @param adRevenue Ad revenue object instance containing all the relevant ad revenue tracking data.
*/
+ (void)trackAdRevenue:(nonnull ADJAdRevenue *)adRevenue;
/**
* @brief Track subscription.
*
* @param subscription Subscription object.
*/
+ (void)trackAppStoreSubscription:(nonnull ADJAppStoreSubscription *)subscription;
/**
* @brief Adjust wrapper for requestTrackingAuthorizationWithCompletionHandler: method of ATTrackingManager.
*
* @param completion Block which value of tracking authorization status will be delivered to.
*/
+ (void)requestAppTrackingAuthorizationWithCompletionHandler:(void (^_Nullable)(NSUInteger status))completion;
/**
* @brief Getter for app tracking authorization status.
*
* @return Value of app tracking authorization status.
*/
+ (int)appTrackingAuthorizationStatus;
/**
* @brief Adjust wrapper for all SKAdNetwork's update conversion value methods.
* Pass in all the required parameters for the supported SKAdNetwork version and nil for the rest.
*
* @param conversionValue Conversion value you would like SDK to set for given user.
* @param coarseValue One of the possible SKAdNetworkCoarseConversionValue values.
* @param lockWindow NSNumber wrapped Boolean value that indicates whether to send the postback before the conversion window ends.
* @param completion Completion handler you can provide to catch and handle any errors.
*/
+ (void)updateSkanConversionValue:(NSInteger)conversionValue
coarseValue:(nullable NSString *)coarseValue
lockWindow:(nullable NSNumber *)lockWindow
withCompletionHandler:(void (^_Nullable)(NSError *_Nullable error))completion;
/**
* @brief Get the last deep link which has opened the app through a callback.
*
* @param completion Completion block to get the last opened deep link delivered to.
*/
+ (void)lastDeeplinkWithCompletionHandler:(nonnull ADJLastDeeplinkGetterBlock)completion;
/**
* @brief Verify in-app-purchase.
*
* @param purchase Purchase object.
* @param completion Callback where verification result will be reported.
*/
+ (void)verifyAppStorePurchase:(nonnull ADJAppStorePurchase *)purchase
withCompletionHandler:(nonnull ADJVerificationResultBlock)completion;
/**
* @brief Verify in-app-purchase and track event upon successfully completed verification.
*
* @param event Adjust event to be tracked.
* @param completion Callback where verification result will be reported.
*/
+ (void)verifyAndTrackAppStorePurchase:(nonnull ADJEvent *)event
withCompletionHandler:(nonnull ADJVerificationResultBlock)completion;
/**
* Obtain singleton Adjust object.
*/
+ (nullable instancetype)getInstance;
#pragma mark - Methods for testing (do not use in your app)
/**
* @brief Method used for internal testing only. Don't use it in your app.
*/
+ (void)setTestOptions:(nullable NSDictionary *)testOptions;
/**
* @brief Method used for internal testing only. Don't use it in your app.
*/
+ (void)trackSubsessionStart;
/**
* @brief Method used for internal testing only. Don't use it in your app.
*/
+ (void)trackSubsessionEnd;
@end