-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPushbots.h
More file actions
305 lines (224 loc) · 7.99 KB
/
Pushbots.h
File metadata and controls
305 lines (224 loc) · 7.99 KB
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
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
//Use UserNotifications with iOS 10+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
#define IOS10PLUS 1
#import <UserNotifications/UserNotifications.h>
#endif
@class Pushbots;
/*!
@class
PushBots SDK v2.4.6
@abstract
The primary interface for integrating PushBots with your app.
<pre>
//in AppDelegate.h:
@property (strong, nonatomic) Pushbots *PushbotsClient;
//in AppDelegate.m
NSString *appID = @"56c3515f357e71aa0a0";
self.PushbotsClient = [Pushbots sharedInstanceWithAppId:appID andLoggingEnabled:YES];
</pre>
For more advanced usage, please see the <a
href="https://pushbots.com/developer/docs/ios-sdk-integration">PushBots iOS SDK integration</a>.
*/
@interface Pushbots : NSObject
/**
* Pushbots log levels.
*/
typedef NS_ENUM(NSUInteger, PBLogLevel) {
PBLogLevelNoLogging, PBLogLevelError, PBLogLevelWarn, PBLogLevelInfo, PBLogLevelVerbose
};
+ (NSDictionary*) currentlyShowingNotification;
+ (NSString*)applicationId;
+ (NSString*)deviceId;
+ (BOOL) prompt;
+ (BOOL) receivedCallback;
typedef void (^PushBotsReceivedNotification)(NSDictionary * result);
typedef void (^PushBotsOpenedNotification)(NSDictionary * result);
typedef void (^PushBotsRegistered)(NSString * userid);
+ (void) onRegistered:(PushBotsRegistered)rCallback;
/*!
@method
@abstract
Initializes an instance of the API.
@discussion
Initializes an instance of the PushBots.
@param appId Pushbots Application ID.
@param launchOptions launchOptions
*/
+(id)initWithAppId:(NSString*)appId withLaunchOptions:(NSDictionary *)launchOptions;
/*!
@method
@abstract
Initializes an instance of the API.
@discussion
Initializes an instance of the PushBots.
@param appId Pushbots Application ID.
@param launchOptions launchOptions
@param prompt Push notification prompt on first app open.
*/
+ (id)initWithAppId:(NSString*)appId withLaunchOptions:(NSDictionary *)launchOptions prompt:(BOOL)prompt;
+ (id)initWithAppId:(NSString*)appId withLaunchOptions:(NSDictionary *)launchOptions prompt:(BOOL)p receivedNotification:(PushBotsReceivedNotification)rCallback openedNotification:(PushBotsOpenedNotification)oCallback;
/*!
@method
@abstract
Initializes an instance of the API.
@discussion
Initializes an instance of the PushBots.
@param appId Pushbots Application ID.
@param launchOptions launchOptions
@param p Push notification prompt on first app open.
@param rCallback block to access notification data on received.
*/
+ (id)initWithAppId:(NSString*)appId withLaunchOptions:(NSDictionary *)launchOptions prompt:(BOOL)p receivedNotification:(PushBotsReceivedNotification)rCallback;
+ (void)notificationReceived:(NSDictionary*)messageDict;
/*!
@method
@discussion
Set PuhsBots SDK log level
<pre>[Pushbots setLogLevel:PBLogLevelVerbose];</pre>
@param pbloglevel PBLogLevelNoLogging, PBLogLevelVerbose, PBLogLevelInfo, PBLogLevelWarn, PBLogLevelError
*/
+ (void)setLogLevel:(PBLogLevel)pbloglevel;
+ (void)setLogLevel:(PBLogLevel)pbloglevel isUILog:(BOOL)uiLog;
/*!
@method
@discussion
Show prompt to register with remote notifications.
*/
+ (void)registerForRemoteNotifications;
/*!
@method
@abstract
Registers device with all its data on PushBots servers, and increment sessions count, updates last session date.
@discussion
This method should be called in <code>application:didRegisterForRemoteNotificationsWithDeviceToken:</code> to register the device on PushBots servers.
@param deviceToken Device token from Apple servers.
*/
+ (void) registerOnPushbots:(NSData *)deviceToken;
/*!
@method
@abstract
Get device data from Pushbots.
@discussion
This method will request device data from PushBots servers, should be used to sync tags/alias.
@param callback callback block to get device data as NSDictionary
*/
+ (void) getDevice:(void (^)(NSDictionary *device, NSError *error))callback;
+ (void) checkInApp:(void (^)(NSArray *inappmessages, NSError *error))callback;
+(void) inAppNotificationOpenedWithId:(NSString *) inapp_id;
/*!
@method
@abstract
Update device data on Pushbots.
@discussion
This method will update device data on PushBots.
Device data keys:
tags: (array) set device tags.
tags_add: (array) add tags.
tags_remove: (array) remove tags.
alias: (String) set device alias.
badge: (Integer) set device badge.
badge_p: (Integer) Increment device badge.
badge_d: (Integet) decrement device badge.
debug: (Boolean) Set device debug status for sandbox.
subscribed: (Boolean) subscribe/unsubscribe from Push notifications.
location: (array)[lat, lng] update device location.
@param deviceObject NSDictionary with device data to be updated.
*/
+ (void) update:(NSDictionary *)deviceObject;
/*!
@method
@discussion
This method will toggle debug mode on the device, visit sandbox section in dashboard for more details.
@param debug Toggle debug mode for sandboxing.
*/
+ (void) debug:(BOOL)debug;
/*!
@method
@discussion
This method will update device alias on PushBots.
@param alias device alias.
*/
+ (void) setAlias:(NSString *)alias;
+ (void) setName:(NSString *)name;
+ (void) setFirstName:(NSString *)f_name;
+ (void) setLastName:(NSString *)l_name;
+ (void) setEmail:(NSString *)email;
+ (void) setGender:(NSString *)gender;
+ (void) setPhone:(NSString *)phone;
/*!
@method
@discussion
This method will remove device alias from PushBots.
*/
+ (void) removeAlias;
/*!
@method
@discussion
This method will add tags to the device info.
@param tags Array of device tags to be added to the device.
*/
+ (void) tag:(NSArray *)tags;
/*!
@method
@discussion
This method will remove tags from device info.
@param tags Array of device tags to be removed from the device.
*/
+ (void) untag:(NSArray *)tags;
/*!
@method
@discussion
This method will set badge count on Pushbots and in the app (applicationIconBadgeNumber).
@param number New badge count.
*/
+ (void) setBadge: (int) number;
/*!
@method
@discussion
This method will increment badge count on PushBots and in the app (applicationIconBadgeNumber).
@param number badge count to add.
*/
+ (void) incrementBadgeCountBy: (int) number;
/*!
@method
@discussion
This method will decrement badge count on PushBots and in the app (applicationIconBadgeNumber).
@param number badge count to substract.
*/
+ (void) decrementBadgeCountBy: (int) number;
/*!
@method
@discussion
This method will Clear badge count on PushBots and in the app (applicationIconBadgeNumber).
*/
+ (void) clearBadgeCount;
+ (void)openURL:(NSDictionary *)userInfo;
/*!
@method
@discussion
This method will toggle Push notification subscription status.
@param subscribed badge count to substract.
*/
+ (void) toggleNotifications:(BOOL)subscribed;
+ (BOOL)showTakeoverNotificationWithObject:(NSDictionary *) notification;
+ (void)showTakeoverNotificationWith:(NSDictionary *) notification;
+ (BOOL) validateInAppMessage:(NSDictionary *) message;
+ (void) trackPushNotificationOpenedWithLaunchOptions:(NSDictionary *) launchOptions;
+ (void) trackPushNotificationOpenedWithPayload:(NSDictionary *) payload;
+ (void) trackPushNotificationOpenedWithPoll:(NSDictionary *) payload andAnswerId:(NSString *)ansewerID sync:(BOOL) sync;
+(void) trackEvent:(NSString *)event;
+(void) trackEvent:(NSString *)event withValue:(NSString *)value;
+(void) shareLocation:(BOOL)isSharingEnabled;
+(void) shareLocationPrompt:(BOOL)isPrompt;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability"
#ifdef IOS10PLUS
// iOS 10 only
// Notification Service Extension
+ (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest*)request withContent:(UNMutableNotificationContent*)replacementContent;
+ (UNMutableNotificationContent*)serviceExtensionTimeWillExpireRequest:(UNNotificationRequest*)request withContent:(UNMutableNotificationContent*)replacementContent;
#endif
#pragma clang diagnostic pop
@end