4343
4444#import < Foundation/Foundation.h>
4545#import < UserNotifications/UserNotifications.h>
46-
46+ #import < OneSignalCore/OneSignalCore.h>
47+ #import < OneSignalOutcomes/OneSignalOutcomes.h>
4748#pragma clang diagnostic push
4849#pragma clang diagnostic ignored "-Wstrict-prototypes"
4950#pragma clang diagnostic ignored "-Wnullability-completeness"
5051
51- /* The action type associated to an OSNotificationAction object */
52- typedef NS_ENUM (NSUInteger , OSNotificationActionType) {
53- OSNotificationActionTypeOpened,
54- OSNotificationActionTypeActionTaken
55- };
56-
57- @interface OSNotificationAction : NSObject
58-
59- /* The type of the notification action */
60- @property (readonly )OSNotificationActionType type;
61-
62- /* The ID associated with the button tapped. NULL when the actionType is NotificationTapped */
63- @property (readonly , nullable )NSString * actionId;
64-
65- @end
66-
67- /* OneSignal OSNotification */
68- @interface OSNotification : NSObject
69-
70- /* Unique Message Identifier */
71- @property (readonly , nullable )NSString * notificationId;
72-
73- /* Unique Template Identifier */
74- @property (readonly , nullable )NSString * templateId;
75-
76- /* Name of Template */
77- @property (readonly , nullable )NSString * templateName;
78-
79- /* True when the key content-available is set to 1 in the apns payload.
80- content-available is used to wake your app when the payload is received.
81- See Apple's documenation for more details.
82- https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623013-application
83- */
84- @property (readonly )BOOL contentAvailable;
85-
86- /* True when the key mutable-content is set to 1 in the apns payload.
87- mutable-content is used to wake your Notification Service Extension to modify a notification.
88- See Apple's documenation for more details.
89- https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension
90- */
91- @property (readonly , getter =hasMutableContent)BOOL mutableContent;
92-
93- /*
94- Notification category key previously registered to display with.
95- This overrides OneSignal's actionButtons.
96- See Apple's documenation for more details.
97- https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/SupportingNotificationsinYourApp.html#//apple_ref/doc/uid/TP40008194-CH4-SW26
98- */
99- @property (readonly , nullable )NSString * category;
100-
101- /* The badge assigned to the application icon */
102- @property (readonly )NSInteger badge;
103- @property (readonly )NSInteger badgeIncrement;
104-
105- /* The sound parameter passed to the notification
106- By default set to UILocalNotificationDefaultSoundName */
107- @property (readonly , nullable )NSString * sound;
108-
109- /* Main push content */
110- @property (readonly , nullable )NSString * title;
111- @property (readonly , nullable )NSString * subtitle;
112- @property (readonly , nullable )NSString * body;
113-
114- /* Web address to launch within the app via a WKWebView */
115- @property (readonly , nullable )NSString * launchURL;
116-
117- /* Additional key value properties set within the payload */
118- @property (readonly , nullable )NSDictionary * additionalData;
119-
120- /* iOS 10+ : Attachments sent as part of the rich notification */
121- @property (readonly , nullable )NSDictionary * attachments;
122-
123- /* Action buttons passed */
124- @property (readonly , nullable )NSArray *actionButtons;
125-
126- /* Holds the original payload received
127- Keep the raw value for users that would like to root the push */
128- @property (readonly , nonnull )NSDictionary *rawPayload;
129-
130- /* iOS 10+ : Groups notifications into threads */
131- @property (readonly , nullable )NSString *threadId;
132-
133- /* iOS 15+ : Relevance Score for notification summary */
134- @property (readonly , nullable )NSNumber *relevanceScore;
135-
136- /* iOS 15+ : Interruption Level */
137- @property (readonly )NSString *interruptionLevel;
138-
139- @property (readonly , nullable )NSString *collapseId;
140-
141- /* Parses an APNS push payload into a OSNotification object.
142- Useful to call from your NotificationServiceExtension when the
143- didReceiveNotificationRequest:withContentHandler: method fires. */
144- + (instancetype )parseWithApns : (nonnull NSDictionary *)message ;
145-
146- /* Convert object into a custom Dictionary / JSON Object */
147- - (NSDictionary * _Nonnull)jsonRepresentation ;
148-
149- /* Convert object into an NSString that can be convertible into a custom Dictionary / JSON Object */
150- - (NSString * _Nonnull)stringify ;
151-
152- @end
153-
154- @interface OSNotificationOpenedResult : NSObject
155-
156- @property (readonly , nonnull )OSNotification* notification;
157- @property (readonly , nonnull )OSNotificationAction *action;
158-
159- /* Convert object into an NSString that can be convertible into a custom Dictionary / JSON Object */
160- - (NSString * _Nonnull)stringify ;
161-
162- // Convert the class into a NSDictionary
163- - (NSDictionary *_Nonnull)jsonRepresentation ;
164-
165- @end ;
166-
16752@interface OSInAppMessage : NSObject
16853
16954@property (strong , nonatomic , nonnull ) NSString *messageId;
@@ -173,16 +58,6 @@ typedef NS_ENUM(NSUInteger, OSNotificationActionType) {
17358
17459@end
17560
176- @interface OSInAppMessageOutcome : NSObject
177-
178- @property (strong , nonatomic , nonnull ) NSString *name;
179- @property (strong , nonatomic , nonnull ) NSNumber *weight;
180- @property (nonatomic ) BOOL unique;
181-
182- // Convert the class into a NSDictionary
183- - (NSDictionary *_Nonnull)jsonRepresentation ;
184-
185- @end
18661
18762@interface OSInAppMessageTag : NSObject
18863
@@ -235,43 +110,6 @@ typedef NS_ENUM(NSUInteger, OSNotificationActionType) {
235110- (void )onDidDismissInAppMessage : (OSInAppMessage *)message ;
236111@end
237112
238- // Pass in nil means a notification will not display
239- typedef void (^OSNotificationDisplayResponse)(OSNotification* _Nullable notification);
240- /* OneSignal Influence Types */
241- typedef NS_ENUM (NSUInteger , OSInfluenceType) {
242- DIRECT,
243- INDIRECT,
244- UNATTRIBUTED,
245- DISABLED
246- };
247- /* OneSignal Influence Channels */
248- typedef NS_ENUM (NSUInteger , OSInfluenceChannel) {
249- IN_APP_MESSAGE,
250- NOTIFICATION,
251- };
252-
253- @interface OSOutcomeEvent : NSObject
254-
255- // Session enum (DIRECT, INDIRECT, UNATTRIBUTED, or DISABLED) to determine code route and request params
256- @property (nonatomic ) OSInfluenceType session;
257-
258- // Notification ids for the current session
259- @property (strong , nonatomic , nullable ) NSArray *notificationIds;
260-
261- // Id or name of the event
262- @property (strong , nonatomic , nonnull ) NSString *name;
263-
264- // Time of the event occurring
265- @property (strong , nonatomic , nonnull ) NSNumber *timestamp;
266-
267- // A weight to attach to the outcome name
268- @property (strong , nonatomic , nonnull ) NSDecimalNumber *weight;
269-
270- // Convert the object into a NSDictionary
271- - (NSDictionary * _Nonnull)jsonRepresentation ;
272-
273- @end
274-
275113typedef NS_ENUM (NSInteger , OSNotificationPermission) {
276114 // The user has not yet made a choice regarding whether your app can show notifications.
277115 OSNotificationPermissionNotDetermined = 0 ,
@@ -436,14 +274,10 @@ typedef void (^OSWebOpenURLResultBlock)(BOOL shouldOpen);
436274typedef void (^OSResultSuccessBlock)(NSDictionary * result);
437275typedef void (^OSFailureBlock)(NSError * error);
438276
439- /* Block for handling outcome event being sent successfully*/
440- typedef void (^OSSendOutcomeSuccess)(OSOutcomeEvent* outcome);
441277
442278// ======= OneSignal Class Interface =========
443279@interface OneSignal : NSObject
444280
445- extern NSString * const ONESIGNAL_VERSION;
446-
447281+ (NSString *)appId ;
448282+ (NSString * _Nonnull)sdkVersionRaw ;
449283+ (NSString * _Nonnull)sdkSemanticVersion ;
@@ -460,16 +294,6 @@ extern NSString* const ONESIGNAL_VERSION;
460294+ (void )setProvidesNotificationSettingsView : (BOOL )providesView ;
461295
462296#pragma mark Logging
463- typedef NS_ENUM (NSUInteger , ONE_S_LOG_LEVEL) {
464- ONE_S_LL_NONE,
465- ONE_S_LL_FATAL,
466- ONE_S_LL_ERROR,
467- ONE_S_LL_WARN,
468- ONE_S_LL_INFO,
469- ONE_S_LL_DEBUG,
470- ONE_S_LL_VERBOSE
471- };
472-
473297+ (void )setLogLevel : (ONE_S_LOG_LEVEL)logLevel visualLevel : (ONE_S_LOG_LEVEL)visualLogLevel ;
474298+ (void )onesignalLog : (ONE_S_LOG_LEVEL)logLevel message : (NSString * _Nonnull)message ;
475299
@@ -510,14 +334,6 @@ typedef void (^OSInAppMessageClickBlock)(OSInAppMessageAction * _Nonnull action)
510334+ (void )setLocationShared : (BOOL )enable ;
511335+ (BOOL )isLocationShared ;
512336
513- #pragma mark NotificationService Extension
514- // iOS 10 only
515- // Process from Notification Service Extension.
516- // Used for iOS Media Attachemtns and Action Buttons.
517- + (UNMutableNotificationContent *)didReceiveNotificationExtensionRequest : (UNNotificationRequest * _Nonnull)request withMutableNotificationContent : (UNMutableNotificationContent * _Nullable)replacementContent __deprecated_msg(" Please use didReceiveNotificationExtensionRequest:withMutableNotificationContent:withContentHandler: instead." );
518- + (UNMutableNotificationContent *)didReceiveNotificationExtensionRequest : (UNNotificationRequest * _Nonnull)request withMutableNotificationContent : (UNMutableNotificationContent * _Nullable)replacementContent withContentHandler : (void (^)(UNNotificationContent *_Nonnull))contentHandler ;
519- + (UNMutableNotificationContent *)serviceExtensionTimeWillExpireRequest : (UNNotificationRequest * _Nonnull)request withMutableNotificationContent : (UNMutableNotificationContent * _Nullable)replacementContent ;
520-
521337#pragma mark Tags
522338+ (void )sendTag : (NSString * _Nonnull)key value : (NSString * _Nonnull)value onSuccess : (OSResultSuccessBlock _Nullable)successBlock onFailure : (OSFailureBlock _Nullable)failureBlock ;
523339+ (void )sendTag : (NSString * _Nonnull)key value : (NSString * _Nonnull)value ;
@@ -626,6 +442,14 @@ typedef void (^OSUpdateExternalUserIdSuccessBlock)(NSDictionary *results);
626442+ (void )sendUniqueOutcome : (NSString * _Nonnull)name onSuccess : (OSSendOutcomeSuccess _Nullable)success ;
627443+ (void )sendOutcomeWithValue : (NSString * _Nonnull)name value : (NSNumber * _Nonnull)value ;
628444+ (void )sendOutcomeWithValue : (NSString * _Nonnull)name value : (NSNumber * _Nonnull)value onSuccess : (OSSendOutcomeSuccess _Nullable)success ;
445+
446+ #pragma mark Extension
447+ // iOS 10 only
448+ // Process from Notification Service Extension.
449+ // Used for iOS Media Attachemtns and Action Buttons.
450+ + (UNMutableNotificationContent *)didReceiveNotificationExtensionRequest : (UNNotificationRequest * _Nonnull)request withMutableNotificationContent : (UNMutableNotificationContent * _Nullable)replacementContent __deprecated_msg(" Please use didReceiveNotificationExtensionRequest:withMutableNotificationContent:withContentHandler: instead." );
451+ + (UNMutableNotificationContent *)didReceiveNotificationExtensionRequest : (UNNotificationRequest * _Nonnull)request withMutableNotificationContent : (UNMutableNotificationContent * _Nullable)replacementContent withContentHandler : (void (^)(UNNotificationContent *_Nonnull))contentHandler ;
452+ + (UNMutableNotificationContent *)serviceExtensionTimeWillExpireRequest : (UNNotificationRequest * _Nonnull)request withMutableNotificationContent : (UNMutableNotificationContent * _Nullable)replacementContent ;
629453@end
630454
631455#pragma clang diagnostic pop
0 commit comments