Commit b6cef56f authored by sugita mamoru's avatar sugita mamoru

Merge commit 'db5c0c64' into develop

parents 20cc3a5e db5c0c64
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Sailassist' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Sailassist
target 'SailAssistTests' do
inherit! :search_paths
# Pods for testing
end
pod 'AzureNotificationHubs-iOS'
use_frameworks!
pod 'SwiftSignalRClient'
end
PODS:
- AzureNotificationHubs-iOS (3.1.5)
- SwiftSignalRClient (1.0.0)
DEPENDENCIES:
- AzureNotificationHubs-iOS
- SwiftSignalRClient
SPEC REPOS:
trunk:
- AzureNotificationHubs-iOS
- SwiftSignalRClient
SPEC CHECKSUMS:
AzureNotificationHubs-iOS: e5de62f44d7915a5cc3c5194ddc57cf2ee78873e
SwiftSignalRClient: f9a23a0407d490a799cc1a3c8835b8611128d76c
PODFILE CHECKSUM: bbdabe3b255c91674ba1766a3ec70d307854a5a9
COCOAPODS: 1.14.2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>tvos-arm64</string>
<key>LibraryPath</key>
<string>WindowsAzureMessaging.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>tvos-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>WindowsAzureMessaging.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_i386_x86_64-simulator</string>
<key>LibraryPath</key>
<string>WindowsAzureMessaging.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>i386</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-maccatalyst</string>
<key>LibraryPath</key>
<string>WindowsAzureMessaging.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_arm64e_armv7_armv7s</string>
<key>LibraryPath</key>
<string>WindowsAzureMessaging.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>arm64e</string>
<string>armv7</string>
<string>armv7s</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>WindowsAzureMessaging.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* Protocol for checking if the object has been modified.
*/
@protocol MSChangeTracking
/**
* Determines whether the object is dirty or not.
*/
@property(nonatomic, assign) BOOL isDirty;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSChangeTracking.h"
#import "MSTaggable.h"
#import <Foundation/Foundation.h>
/**
* This class represents an installation.
*/
@class MSInstallationTemplate;
/**
* The Azure Notification Hubs installation for a given device.
*/
@interface MSInstallation : NSObject <NSCoding, MSTaggable, MSChangeTracking>
/**
* The unique identifier for the installation
*/
@property(nonatomic, copy) NSString *installationId;
/**
* The push token for the APNS Service
*/
@property(nonatomic, copy) NSString *pushChannel;
/**
* The userID
*/
@property(nonatomic, copy) NSString *userId;
/**
* The expiration for the installation
*/
@property(nonatomic, copy) NSDate *expirationTime;
/**
* A collection ofinstallation templates.
*/
@property(nonatomic, readonly, copy) NSDictionary<NSString *, MSInstallationTemplate *> *templates;
/**
* Sets the template for the installation template for the given key.
*
* @param template The `MSInstallationTemplate` object containing the installation template data.
* @param key The key for the template.
*
* @returns YES if the template was added, else NO.
*
* @see MSInstallationTemplate
*/
- (BOOL)setTemplate:(MSInstallationTemplate *)template forKey:(NSString *)key;
/**
* Removes the installation template for the given key.
*
* @param key The key for the inistallation template.
*
* @returns YES if removed, else NO.
*/
- (BOOL)removeTemplateForKey:(NSString *)key;
/**
* Gets the installation template `MSInstallationTemplate` for the given key.
*
* @param key The key for the template.
*
* @returns The installation template instance
*
* @see MSInstallationTemplate
*/
- (MSInstallationTemplate *)getTemplateForKey:(NSString *)key;
/**
* Converts the current installation into JSON Data.
*/
- (NSData *)toJsonData;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSInstallation;
/**
* A protocol for enriching an installation before it is sent to the backend.
*/
@protocol MSInstallationEnrichmentDelegate <NSObject>
@optional
/**
* Method that allows to enrich intercepted installation with any data before it is saved to the backend.
*
* @param notificationHub The MSNotificationHub instance.
* @param installation The instance of MSInstallation that the user can make changes to
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub willEnrichInstallation:(MSInstallation *)installation;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSInstallation;
/**
* Protocol for the installation lifecycle management for saving an installation calling back when saved successfully or failed to save.
*/
@protocol MSInstallationLifecycleDelegate <NSObject>
@optional
/**
* The installation saved operation succeeded.
* @param notificationHub The notification hub instance.
* @param installation The installation saved to the backend.
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub didSaveInstallation:(MSInstallation *)installation;
/**
* The installation save operation failed.
* @param notificationHub The notification hub instance.
* @param error The error that occurred saving the installation.
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub
didFailToSaveInstallation:(MSInstallation *)installation
withError:(NSError *)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class MSNotificationHub;
@class MSInstallation;
@protocol MSInstallationManagementDelegate <NSObject>
@optional
/**
*Method that allows to save installation to custom back end
*
* @param installation The instance of MSInstallation that user can save
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub
willUpsertInstallation:(MSInstallation *)installation
completionHandler:(void (^)(NSError *_Nullable))completionHandler;
@end
NS_ASSUME_NONNULL_END
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSChangeTracking.h"
#import "MSTaggable.h"
#import <Foundation/Foundation.h>
/**
* Represents an installation template.
*/
@interface MSInstallationTemplate : NSObject <MSTaggable, MSChangeTracking>
/**
* The template body for notification payload which may contain placeholders to be filled in with actual data during the send operation
*/
@property(nonatomic, copy) NSString *body;
/**
* A collection of headers applicable for MPNS-targeted notifications
*/
@property(nonatomic, copy, readonly) NSDictionary<NSString *, NSString *> *headers;
/**
* Sets the header key and value.
*
* @param value The value of the header
* @param key The name of the header.
*/
- (void)setHeaderValue:(NSString *)value forKey:(NSString *)key;
/**
* Removes the header for the given key.
*
* @param key The header to remove based upon the key.
*/
- (void)removeHeaderValueForKey:(NSString *)key;
/**
* Gets the header value based upon the key.
*
* @param key The name of the header
*
* @returns The value of the header.
*/
- (NSString *)getHeaderValueForKey:(NSString *)key;
// Serialize
- (NSDictionary *)toDictionary;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSInstallationEnrichmentDelegate.h"
#import "MSInstallationLifecycleDelegate.h"
#import "MSInstallationManagementDelegate.h"
#import "MSNotificationHubDelegate.h"
#import "MSNotificationHubMessage.h"
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class MSInstallation;
@class MSDebounceInstallationManager;
@class MSInstallationTemplate;
@class MSNotificationHubOptions;
/**
* The Azure Notification Hubs service
*/
@interface MSNotificationHub : NSObject
/**
* Initializes the Notification Hub with the connection string from the Access
* Policy, and Hub Name.
*
* @param connectionString The access policy connection string.
* @param notificationHubName The Azure Notification Hub name
*/
+ (void)startWithConnectionString:(NSString *)connectionString
hubName:(NSString *)notificationHubName NS_SWIFT_NAME(start(connectionString:hubName:));
/**
* Initializes the Notification Hub with the connection string from the Access
* Policy, and Hub Name.
*
* @param connectionString The access policy connection string.
* @param notificationHubName The Azure Notification Hub name
* @param options The Azure Notification Hubs options such as Authorization Options.
*/
+ (void)startWithConnectionString:(NSString *)connectionString hubName:(NSString *)notificationHubName options:(MSNotificationHubOptions *)options NS_SWIFT_NAME(start(connectionString:hubName:options:));
/**
* Initializes the Notification Hub with the installation management delegate to a custom backend.
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param managementDelegate The delegate.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)startWithInstallationManagement:(id<MSInstallationManagementDelegate>)managementDelegate;
/**
* Initializes the Notification Hub with the installation management delegate to a custom backend and options
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param managementDelegate The delegate.
* @param options The Azure Notification Hubs options such as Authorization Options.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)startWithInstallationManagement:(id<MSInstallationManagementDelegate>)managementDelegate options:(MSNotificationHubOptions *)options;
#pragma mark Push Initialization
/**
* Callback for successful registration with push token.
*
* @param deviceToken The device token for remote notifications.
*/
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
/**
* Callback for unsuccessful registration with error.
*
* @param error Error of unsuccessful registration.
*/
+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
/**
* Callback for notification with user info.
*
* @param userInfo The user info for the remote notification.
*/
+ (void)didReceiveRemoteNotification:(NSDictionary *)userInfo;
/**
* Set the delegate.
* Defines the class that implements the optional protocol `MSNotificationHubDelegate`.
*
* @param delegate The delegate.
*
* @see MSNotificationHubDelegate
*/
+ (void)setDelegate:(nullable id<MSNotificationHubDelegate>)delegate;
/**
* Check whether the Azure Notification Hubs SDK is enabled or not as a whole.
*
* @return YES if enabled, NO otherwise.
*
* @see setEnabled:
*/
+ (BOOL)isEnabled;
/**
* Enable or disable the Azure Notification Hubs SDK from receiving messages.
* The state is persisted in the device's storage across application launches.
*
* @param isEnabled YES to enable, NO to disable.
*
* @see isEnabled
*/
+ (void)setEnabled:(BOOL)isEnabled;
#pragma mark Installation Support
/**
* Saves the current installation in local storage.
*/
+ (void)willSaveInstallation;
/**
* Gets the current push channel device token.
*
* @returns The push channel device token.
*/
+ (NSString *)getPushChannel;
/**
* Gets the current installation ID.
*
* @returns The current installation ID.
*/
+ (NSString *)getInstallationId;
#pragma mark Tags Support
/**
* Adds a tag to the current installation.
*
* @param tag The tag to add
*
* @returns YES if tag was added, else NO.
*/
+ (BOOL)addTag:(NSString *)tag;
/**
* Adds the tags array to the current installation.
*
* @param tags The tags array to add
*
* @returns YES if the tags were added, else NO.
*/
+ (BOOL)addTags:(NSArray<NSString *> *)tags;
/**
* Removes the tag from the current installation.
*
* @param tag The tag to remove.
*
* @returns YES if the tag was removed, else NO.
*/
+ (BOOL)removeTag:(NSString *)tag;
/**
* Removes the tags from the current installation.
*
* @param tags The tags to remove.
*
* @returns YES if the tags were removed, else NO.
*/
+ (BOOL)removeTags:(NSArray<NSString *> *)tags;
/**
* Gets the tags from the current installation.
*
* @returns The tags from the current installation.
*/
+ (NSArray<NSString *> *)getTags;
/**
* Clears the tags from the current installation.
*/
+ (void)clearTags;
#pragma mark Template Support
/**
* Sets the template for the installation template for the given key.
*
* @param template The `MSInstallationTemplate` object containing the installation template data.
* @param key The key for the template.
*
* @returns YES if the template was added, else NO.
*
* @see MSInstallationTemplate
*/
+ (BOOL)setTemplate:(MSInstallationTemplate *)template forKey:(NSString *)key;
/**
* Removes the installation template for the given key.
*
* @param key The key for the inistallation template.
*
* @returns YES if removed, else NO.
*/
+ (BOOL)removeTemplateForKey:(NSString *)key;
/**
* Gets the installation template `MSInstallationTemplate` for the given key.
*
* @param key The key for the template.
*
* @returns The installation template instance
*
* @see MSInstallationTemplate
*/
+ (MSInstallationTemplate *)getTemplateForKey:(NSString *)key;
/**
* Gets all the templates for the given installation.
*
* @returns A dictionary of the strings and installation templates.
*
* @see MSInstallationTemplate
*/
+ (NSDictionary<NSString *, MSInstallationTemplate *> *)getTemplates;
#pragma mark UserID support
/**
* Adds a userId to the current installation.
*
* @param userId The userId to add
*/
+ (void)setUserId:(NSString *)userId;
/**
* Get the current User Id
*
* @returns the current User Id
*/
+ (NSString *)getUserId;
#pragma mark Installation management support
/**
* Set the enrichment delegate for the installation
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param enrichmentDelegate The delegate.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)setEnrichmentDelegate:(nullable id<MSInstallationEnrichmentDelegate>)enrichmentDelegate;
/**
* Set the lifecycle delegate to be able to intercept whether saving the installation was successful.
* Defines the class that implements the optional protocol `MSInstallationLifecycleDelegate`.
*
* @param lifecycleDelegate The delegate.
*
* @see MSInstallationLifecycleDelegate
*/
+ (void)setLifecycleDelegate:(nullable id<MSInstallationLifecycleDelegate>)lifecycleDelegate;
@end
NS_ASSUME_NONNULL_END
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSNotificationHubMessage;
/**
* Protocol for receiving messages from a Notification Hub
*/
@protocol MSNotificationHubDelegate <NSObject>
@optional
/**
* Callback method that will be called whenever a push notification is clicked
* from notification center or a notification is received in foreground.
*
* @param notificationHub The instance of MSNotificationHub
* @param message The push notification details.
*/
- (void)notificationHub:(MSNotificationHub *_Nonnull)notificationHub didReceivePushNotification:(MSNotificationHubMessage *_Nonnull)message;
/**
* Callback method that will be called when the system calls [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:completionHandler:]
*
* @param notificationHub The instance of MSNotificationHub
* @param granted Whether the authorization was granted
* @param error Whther there was an error in requesting authorization.
*/
- (void)notificationHub:(MSNotificationHub *_Nonnull)notificationHub didRequestAuthorization:(BOOL)granted error:(NSError *_Nullable)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* The Push Notification message.
*/
@interface MSNotificationHubMessage : NSObject
/**
* Notification title.
*/
@property(nonatomic, readonly) NSString *title;
/**
* Notification message.
*/
@property(nonatomic, readonly) NSString *body;
/**
* Notification data.
*/
@property(nonatomic, readonly) NSDictionary *userInfo;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import <UserNotifications/UserNotifications.h>
/**
* A class which contains the options for the Notification Hubs initialization.
*/
@interface MSNotificationHubOptions : NSObject
/**
* The authorization options for registering for push notifications.
*/
@property (nonatomic)UNAuthorizationOptions authorizationOptions API_AVAILABLE(ios(10.0), watchos(3.0), macos(10.14), macCatalyst(13.0));
- (instancetype)initWithAuthorizationOptions:(UNAuthorizationOptions)authorizationOptions API_AVAILABLE(ios(10.0), watchos(3.0), macos(10.14), macCatalyst(13.0)) NS_SWIFT_NAME(init(withOptions:));
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* A protocol for managing tags, adding, deleting and retrieving
*/
@protocol MSTaggable
/**
* A collection of tags for the installation.
*/
@property(nonatomic, copy, readonly) NSSet<NSString *> *tags;
/**
* Adds a tag to the current installation.
*
* @param tag The tag to add
*
* @returns YES if tag was added, else NO.
*/
- (BOOL)addTag:(NSString *)tag;
/**
* Adds the tags array to the current installation.
*
* @param tagsToAdd The tags array to add
*
* @returns YES if the tags were added, else NO.
*/
- (BOOL)addTags:(NSArray<NSString *> *)tagsToAdd;
/**
* Removes the tag from the current installation.
*
* @param tag The tag to remove.
*
* @returns YES if the tag was removed, else NO.
*/
- (BOOL)removeTag:(NSString *)tag;
/**
* Removes the tags from the current installation.
*
* @param tagsToRemove The tags to remove.
*
* @returns YES if the tags were removed, else NO.
*/
- (BOOL)removeTags:(NSArray<NSString *> *)tagsToRemove;
/**
* Clears the tags from the current installation.
*/
- (void)clearTags;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBConnectionString : NSObject
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint issuer:(NSString *)issuer issuerSecret:(NSString *)secret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint fullAccessSecret:(NSString *)fullAccessSecret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint listenAccessSecret:(NSString *)listenAccessSecret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint sharedAccessKeyName:(NSString *)keyName accessSecret:(NSString *)secret;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBStoredRegistrationEntry.h"
#import <Foundation/Foundation.h>
@class SBRegistration;
@interface SBLocalStorage : NSObject {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wobjc-interface-ivars"
@private
NSString *_path;
NSMutableDictionary *_registrations;
NSString *_versionKey;
NSString *_deviceTokenKey;
NSString *_registrationsKey;
}
#pragma GCC diagnostic pop
@property(copy, nonatomic) NSString *deviceToken;
@property(nonatomic) BOOL isRefreshNeeded;
- (SBLocalStorage *)initWithNotificationHubPath:(NSString *)notificationHubPath;
- (void)refreshFinishedWithDeviceToken:(NSString *)newDeviceToken;
- (StoredRegistrationEntry *)getStoredRegistrationEntryWithRegistrationName:(NSString *)registrationName;
- (void)updateWithRegistrationName:(NSString *)registrationName registration:(SBRegistration *)registration;
- (void)updateWithRegistrationName:(NSString *)registrationName
registrationId:(NSString *)registrationId
eTag:(NSString *)eTag
deviceToken:(NSString *)devToken;
- (void)updateWithRegistration:(SBRegistration *)registration;
- (void)deleteWithRegistrationName:(NSString *)registrationName;
- (void)deleteAllRegistrations;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import "SBLocalStorage.h"
#import "SBTokenProvider.h"
@interface SBNotificationHub : NSObject
- (SBNotificationHub *)initWithConnectionString:(NSString *)connectionString notificationHubPath:(NSString *)notificationHubPath;
// Async operations
- (void)registerNativeWithDeviceToken:(NSData *)deviceToken tags:(NSSet *)tags completion:(void (^)(NSError *error))completion;
- (void)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)name
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
tags:(NSSet *)tags
completion:(void (^)(NSError *error))completion;
- (void)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)name
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
priorityTemplate:(NSString *)priorityTemplate
tags:(NSSet *)tags
completion:(void (^)(NSError *error))completion;
- (void)unregisterNativeWithCompletion:(void (^)(NSError *error))completion;
- (void)unregisterTemplateWithName:(NSString *)name completion:(void (^)(NSError *error))completion;
- (void)unregisterAllWithDeviceToken:(NSData *)deviceToken completion:(void (^)(NSError *error))completion;
// sync operations
- (BOOL)registerNativeWithDeviceToken:(NSData *)deviceToken tags:(NSSet *)tags error:(NSError **)error;
- (BOOL)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)templateName
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
tags:(NSSet *)tags
error:(NSError **)error;
- (BOOL)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)templateName
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
priorityTemplate:(NSString *)priorityTemplate
tags:(NSSet *)tags
error:(NSError **)error;
- (BOOL)unregisterNativeWithError:(NSError **)error;
- (BOOL)unregisterTemplateWithName:(NSString *)name error:(NSError **)error;
- (BOOL)unregisterAllWithDeviceToken:(NSData *)deviceToken error:(NSError **)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBRegistration : NSObject
@property(copy, nonatomic) NSString *ETag;
@property(copy, nonatomic) NSDate *expiresAt;
@property(copy, nonatomic) NSSet *tags;
@property(copy, nonatomic) NSString *registrationId;
@property(copy, nonatomic) NSString *deviceToken;
+ (NSString *)Name;
+ (NSString *)payloadWithDeviceToken:(NSString *)deviceToken tags:(NSSet *)tags;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface StoredRegistrationEntry : NSObject
@property(copy, nonatomic) NSString *RegistrationName;
@property(copy, nonatomic) NSString *RegistrationId;
@property(copy, nonatomic) NSString *ETag;
- (StoredRegistrationEntry *)initWithString:(NSString *)string;
- (NSString *)toString;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBRegistration.h"
#import <Foundation/Foundation.h>
@interface SBTemplateRegistration : SBRegistration
@property(copy, nonatomic) NSString *bodyTemplate;
@property(copy, nonatomic) NSString *expiry;
@property(copy, nonatomic) NSString *templateName;
+ (NSString *)payloadWithDeviceToken:(NSString *)deviceToken
bodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
priorityTemplate:(NSString *)priorityTemplate
tags:(NSSet *)tags
templateName:(NSString *)templateName;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBTokenProvider : NSObject {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wobjc-interface-ivars"
@private
NSString *_sharedAccessKey;
NSString *_sharedAccessKeyName;
NSString *_sharedSecret;
NSString *_sharedSecretIssurer;
NSURL *_stsHostName;
NSURL *_serviceEndPoint;
}
#pragma GCC diagnostic pop
@property(nonatomic) NSInteger timeToExpireinMins;
- (SBTokenProvider *)initWithConnectionDictinary:(NSDictionary *)connectionDictionary;
- (void)setTokenWithRequest:(NSMutableURLRequest *)request completion:(void (^)(NSError *))completion;
- (BOOL)setTokenWithRequest:(NSMutableURLRequest *)request error:(NSError **)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
// Legacy API
#if !TARGET_OS_OSX
#import "SBConnectionString.h"
#import "SBNotificationHub.h"
#endif
// New API
#import "MSInstallation.h"
#import "MSInstallationEnrichmentDelegate.h"
#import "MSInstallationLifecycleDelegate.h"
#import "MSInstallationManagementDelegate.h"
#import "MSInstallationTemplate.h"
#import "MSNotificationHubOptions.h"
#import "MSNotificationHub.h"
#import "MSNotificationHubDelegate.h"
#import "MSNotificationHubMessage.h"
framework module WindowsAzureMessaging {
umbrella header "WindowsAzureMessaging.h"
export *
module * { export * }
link framework "Foundation"
link framework "SystemConfiguration"
link framework "UIKit"
link framework "UserNotifications"
}
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* Protocol for checking if the object has been modified.
*/
@protocol MSChangeTracking
/**
* Determines whether the object is dirty or not.
*/
@property(nonatomic, assign) BOOL isDirty;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSChangeTracking.h"
#import "MSTaggable.h"
#import <Foundation/Foundation.h>
/**
* This class represents an installation.
*/
@class MSInstallationTemplate;
/**
* The Azure Notification Hubs installation for a given device.
*/
@interface MSInstallation : NSObject <NSCoding, MSTaggable, MSChangeTracking>
/**
* The unique identifier for the installation
*/
@property(nonatomic, copy) NSString *installationId;
/**
* The push token for the APNS Service
*/
@property(nonatomic, copy) NSString *pushChannel;
/**
* The userID
*/
@property(nonatomic, copy) NSString *userId;
/**
* The expiration for the installation
*/
@property(nonatomic, copy) NSDate *expirationTime;
/**
* A collection ofinstallation templates.
*/
@property(nonatomic, readonly, copy) NSDictionary<NSString *, MSInstallationTemplate *> *templates;
/**
* Sets the template for the installation template for the given key.
*
* @param template The `MSInstallationTemplate` object containing the installation template data.
* @param key The key for the template.
*
* @returns YES if the template was added, else NO.
*
* @see MSInstallationTemplate
*/
- (BOOL)setTemplate:(MSInstallationTemplate *)template forKey:(NSString *)key;
/**
* Removes the installation template for the given key.
*
* @param key The key for the inistallation template.
*
* @returns YES if removed, else NO.
*/
- (BOOL)removeTemplateForKey:(NSString *)key;
/**
* Gets the installation template `MSInstallationTemplate` for the given key.
*
* @param key The key for the template.
*
* @returns The installation template instance
*
* @see MSInstallationTemplate
*/
- (MSInstallationTemplate *)getTemplateForKey:(NSString *)key;
/**
* Converts the current installation into JSON Data.
*/
- (NSData *)toJsonData;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSInstallation;
/**
* A protocol for enriching an installation before it is sent to the backend.
*/
@protocol MSInstallationEnrichmentDelegate <NSObject>
@optional
/**
* Method that allows to enrich intercepted installation with any data before it is saved to the backend.
*
* @param notificationHub The MSNotificationHub instance.
* @param installation The instance of MSInstallation that the user can make changes to
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub willEnrichInstallation:(MSInstallation *)installation;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSInstallation;
/**
* Protocol for the installation lifecycle management for saving an installation calling back when saved successfully or failed to save.
*/
@protocol MSInstallationLifecycleDelegate <NSObject>
@optional
/**
* The installation saved operation succeeded.
* @param notificationHub The notification hub instance.
* @param installation The installation saved to the backend.
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub didSaveInstallation:(MSInstallation *)installation;
/**
* The installation save operation failed.
* @param notificationHub The notification hub instance.
* @param error The error that occurred saving the installation.
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub
didFailToSaveInstallation:(MSInstallation *)installation
withError:(NSError *)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class MSNotificationHub;
@class MSInstallation;
@protocol MSInstallationManagementDelegate <NSObject>
@optional
/**
*Method that allows to save installation to custom back end
*
* @param installation The instance of MSInstallation that user can save
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub
willUpsertInstallation:(MSInstallation *)installation
completionHandler:(void (^)(NSError *_Nullable))completionHandler;
@end
NS_ASSUME_NONNULL_END
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSChangeTracking.h"
#import "MSTaggable.h"
#import <Foundation/Foundation.h>
/**
* Represents an installation template.
*/
@interface MSInstallationTemplate : NSObject <MSTaggable, MSChangeTracking>
/**
* The template body for notification payload which may contain placeholders to be filled in with actual data during the send operation
*/
@property(nonatomic, copy) NSString *body;
/**
* A collection of headers applicable for MPNS-targeted notifications
*/
@property(nonatomic, copy, readonly) NSDictionary<NSString *, NSString *> *headers;
/**
* Sets the header key and value.
*
* @param value The value of the header
* @param key The name of the header.
*/
- (void)setHeaderValue:(NSString *)value forKey:(NSString *)key;
/**
* Removes the header for the given key.
*
* @param key The header to remove based upon the key.
*/
- (void)removeHeaderValueForKey:(NSString *)key;
/**
* Gets the header value based upon the key.
*
* @param key The name of the header
*
* @returns The value of the header.
*/
- (NSString *)getHeaderValueForKey:(NSString *)key;
// Serialize
- (NSDictionary *)toDictionary;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSInstallationEnrichmentDelegate.h"
#import "MSInstallationLifecycleDelegate.h"
#import "MSInstallationManagementDelegate.h"
#import "MSNotificationHubDelegate.h"
#import "MSNotificationHubMessage.h"
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class MSInstallation;
@class MSDebounceInstallationManager;
@class MSInstallationTemplate;
@class MSNotificationHubOptions;
/**
* The Azure Notification Hubs service
*/
@interface MSNotificationHub : NSObject
/**
* Initializes the Notification Hub with the connection string from the Access
* Policy, and Hub Name.
*
* @param connectionString The access policy connection string.
* @param notificationHubName The Azure Notification Hub name
*/
+ (void)startWithConnectionString:(NSString *)connectionString
hubName:(NSString *)notificationHubName NS_SWIFT_NAME(start(connectionString:hubName:));
/**
* Initializes the Notification Hub with the connection string from the Access
* Policy, and Hub Name.
*
* @param connectionString The access policy connection string.
* @param notificationHubName The Azure Notification Hub name
* @param options The Azure Notification Hubs options such as Authorization Options.
*/
+ (void)startWithConnectionString:(NSString *)connectionString hubName:(NSString *)notificationHubName options:(MSNotificationHubOptions *)options NS_SWIFT_NAME(start(connectionString:hubName:options:));
/**
* Initializes the Notification Hub with the installation management delegate to a custom backend.
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param managementDelegate The delegate.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)startWithInstallationManagement:(id<MSInstallationManagementDelegate>)managementDelegate;
/**
* Initializes the Notification Hub with the installation management delegate to a custom backend and options
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param managementDelegate The delegate.
* @param options The Azure Notification Hubs options such as Authorization Options.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)startWithInstallationManagement:(id<MSInstallationManagementDelegate>)managementDelegate options:(MSNotificationHubOptions *)options;
#pragma mark Push Initialization
/**
* Callback for successful registration with push token.
*
* @param deviceToken The device token for remote notifications.
*/
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
/**
* Callback for unsuccessful registration with error.
*
* @param error Error of unsuccessful registration.
*/
+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
/**
* Callback for notification with user info.
*
* @param userInfo The user info for the remote notification.
*/
+ (void)didReceiveRemoteNotification:(NSDictionary *)userInfo;
/**
* Set the delegate.
* Defines the class that implements the optional protocol `MSNotificationHubDelegate`.
*
* @param delegate The delegate.
*
* @see MSNotificationHubDelegate
*/
+ (void)setDelegate:(nullable id<MSNotificationHubDelegate>)delegate;
/**
* Check whether the Azure Notification Hubs SDK is enabled or not as a whole.
*
* @return YES if enabled, NO otherwise.
*
* @see setEnabled:
*/
+ (BOOL)isEnabled;
/**
* Enable or disable the Azure Notification Hubs SDK from receiving messages.
* The state is persisted in the device's storage across application launches.
*
* @param isEnabled YES to enable, NO to disable.
*
* @see isEnabled
*/
+ (void)setEnabled:(BOOL)isEnabled;
#pragma mark Installation Support
/**
* Saves the current installation in local storage.
*/
+ (void)willSaveInstallation;
/**
* Gets the current push channel device token.
*
* @returns The push channel device token.
*/
+ (NSString *)getPushChannel;
/**
* Gets the current installation ID.
*
* @returns The current installation ID.
*/
+ (NSString *)getInstallationId;
#pragma mark Tags Support
/**
* Adds a tag to the current installation.
*
* @param tag The tag to add
*
* @returns YES if tag was added, else NO.
*/
+ (BOOL)addTag:(NSString *)tag;
/**
* Adds the tags array to the current installation.
*
* @param tags The tags array to add
*
* @returns YES if the tags were added, else NO.
*/
+ (BOOL)addTags:(NSArray<NSString *> *)tags;
/**
* Removes the tag from the current installation.
*
* @param tag The tag to remove.
*
* @returns YES if the tag was removed, else NO.
*/
+ (BOOL)removeTag:(NSString *)tag;
/**
* Removes the tags from the current installation.
*
* @param tags The tags to remove.
*
* @returns YES if the tags were removed, else NO.
*/
+ (BOOL)removeTags:(NSArray<NSString *> *)tags;
/**
* Gets the tags from the current installation.
*
* @returns The tags from the current installation.
*/
+ (NSArray<NSString *> *)getTags;
/**
* Clears the tags from the current installation.
*/
+ (void)clearTags;
#pragma mark Template Support
/**
* Sets the template for the installation template for the given key.
*
* @param template The `MSInstallationTemplate` object containing the installation template data.
* @param key The key for the template.
*
* @returns YES if the template was added, else NO.
*
* @see MSInstallationTemplate
*/
+ (BOOL)setTemplate:(MSInstallationTemplate *)template forKey:(NSString *)key;
/**
* Removes the installation template for the given key.
*
* @param key The key for the inistallation template.
*
* @returns YES if removed, else NO.
*/
+ (BOOL)removeTemplateForKey:(NSString *)key;
/**
* Gets the installation template `MSInstallationTemplate` for the given key.
*
* @param key The key for the template.
*
* @returns The installation template instance
*
* @see MSInstallationTemplate
*/
+ (MSInstallationTemplate *)getTemplateForKey:(NSString *)key;
/**
* Gets all the templates for the given installation.
*
* @returns A dictionary of the strings and installation templates.
*
* @see MSInstallationTemplate
*/
+ (NSDictionary<NSString *, MSInstallationTemplate *> *)getTemplates;
#pragma mark UserID support
/**
* Adds a userId to the current installation.
*
* @param userId The userId to add
*/
+ (void)setUserId:(NSString *)userId;
/**
* Get the current User Id
*
* @returns the current User Id
*/
+ (NSString *)getUserId;
#pragma mark Installation management support
/**
* Set the enrichment delegate for the installation
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param enrichmentDelegate The delegate.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)setEnrichmentDelegate:(nullable id<MSInstallationEnrichmentDelegate>)enrichmentDelegate;
/**
* Set the lifecycle delegate to be able to intercept whether saving the installation was successful.
* Defines the class that implements the optional protocol `MSInstallationLifecycleDelegate`.
*
* @param lifecycleDelegate The delegate.
*
* @see MSInstallationLifecycleDelegate
*/
+ (void)setLifecycleDelegate:(nullable id<MSInstallationLifecycleDelegate>)lifecycleDelegate;
@end
NS_ASSUME_NONNULL_END
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSNotificationHubMessage;
/**
* Protocol for receiving messages from a Notification Hub
*/
@protocol MSNotificationHubDelegate <NSObject>
@optional
/**
* Callback method that will be called whenever a push notification is clicked
* from notification center or a notification is received in foreground.
*
* @param notificationHub The instance of MSNotificationHub
* @param message The push notification details.
*/
- (void)notificationHub:(MSNotificationHub *_Nonnull)notificationHub didReceivePushNotification:(MSNotificationHubMessage *_Nonnull)message;
/**
* Callback method that will be called when the system calls [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:completionHandler:]
*
* @param notificationHub The instance of MSNotificationHub
* @param granted Whether the authorization was granted
* @param error Whther there was an error in requesting authorization.
*/
- (void)notificationHub:(MSNotificationHub *_Nonnull)notificationHub didRequestAuthorization:(BOOL)granted error:(NSError *_Nullable)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* The Push Notification message.
*/
@interface MSNotificationHubMessage : NSObject
/**
* Notification title.
*/
@property(nonatomic, readonly) NSString *title;
/**
* Notification message.
*/
@property(nonatomic, readonly) NSString *body;
/**
* Notification data.
*/
@property(nonatomic, readonly) NSDictionary *userInfo;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import <UserNotifications/UserNotifications.h>
/**
* A class which contains the options for the Notification Hubs initialization.
*/
@interface MSNotificationHubOptions : NSObject
/**
* The authorization options for registering for push notifications.
*/
@property (nonatomic)UNAuthorizationOptions authorizationOptions API_AVAILABLE(ios(10.0), watchos(3.0), macos(10.14), macCatalyst(13.0));
- (instancetype)initWithAuthorizationOptions:(UNAuthorizationOptions)authorizationOptions API_AVAILABLE(ios(10.0), watchos(3.0), macos(10.14), macCatalyst(13.0)) NS_SWIFT_NAME(init(withOptions:));
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* A protocol for managing tags, adding, deleting and retrieving
*/
@protocol MSTaggable
/**
* A collection of tags for the installation.
*/
@property(nonatomic, copy, readonly) NSSet<NSString *> *tags;
/**
* Adds a tag to the current installation.
*
* @param tag The tag to add
*
* @returns YES if tag was added, else NO.
*/
- (BOOL)addTag:(NSString *)tag;
/**
* Adds the tags array to the current installation.
*
* @param tagsToAdd The tags array to add
*
* @returns YES if the tags were added, else NO.
*/
- (BOOL)addTags:(NSArray<NSString *> *)tagsToAdd;
/**
* Removes the tag from the current installation.
*
* @param tag The tag to remove.
*
* @returns YES if the tag was removed, else NO.
*/
- (BOOL)removeTag:(NSString *)tag;
/**
* Removes the tags from the current installation.
*
* @param tagsToRemove The tags to remove.
*
* @returns YES if the tags were removed, else NO.
*/
- (BOOL)removeTags:(NSArray<NSString *> *)tagsToRemove;
/**
* Clears the tags from the current installation.
*/
- (void)clearTags;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBConnectionString : NSObject
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint issuer:(NSString *)issuer issuerSecret:(NSString *)secret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint fullAccessSecret:(NSString *)fullAccessSecret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint listenAccessSecret:(NSString *)listenAccessSecret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint sharedAccessKeyName:(NSString *)keyName accessSecret:(NSString *)secret;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBStoredRegistrationEntry.h"
#import <Foundation/Foundation.h>
@class SBRegistration;
@interface SBLocalStorage : NSObject {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wobjc-interface-ivars"
@private
NSString *_path;
NSMutableDictionary *_registrations;
NSString *_versionKey;
NSString *_deviceTokenKey;
NSString *_registrationsKey;
}
#pragma GCC diagnostic pop
@property(copy, nonatomic) NSString *deviceToken;
@property(nonatomic) BOOL isRefreshNeeded;
- (SBLocalStorage *)initWithNotificationHubPath:(NSString *)notificationHubPath;
- (void)refreshFinishedWithDeviceToken:(NSString *)newDeviceToken;
- (StoredRegistrationEntry *)getStoredRegistrationEntryWithRegistrationName:(NSString *)registrationName;
- (void)updateWithRegistrationName:(NSString *)registrationName registration:(SBRegistration *)registration;
- (void)updateWithRegistrationName:(NSString *)registrationName
registrationId:(NSString *)registrationId
eTag:(NSString *)eTag
deviceToken:(NSString *)devToken;
- (void)updateWithRegistration:(SBRegistration *)registration;
- (void)deleteWithRegistrationName:(NSString *)registrationName;
- (void)deleteAllRegistrations;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import "SBLocalStorage.h"
#import "SBTokenProvider.h"
@interface SBNotificationHub : NSObject
- (SBNotificationHub *)initWithConnectionString:(NSString *)connectionString notificationHubPath:(NSString *)notificationHubPath;
// Async operations
- (void)registerNativeWithDeviceToken:(NSData *)deviceToken tags:(NSSet *)tags completion:(void (^)(NSError *error))completion;
- (void)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)name
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
tags:(NSSet *)tags
completion:(void (^)(NSError *error))completion;
- (void)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)name
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
priorityTemplate:(NSString *)priorityTemplate
tags:(NSSet *)tags
completion:(void (^)(NSError *error))completion;
- (void)unregisterNativeWithCompletion:(void (^)(NSError *error))completion;
- (void)unregisterTemplateWithName:(NSString *)name completion:(void (^)(NSError *error))completion;
- (void)unregisterAllWithDeviceToken:(NSData *)deviceToken completion:(void (^)(NSError *error))completion;
// sync operations
- (BOOL)registerNativeWithDeviceToken:(NSData *)deviceToken tags:(NSSet *)tags error:(NSError **)error;
- (BOOL)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)templateName
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
tags:(NSSet *)tags
error:(NSError **)error;
- (BOOL)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)templateName
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
priorityTemplate:(NSString *)priorityTemplate
tags:(NSSet *)tags
error:(NSError **)error;
- (BOOL)unregisterNativeWithError:(NSError **)error;
- (BOOL)unregisterTemplateWithName:(NSString *)name error:(NSError **)error;
- (BOOL)unregisterAllWithDeviceToken:(NSData *)deviceToken error:(NSError **)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBRegistration : NSObject
@property(copy, nonatomic) NSString *ETag;
@property(copy, nonatomic) NSDate *expiresAt;
@property(copy, nonatomic) NSSet *tags;
@property(copy, nonatomic) NSString *registrationId;
@property(copy, nonatomic) NSString *deviceToken;
+ (NSString *)Name;
+ (NSString *)payloadWithDeviceToken:(NSString *)deviceToken tags:(NSSet *)tags;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface StoredRegistrationEntry : NSObject
@property(copy, nonatomic) NSString *RegistrationName;
@property(copy, nonatomic) NSString *RegistrationId;
@property(copy, nonatomic) NSString *ETag;
- (StoredRegistrationEntry *)initWithString:(NSString *)string;
- (NSString *)toString;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBRegistration.h"
#import <Foundation/Foundation.h>
@interface SBTemplateRegistration : SBRegistration
@property(copy, nonatomic) NSString *bodyTemplate;
@property(copy, nonatomic) NSString *expiry;
@property(copy, nonatomic) NSString *templateName;
+ (NSString *)payloadWithDeviceToken:(NSString *)deviceToken
bodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
priorityTemplate:(NSString *)priorityTemplate
tags:(NSSet *)tags
templateName:(NSString *)templateName;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBTokenProvider : NSObject {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wobjc-interface-ivars"
@private
NSString *_sharedAccessKey;
NSString *_sharedAccessKeyName;
NSString *_sharedSecret;
NSString *_sharedSecretIssurer;
NSURL *_stsHostName;
NSURL *_serviceEndPoint;
}
#pragma GCC diagnostic pop
@property(nonatomic) NSInteger timeToExpireinMins;
- (SBTokenProvider *)initWithConnectionDictinary:(NSDictionary *)connectionDictionary;
- (void)setTokenWithRequest:(NSMutableURLRequest *)request completion:(void (^)(NSError *))completion;
- (BOOL)setTokenWithRequest:(NSMutableURLRequest *)request error:(NSError **)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
// Legacy API
#if !TARGET_OS_OSX
#import "SBConnectionString.h"
#import "SBNotificationHub.h"
#endif
// New API
#import "MSInstallation.h"
#import "MSInstallationEnrichmentDelegate.h"
#import "MSInstallationLifecycleDelegate.h"
#import "MSInstallationManagementDelegate.h"
#import "MSInstallationTemplate.h"
#import "MSNotificationHubOptions.h"
#import "MSNotificationHub.h"
#import "MSNotificationHubDelegate.h"
#import "MSNotificationHubMessage.h"
framework module WindowsAzureMessaging {
umbrella header "WindowsAzureMessaging.h"
export *
module * { export * }
link framework "Foundation"
link framework "SystemConfiguration"
link framework "UIKit"
link framework "UserNotifications"
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Headers/MSChangeTracking.h</key>
<data>
narBdtZCYRHU7b5QlBlLXW/RrpM=
</data>
<key>Headers/MSInstallation.h</key>
<data>
TmHwzBd8L6u15ovfaYPTt3Ep0z4=
</data>
<key>Headers/MSInstallationEnrichmentDelegate.h</key>
<data>
yPD4dZTgb7EXJAugJz994IGu0rA=
</data>
<key>Headers/MSInstallationLifecycleDelegate.h</key>
<data>
zCAT/QGwk4b6gyM1eJQH+bRTr2M=
</data>
<key>Headers/MSInstallationManagementDelegate.h</key>
<data>
ajzRJsUwYcjO3SjZs2xHSMMOziM=
</data>
<key>Headers/MSInstallationTemplate.h</key>
<data>
tNPp8nmms73xdU70Ps/IVcopco8=
</data>
<key>Headers/MSNotificationHub.h</key>
<data>
ZF/P/m7lreJ3QTLev02w3EnguYE=
</data>
<key>Headers/MSNotificationHubDelegate.h</key>
<data>
9/5tbObhYlyWGVnTMQ26X3QNwLI=
</data>
<key>Headers/MSNotificationHubMessage.h</key>
<data>
Ba/Ebk7xmui2+Of167CEw2LR2zY=
</data>
<key>Headers/MSNotificationHubOptions.h</key>
<data>
rlRVUZcFNLfqoQwaYe223Alj3SM=
</data>
<key>Headers/MSTaggable.h</key>
<data>
z3CoktFzuETnaqgxVoQjzJL/I1w=
</data>
<key>Headers/SBConnectionString.h</key>
<data>
cwcujccPU27Mp4pQNlYuONOjaKs=
</data>
<key>Headers/SBLocalStorage.h</key>
<data>
BkM7J5DmnhyeFXeKhpaZwZkqDP8=
</data>
<key>Headers/SBNotificationHub.h</key>
<data>
kXCONu34NoQusR3NoXWPpBQ6V4M=
</data>
<key>Headers/SBRegistration.h</key>
<data>
yFQO7VhTmmy481e9mc1yNdANo68=
</data>
<key>Headers/SBStoredRegistrationEntry.h</key>
<data>
lYy2XTnpS4DiUe16E9PmCXFktg0=
</data>
<key>Headers/SBTemplateRegistration.h</key>
<data>
/d0nzaXU4xj3j8zdFhw/ucV6vts=
</data>
<key>Headers/SBTokenProvider.h</key>
<data>
Cn5VsCS7kAd2OY0PMN6x1y6AquY=
</data>
<key>Headers/WindowsAzureMessaging.h</key>
<data>
WTYzJIG9hWZNOfZ66VDCG3BzALE=
</data>
<key>Info.plist</key>
<data>
j8aYS8186Mpr1N8Ua9nmELLALXY=
</data>
<key>Modules/module.modulemap</key>
<data>
3rVnbdQqwQCPdm4IKwXtDSG8NX8=
</data>
</dict>
<key>files2</key>
<dict>
<key>Headers/MSChangeTracking.h</key>
<dict>
<key>hash</key>
<data>
narBdtZCYRHU7b5QlBlLXW/RrpM=
</data>
<key>hash2</key>
<data>
WiBjeFCuSYi7sfGLuhUPg+TsMueCQNpKhdZLAPRl5v8=
</data>
</dict>
<key>Headers/MSInstallation.h</key>
<dict>
<key>hash</key>
<data>
TmHwzBd8L6u15ovfaYPTt3Ep0z4=
</data>
<key>hash2</key>
<data>
F+EcxtW15PUncN3c/GlK9876vQox/Qklt5nWV2HxDrg=
</data>
</dict>
<key>Headers/MSInstallationEnrichmentDelegate.h</key>
<dict>
<key>hash</key>
<data>
yPD4dZTgb7EXJAugJz994IGu0rA=
</data>
<key>hash2</key>
<data>
vOem7EfaA5v5XOnaIKpkpy4NXrtJT/cFH5aZlDQ3cbc=
</data>
</dict>
<key>Headers/MSInstallationLifecycleDelegate.h</key>
<dict>
<key>hash</key>
<data>
zCAT/QGwk4b6gyM1eJQH+bRTr2M=
</data>
<key>hash2</key>
<data>
l5m5JgcUntFNsvuAIz+ufHXaIWh9QBsvX6gtcPkD8uM=
</data>
</dict>
<key>Headers/MSInstallationManagementDelegate.h</key>
<dict>
<key>hash</key>
<data>
ajzRJsUwYcjO3SjZs2xHSMMOziM=
</data>
<key>hash2</key>
<data>
DoKBXqMi7znYgK/IJ9WMkLXRxqB60L5IhRPNUz9iHO8=
</data>
</dict>
<key>Headers/MSInstallationTemplate.h</key>
<dict>
<key>hash</key>
<data>
tNPp8nmms73xdU70Ps/IVcopco8=
</data>
<key>hash2</key>
<data>
gnj5Uvf8q+lmCEnLO0a5CUkHps3h5rjgmBlf34noZ0o=
</data>
</dict>
<key>Headers/MSNotificationHub.h</key>
<dict>
<key>hash</key>
<data>
ZF/P/m7lreJ3QTLev02w3EnguYE=
</data>
<key>hash2</key>
<data>
gaLu3qX5oXoGTG3kObunwiRTpmVVhrUf2PkeoFZz5RI=
</data>
</dict>
<key>Headers/MSNotificationHubDelegate.h</key>
<dict>
<key>hash</key>
<data>
9/5tbObhYlyWGVnTMQ26X3QNwLI=
</data>
<key>hash2</key>
<data>
gZEndbnlAGu1OPv5HCqejEv/R+jrTXI8co4oyc0tbdE=
</data>
</dict>
<key>Headers/MSNotificationHubMessage.h</key>
<dict>
<key>hash</key>
<data>
Ba/Ebk7xmui2+Of167CEw2LR2zY=
</data>
<key>hash2</key>
<data>
Xy4qGgxPn1x9nEZhG+NuQDHB1lboeYGlUjz2ZhWZvo8=
</data>
</dict>
<key>Headers/MSNotificationHubOptions.h</key>
<dict>
<key>hash</key>
<data>
rlRVUZcFNLfqoQwaYe223Alj3SM=
</data>
<key>hash2</key>
<data>
nbBtQOOVYPe54RyS2FJ2ZB+ipqS+8P1JxE2KO0qd5P0=
</data>
</dict>
<key>Headers/MSTaggable.h</key>
<dict>
<key>hash</key>
<data>
z3CoktFzuETnaqgxVoQjzJL/I1w=
</data>
<key>hash2</key>
<data>
a6n/C7Cyg1qxNZBOz0D7cTIxATvpjO1zc7YAHkGc8gA=
</data>
</dict>
<key>Headers/SBConnectionString.h</key>
<dict>
<key>hash</key>
<data>
cwcujccPU27Mp4pQNlYuONOjaKs=
</data>
<key>hash2</key>
<data>
gJBZWoKoIC/3IsUJJpWyfW4sl3ezkgURCwEv57nktaE=
</data>
</dict>
<key>Headers/SBLocalStorage.h</key>
<dict>
<key>hash</key>
<data>
BkM7J5DmnhyeFXeKhpaZwZkqDP8=
</data>
<key>hash2</key>
<data>
LKPxnTfQ6nVXBTaIcQ1IPWDaWDVNxzdWzSvGJdaxIA8=
</data>
</dict>
<key>Headers/SBNotificationHub.h</key>
<dict>
<key>hash</key>
<data>
kXCONu34NoQusR3NoXWPpBQ6V4M=
</data>
<key>hash2</key>
<data>
CPV8/5nIlggEebmWDXFShuts6tg48WPS1Kuv+iQpC6I=
</data>
</dict>
<key>Headers/SBRegistration.h</key>
<dict>
<key>hash</key>
<data>
yFQO7VhTmmy481e9mc1yNdANo68=
</data>
<key>hash2</key>
<data>
OO5WiztX60NYA9aJhPSr5svyE7JCJwqlPNUVt22Ct5s=
</data>
</dict>
<key>Headers/SBStoredRegistrationEntry.h</key>
<dict>
<key>hash</key>
<data>
lYy2XTnpS4DiUe16E9PmCXFktg0=
</data>
<key>hash2</key>
<data>
v3+jdXZp03yiY/6uFh2x91hPPuBPsEhUS8CmxMe9OBY=
</data>
</dict>
<key>Headers/SBTemplateRegistration.h</key>
<dict>
<key>hash</key>
<data>
/d0nzaXU4xj3j8zdFhw/ucV6vts=
</data>
<key>hash2</key>
<data>
cOOVOi6zGOkPqhW7C0GIvjGpu7bdyoLiSXX5y0/fI7U=
</data>
</dict>
<key>Headers/SBTokenProvider.h</key>
<dict>
<key>hash</key>
<data>
Cn5VsCS7kAd2OY0PMN6x1y6AquY=
</data>
<key>hash2</key>
<data>
yFuCWFBA8awjmDF3nhRgWwL6omcyrc+ahIj9ds5P6Jk=
</data>
</dict>
<key>Headers/WindowsAzureMessaging.h</key>
<dict>
<key>hash</key>
<data>
WTYzJIG9hWZNOfZ66VDCG3BzALE=
</data>
<key>hash2</key>
<data>
80uVXjQ+reWYsi4FtNc0xPChXBBIo5MP6zqNZ4g1/S8=
</data>
</dict>
<key>Modules/module.modulemap</key>
<dict>
<key>hash</key>
<data>
3rVnbdQqwQCPdm4IKwXtDSG8NX8=
</data>
<key>hash2</key>
<data>
1D3LXEtQ1F/EnwWVc3L5elNhFWwHHU4rK6DYAv4B/ho=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* Protocol for checking if the object has been modified.
*/
@protocol MSChangeTracking
/**
* Determines whether the object is dirty or not.
*/
@property(nonatomic, assign) BOOL isDirty;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSChangeTracking.h"
#import "MSTaggable.h"
#import <Foundation/Foundation.h>
/**
* This class represents an installation.
*/
@class MSInstallationTemplate;
/**
* The Azure Notification Hubs installation for a given device.
*/
@interface MSInstallation : NSObject <NSCoding, MSTaggable, MSChangeTracking>
/**
* The unique identifier for the installation
*/
@property(nonatomic, copy) NSString *installationId;
/**
* The push token for the APNS Service
*/
@property(nonatomic, copy) NSString *pushChannel;
/**
* The userID
*/
@property(nonatomic, copy) NSString *userId;
/**
* The expiration for the installation
*/
@property(nonatomic, copy) NSDate *expirationTime;
/**
* A collection ofinstallation templates.
*/
@property(nonatomic, readonly, copy) NSDictionary<NSString *, MSInstallationTemplate *> *templates;
/**
* Sets the template for the installation template for the given key.
*
* @param template The `MSInstallationTemplate` object containing the installation template data.
* @param key The key for the template.
*
* @returns YES if the template was added, else NO.
*
* @see MSInstallationTemplate
*/
- (BOOL)setTemplate:(MSInstallationTemplate *)template forKey:(NSString *)key;
/**
* Removes the installation template for the given key.
*
* @param key The key for the inistallation template.
*
* @returns YES if removed, else NO.
*/
- (BOOL)removeTemplateForKey:(NSString *)key;
/**
* Gets the installation template `MSInstallationTemplate` for the given key.
*
* @param key The key for the template.
*
* @returns The installation template instance
*
* @see MSInstallationTemplate
*/
- (MSInstallationTemplate *)getTemplateForKey:(NSString *)key;
/**
* Converts the current installation into JSON Data.
*/
- (NSData *)toJsonData;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSInstallation;
/**
* A protocol for enriching an installation before it is sent to the backend.
*/
@protocol MSInstallationEnrichmentDelegate <NSObject>
@optional
/**
* Method that allows to enrich intercepted installation with any data before it is saved to the backend.
*
* @param notificationHub The MSNotificationHub instance.
* @param installation The instance of MSInstallation that the user can make changes to
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub willEnrichInstallation:(MSInstallation *)installation;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSInstallation;
/**
* Protocol for the installation lifecycle management for saving an installation calling back when saved successfully or failed to save.
*/
@protocol MSInstallationLifecycleDelegate <NSObject>
@optional
/**
* The installation saved operation succeeded.
* @param notificationHub The notification hub instance.
* @param installation The installation saved to the backend.
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub didSaveInstallation:(MSInstallation *)installation;
/**
* The installation save operation failed.
* @param notificationHub The notification hub instance.
* @param error The error that occurred saving the installation.
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub
didFailToSaveInstallation:(MSInstallation *)installation
withError:(NSError *)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class MSNotificationHub;
@class MSInstallation;
@protocol MSInstallationManagementDelegate <NSObject>
@optional
/**
*Method that allows to save installation to custom back end
*
* @param installation The instance of MSInstallation that user can save
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub
willUpsertInstallation:(MSInstallation *)installation
completionHandler:(void (^)(NSError *_Nullable))completionHandler;
@end
NS_ASSUME_NONNULL_END
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSChangeTracking.h"
#import "MSTaggable.h"
#import <Foundation/Foundation.h>
/**
* Represents an installation template.
*/
@interface MSInstallationTemplate : NSObject <MSTaggable, MSChangeTracking>
/**
* The template body for notification payload which may contain placeholders to be filled in with actual data during the send operation
*/
@property(nonatomic, copy) NSString *body;
/**
* A collection of headers applicable for MPNS-targeted notifications
*/
@property(nonatomic, copy, readonly) NSDictionary<NSString *, NSString *> *headers;
/**
* Sets the header key and value.
*
* @param value The value of the header
* @param key The name of the header.
*/
- (void)setHeaderValue:(NSString *)value forKey:(NSString *)key;
/**
* Removes the header for the given key.
*
* @param key The header to remove based upon the key.
*/
- (void)removeHeaderValueForKey:(NSString *)key;
/**
* Gets the header value based upon the key.
*
* @param key The name of the header
*
* @returns The value of the header.
*/
- (NSString *)getHeaderValueForKey:(NSString *)key;
// Serialize
- (NSDictionary *)toDictionary;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSInstallationEnrichmentDelegate.h"
#import "MSInstallationLifecycleDelegate.h"
#import "MSInstallationManagementDelegate.h"
#import "MSNotificationHubDelegate.h"
#import "MSNotificationHubMessage.h"
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class MSInstallation;
@class MSDebounceInstallationManager;
@class MSInstallationTemplate;
@class MSNotificationHubOptions;
/**
* The Azure Notification Hubs service
*/
@interface MSNotificationHub : NSObject
/**
* Initializes the Notification Hub with the connection string from the Access
* Policy, and Hub Name.
*
* @param connectionString The access policy connection string.
* @param notificationHubName The Azure Notification Hub name
*/
+ (void)startWithConnectionString:(NSString *)connectionString
hubName:(NSString *)notificationHubName NS_SWIFT_NAME(start(connectionString:hubName:));
/**
* Initializes the Notification Hub with the connection string from the Access
* Policy, and Hub Name.
*
* @param connectionString The access policy connection string.
* @param notificationHubName The Azure Notification Hub name
* @param options The Azure Notification Hubs options such as Authorization Options.
*/
+ (void)startWithConnectionString:(NSString *)connectionString hubName:(NSString *)notificationHubName options:(MSNotificationHubOptions *)options NS_SWIFT_NAME(start(connectionString:hubName:options:));
/**
* Initializes the Notification Hub with the installation management delegate to a custom backend.
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param managementDelegate The delegate.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)startWithInstallationManagement:(id<MSInstallationManagementDelegate>)managementDelegate;
/**
* Initializes the Notification Hub with the installation management delegate to a custom backend and options
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param managementDelegate The delegate.
* @param options The Azure Notification Hubs options such as Authorization Options.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)startWithInstallationManagement:(id<MSInstallationManagementDelegate>)managementDelegate options:(MSNotificationHubOptions *)options;
#pragma mark Push Initialization
/**
* Callback for successful registration with push token.
*
* @param deviceToken The device token for remote notifications.
*/
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
/**
* Callback for unsuccessful registration with error.
*
* @param error Error of unsuccessful registration.
*/
+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
/**
* Callback for notification with user info.
*
* @param userInfo The user info for the remote notification.
*/
+ (void)didReceiveRemoteNotification:(NSDictionary *)userInfo;
/**
* Set the delegate.
* Defines the class that implements the optional protocol `MSNotificationHubDelegate`.
*
* @param delegate The delegate.
*
* @see MSNotificationHubDelegate
*/
+ (void)setDelegate:(nullable id<MSNotificationHubDelegate>)delegate;
/**
* Check whether the Azure Notification Hubs SDK is enabled or not as a whole.
*
* @return YES if enabled, NO otherwise.
*
* @see setEnabled:
*/
+ (BOOL)isEnabled;
/**
* Enable or disable the Azure Notification Hubs SDK from receiving messages.
* The state is persisted in the device's storage across application launches.
*
* @param isEnabled YES to enable, NO to disable.
*
* @see isEnabled
*/
+ (void)setEnabled:(BOOL)isEnabled;
#pragma mark Installation Support
/**
* Saves the current installation in local storage.
*/
+ (void)willSaveInstallation;
/**
* Gets the current push channel device token.
*
* @returns The push channel device token.
*/
+ (NSString *)getPushChannel;
/**
* Gets the current installation ID.
*
* @returns The current installation ID.
*/
+ (NSString *)getInstallationId;
#pragma mark Tags Support
/**
* Adds a tag to the current installation.
*
* @param tag The tag to add
*
* @returns YES if tag was added, else NO.
*/
+ (BOOL)addTag:(NSString *)tag;
/**
* Adds the tags array to the current installation.
*
* @param tags The tags array to add
*
* @returns YES if the tags were added, else NO.
*/
+ (BOOL)addTags:(NSArray<NSString *> *)tags;
/**
* Removes the tag from the current installation.
*
* @param tag The tag to remove.
*
* @returns YES if the tag was removed, else NO.
*/
+ (BOOL)removeTag:(NSString *)tag;
/**
* Removes the tags from the current installation.
*
* @param tags The tags to remove.
*
* @returns YES if the tags were removed, else NO.
*/
+ (BOOL)removeTags:(NSArray<NSString *> *)tags;
/**
* Gets the tags from the current installation.
*
* @returns The tags from the current installation.
*/
+ (NSArray<NSString *> *)getTags;
/**
* Clears the tags from the current installation.
*/
+ (void)clearTags;
#pragma mark Template Support
/**
* Sets the template for the installation template for the given key.
*
* @param template The `MSInstallationTemplate` object containing the installation template data.
* @param key The key for the template.
*
* @returns YES if the template was added, else NO.
*
* @see MSInstallationTemplate
*/
+ (BOOL)setTemplate:(MSInstallationTemplate *)template forKey:(NSString *)key;
/**
* Removes the installation template for the given key.
*
* @param key The key for the inistallation template.
*
* @returns YES if removed, else NO.
*/
+ (BOOL)removeTemplateForKey:(NSString *)key;
/**
* Gets the installation template `MSInstallationTemplate` for the given key.
*
* @param key The key for the template.
*
* @returns The installation template instance
*
* @see MSInstallationTemplate
*/
+ (MSInstallationTemplate *)getTemplateForKey:(NSString *)key;
/**
* Gets all the templates for the given installation.
*
* @returns A dictionary of the strings and installation templates.
*
* @see MSInstallationTemplate
*/
+ (NSDictionary<NSString *, MSInstallationTemplate *> *)getTemplates;
#pragma mark UserID support
/**
* Adds a userId to the current installation.
*
* @param userId The userId to add
*/
+ (void)setUserId:(NSString *)userId;
/**
* Get the current User Id
*
* @returns the current User Id
*/
+ (NSString *)getUserId;
#pragma mark Installation management support
/**
* Set the enrichment delegate for the installation
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param enrichmentDelegate The delegate.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)setEnrichmentDelegate:(nullable id<MSInstallationEnrichmentDelegate>)enrichmentDelegate;
/**
* Set the lifecycle delegate to be able to intercept whether saving the installation was successful.
* Defines the class that implements the optional protocol `MSInstallationLifecycleDelegate`.
*
* @param lifecycleDelegate The delegate.
*
* @see MSInstallationLifecycleDelegate
*/
+ (void)setLifecycleDelegate:(nullable id<MSInstallationLifecycleDelegate>)lifecycleDelegate;
@end
NS_ASSUME_NONNULL_END
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSNotificationHubMessage;
/**
* Protocol for receiving messages from a Notification Hub
*/
@protocol MSNotificationHubDelegate <NSObject>
@optional
/**
* Callback method that will be called whenever a push notification is clicked
* from notification center or a notification is received in foreground.
*
* @param notificationHub The instance of MSNotificationHub
* @param message The push notification details.
*/
- (void)notificationHub:(MSNotificationHub *_Nonnull)notificationHub didReceivePushNotification:(MSNotificationHubMessage *_Nonnull)message;
/**
* Callback method that will be called when the system calls [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:completionHandler:]
*
* @param notificationHub The instance of MSNotificationHub
* @param granted Whether the authorization was granted
* @param error Whther there was an error in requesting authorization.
*/
- (void)notificationHub:(MSNotificationHub *_Nonnull)notificationHub didRequestAuthorization:(BOOL)granted error:(NSError *_Nullable)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* The Push Notification message.
*/
@interface MSNotificationHubMessage : NSObject
/**
* Notification title.
*/
@property(nonatomic, readonly) NSString *title;
/**
* Notification message.
*/
@property(nonatomic, readonly) NSString *body;
/**
* Notification data.
*/
@property(nonatomic, readonly) NSDictionary *userInfo;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import <UserNotifications/UserNotifications.h>
/**
* A class which contains the options for the Notification Hubs initialization.
*/
@interface MSNotificationHubOptions : NSObject
/**
* The authorization options for registering for push notifications.
*/
@property (nonatomic)UNAuthorizationOptions authorizationOptions API_AVAILABLE(ios(10.0), watchos(3.0), macos(10.14), macCatalyst(13.0));
- (instancetype)initWithAuthorizationOptions:(UNAuthorizationOptions)authorizationOptions API_AVAILABLE(ios(10.0), watchos(3.0), macos(10.14), macCatalyst(13.0)) NS_SWIFT_NAME(init(withOptions:));
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* A protocol for managing tags, adding, deleting and retrieving
*/
@protocol MSTaggable
/**
* A collection of tags for the installation.
*/
@property(nonatomic, copy, readonly) NSSet<NSString *> *tags;
/**
* Adds a tag to the current installation.
*
* @param tag The tag to add
*
* @returns YES if tag was added, else NO.
*/
- (BOOL)addTag:(NSString *)tag;
/**
* Adds the tags array to the current installation.
*
* @param tagsToAdd The tags array to add
*
* @returns YES if the tags were added, else NO.
*/
- (BOOL)addTags:(NSArray<NSString *> *)tagsToAdd;
/**
* Removes the tag from the current installation.
*
* @param tag The tag to remove.
*
* @returns YES if the tag was removed, else NO.
*/
- (BOOL)removeTag:(NSString *)tag;
/**
* Removes the tags from the current installation.
*
* @param tagsToRemove The tags to remove.
*
* @returns YES if the tags were removed, else NO.
*/
- (BOOL)removeTags:(NSArray<NSString *> *)tagsToRemove;
/**
* Clears the tags from the current installation.
*/
- (void)clearTags;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBConnectionString : NSObject
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint issuer:(NSString *)issuer issuerSecret:(NSString *)secret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint fullAccessSecret:(NSString *)fullAccessSecret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint listenAccessSecret:(NSString *)listenAccessSecret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint sharedAccessKeyName:(NSString *)keyName accessSecret:(NSString *)secret;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBStoredRegistrationEntry.h"
#import <Foundation/Foundation.h>
@class SBRegistration;
@interface SBLocalStorage : NSObject {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wobjc-interface-ivars"
@private
NSString *_path;
NSMutableDictionary *_registrations;
NSString *_versionKey;
NSString *_deviceTokenKey;
NSString *_registrationsKey;
}
#pragma GCC diagnostic pop
@property(copy, nonatomic) NSString *deviceToken;
@property(nonatomic) BOOL isRefreshNeeded;
- (SBLocalStorage *)initWithNotificationHubPath:(NSString *)notificationHubPath;
- (void)refreshFinishedWithDeviceToken:(NSString *)newDeviceToken;
- (StoredRegistrationEntry *)getStoredRegistrationEntryWithRegistrationName:(NSString *)registrationName;
- (void)updateWithRegistrationName:(NSString *)registrationName registration:(SBRegistration *)registration;
- (void)updateWithRegistrationName:(NSString *)registrationName
registrationId:(NSString *)registrationId
eTag:(NSString *)eTag
deviceToken:(NSString *)devToken;
- (void)updateWithRegistration:(SBRegistration *)registration;
- (void)deleteWithRegistrationName:(NSString *)registrationName;
- (void)deleteAllRegistrations;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import "SBLocalStorage.h"
#import "SBTokenProvider.h"
@interface SBNotificationHub : NSObject
- (SBNotificationHub *)initWithConnectionString:(NSString *)connectionString notificationHubPath:(NSString *)notificationHubPath;
// Async operations
- (void)registerNativeWithDeviceToken:(NSData *)deviceToken tags:(NSSet *)tags completion:(void (^)(NSError *error))completion;
- (void)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)name
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
tags:(NSSet *)tags
completion:(void (^)(NSError *error))completion;
- (void)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)name
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
priorityTemplate:(NSString *)priorityTemplate
tags:(NSSet *)tags
completion:(void (^)(NSError *error))completion;
- (void)unregisterNativeWithCompletion:(void (^)(NSError *error))completion;
- (void)unregisterTemplateWithName:(NSString *)name completion:(void (^)(NSError *error))completion;
- (void)unregisterAllWithDeviceToken:(NSData *)deviceToken completion:(void (^)(NSError *error))completion;
// sync operations
- (BOOL)registerNativeWithDeviceToken:(NSData *)deviceToken tags:(NSSet *)tags error:(NSError **)error;
- (BOOL)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)templateName
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
tags:(NSSet *)tags
error:(NSError **)error;
- (BOOL)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)templateName
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
priorityTemplate:(NSString *)priorityTemplate
tags:(NSSet *)tags
error:(NSError **)error;
- (BOOL)unregisterNativeWithError:(NSError **)error;
- (BOOL)unregisterTemplateWithName:(NSString *)name error:(NSError **)error;
- (BOOL)unregisterAllWithDeviceToken:(NSData *)deviceToken error:(NSError **)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBRegistration : NSObject
@property(copy, nonatomic) NSString *ETag;
@property(copy, nonatomic) NSDate *expiresAt;
@property(copy, nonatomic) NSSet *tags;
@property(copy, nonatomic) NSString *registrationId;
@property(copy, nonatomic) NSString *deviceToken;
+ (NSString *)Name;
+ (NSString *)payloadWithDeviceToken:(NSString *)deviceToken tags:(NSSet *)tags;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface StoredRegistrationEntry : NSObject
@property(copy, nonatomic) NSString *RegistrationName;
@property(copy, nonatomic) NSString *RegistrationId;
@property(copy, nonatomic) NSString *ETag;
- (StoredRegistrationEntry *)initWithString:(NSString *)string;
- (NSString *)toString;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBRegistration.h"
#import <Foundation/Foundation.h>
@interface SBTemplateRegistration : SBRegistration
@property(copy, nonatomic) NSString *bodyTemplate;
@property(copy, nonatomic) NSString *expiry;
@property(copy, nonatomic) NSString *templateName;
+ (NSString *)payloadWithDeviceToken:(NSString *)deviceToken
bodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
priorityTemplate:(NSString *)priorityTemplate
tags:(NSSet *)tags
templateName:(NSString *)templateName;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBTokenProvider : NSObject {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wobjc-interface-ivars"
@private
NSString *_sharedAccessKey;
NSString *_sharedAccessKeyName;
NSString *_sharedSecret;
NSString *_sharedSecretIssurer;
NSURL *_stsHostName;
NSURL *_serviceEndPoint;
}
#pragma GCC diagnostic pop
@property(nonatomic) NSInteger timeToExpireinMins;
- (SBTokenProvider *)initWithConnectionDictinary:(NSDictionary *)connectionDictionary;
- (void)setTokenWithRequest:(NSMutableURLRequest *)request completion:(void (^)(NSError *))completion;
- (BOOL)setTokenWithRequest:(NSMutableURLRequest *)request error:(NSError **)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
// Legacy API
#if !TARGET_OS_OSX
#import "SBConnectionString.h"
#import "SBNotificationHub.h"
#endif
// New API
#import "MSInstallation.h"
#import "MSInstallationEnrichmentDelegate.h"
#import "MSInstallationLifecycleDelegate.h"
#import "MSInstallationManagementDelegate.h"
#import "MSInstallationTemplate.h"
#import "MSNotificationHubOptions.h"
#import "MSNotificationHub.h"
#import "MSNotificationHubDelegate.h"
#import "MSNotificationHubMessage.h"
framework module WindowsAzureMessaging {
umbrella header "WindowsAzureMessaging.h"
export *
module * { export * }
link framework "Foundation"
link framework "SystemConfiguration"
link framework "UIKit"
link framework "UserNotifications"
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>20G80</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>WindowsAzureMessaging</string>
<key>CFBundleIdentifier</key>
<string>com.microsoft.WindowsAzureMessaging</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>WindowsAzureMessaging</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>12E507</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>11.3</string>
<key>DTSDKBuild</key>
<string>20E214</string>
<key>DTSDKName</key>
<string>macosx11.3</string>
<key>DTXcode</key>
<string>1251</string>
<key>DTXcodeBuild</key>
<string>12E507</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>UIDeviceFamily</key>
<array>
<integer>2</integer>
</array>
</dict>
</plist>
/Users/matthewp/Library/Developer/Xcode/DerivedData/WindowsAzureMessaging-gtakvndxivnwmuebjxwxzcqevqjd/Build/Intermediates.noindex/ArchiveIntermediates/All Frameworks/IntermediateBuildFilesPath/UninstalledProducts/macosx/WindowsAzureMessaging.framework
\ No newline at end of file
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* Protocol for checking if the object has been modified.
*/
@protocol MSChangeTracking
/**
* Determines whether the object is dirty or not.
*/
@property(nonatomic, assign) BOOL isDirty;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSChangeTracking.h"
#import "MSTaggable.h"
#import <Foundation/Foundation.h>
/**
* This class represents an installation.
*/
@class MSInstallationTemplate;
/**
* The Azure Notification Hubs installation for a given device.
*/
@interface MSInstallation : NSObject <NSCoding, MSTaggable, MSChangeTracking>
/**
* The unique identifier for the installation
*/
@property(nonatomic, copy) NSString *installationId;
/**
* The push token for the APNS Service
*/
@property(nonatomic, copy) NSString *pushChannel;
/**
* The userID
*/
@property(nonatomic, copy) NSString *userId;
/**
* The expiration for the installation
*/
@property(nonatomic, copy) NSDate *expirationTime;
/**
* A collection ofinstallation templates.
*/
@property(nonatomic, readonly, copy) NSDictionary<NSString *, MSInstallationTemplate *> *templates;
/**
* Sets the template for the installation template for the given key.
*
* @param template The `MSInstallationTemplate` object containing the installation template data.
* @param key The key for the template.
*
* @returns YES if the template was added, else NO.
*
* @see MSInstallationTemplate
*/
- (BOOL)setTemplate:(MSInstallationTemplate *)template forKey:(NSString *)key;
/**
* Removes the installation template for the given key.
*
* @param key The key for the inistallation template.
*
* @returns YES if removed, else NO.
*/
- (BOOL)removeTemplateForKey:(NSString *)key;
/**
* Gets the installation template `MSInstallationTemplate` for the given key.
*
* @param key The key for the template.
*
* @returns The installation template instance
*
* @see MSInstallationTemplate
*/
- (MSInstallationTemplate *)getTemplateForKey:(NSString *)key;
/**
* Converts the current installation into JSON Data.
*/
- (NSData *)toJsonData;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSInstallation;
/**
* A protocol for enriching an installation before it is sent to the backend.
*/
@protocol MSInstallationEnrichmentDelegate <NSObject>
@optional
/**
* Method that allows to enrich intercepted installation with any data before it is saved to the backend.
*
* @param notificationHub The MSNotificationHub instance.
* @param installation The instance of MSInstallation that the user can make changes to
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub willEnrichInstallation:(MSInstallation *)installation;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSInstallation;
/**
* Protocol for the installation lifecycle management for saving an installation calling back when saved successfully or failed to save.
*/
@protocol MSInstallationLifecycleDelegate <NSObject>
@optional
/**
* The installation saved operation succeeded.
* @param notificationHub The notification hub instance.
* @param installation The installation saved to the backend.
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub didSaveInstallation:(MSInstallation *)installation;
/**
* The installation save operation failed.
* @param notificationHub The notification hub instance.
* @param error The error that occurred saving the installation.
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub
didFailToSaveInstallation:(MSInstallation *)installation
withError:(NSError *)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class MSNotificationHub;
@class MSInstallation;
@protocol MSInstallationManagementDelegate <NSObject>
@optional
/**
*Method that allows to save installation to custom back end
*
* @param installation The instance of MSInstallation that user can save
*/
- (void)notificationHub:(MSNotificationHub *)notificationHub
willUpsertInstallation:(MSInstallation *)installation
completionHandler:(void (^)(NSError *_Nullable))completionHandler;
@end
NS_ASSUME_NONNULL_END
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSChangeTracking.h"
#import "MSTaggable.h"
#import <Foundation/Foundation.h>
/**
* Represents an installation template.
*/
@interface MSInstallationTemplate : NSObject <MSTaggable, MSChangeTracking>
/**
* The template body for notification payload which may contain placeholders to be filled in with actual data during the send operation
*/
@property(nonatomic, copy) NSString *body;
/**
* A collection of headers applicable for MPNS-targeted notifications
*/
@property(nonatomic, copy, readonly) NSDictionary<NSString *, NSString *> *headers;
/**
* Sets the header key and value.
*
* @param value The value of the header
* @param key The name of the header.
*/
- (void)setHeaderValue:(NSString *)value forKey:(NSString *)key;
/**
* Removes the header for the given key.
*
* @param key The header to remove based upon the key.
*/
- (void)removeHeaderValueForKey:(NSString *)key;
/**
* Gets the header value based upon the key.
*
* @param key The name of the header
*
* @returns The value of the header.
*/
- (NSString *)getHeaderValueForKey:(NSString *)key;
// Serialize
- (NSDictionary *)toDictionary;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "MSInstallationEnrichmentDelegate.h"
#import "MSInstallationLifecycleDelegate.h"
#import "MSInstallationManagementDelegate.h"
#import "MSNotificationHubDelegate.h"
#import "MSNotificationHubMessage.h"
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class MSInstallation;
@class MSDebounceInstallationManager;
@class MSInstallationTemplate;
@class MSNotificationHubOptions;
/**
* The Azure Notification Hubs service
*/
@interface MSNotificationHub : NSObject
/**
* Initializes the Notification Hub with the connection string from the Access
* Policy, and Hub Name.
*
* @param connectionString The access policy connection string.
* @param notificationHubName The Azure Notification Hub name
*/
+ (void)startWithConnectionString:(NSString *)connectionString
hubName:(NSString *)notificationHubName NS_SWIFT_NAME(start(connectionString:hubName:));
/**
* Initializes the Notification Hub with the connection string from the Access
* Policy, and Hub Name.
*
* @param connectionString The access policy connection string.
* @param notificationHubName The Azure Notification Hub name
* @param options The Azure Notification Hubs options such as Authorization Options.
*/
+ (void)startWithConnectionString:(NSString *)connectionString hubName:(NSString *)notificationHubName options:(MSNotificationHubOptions *)options NS_SWIFT_NAME(start(connectionString:hubName:options:));
/**
* Initializes the Notification Hub with the installation management delegate to a custom backend.
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param managementDelegate The delegate.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)startWithInstallationManagement:(id<MSInstallationManagementDelegate>)managementDelegate;
/**
* Initializes the Notification Hub with the installation management delegate to a custom backend and options
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param managementDelegate The delegate.
* @param options The Azure Notification Hubs options such as Authorization Options.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)startWithInstallationManagement:(id<MSInstallationManagementDelegate>)managementDelegate options:(MSNotificationHubOptions *)options;
#pragma mark Push Initialization
/**
* Callback for successful registration with push token.
*
* @param deviceToken The device token for remote notifications.
*/
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
/**
* Callback for unsuccessful registration with error.
*
* @param error Error of unsuccessful registration.
*/
+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
/**
* Callback for notification with user info.
*
* @param userInfo The user info for the remote notification.
*/
+ (void)didReceiveRemoteNotification:(NSDictionary *)userInfo;
/**
* Set the delegate.
* Defines the class that implements the optional protocol `MSNotificationHubDelegate`.
*
* @param delegate The delegate.
*
* @see MSNotificationHubDelegate
*/
+ (void)setDelegate:(nullable id<MSNotificationHubDelegate>)delegate;
/**
* Check whether the Azure Notification Hubs SDK is enabled or not as a whole.
*
* @return YES if enabled, NO otherwise.
*
* @see setEnabled:
*/
+ (BOOL)isEnabled;
/**
* Enable or disable the Azure Notification Hubs SDK from receiving messages.
* The state is persisted in the device's storage across application launches.
*
* @param isEnabled YES to enable, NO to disable.
*
* @see isEnabled
*/
+ (void)setEnabled:(BOOL)isEnabled;
#pragma mark Installation Support
/**
* Saves the current installation in local storage.
*/
+ (void)willSaveInstallation;
/**
* Gets the current push channel device token.
*
* @returns The push channel device token.
*/
+ (NSString *)getPushChannel;
/**
* Gets the current installation ID.
*
* @returns The current installation ID.
*/
+ (NSString *)getInstallationId;
#pragma mark Tags Support
/**
* Adds a tag to the current installation.
*
* @param tag The tag to add
*
* @returns YES if tag was added, else NO.
*/
+ (BOOL)addTag:(NSString *)tag;
/**
* Adds the tags array to the current installation.
*
* @param tags The tags array to add
*
* @returns YES if the tags were added, else NO.
*/
+ (BOOL)addTags:(NSArray<NSString *> *)tags;
/**
* Removes the tag from the current installation.
*
* @param tag The tag to remove.
*
* @returns YES if the tag was removed, else NO.
*/
+ (BOOL)removeTag:(NSString *)tag;
/**
* Removes the tags from the current installation.
*
* @param tags The tags to remove.
*
* @returns YES if the tags were removed, else NO.
*/
+ (BOOL)removeTags:(NSArray<NSString *> *)tags;
/**
* Gets the tags from the current installation.
*
* @returns The tags from the current installation.
*/
+ (NSArray<NSString *> *)getTags;
/**
* Clears the tags from the current installation.
*/
+ (void)clearTags;
#pragma mark Template Support
/**
* Sets the template for the installation template for the given key.
*
* @param template The `MSInstallationTemplate` object containing the installation template data.
* @param key The key for the template.
*
* @returns YES if the template was added, else NO.
*
* @see MSInstallationTemplate
*/
+ (BOOL)setTemplate:(MSInstallationTemplate *)template forKey:(NSString *)key;
/**
* Removes the installation template for the given key.
*
* @param key The key for the inistallation template.
*
* @returns YES if removed, else NO.
*/
+ (BOOL)removeTemplateForKey:(NSString *)key;
/**
* Gets the installation template `MSInstallationTemplate` for the given key.
*
* @param key The key for the template.
*
* @returns The installation template instance
*
* @see MSInstallationTemplate
*/
+ (MSInstallationTemplate *)getTemplateForKey:(NSString *)key;
/**
* Gets all the templates for the given installation.
*
* @returns A dictionary of the strings and installation templates.
*
* @see MSInstallationTemplate
*/
+ (NSDictionary<NSString *, MSInstallationTemplate *> *)getTemplates;
#pragma mark UserID support
/**
* Adds a userId to the current installation.
*
* @param userId The userId to add
*/
+ (void)setUserId:(NSString *)userId;
/**
* Get the current User Id
*
* @returns the current User Id
*/
+ (NSString *)getUserId;
#pragma mark Installation management support
/**
* Set the enrichment delegate for the installation
* Defines the class that implements the optional protocol `MSInstallationEnrichmentDelegate`.
*
* @param enrichmentDelegate The delegate.
*
* @see MSInstallationEnrichmentDelegate
*/
+ (void)setEnrichmentDelegate:(nullable id<MSInstallationEnrichmentDelegate>)enrichmentDelegate;
/**
* Set the lifecycle delegate to be able to intercept whether saving the installation was successful.
* Defines the class that implements the optional protocol `MSInstallationLifecycleDelegate`.
*
* @param lifecycleDelegate The delegate.
*
* @see MSInstallationLifecycleDelegate
*/
+ (void)setLifecycleDelegate:(nullable id<MSInstallationLifecycleDelegate>)lifecycleDelegate;
@end
NS_ASSUME_NONNULL_END
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@class MSNotificationHub;
@class MSNotificationHubMessage;
/**
* Protocol for receiving messages from a Notification Hub
*/
@protocol MSNotificationHubDelegate <NSObject>
@optional
/**
* Callback method that will be called whenever a push notification is clicked
* from notification center or a notification is received in foreground.
*
* @param notificationHub The instance of MSNotificationHub
* @param message The push notification details.
*/
- (void)notificationHub:(MSNotificationHub *_Nonnull)notificationHub didReceivePushNotification:(MSNotificationHubMessage *_Nonnull)message;
/**
* Callback method that will be called when the system calls [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:completionHandler:]
*
* @param notificationHub The instance of MSNotificationHub
* @param granted Whether the authorization was granted
* @param error Whther there was an error in requesting authorization.
*/
- (void)notificationHub:(MSNotificationHub *_Nonnull)notificationHub didRequestAuthorization:(BOOL)granted error:(NSError *_Nullable)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* The Push Notification message.
*/
@interface MSNotificationHubMessage : NSObject
/**
* Notification title.
*/
@property(nonatomic, readonly) NSString *title;
/**
* Notification message.
*/
@property(nonatomic, readonly) NSString *body;
/**
* Notification data.
*/
@property(nonatomic, readonly) NSDictionary *userInfo;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import <UserNotifications/UserNotifications.h>
/**
* A class which contains the options for the Notification Hubs initialization.
*/
@interface MSNotificationHubOptions : NSObject
/**
* The authorization options for registering for push notifications.
*/
@property (nonatomic)UNAuthorizationOptions authorizationOptions API_AVAILABLE(ios(10.0), watchos(3.0), macos(10.14), macCatalyst(13.0));
- (instancetype)initWithAuthorizationOptions:(UNAuthorizationOptions)authorizationOptions API_AVAILABLE(ios(10.0), watchos(3.0), macos(10.14), macCatalyst(13.0)) NS_SWIFT_NAME(init(withOptions:));
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
/**
* A protocol for managing tags, adding, deleting and retrieving
*/
@protocol MSTaggable
/**
* A collection of tags for the installation.
*/
@property(nonatomic, copy, readonly) NSSet<NSString *> *tags;
/**
* Adds a tag to the current installation.
*
* @param tag The tag to add
*
* @returns YES if tag was added, else NO.
*/
- (BOOL)addTag:(NSString *)tag;
/**
* Adds the tags array to the current installation.
*
* @param tagsToAdd The tags array to add
*
* @returns YES if the tags were added, else NO.
*/
- (BOOL)addTags:(NSArray<NSString *> *)tagsToAdd;
/**
* Removes the tag from the current installation.
*
* @param tag The tag to remove.
*
* @returns YES if the tag was removed, else NO.
*/
- (BOOL)removeTag:(NSString *)tag;
/**
* Removes the tags from the current installation.
*
* @param tagsToRemove The tags to remove.
*
* @returns YES if the tags were removed, else NO.
*/
- (BOOL)removeTags:(NSArray<NSString *> *)tagsToRemove;
/**
* Clears the tags from the current installation.
*/
- (void)clearTags;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBConnectionString : NSObject
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint issuer:(NSString *)issuer issuerSecret:(NSString *)secret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint fullAccessSecret:(NSString *)fullAccessSecret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint listenAccessSecret:(NSString *)listenAccessSecret;
+ (NSString *)stringWithEndpoint:(NSURL *)endpoint sharedAccessKeyName:(NSString *)keyName accessSecret:(NSString *)secret;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBStoredRegistrationEntry.h"
#import <Foundation/Foundation.h>
@class SBRegistration;
@interface SBLocalStorage : NSObject {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wobjc-interface-ivars"
@private
NSString *_path;
NSMutableDictionary *_registrations;
NSString *_versionKey;
NSString *_deviceTokenKey;
NSString *_registrationsKey;
}
#pragma GCC diagnostic pop
@property(copy, nonatomic) NSString *deviceToken;
@property(nonatomic) BOOL isRefreshNeeded;
- (SBLocalStorage *)initWithNotificationHubPath:(NSString *)notificationHubPath;
- (void)refreshFinishedWithDeviceToken:(NSString *)newDeviceToken;
- (StoredRegistrationEntry *)getStoredRegistrationEntryWithRegistrationName:(NSString *)registrationName;
- (void)updateWithRegistrationName:(NSString *)registrationName registration:(SBRegistration *)registration;
- (void)updateWithRegistrationName:(NSString *)registrationName
registrationId:(NSString *)registrationId
eTag:(NSString *)eTag
deviceToken:(NSString *)devToken;
- (void)updateWithRegistration:(SBRegistration *)registration;
- (void)deleteWithRegistrationName:(NSString *)registrationName;
- (void)deleteAllRegistrations;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import "SBLocalStorage.h"
#import "SBTokenProvider.h"
@interface SBNotificationHub : NSObject
- (SBNotificationHub *)initWithConnectionString:(NSString *)connectionString notificationHubPath:(NSString *)notificationHubPath;
// Async operations
- (void)registerNativeWithDeviceToken:(NSData *)deviceToken tags:(NSSet *)tags completion:(void (^)(NSError *error))completion;
- (void)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)name
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
tags:(NSSet *)tags
completion:(void (^)(NSError *error))completion;
- (void)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)name
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
priorityTemplate:(NSString *)priorityTemplate
tags:(NSSet *)tags
completion:(void (^)(NSError *error))completion;
- (void)unregisterNativeWithCompletion:(void (^)(NSError *error))completion;
- (void)unregisterTemplateWithName:(NSString *)name completion:(void (^)(NSError *error))completion;
- (void)unregisterAllWithDeviceToken:(NSData *)deviceToken completion:(void (^)(NSError *error))completion;
// sync operations
- (BOOL)registerNativeWithDeviceToken:(NSData *)deviceToken tags:(NSSet *)tags error:(NSError **)error;
- (BOOL)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)templateName
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
tags:(NSSet *)tags
error:(NSError **)error;
- (BOOL)registerTemplateWithDeviceToken:(NSData *)deviceToken
name:(NSString *)templateName
jsonBodyTemplate:(NSString *)bodyTemplate
expiryTemplate:(NSString *)expiryTemplate
priorityTemplate:(NSString *)priorityTemplate
tags:(NSSet *)tags
error:(NSError **)error;
- (BOOL)unregisterNativeWithError:(NSError **)error;
- (BOOL)unregisterTemplateWithName:(NSString *)name error:(NSError **)error;
- (BOOL)unregisterAllWithDeviceToken:(NSData *)deviceToken error:(NSError **)error;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBRegistration : NSObject
@property(copy, nonatomic) NSString *ETag;
@property(copy, nonatomic) NSDate *expiresAt;
@property(copy, nonatomic) NSSet *tags;
@property(copy, nonatomic) NSString *registrationId;
@property(copy, nonatomic) NSString *deviceToken;
+ (NSString *)Name;
+ (NSString *)payloadWithDeviceToken:(NSString *)deviceToken tags:(NSSet *)tags;
@end
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface StoredRegistrationEntry : NSObject
@property(copy, nonatomic) NSString *RegistrationName;
@property(copy, nonatomic) NSString *RegistrationId;
@property(copy, nonatomic) NSString *ETag;
- (StoredRegistrationEntry *)initWithString:(NSString *)string;
- (NSString *)toString;
@end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment