blackberry.com
BlackBerry Dynamics
Runtime library for iOS applications
from the application developer portal

GDPush.h

Go to the documentation of this file.
00001 /*
00002  * (c) 2018 BlackBerry Limited. All rights reserved.
00003  *
00004  */
00005 
00006 #ifndef __GD_PUSH_H__
00007 #define __GD_PUSH_H__
00008 
00009 #import <Foundation/Foundation.h>
00010 #import "GDPortability.h"
00011 
00012 // See: http://clang.llvm.org/docs/LanguageExtensions.html
00013 #ifndef __has_extension
00014 #define __has_extension(x) 0  // Compatibility with non-clang compilers.
00015 #endif
00016 
00017 #if __has_extension(attribute_deprecated_with_message)
00018 #   define DEPRECATE_PUSH_CONNECT_DISCONNECT __attribute__((deprecated("No longer required")))
00019 #   define DEPRECATE_GDPUSHCONNECTION __attribute__((deprecated("GDPushConnection interface has been deprecated")))
00020 #   define DEPRECATE_GDPUSHCHANNELDELEGATE __attribute__((deprecated("GDPushChannelDelegate protocol has been deprecated, use notifications instead.")))
00021 #else
00022 #   define DEPRECATE_PUSH_CONNECT_DISCONNECT __attribute__((deprecated))
00023 #   define DEPRECATE_GDPUSHCONNECTION __attribute__((deprecated))
00024 #   define DEPRECATE_GDPUSHCHANNELDELEGATE __attribute__((deprecated))
00025 #endif
00026 
00027 GD_NS_ASSUME_NONNULL_BEGIN
00028 
00040 typedef NS_ENUM(NSInteger, GDPushChannelState)
00041 {
00044     GDPushChannelStateNone = 0,
00045     
00048     GDPushChannelStateOpen,
00049     
00052     GDPushChannelStateClosed,
00053     
00056     GDPushChannelStateError
00057 };
00058 
00085 extern NSString* const GDPushChannelOpenedNotification;
00086 
00124 extern NSString* const GDPushChannelClosedNotification;
00125 
00173 extern NSString* const GDPushChannelErrorNotification;
00174 
00211 extern NSString* const GDPushChannelMessageNotification;
00212 
00289 extern NSString* const GDPushChannelPingFailedNotification;
00290 
00310 extern NSString* const GDPushChannelTokenKey;
00311 
00328 extern NSString* const GDPushChannelMessageKey;
00329 
00349 extern NSString* const GDPushChannelErrorKey;
00350 
00397 DEPRECATE_GDPUSHCONNECTION
00398 @protocol GDPushConnectionDelegate
00399 
00436 - (void)onStatus:(int)status;
00437 @end
00438 
00439 
00544 DEPRECATE_GDPUSHCONNECTION
00545 @interface GDPushConnection : NSObject {
00546 }
00547 
00559 + (instancetype)sharedConnection;
00560 
00573 - (BOOL)isConnected;
00574 
00600 - (void)connect DEPRECATE_PUSH_CONNECT_DISCONNECT;
00601 
00618 - (void)disconnect DEPRECATE_PUSH_CONNECT_DISCONNECT;
00619 
00635 @property (GD_NSNULLABLE_PROP nonatomic, weak) id<GDPushConnectionDelegate> delegate;
00636 
00637 @end
00638 
00639 
00778 DEPRECATE_GDPUSHCHANNELDELEGATE
00779 @protocol GDPushChannelDelegate
00780 
00807 - (void)onChannelOpen:(NSString*)token;
00808 
00843 - (void)onChannelMessage:(NSString*)data;
00844 
00880 - (void)onChannelClose:(NSString*)data;
00881 
00927 - (void)onChannelError:(int)error;
00928 
00990 - (void)onChannelPingFail:(int)error;
00991 
00992 @end
00993 
00994 
01443 @interface GDPushChannel : NSObject {
01444     @private
01445     void* m_pushChannelInternal;
01446 }
01447 
01464 @property (GD_NSNULLABLE_PROP nonatomic, weak) id<GDPushChannelDelegate> delegate DEPRECATE_GDPUSHCHANNELDELEGATE;
01465 
01473 @property (nonatomic, readonly) GDPushChannelState state;
01474 
01475 
01487 - (instancetype)initWithIdentifier:(NSString*)pushChannelIdentifier;
01488 
01489 #if __has_extension(attribute_deprecated_with_message)
01490 #   define DEPRECATE_PUSH_CHANNEL_INIT __attribute((deprecated("Use initWithIdentifier instead")))
01491 #else
01492 #   define DEPRECATE_PUSH_CHANNEL_INIT __attribute((deprecated))
01493 #endif
01494 
01507 - (instancetype)init DEPRECATE_PUSH_CHANNEL_INIT;
01508 
01509 
01533 - (void)connect;
01534 
01560 - (void)disconnect;
01561 
01562 @end
01563 
01564 GD_NS_ASSUME_NONNULL_END
01565 
01566 #endif /* __GD_PUSH_H__ */