This interface has two classes that handles the SDK initialization and registration. The classes are:
- imiconnect
- ICDeviceProfile
- ICConfig
- ICLogger
- ICInAppNotificationManager
- ICInAppNotificationThemeStyle
- ICInAppNotificationViewStyle
- ICInAppModalNotificationViewStyle
- ICInAppBannerNotificationViewStyle
- ICInAppNotificationButtonStyle
- ICInAppNotificationViewBinder
- ICInAppNotificationViewBinderFactory
- ICInAppBannerNotificationViewBinder
- ICInAppBannerNotificationViewBinderFactory
- ICInAppModalNotificationViewBinder
- ICInAppModalNotificationViewBinderFactory.
This class contains the methods to initialize the SDK and register a user. When integrating the SDK into your app, it is mandatory to use this class to initialize the SDK. With the exception of the Authentication module, it is also necessary to register a user before other features are used.
- startupWithLaunchOptions
- startupWithLaunchOptions(with config)
- shutdown
- registerWithDeviceProfile
- deviceProfile
- updateDeviceProfileParam
- removeDeviceProfileParam
- unregister
- setPolicyPollingInterval
- isRegistered
- policyPollingInterval
- deviceId - Deprecated
- sdkVersion
- setSecurityToken
- setSecurityTokenErrorDelegate
startupWithLaunchOptions
This method initializes the SDK using the passed configuration options. An error can be passed in parameters, which will be set if something goes wrong during the startup process. This method is mandatory if imiconnectConfiguration.plist
is not used.
Syntax: + (BOOL)startupWithLaunchOptions:(NSDictionary *)launchOptions error:(NSError **)error
Parameters:
launchOptions
NSDictionary
The launch options passed from didFinishLaunching
method.
error
NSError
Specifies the error description. The error will be set if a startup fails.
Return Value: YES if the startup succeeds, else NO
The default delegate method is (**BOOL**)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
.
startupWithLaunchOptions (with config)
This method initializes the SDK using the passed configuration options. An error can be passed in parameters, which will be set if something goes wrong during the startup process. This method is mandatory if imiconnectConfiguration.plist
is not used.
Syntax: + (BOOL)startupWithLaunchOptions:(NSDictionary *)launchOptions withConfig:(ICConfig *)config error:(NSError **)error
Parameters:
launchOptions
NSDictionary
The launch options passed from didFinishLaunching
method.
config
ICConfig
The config object containing the appId and the clientKey.
error
NSError
Specifies the error description. The error will be set if a startup fails.
The default delegate method is (**BOOL**)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
.
shutdown
This method is used to clean up the SDK, freeing all internal object instances. Invoking this method will stop the SDK features from functioning as such Real-Time Messages and Push notifications.
Usage of this method is not required unless there are a few limited cases where you may wish to use it; for example, if you are only using the Authentication or Monitoring features.
registerWithDeviceProfile
This method registers the device profile with the SDK. This method causes profile details to be sent to the imiconnect platform. Once a profile is registered, all further SDK calls take place in the context of that profile.
Syntax: (void)registerWithDeviceProfile:(ICDeviceProfile *)deviceProfile
completionHandler:(void (^)(NSDictionary *response,NSError *error))completionHandler
ICDeviceProfile *deviceProfile = [[ICDeviceProfile alloc]
initWithDeviceId: [ICDeviceProfile defaultDeviceID]];
[imiconnect registerWithDeviceProfile:deviceProfile
completionHandler:^(NSDictionary*response, NSError *error)
{
//Handle the response
}];
deviceProfile
This method retrieves the currently registered device profile.
Syntax: + (ICDeviceProfile *)deviceProfile
isRegistered
This method is used to check whether the user is currently registered with imiconnect. This method returns true if the user is registered, else false is returned.
Syntax: + (BOOL)isRegistered;
setPolicyPollingInterval
This method is used to set the interval at which the SDK will poll policy updates in minutes. To prevent adverse effects on battery or CPU usage a minimum interval of 30 minutes is enforced. To disable polling, set the value to 0. If Real-Time Messaging or Push is enabled, this value will not be used.
Syntax: +(void)setPolicyPollingInterval:(NSTimeInterval)interval;
Parameters:
interval
NSTimeInterval
Specifies the time in minutes after which policy updates will happen.
policyPollingInterval
This method is used to get the current policy polling interval, in minutes.
Syntax: +(NSTimeInterval)policyPollingInterval;
updateDeviceProfileParam
This method updates the device profile parameter identified by ICDeviceProfileParam with a new value.
Syntax: + (void)updateDeviceProfileParam:(ICDeviceProfileParam)deviceProfileParam
withValue:(NSString *)value
completionHandler:(void (^)(NSDictionary *response,NSError *error))completionHandler
[imiconnect updateDeviceProfileParam:ICDeviceProfileParamCustomerId
withValue:_userIdTextField.text
completionHandler:^(NSDictionary *response, NSError *error)
{
//Handle response
}];
deviceProfile
This method retrieves the deviceId
used by imiconnect APIs.
Syntax: + (ICDeviceProfile *)deviceProfile
+(NSString *)deviceId
+(ICDeviceProfile *)deviceProfile
Retrieves the deviceId used by imiconnect APIs.
removeDeviceProfileParam
This method removes the device profile parameter identified by ICDeviceProfileParam with a new value.
Syntax: + (void)removeDeviceProfileParam:(ICDeviceProfileParam)completionHandler:(void (^)(NSDictionary *response,NSError *error))completionHandler
[imiconnect removeDeviceProfileParam:ICDeviceProfileParamUserId
completionHandler:^(NSDictionary *response, NSError *error)
{
//Handle the response
}];
unregister
This method unregisters the current device profile.
Syntax: + (void)unregister:(void (^)(NSError *error))completionHandler
sdkVersion
This method retrieves the SDK version number.
Syntax: + (NSString *)sdkVersion;
Return Value: Returns the SDK version number.
setSecurityToken
This method is used to set security token to provide better access control for user-centric resources. This method allows developers to specify the Security Token that the SDK will pass to the Gateway API calls.
Syntax: + (void)setSecurityToken:(NSString *)token;
Parameters:
token
String
Specifies the token which is generated from jwttoken
API.
Example:
TokenRequest *tokenRequest = [TokenRequest new];
[tokenRequest requestTokenWithUserId:userId
appId:appId
expiresIn:self.expirationTime
completionHandler:^(NSString *token, NSError *error)
{
if (token != nil)
{
[imiconnect setSecurityToken:token];
}
if (completionHandler != nil)
{
completionHandler(token,error);
}
}];
setSecurityTokenErrorDelegate
This method allows developers to register an object which implements the SecurityTokenExceptionListener
interface to listen for Security Token related exceptions which occur from internal (indirect) Gateway API calls.
Syntax:+ (void)setSecurityTokenErrorDelegate(id<ICSecurityTokenErrorDelegate>)delegate;
Example:
[imiconnect setSecurityTokenErrorDelegate:self];
ICDeviceProfile is a class that gathers information about the back-end device profile. An ICDeviceProfile instance should be instantiated to register a device profile.
The developer can choose to register the device profile with a deviceId
only or with a deviceId
and an appUserId
. User can generate a unique/own device ID or can choose the defaultDeviceId
provided by the SDK.
If the user chooses to register a device profile with the deviceId
only, the backend will automatically generate an appUserId
. The current device profile is accessible via the imiconnect class.
@property (nonatomic) NSString *deviceId
Device ID
@property (nonatomic) NSString *appUserId
App user ID
@property (nonatomic) BOOL isAppUserIdSystemGenerated
Indicates if the app user ID has been generated by the system
@property (nonatomic) NSString *customerId
Customer ID
(instancetype)initWithDeviceId:(NSString *)deviceId
Instantiates an ICDeviceProfile with a deviceId
(instancetype)initWithDeviceId:(NSString *)
deviceId appUserId:(NSString *)appUserId
Instantiates an ICDeviceProfile with a deviceId
and an appUserId
(NSString *)defaultDeviceId
Retrieves the default device ID based on the vendor ID of the device
This class holds the configuration information that is used to initialize the SDK.
@property (nonatomic, readonly) NSString *appId
Specifies the app id of the app created in imiconnect.
@property (nonatomic, readonly) NSString *clientKey
Specifies the client key of the app created in imiconnect.
@property (nonatomic, readonly) NSString *groupIdentifier
The app group identifier. This group identifier is used to retrieve information between the CoreSDK and the NotificationServiceExtension.
@property (nonatomic, readonly) NSString *serverDomain
Specifies server domain configuration to override zero-rating domain.
Methods
- initWithAppId:withappid:clientkey
- initWithAppId:withappid:clientkey:groupIdentifier
- initWithAppId:withappid:clientkey:serverDomain
- initWithAppId:withappid:clientkey:groupidentifier:serverDomain
initWithAppId:withappid:clientkey
This method is used to initialize an ICConfig instance with an appId and clientkey.
Syntax: - (instancetype)initWithAppId:(NSString *)appId
clientKey:(NSString *)clientKey;
Parameters:
appId
NSString
Specifies the app id that is created in imiconnect
clientKey
NSString
Specifies the client key that is created in imiconnect
Returns:
An instance of ICConfig.
initWithAppId:withappid:clientkey:groupIdentifier
This method is used to initialize an ICConfig instance with an appId, clientkey and groupIdentifier.
Syntax - initWithAppId:(NSString *)appId
clientKey:(NSString *)clientKey
groupIdentifier:(NSString *)groupIdentifier;
Parameters:
appId
NSString
Specifies the app id that is created in imiconnect
clientKey
NSString
Specifies the client key that is created in imiconnect
groupIdentifier
NSString
Specifies the app group identifier associated to the app
Returns:
An instance of ICConfig.
initWithAppId:withappid:clientkey:serverDomain
This method is used to initialize an ICConfig instance with an appId, clientkey, and serverDomain.
Syntax - (instancetype)initWithAppId:(NSString *)appId
clientKey:(NSString *)clientKey
serverDomain:(NSString *)serverDomain;
Parameters:
appId
NSString
Specifies the app id that is created in imiconnect
clientKey
NSString
Specifies the client key that is created in imiconnect
serverDomain
NSString
Specifies server domain to override zero-rating domain
Returns:
An instance of ICConfig.
initWithAppId:withappid:clientkey:groupidentifier:serverDomain
This method is used to initialize an ICConfig instance with an appId, clientkey, groupIdentifier, and serverDomain.
Syntax - initWithAppId:(NSString *)appId
clientKey:(NSString *)clientKey
groupIdentifier:(NSString *)groupIdentifier
serverDomain:(NSString *)serverDomain;
Parameters:
appId
NSString
Specifies the app id that is created in imiconnect
clientKey
NSString
Specifies the client key that is created in imiconnect
groupIdentifier
NSString
Specifies the app group identifier associated to the app
serverDomain
NSString
Specifies server domain to override zero-rating domain
Returns:
An instance of ICConfig.
Methods
setLogType
This method sets the log options for the logger.
Syntax: + (void)setLogType:(ICLogType)logType forLogTarget:(ICLogTarget)logTarget
Parameters:
logType
ICLogType
The type of logs that will be logged.
target
ICLogTarget
The target on which the logs will be displayed/recorded.
setRetentionDuration
This method sets the retention duration of the logs. The logs will be kept during that duration and will be automatically purged after.
Syntax: + (void)setRetentionDuration:(NSInteger)days
Parameters:
days
Integer
The number of days after which the logs will be purged.
logPath
This method retrieves the directory path where the logs are stored.
Syntax: + (NSString *)logPath
Return Value: Returns the directory path where the logs are stored.
publishEvent
Invoke publishEvent
to publish your custom events info to the imiconnect platform.
Syntax: + (void)publishEventParam:(NSDictionary *)eventParams
completionHandler:(void (^)(NSDictionary *response, NSError *error))completionHandler
Parameters:
eventParams
NSDictionary
The eventParams for custom params which needs to be published
completionHandler
void (^)(NSDictionary response, NSError error)
A completionHandler that will be called when a response from the server is received
Example:
NSDictionary *eventParams = [NSDictionary new];
[eventParams setValue:@"9123443212" forKey:@"number"];
[eventParams setValue:@"234642" forKey:@"OTP"];
[imiconnect publishEventParam:eventParams completionHandler:^(NSDictionary *response, NSError *error)
{
if(error != nil)
{
NSLog(@"Publish failed, error: %@", error.localizedDescription);
return;
}
NSLog(@"Published successfully");
}];
setEnable
This method can be used to enable the notification display when app is in active state.
Syntax: - (void)setEnable:(BOOL)enable;
Parameters:
enable
Boolean
A boolean value which will be used to enable/disable the InApp Notifications.
Example:
[[ICInAppNotificationManager shared] setEnable:YES];
registerViewFactory
This method can be used to register the view factory for notification types like Modal and Banner.
Syntax: - (void)registerViewFactory:(id<ICInAppNotificationViewBinderFactory>)notificationFactory
forNotificationType:(ICInAppNotificationType)notificationType
Parameters:
notificationFactory
ICInAppNotificationViewBinderFactory
An instance of ICInAppNotificationViewBinderFactory through which user has to pass the view binder factory details to register for notifications with the specified type.
notificationType
User can register for banner type notifications by passing ICInAppNotificationTypeBanner to this parameter and to register for modal type notifications he should pass ICInAppNotificationTypeModal to this parameter.
Example:
[[ICInAppNotificationManager shared] registerViewFactory:[ICInAppBannerNotificationViewBinderFactory new] forNotificationType:ICInAppNotificationTypeBanner];
[[ICInAppNotificationManager shared] registerViewFactory:[ICInAppModalNotificationViewBinderFactory new] forNotificationType:(ICInAppNotificationType)ICInAppNotificationTypeModal];
setModalNotificationViewStyle
This method can be used to set the Modal notifications view style.
Syntax: - - (void)setModalNotificationViewStyle:(ICInAppModalNotificationViewStyle *)viewStyle;
Parameters:
viewStyle
ICInAppModalNotificationViewStyle
An instance of ICInAppModalNotificationViewStyle class through which user has to set up the required styles like color, font using the attributes defined in the class.
Example:
ICInAppModalNotificationViewStyle *modalViewStyle = [[ICInAppModalNotificationViewStyle alloc] init];
modalViewStyle.titleTextColor = [UIColor blackColor]; modalViewStyle.titleTextFont = [UIFont systemFontOfSize:15.0f];
modalViewStyle.backGroundColor = [UIColor whiteColor]; [[ICInAppNotificationManager shared] setModalNotificationViewStyle:modalViewStyle];
setBannerNotificationViewStyle
This method can be used to set the Banner notifications view style.
Syntax: - (void)setBannerNotificationViewStyle:(ICInAppBannerNotificationViewStyle *)viewStyle;
Parameters:
viewStyle
ICInAppBannerNotificationViewStyle
An instance of ICInAppBannerNotificationViewStyle class through which user has to set up the required styles like color, font using the attributes defined in the class.
Example:
ICInAppBannerNotificationViewStyle *bannerViewStyle = [[ICInAppBannerNotificationViewStyle alloc] init];
bannerViewStyle.titleTextColor = [UIColor blackColor];
bannerViewStyle.titleTextFont = [UIFont systemFontOfSize:15.0f];
bannerViewStyle.backGroundColor = [UIColor whiteColor];
bannerViewStyle.closeButtonTintColor = [UIColor redColor];
ICInAppNotificationButtonStyle *buttonStyle = [[ICInAppNotificationButtonStyle alloc] init];
buttonStyle.buttonTextColor = [UIColor blueColor];
buttonStyle.buttonBackgroundColor = [UIColor grayColor];
bannerViewStyle.buttonStyle = buttonStyle;
[[ICInAppNotificationManager shared] setBannerNotificationViewStyle:bannerViewStyle];
setModelNotificationViewTheme
This method can be used to set the Model notifications view theme (Light or Dark).
Syntax: - - (void)setModalNotificationViewTheme:(ICInAppModalNotificationTheme)modalNotificaitonTheme;
Parameters:
modalNotificaitonTheme
- User can set the modal notification theme as Dark theme by passing the ICInAppModalNotificationThemeDark to this parameter and user has to pass ICInAppModalNotificationThemeLight to set light theme.
Example:
[[ICInAppNotificationManager shared] setModalNotificationViewTheme:ICInAppModalNotificationThemeDark];
setBannerNotificationViewTheme
This method can be used to set the Banner notifications view theme (Light or Dark).
Syntax: - (void)setBannerNotificationViewTheme:(ICInAppBannerNotificationTheme)bannerNotificaitonTheme;
Parameters:
bannerNotificaitonTheme
User can set the banner notification theme as Dark theme by passing the ICInAppBannerNotificationThemeDark to this parameter and user has to pass ICInAppBannerNotificationThemeLight to set light theme.
Example:
[[ICInAppNotificationManager shared] setBannerNotificationViewTheme:ICInAppBannerNotificationThemeLight];
This class holds the Theme styles of InApp Notifications and it will be used to render the theme styles selected by the user.
Properties
@property (nonatomic) ICInAppBannerNotificationTheme notificationBannerTheme;
InApp Notification Banner type theme such as Light/Dark.
@property (nonatomic) ICInAppModalNotificationTheme notificationModalTheme;
InApp Notification Modal type theme such as Light/Dark.
This class holds the View styles of InApp Notifications and it will be used to render the view styles selected by the user.
Properties
Below properties are available for both Modal and Banner Notifications.
@property (nonatomic, readwrite) UIColor *titleTextColor;
This property can be used to set the text color for the InApp Notification title.
@property (nonatomic, readwrite) UIFont *titleTextFont;
This property can be used to set the text Font for InApp Notification title.
@property (nonatomic, readwrite) UIColor *titleTextShadowColor;
This property can be used to set the text-shadow color for the InApp Notification title.
@property (nonatomic, readwrite) UIColor *textColor;
This property can be used to set the text color for InApp Notification details(Body message).
@property (nonatomic, readwrite) UIFont *textFont;
This property can be used to set the text Font for InApp Notification details(Body message).
@property (nonatomic, readwrite) UIColor *textShadowColor;
This property can be used to set the text Shadow color for InApp Notification details(Body message).
@property (nonatomic, readwrite) UIColor *backGroundColor;
This property can be used to set the background color for the InApp Notification view.
@property (nonatomic, readwrite) ICInAppNotificationButtonStyle *buttonStyle;
This property can be used to set the Buttons Style for InApp Notification buttons.
This class has been derived from ICInAppNotificationViewStyle, so that it can access all the properties from the ICInAppNotificationViewStyle class. We haven’t added any properties to this class as all the required attributes have been declared in the superclass.
This class has been derived from ICInAppNotificationViewStyle, so that it can access all the properties from the ICInAppNotificationViewStyle class. We haven’t added any properties to this class as all the required attributes have been declared in the superclass.
This class holds the styling attributes of InApp Notification Buttons. Users can set attributes like tint color, background color to the InApp Notification buttons.
Properties
@property (nonatomic) UIColor *buttonTextColor;
This property can be used to set the text color for Buttons.
@property (nonatomic) UIColor *buttonTintColor;
This property can be used to set the tint color for Buttons.
@property (nonatomic) UIButtonType buttonType;
This property can be used to set the button type for Buttons.
@property (nonatomic) UIColor *buttonBackgroundColor;
This property can be used to set the Background color for Buttons.
This class holds the InApp notification’s message object and view styles. These properties will be used to render the notifications UI.
Properties
@property (nonatomic, retain)ICMessage *message;
This property holds the notification message object which contains complete information like title, details, attachments, and actions.
@property (nonatomic)ICInAppBannerNotificationViewStyle *bannerViewStyle;
This property is responsible for the banner type InApp Notification view style which will be used to render the UI as specified by the user.
@property (nonatomic)ICInAppModalNotificationViewStyle *modalViewStyle;
This property is responsible for modal type InApp Notification view style which will be used to render the UI as specified by the user.
Methods
(void)bindMessage:(ICMessage *)message;
This function binds the message data to the notification view. It holds the business logic of data rendering.
(UIViewController *)getView;
(void)bindModalViewStyle:(ICInAppModalNotificationViewStyle *)modalViewStyle;
This function binds the modal notification’s view style to the notification view.
(void)bindBannerViewStyle:(ICInAppBannerNotificationViewStyle *)bannerViewStyle;
This function binds the banner notification’s view style to the notification view.
This class acts as a base binder factory class for Modal and Banner notification’s binder factory classes. Below are the functions declared under a protocol named “ICInAppNotificationViewBinderFactory”.
(NSString *)notificationType;
It returns the content type of the message part handled by the factory. (example: “BasicNotification”, “BasicAlert”, “RichAlert”)
(ICInAppNotificationViewBinder *)createNotificationView
It returns an instance of the Notification view binder. It can be a banner view binder or modal view binder.
This class has been inherited from “ICInAppNotificationViewBinder“. This class holds the banner notification UI rendering. It holds all the business logic(action handlers of notifications) and UI logic (attachments and actions rendering) to adopt for the different resolutions and orientations.
This class confirms to “ICInAppNotificationViewBinderFactory” and implements the required methods of this protocol. This class is responsible to create view binder for Banner type when a banner notification received.
This class has been inherited from “ICInAppNotificationViewBinder“. This class holds the modal notification UI rendering. It holds all the business logic(action handlers of notifications) and UI logic (attachments and actions rendering) to adopt for the different resolutions and orientations.
This class confirms to “ICInAppNotificationViewBinderFactory” and implements the required methods of this protocol. This class is responsible to create view binder for Modal type when a modal type notification received.
Updated 2 months ago