4848#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
4949#define XC8_AVAILABLE 1
5050#import < UserNotifications/UserNotifications.h>
51-
5251#endif
5352
5453/* The action type associated to an OSNotificationAction object */
@@ -70,14 +69,6 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {
7069};
7170
7271
73-
74- /*
75- Used as value type for `kOSSettingsKeyInFocusDisplayOption`
76- for setting the display option of a notification received while the app was in focus.
77- */
78- typedef OSNotificationDisplayType OSInFocusDisplayOption;
79-
80-
8172@interface OSNotificationAction : NSObject
8273
8374/* The type of the notification action */
@@ -174,24 +165,31 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
174165@end ;
175166
176167
177- // TODO: Check tenses (past vs present)
168+ typedef NS_ENUM (NSInteger , OSNotificationPermission) {
169+ // The user has not yet made a choice regarding whether your app can show notifications.
170+ OSNotificationPermissionNotDetermined = 0 ,
171+
172+ // The application is not authorized to post user notifications.
173+ OSNotificationPermissionDenied,
174+
175+ // The application is authorized to post user notifications.
176+ OSNotificationPermissionAuthorized
177+ };
178+
178179
179180
180181// Permission Classes
181182@interface OSPermissionState : NSObject
182183
183184@property (readonly , nonatomic ) BOOL hasPrompted;
184- @property (readonly , nonatomic ) BOOL anwseredPrompt;
185- @property (readonly , nonatomic ) BOOL accepted;
185+ @property (readonly , nonatomic ) OSNotificationPermission status;
186186
187187@end
188188
189189@interface OSPermissionStateChanges : NSObject
190190
191191@property (readonly ) OSPermissionState* to;
192192@property (readonly ) OSPermissionState* from;
193- @property (readonly , nonatomic ) BOOL justEnabled;
194- @property (readonly , nonatomic ) BOOL justDisabled;
195193
196194@end
197195
@@ -235,9 +233,6 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
235233
236234
237235
238-
239-
240-
241236typedef void (^OSResultSuccessBlock)(NSDictionary * result);
242237typedef void (^OSFailureBlock)(NSError * error);
243238
@@ -268,6 +263,8 @@ extern NSString * const kOSSettingsKeyInAppLaunchURL;
268263extern NSString * const kOSSettingsKeyInFocusDisplayOption ;
269264
270265
266+
267+ // ======= OneSignal Class Interface =========
271268@interface OneSignal : NSObject
272269
273270extern NSString * const ONESIGNAL_VERSION;
@@ -278,8 +275,8 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
278275
279276
280277/* *
281- Initialize OneSignal. Sends push token to OneSignal so you can later send notifications.
282-
278+ Initialize OneSignal.
279+ Sends push token to OneSignal so you can later send notifications.
283280*/
284281
285282// - Initialization
@@ -288,7 +285,11 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
288285+ (id )initWithLaunchOptions : (NSDictionary *)launchOptions appId : (NSString *)appId handleNotificationAction : (OSHandleNotificationActionBlock)actionCallback settings : (NSDictionary *)settings ;
289286+ (id )initWithLaunchOptions : (NSDictionary *)launchOptions appId : (NSString *)appId handleNotificationReceived : (OSHandleNotificationReceivedBlock)receivedCallback handleNotificationAction : (OSHandleNotificationActionBlock)actionCallback settings : (NSDictionary *)settings ;
290287
288+ @property (class ) OSNotificationDisplayType inFocusDisplayType;
289+
291290+ (NSString *)app_id ;
291+ + (NSString *)sdk_version_raw ;
292+ + (NSString *)sdk_semantic_version ;
292293
293294// Only use if you set kOSSettingsKeyAutoPrompt to false
294295+ (void )registerForPushNotifications ;
@@ -318,18 +319,16 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
318319
319320// - Subscription and Permissions
320321+ (void )IdsAvailable : (OSIdsAvailableBlock)idsAvailableBlock ;
321- + (OSPermissionSubscriptionState*)getPermisionSubscriptionState ;
322322
323- // + (void)addSubscriptionChanged:(void(^)(OSSubscriptionStateChanges* subscriptionStatus))completionHandler;
324- + (void )addSubscriptionObserver : (NSObject <OSSubscriptionObserver>*)observer ;
325- + (void )removeSubscriptionObserver : (NSObject <OSSubscriptionObserver>*)observer ;
323+ + (OSPermissionSubscriptionState*)getPermissionSubscriptionState ;
326324
327325+ (void )addPermissionObserver : (NSObject <OSPermissionObserver>*)observer ;
328326+ (void )removePermissionObserver : (NSObject <OSPermissionObserver>*)observer ;
329327
330- + (void )setSubscription : ( BOOL ) enable ;
331-
328+ + (void )addSubscriptionObserver : ( NSObject <OSSubscriptionObserver>*) observer ;
329+ + ( void ) removeSubscriptionObserver : ( NSObject <OSSubscriptionObserver>*) observer ;
332330
331+ + (void )setSubscription : (BOOL )enable ;
333332
334333// - Posting Notification
335334+ (void )postNotification : (NSDictionary *)jsonData ;
0 commit comments