|
| 1 | +// |
| 2 | +// Singular.h |
| 3 | +// Singular SDK for iOS public API |
| 4 | +// |
| 5 | +// Copyright © 2010-2020 Singular Inc. All rights reserved. |
| 6 | +// |
| 7 | + |
| 8 | +#import <Foundation/Foundation.h> |
| 9 | +#import <UIKit/UIKit.h> |
| 10 | +#import <WebKit/WebKit.h> |
| 11 | +#import "SingularAdData.h" |
| 12 | + |
| 13 | +// avoid circular include of SingularLinkParams |
| 14 | +#ifndef SingularLinkParams |
| 15 | +#import "SingularLinkParams.h" |
| 16 | +#endif |
| 17 | + |
| 18 | +// avoid circular include of SingularConfig |
| 19 | +#ifndef SingularConfig |
| 20 | +#import "SingularConfig.h" |
| 21 | +#endif |
| 22 | + |
| 23 | +@interface Singular : NSObject |
| 24 | + |
| 25 | ++ (BOOL)start:(SingularConfig*)config; |
| 26 | + |
| 27 | ++ (void)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret; |
| 28 | ++ (BOOL)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret andLaunchOptions:(NSDictionary *)launchOptions withSingularLinkHandler:(void(^)(SingularLinkParams*))handler; |
| 29 | ++ (BOOL)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret |
| 30 | + andLaunchOptions:(NSDictionary *)launchOptions withSingularLinkHandler:(void(^)(SingularLinkParams*))handler andShortLinkResolveTimeout:(long)timeoutSec; |
| 31 | ++ (BOOL)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret andLaunchOptions:(NSDictionary *)launchOptions withSingularLinkHandler:(void(^)(SingularLinkParams*))handler andSupportedDomains:(NSArray*)domains; |
| 32 | ++ (BOOL)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret andLaunchOptions:(NSDictionary *)launchOptions withSingularLinkHandler:(void(^)(SingularLinkParams*))handler andShortLinkResolveTimeout:(long)timeoutSec andSupportedDomains:(NSArray*)domains; |
| 33 | ++ (BOOL)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret andUserActivity:(NSUserActivity *)userActivity withSingularLinkHandler:(void(^)(SingularLinkParams*))handler; |
| 34 | ++ (BOOL)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret andUserActivity:(NSUserActivity *)userActivity withSingularLinkHandler:(void(^)(SingularLinkParams*))handler andShortLinkResolveTimeout:(long)timeoutSec; |
| 35 | ++ (BOOL)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret andUserActivity:(NSUserActivity *)userActivity withSingularLinkHandler:(void(^)(SingularLinkParams*))handler andSupportedDomains:(NSArray*)domains; |
| 36 | ++ (BOOL)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret andUserActivity:(NSUserActivity *)userActivity withSingularLinkHandler:(void(^)(SingularLinkParams*))handler andShortLinkResolveTimeout:(long)timeoutSec andSupportedDomains:(NSArray*)domains; |
| 37 | ++ (void)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret andLaunchOptions:(NSDictionary *)launchOptions; |
| 38 | ++ (void)startSession:(NSString *)apiKey withKey:(NSString *)apiSecret andLaunchURL:(NSURL *)url; |
| 39 | ++ (void)reStartSession:(NSString *)apiKey withKey:(NSString *)apiSecret; |
| 40 | ++ (BOOL)sessionStarted; |
| 41 | ++ (void)endSession; |
| 42 | ++ (void)event:(NSString *)name; |
| 43 | ++ (void)event:(NSString *)name withArgs:(NSDictionary *)args; |
| 44 | ++ (void)eventWithArgs:(NSString *)name, ...; // use only subclasses of |
| 45 | + // NSObject, not primitive types |
| 46 | + // like int |
| 47 | ++ (void)setDeviceCustomUserId:(NSString *) customUserId; |
| 48 | + |
| 49 | ++ (void)registerDeviceTokenForUninstall:(NSData *)deviceToken; |
| 50 | ++ (void)registerDeferredDeepLinkHandler:(void (^)(NSString *deeplink))handler; |
| 51 | ++ (int)setDeferredDeepLinkTimeout:(int)duration; |
| 52 | + |
| 53 | ++ (Singular *) shared; |
| 54 | ++ (NSTimeInterval) sessionDuration; |
| 55 | ++ (NSDate *) sessionStartDate; |
| 56 | ++ (NSString *) sessionID; |
| 57 | ++ (NSString *) version; |
| 58 | ++ (NSString *) singularID; |
| 59 | ++ (NSString *)singularKeyspace; |
| 60 | ++ (void) setBufferLimit:(int)size; |
| 61 | +@property(strong, nonatomic, readonly) NSString *applicationName; |
| 62 | +@property(strong, nonatomic, readonly) NSString *applicationIdentifier; |
| 63 | ++ (BOOL) processJSRequestWK:(WKWebView *)webView withURL:(NSURLRequest *)url; |
| 64 | +@property(nonatomic) int minSessionDuration; // Default: 5 |
| 65 | ++ (void) setMinSessionDuration:(int)seconds; |
| 66 | + |
| 67 | +// IAP |
| 68 | ++ (void)initializeApStore; |
| 69 | ++ (void)setAllowAutoIAPComplete:(BOOL)boolean; |
| 70 | ++ (void)iapComplete:(id)transaction; |
| 71 | ++ (void)iapComplete:(id)transaction withName:(NSString*)name; |
| 72 | ++ (void)iapComplete:(id)transaction withAttributes:(id)value, ...; |
| 73 | ++ (void)iapComplete:(id)transaction withName:(NSString*)name withAttributes:(id)value, ...; |
| 74 | + |
| 75 | +// DEMO |
| 76 | ++ (void)setGender:(NSString *)gender; |
| 77 | ++ (void)setAge:(id)age; |
| 78 | + |
| 79 | +// BATCHING |
| 80 | ++ (int)batchInterval; |
| 81 | ++ (void)setBatchInterval:(int)interval; |
| 82 | ++ (BOOL)batchesEvents; |
| 83 | ++ (void)setBatchesEvents:(BOOL)boolean; |
| 84 | ++ (void)sendAllBatches; |
| 85 | + |
| 86 | +//ANIMESH UPDATE |
| 87 | +// REVENUE |
| 88 | ++ (void)revenue:(id)transaction; |
| 89 | ++ (void)revenue:(id)transaction withAttributes:(NSDictionary*)attributes; |
| 90 | ++ (void)revenue:(NSString *)currency amount:(double)amount; |
| 91 | ++ (void)revenue:(NSString *)currency amount:(double)amount withAttributes:(NSDictionary*)attributes; |
| 92 | ++ (void)revenue:(NSString *)currency amount:(double)amount productSKU:(NSString *)productSKU productName:(NSString *)productName productCategory:(NSString *)productCategory productQuantity:(int)productQuantity productPrice:(double)productPrice; |
| 93 | + |
| 94 | ++ (void)customRevenue:(NSString*)eventname transaction:(id)transaction; |
| 95 | ++ (void)customRevenue:(NSString*)eventname transaction:(id)transaction withAttributes:(NSDictionary*)attributes; |
| 96 | ++ (void)customRevenue:(NSString*)eventname currency:(NSString *)currency amount:(double)amount; |
| 97 | ++ (void)customRevenue:(NSString*)eventname currency:(NSString *)currency amount:(double)amount withAttributes:(NSDictionary*)attributes; |
| 98 | ++ (void)customRevenue:(NSString*)eventname currency:(NSString *)currency amount:(double)amount productSKU:(NSString *)productSKU productName:(NSString *)productName productCategory:(NSString *)productCategory productQuantity:(int)productQuantity productPrice:(double)productPrice; |
| 99 | + |
| 100 | ++ (void)setCustomUserId:(NSString*)customUserId; |
| 101 | ++ (void)unsetCustomUserId; |
| 102 | + |
| 103 | ++ (void)setSessionTimeout:(int)timeout; |
| 104 | ++ (NSInteger)getFirstSessionUnixTime; |
| 105 | + |
| 106 | ++ (void)setWrapperName:(NSString*)name andVersion:(NSString*)version; |
| 107 | + |
| 108 | +/* Global Properties */ |
| 109 | + |
| 110 | ++ (NSDictionary*)getGlobalProperties; |
| 111 | ++ (BOOL)setGlobalProperty:(NSString*)key andValue:(NSString*)value overrideExisting:(BOOL)overrideExisting; |
| 112 | ++ (void)unsetGlobalProperty:(NSString*)key; |
| 113 | ++ (void)clearGlobalProperties; |
| 114 | + |
| 115 | +/* GDPR helpers */ |
| 116 | + |
| 117 | ++ (void)trackingOptIn; |
| 118 | ++ (void)trackingUnder13; |
| 119 | ++ (void)stopAllTracking; |
| 120 | ++ (void)resumeAllTracking; |
| 121 | ++ (BOOL)isAllTrackingStopped; |
| 122 | ++ (void)limitDataSharing:(BOOL)shouldLimitDataSharing; |
| 123 | ++ (BOOL)getLimitDataSharing; |
| 124 | + |
| 125 | +/* SKAN Methods */ |
| 126 | + |
| 127 | ++ (void)skanRegisterAppForAdNetworkAttribution; |
| 128 | ++ (BOOL)skanUpdateConversionValue:(NSInteger)conversionValue; |
| 129 | ++ (NSNumber *)skanGetConversionValue; |
| 130 | + |
| 131 | +/* Singular Links */ |
| 132 | + |
| 133 | ++(BOOL)isSingularLink:(id)linkHolder; |
| 134 | + |
| 135 | +/* Admon Methods*/ |
| 136 | + |
| 137 | ++ (void)adRevenue:(SingularAdData*)adData; |
| 138 | + |
| 139 | +@end |
0 commit comments