Skip to content

Commit c532c38

Browse files
authored
Merge pull request #1 from singular-labs/First-upload
initial commit
2 parents fff72d7 + 31329d0 commit c532c38

19 files changed

+924
-0
lines changed

Singular-Kids-SDK.podspec

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Pod::Spec.new do |spec|
2+
spec.name = "Singular-Kids-SDK"
3+
spec.version = "11.0.0"
4+
spec.summary = "Singular's iOS Kids SDK"
5+
spec.description = "Singular's SDK integration for iOS"
6+
spec.license = "MIT"
7+
spec.homepage = "https://www.singular.net/"
8+
spec.author = "Singular Labs"
9+
spec.source = { :git => "https://github.com/singular-labs/Singular-Kids-SDK.git", :tag => spec.version.to_s }
10+
11+
spec.static_framework = true
12+
spec.ios.deployment_target = "8.0"
13+
spec.ios.source_files = 'headers/*.h'
14+
spec.ios.resources = ['headers/*.js']
15+
spec.ios.vendored_frameworks = 'frameworks/Singular.framework'
16+
spec.ios.frameworks = 'Security', 'SystemConfiguration', 'iAd', 'StoreKit', 'WebKit'
17+
spec.ios.libraries = 'sqlite3.0', 'z'
18+
spec.pod_target_xcconfig = {
19+
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
20+
}
21+
spec.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
22+
spec.ios.pod_target_xcconfig = {
23+
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) $(PODS_ROOT)/Singular-SDK/frameworks/**',
24+
'OTHER_LDFLAGS' => '$(inherited) -framework "Singular"'
25+
}
26+
27+
end
28+
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
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
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
//
2+
// Singular.js
3+
// Singular js/SDK for iPhone/iOS public API
4+
//
5+
// Created by Frank Ledo on 11/14/11
6+
// Copyright © 2010-2011 Singular Inc. All rights reserved.
7+
//
8+
var Singular={
9+
AP_TRIGGER_RESULT:{
10+
AP_TRIGGER_SUCCESS: 0, // An overlay was loaded
11+
AP_TRIGGER_NOT_SHOWN: 1, // Overlay not shown, unknown reason
12+
AP_TRIGGER_NOT_READY: 2, // Singular session not started
13+
AP_TRIGGER_NO_CONNECTIVITY: 3, // No connectivity needed to do overlay
14+
AP_TRIGGER_NO_RULE: 4, // No rules connected to this trigger
15+
AP_TRIGGER_UNKNOWN: 5, // New trigger, not yet registered
16+
AP_TRIGGER_CURRENTLY_ACTIVE:6 // A trigger is already active
17+
}
18+
/*
19+
* Read-Only Properties, set after each call to Singular.
20+
* Call Singular.update() to update these.
21+
*/
22+
// version: Singular API Version
23+
,version:null
24+
// triggerActive: If an Singular trigger is currently active
25+
,triggerActive:false
26+
// lastTriggerResult: The result code of the last Singular trigger
27+
,lastTriggerResult:null
28+
// sessionStarted: If an Singular session has started
29+
,sessionStarted:false
30+
/* Methods */
31+
,event:function(name, withArgs) {
32+
// convert from JSON string (to maintain consistency with the Android SDK)
33+
if (typeof withArgs == "string") {
34+
withArgs = JSON.parse(withArgs);
35+
}
36+
37+
Singular.int_call('event', name, withArgs);
38+
}
39+
,revenue:function(currency, amount) {
40+
Singular.int_call('revenue', currency, amount);
41+
}
42+
,setCustomUserId:function(customUserId) {
43+
Singular.int_call('setCustomUserId', customUserId);
44+
}
45+
,unsetCustomUserId:function() {
46+
Singular.int_call('unsetCustomUserId');
47+
}
48+
/* registerCallback: Register a callback function.
49+
* @param signature The signature takes the format of:
50+
* funcname(var1,var2,var3), the signature will be
51+
* viewable in the web interface, and you will be able
52+
* to define values for these variables.
53+
* @param func function that will be called. This function should
54+
* expect to receive one parameter, an object whose keys
55+
* will include the variables defined in the signautre as
56+
* well as some Singular specific information.
57+
*/
58+
,registerCallback:function(signature, func) {
59+
signature='js:'+signature.replace(' ', '');
60+
Singular.int_callbacks[signature]=func;
61+
Singular.int_call('registerCallback', signature);
62+
}
63+
/*
64+
* trigger: Initiate a trigger
65+
* @param name The name of the trigger to initiate.
66+
*/
67+
,trigger:function(name) {
68+
Singular.int_call('trigger',name);
69+
}
70+
/* update: Update read-only properties */
71+
,update:function() {
72+
Singular.int_call('update');
73+
}
74+
/* Internal use only */
75+
,int_callbacks:{}
76+
,int_request:function(url) {
77+
var iframe = document.createElement("iframe");
78+
iframe.setAttribute("style", "display:none;");
79+
iframe.setAttribute("height","0px");
80+
iframe.setAttribute("width","0px");
81+
iframe.setAttribute("frameborder","0");
82+
iframe.src=url;
83+
document.documentElement.appendChild(iframe);
84+
}
85+
,int_call:function() {
86+
var arg, uargs=[], aargs=['_rand_='+parseInt(Math.random()*100)],
87+
url='singular://';
88+
for (var i=0, val;(val = arguments[i]);i++) {
89+
if (typeof val == 'object') {
90+
for (o in val) {
91+
arg=o+'='+encodeURIComponent(val[o]);
92+
aargs.push(arg)
93+
}
94+
}
95+
else {
96+
arg=encodeURIComponent(val);
97+
uargs.push(arg);
98+
}
99+
}
100+
url=url+uargs.join('/')+'?'+aargs.join('&');
101+
Singular.int_request(url);
102+
}
103+
,int_callback:function(signature, dict) {
104+
if (Singular.int_callbacks[signature])
105+
Singular.int_callbacks[signature](dict);
106+
}
107+
};
108+
// Do an initial update to set the value of read-only properties.
109+
Singular.update();
110+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// SingularAdData.h
3+
// Singular
4+
//
5+
// Created by Eyal Rabinovich on 13/06/2019.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
NS_ASSUME_NONNULL_BEGIN
11+
12+
@interface SingularAdData : NSMutableDictionary
13+
14+
- (id)initWithAdPlatfrom:(NSString*)adPlatform withCurrency:(NSString*)currency withRevenue:(NSNumber*)revenue;
15+
16+
- (void)setNetworkName:(NSString*)networkName;
17+
- (void)setAdType:(NSString*)adType;
18+
- (void)setGroupType:(NSString*)adGroupType;
19+
- (void)setImpressionId:(NSString*)impressionId;
20+
- (void)setAdPlacementName:(NSString*)adPlacementName;
21+
- (void)setAdUnitId:(NSString*)adUnitId;
22+
- (void)setAdGroupId:(NSString*)adGroupId;
23+
- (void)setAdGroupName:(NSString*)adGroupName;
24+
- (void)setAdGroupPriority:(NSString*)adGroupPriority;
25+
- (void)setPrecision:(NSString*)precision;
26+
- (void)setPlacementId:(NSString*)placementId;
27+
- (void)setAdUnitName:(NSString*)adUnitName;
28+
29+
- (BOOL)hasRequiredParams;
30+
31+
@end
32+
33+
NS_ASSUME_NONNULL_END
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// SingularConfig.h
3+
// Singular
4+
//
5+
// Created by Eyal Rabinovich on 03/06/2020.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
// avoid circular include of SingularLinkParams
11+
#ifndef SingularLinkParams
12+
#import "SingularLinkParams.h"
13+
#endif
14+
15+
@interface SingularConfig : NSObject
16+
17+
// General Fields
18+
@property NSString* apikey;
19+
@property NSString* secret;
20+
21+
// Singular Links fields
22+
@property NSDictionary *launchOptions;
23+
@property NSUserActivity* userActivity;
24+
@property NSURL* openUrl;
25+
@property void(^singularLinksHandler)(SingularLinkParams*);
26+
@property long shortLinkResolveTimeOut;
27+
@property NSArray* supportedDomains;
28+
@property NSArray* espDomains;
29+
30+
// Global Properties fields
31+
@property (readonly) NSMutableDictionary* globalProperties;
32+
33+
// SKAN fields
34+
@property BOOL skAdNetworkEnabled;
35+
@property BOOL manualSkanConversionManagement;
36+
@property void(^conversionValueUpdatedCallback)(NSInteger);
37+
@property NSInteger waitForTrackingAuthorizationWithTimeoutInterval;
38+
39+
-(id)initWithApiKey:(NSString*)apikey andSecret:(NSString*)secret;
40+
41+
-(void)setGlobalProperty:(NSString*)key withValue:(NSString*)value overrideExisting:(BOOL)overrideExisiting;
42+
-(NSString*)toJsonString;
43+
44+
@end
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// SingularLinkParams.h
3+
// Singular
4+
//
5+
// Created by Eyal Rabinovich on 15/04/2019.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
@interface SingularLinkParams: NSObject{
11+
NSString* deeplink;
12+
NSString* passthrough;
13+
BOOL isDeferred;
14+
}
15+
16+
- (id)initWithDeepLink:(NSString *)link andPassthrough:(NSString *)sentPassthrough isDeferred:(BOOL)isLinkDeferred;
17+
18+
- (NSString*)getDeepLink;
19+
- (NSString*)getPassthrough;
20+
- (BOOL)isDeferred;
21+
22+
@end
23+
735 Bytes
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
framework module Singular {
2+
umbrella header "Singular.h"
3+
4+
export *
5+
module * { export * }
6+
}
12.8 MB
Binary file not shown.
160 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)