Skip to content

Instantly share code, notes, and snippets.

@vbabenkoru
Last active August 29, 2022 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vbabenkoru/830bb645c50cc016dd0be158eff07dd8 to your computer and use it in GitHub Desktop.
Save vbabenkoru/830bb645c50cc016dd0be158eff07dd8 to your computer and use it in GitHub Desktop.
Objective-C compatibility header for Iterable SDK 6.4.7
// Generated by Apple Swift version 5.6.1 (swiftlang-5.6.0.323.66 clang-1316.0.20.12)
#ifndef ITERABLESDK_SWIFT_H
#define ITERABLESDK_SWIFT_H
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgcc-compat"
#if !defined(__has_include)
# define __has_include(x) 0
#endif
#if !defined(__has_attribute)
# define __has_attribute(x) 0
#endif
#if !defined(__has_feature)
# define __has_feature(x) 0
#endif
#if !defined(__has_warning)
# define __has_warning(x) 0
#endif
#if __has_include(<swift/objc-prologue.h>)
# include <swift/objc-prologue.h>
#endif
#pragma clang diagnostic ignored "-Wauto-import"
#include <Foundation/Foundation.h>
#include <CoreData/CoreData.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#if !defined(SWIFT_TYPEDEFS)
# define SWIFT_TYPEDEFS 1
# if __has_include(<uchar.h>)
# include <uchar.h>
# elif !defined(__cplusplus)
typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;
# endif
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
#endif
#if !defined(SWIFT_PASTE)
# define SWIFT_PASTE_HELPER(x, y) x##y
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
#endif
#if !defined(SWIFT_METATYPE)
# define SWIFT_METATYPE(X) Class
#endif
#if !defined(SWIFT_CLASS_PROPERTY)
# if __has_feature(objc_class_property)
# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
# else
# define SWIFT_CLASS_PROPERTY(...)
# endif
#endif
#if __has_attribute(objc_runtime_name)
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
#else
# define SWIFT_RUNTIME_NAME(X)
#endif
#if __has_attribute(swift_name)
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
#else
# define SWIFT_COMPILE_NAME(X)
#endif
#if __has_attribute(objc_method_family)
# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
#else
# define SWIFT_METHOD_FAMILY(X)
#endif
#if __has_attribute(noescape)
# define SWIFT_NOESCAPE __attribute__((noescape))
#else
# define SWIFT_NOESCAPE
#endif
#if __has_attribute(ns_consumed)
# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
#else
# define SWIFT_RELEASES_ARGUMENT
#endif
#if __has_attribute(warn_unused_result)
# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
# define SWIFT_WARN_UNUSED_RESULT
#endif
#if __has_attribute(noreturn)
# define SWIFT_NORETURN __attribute__((noreturn))
#else
# define SWIFT_NORETURN
#endif
#if !defined(SWIFT_CLASS_EXTRA)
# define SWIFT_CLASS_EXTRA
#endif
#if !defined(SWIFT_PROTOCOL_EXTRA)
# define SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_ENUM_EXTRA)
# define SWIFT_ENUM_EXTRA
#endif
#if !defined(SWIFT_CLASS)
# if __has_attribute(objc_subclassing_restricted)
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# else
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# endif
#endif
#if !defined(SWIFT_RESILIENT_CLASS)
# if __has_attribute(objc_class_stub)
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
# else
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
# endif
#endif
#if !defined(SWIFT_PROTOCOL)
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_EXTENSION)
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
#endif
#if !defined(OBJC_DESIGNATED_INITIALIZER)
# if __has_attribute(objc_designated_initializer)
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
# else
# define OBJC_DESIGNATED_INITIALIZER
# endif
#endif
#if !defined(SWIFT_ENUM_ATTR)
# if defined(__has_attribute) && __has_attribute(enum_extensibility)
# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
# else
# define SWIFT_ENUM_ATTR(_extensibility)
# endif
#endif
#if !defined(SWIFT_ENUM)
# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
# if __has_feature(generalized_swift_name)
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
# else
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
# endif
#endif
#if !defined(SWIFT_UNAVAILABLE)
# define SWIFT_UNAVAILABLE __attribute__((unavailable))
#endif
#if !defined(SWIFT_UNAVAILABLE_MSG)
# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
#endif
#if !defined(SWIFT_AVAILABILITY)
# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
#endif
#if !defined(SWIFT_WEAK_IMPORT)
# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
#endif
#if !defined(SWIFT_DEPRECATED)
# define SWIFT_DEPRECATED __attribute__((deprecated))
#endif
#if !defined(SWIFT_DEPRECATED_MSG)
# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
#endif
#if __has_feature(attribute_diagnose_if_objc)
# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
#else
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
#endif
#if !defined(IBSegueAction)
# define IBSegueAction
#endif
#if !defined(SWIFT_EXTERN)
# if defined(__cplusplus)
# define SWIFT_EXTERN extern "C"
# else
# define SWIFT_EXTERN extern
# endif
#endif
#if __has_feature(modules)
#if __has_warning("-Watimport-in-framework-header")
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
#endif
@import CoreData;
@import Foundation;
@import ObjectiveC;
@import UIKit;
#endif
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
#if __has_warning("-Wpragma-clang-attribute")
# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
#endif
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wnullability"
#if __has_attribute(external_source_symbol)
# pragma push_macro("any")
# undef any
# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="IterableSDK",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
# pragma pop_macro("any")
#endif
enum IterableLogLevel : NSInteger;
@class NSString;
/// The protocol for adjusting logging
SWIFT_PROTOCOL("_TtP11IterableSDK19IterableLogDelegate_")
@protocol IterableLogDelegate
/// Log a message.
/// \param level The logging level
///
/// \param message The message to log. The message will include file, method and line of the call.
///
- (void)log:(enum IterableLogLevel)level message:(NSString * _Nonnull)message;
@end
/// Will log everything
SWIFT_CLASS("_TtC11IterableSDK14AllLogDelegate")
@interface AllLogDelegate : NSObject <IterableLogDelegate>
- (void)log:(enum IterableLogLevel)level message:(NSString * _Nonnull)message;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
/// Abstraction of applicationState
SWIFT_PROTOCOL("_TtP11IterableSDK32ApplicationStateProviderProtocol_")
@protocol ApplicationStateProviderProtocol
@property (nonatomic, readonly) UIApplicationState applicationState;
@end
@class NSNumber;
/// <code>CommerceItem</code> represents a product
/// seealso:
/// IterableAPI.track(purchase withTotal: items:)
SWIFT_CLASS("_TtC11IterableSDK12CommerceItem")
@interface CommerceItem : NSObject
/// id of this product
@property (nonatomic, copy) NSString * _Nonnull id;
/// name of this product
@property (nonatomic, copy) NSString * _Nonnull name;
/// price of this product
@property (nonatomic, strong) NSNumber * _Nonnull price;
/// quantity of this product
@property (nonatomic) NSUInteger quantity;
/// SKU of this product
@property (nonatomic, copy) NSString * _Nullable sku;
/// description of the product
/// the class field is named <code>itemDescription</code> to avoid iOS namespace (<code>description</code>)
@property (nonatomic, copy) NSString * _Nullable itemDescription;
/// URL of the product
@property (nonatomic, copy) NSString * _Nullable url;
/// URL of the product’s image
@property (nonatomic, copy) NSString * _Nullable imageUrl;
/// categories this product belongs to
/// each category is a breadcrumb in list form
@property (nonatomic, copy) NSArray<NSString *> * _Nullable categories;
/// data fields for this product
@property (nonatomic, copy) NSDictionary * _Nullable dataFields;
/// Creates a <code>CommerceItem</code> with the specified properties
/// \param id id of the product
///
/// \param name name of the product
///
/// \param price price of the product
///
/// \param quantity quantity of the product
///
/// \param sku SKU of the eproduct
///
/// \param description description of the product
///
/// \param url URL of the product
///
/// \param imageUrl URL of the product’s image
///
/// \param categories categories this product belongs to
///
///
/// returns:
/// an instance of <code>CommerceItem</code> with the specified properties
- (nonnull instancetype)initWithId:(NSString * _Nonnull)id name:(NSString * _Nonnull)name price:(NSNumber * _Nonnull)price quantity:(NSUInteger)quantity sku:(NSString * _Nullable)sku description:(NSString * _Nullable)description url:(NSString * _Nullable)url imageUrl:(NSString * _Nullable)imageUrl categories:(NSArray<NSString *> * _Nullable)categories dataFields:(NSDictionary * _Nullable)dataFields OBJC_DESIGNATED_INITIALIZER;
/// A <code>Dictionary</code> representation of this item
///
/// returns:
/// An <code>Dictionary</code> representing this item
- (NSDictionary * _Nonnull)toDictionary SWIFT_WARN_UNUSED_RESULT;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
/// Will log if logLevel is >= minLogLevel
SWIFT_CLASS("_TtC11IterableSDK18DefaultLogDelegate")
@interface DefaultLogDelegate : NSObject <IterableLogDelegate>
- (void)log:(enum IterableLogLevel)level message:(NSString * _Nonnull)message;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
typedef SWIFT_ENUM(NSInteger, InAppCloseSource, closed) {
InAppCloseSourceBack = 0,
InAppCloseSourceLink = 1,
};
typedef SWIFT_ENUM(NSInteger, InAppDeleteSource, closed) {
InAppDeleteSourceInboxSwipe = 0,
InAppDeleteSourceDeleteButton = 1,
};
typedef SWIFT_ENUM(NSInteger, InAppLocation, closed) {
InAppLocationInApp = 0,
InAppLocationInbox = 1,
};
/// <code>show</code> to show the in-app otherwise <code>skip</code> to skip.
typedef SWIFT_ENUM(NSInteger, InAppShowResponse, closed) {
InAppShowResponseShow = 0,
InAppShowResponseSkip = 1,
};
@class IterableAttributionInfo;
@class IterableConfig;
@class NSURL;
@protocol IterableInAppManagerProtocol;
@class NSData;
@class IterableInAppMessage;
@class IterableInboxSession;
SWIFT_CLASS("_TtC11IterableSDK11IterableAPI")
@interface IterableAPI : NSObject
/// The current SDK version
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull sdkVersion;)
+ (NSString * _Nonnull)sdkVersion SWIFT_WARN_UNUSED_RESULT;
/// The email of the logged in user that this IterableAPI is using
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, copy) NSString * _Nullable email;)
+ (NSString * _Nullable)email SWIFT_WARN_UNUSED_RESULT;
+ (void)setEmail:(NSString * _Nullable)newValue;
/// The user ID of the logged in user that this IterableAPI is using
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, copy) NSString * _Nullable userId;)
+ (NSString * _Nullable)userId SWIFT_WARN_UNUSED_RESULT;
+ (void)setUserId:(NSString * _Nullable)newValue;
/// The <code>userInfo</code> dictionary which came with last push
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSDictionary * _Nullable lastPushPayload;)
+ (NSDictionary * _Nullable)lastPushPayload SWIFT_WARN_UNUSED_RESULT;
/// Attribution info (<code>campaignId</code>, <code>messageId</code>, etc.) for last push open or app link click from an email
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, strong) IterableAttributionInfo * _Nullable attributionInfo;)
+ (IterableAttributionInfo * _Nullable)attributionInfo SWIFT_WARN_UNUSED_RESULT;
+ (void)setAttributionInfo:(IterableAttributionInfo * _Nullable)newValue;
/// An SDK initializer taking in the Iterable Mobile API key to be utilized, and using default SDK settings
/// seealso:
/// IterableConfig
/// \param apiKey The Iterable Mobile API key to be used with the SDK
///
+ (void)initializeWithApiKey:(NSString * _Nonnull)apiKey SWIFT_AVAILABILITY(ios_app_extension,unavailable);
/// An SDK initializer taking in the Iterable Mobile API key to be utilized, and a config object for the
/// SDK’s settings
/// seealso:
/// IterableConfig
/// \param apiKey The Iterable Mobile API key to be used with the SDK
///
/// \param config The <code>IterableConfig</code> object with the settings to be used
///
+ (void)initializeWithApiKey:(NSString * _Nonnull)apiKey config:(IterableConfig * _Nonnull)config SWIFT_AVAILABILITY(ios_app_extension,unavailable);
/// An SDK initializer taking in the Iterable Mobile API key to be utilized and the
/// <code>launchOptions</code> passed on from the app delegate, using default SDK settings
/// seealso:
/// IterableConfig
/// \param apiKey The Iterable Mobile API key to be used with the SDK
///
/// \param launchOptions The <code>launchOptions</code> coming from <code>application(_:didFinishLaunchingWithOptions:)</code>
///
+ (void)initializeWithApiKey:(NSString * _Nonnull)apiKey launchOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> * _Nullable)launchOptions SWIFT_AVAILABILITY(ios_app_extension,unavailable);
/// An SDK initializer taking in the Iterable Mobile API key to be utilized as well as the
/// <code>launchOptions</code> passed on from the Apple app delegate, and a config object for the SDK
/// seealso:
/// IterableConfig
/// \param apiKey The Iterable Mobile API key to be used with the SDK
///
/// \param launchOptions The <code>launchOptions</code> coming from <code>application(_:didFinishLaunchingWithOptions:)</code>
///
/// \param config The <code>IterableConfig</code> object with the settings to be used
///
+ (void)initializeWithApiKey:(NSString * _Nonnull)apiKey launchOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> * _Nullable)launchOptions config:(IterableConfig * _Nonnull)config SWIFT_AVAILABILITY(ios_app_extension,unavailable);
/// DO NOT USE THIS.
/// This method is used internally to connect to staging and test environments.
+ (void)initialize2WithApiKey:(NSString * _Nonnull)apiKey launchOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> * _Nullable)launchOptions config:(IterableConfig * _Nonnull)config apiEndPointOverride:(NSString * _Nullable)apiEndPointOverride callback:(void (^ _Nullable)(BOOL))callback SWIFT_AVAILABILITY(ios_app_extension,unavailable);
+ (void)setEmail:(NSString * _Nullable)email :(NSString * _Nullable)authToken;
+ (void)setUserId:(NSString * _Nullable)userId :(NSString * _Nullable)authToken;
/// Handle a Universal Link
/// For Iterable links, it will track the click and retrieve the original URL,
/// pass it to <code>IterableURLDelegate</code> for handling. If it’s not an Iterable link,
/// it just passes the same URL to <code>IterableURLDelegate</code>
/// \param url The URL obtained from <code>UserActivity.webpageURL</code>
///
///
/// returns:
/// <code>true</code> if it is an Iterable link, or the value returned from <code>IterableURLDelegate</code> otherwise
+ (BOOL)handleUniversalLink:(NSURL * _Nonnull)url;
/// Add an entry in the device attributes
/// remark:
/// This is used by our React Native SDK to properly attribute SDK usage
/// \param name The device attribute name
///
/// \param value The device attribute value
///
+ (void)setDeviceAttribute:(NSString * _Nonnull)name value:(NSString * _Nonnull)value;
/// Remove an entry in the device attributes
/// remark:
/// This is used by our React Native SDK to properly attribute SDK usage
/// \param name The device attribute name
///
+ (void)removeDeviceAttribute:(NSString * _Nonnull)name;
/// Logs out the current user from the SDK instance
/// remark:
/// This will empty out user specific authentication data and reset the in-app manager.
/// If <code>autoPushRegistration</code> is <code>true</code> (which is the default value), this will also
/// disable the current push token.
+ (void)logoutUser;
/// The instance that manages getting and showing in-app messages
/// \code
/// IterableAPI.inAppManager.getMessages()
/// IterableAPI.inAppManager.show(message: message, consume: true)
///
/// \endcoderemark:
/// This variable will do nothing if the SDK has not been initialized yet
/// seealso:
/// IterableInAppManagerProtocol
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) id <IterableInAppManagerProtocol> _Nonnull inAppManager;)
+ (id <IterableInAppManagerProtocol> _Nonnull)inAppManager SWIFT_WARN_UNUSED_RESULT;
/// Register this device’s token with Iterable
/// Push integration name and platform are read from <code>IterableConfig</code>. If platform is set to <code>auto</code>, it will
/// read APNS environment from the provisioning profile and use an integration name specified in <code>IterableConfig</code>.
/// seealso:
/// IterableConfig
/// \param token The token representing this device/application pair, obtained from
/// <code>application:didRegisterForRemoteNotificationsWithDeviceToken</code>
/// after registering for remote notifications
///
+ (void)registerToken:(NSData * _Nonnull)token;
/// Register this device’s token with Iterable
/// Push integration name and platform are read from <code>IterableConfig</code>. If platform is set to <code>auto</code>, it will
/// read APNS environment from the provisioning profile and use an integration name specified in <code>IterableConfig</code>.
/// seealso:
/// IterableConfig, OnSuccessHandler, OnFailureHandler
/// \param token The token representing this device/application pair, obtained from
/// <code>application:didRegisterForRemoteNotificationsWithDeviceToken</code>
/// after registering for remote notifications
///
/// \param onSuccess <code>OnSuccessHandler</code> to invoke if token registration is successful
///
/// \param onFailure <code>OnFailureHandler</code> to invoke if token registration fails
///
+ (void)registerToken:(NSData * _Nonnull)token onSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess OnFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Disable this device’s token in Iterable, for the current user.
/// remark:
/// By default, the SDK calls this upon user logout automatically. If a different or manually controlled
/// behavior is desired, set <code>autoPushRegistration</code> to <code>false</code> in the <code>IterableConfig</code> object when
/// initializing the SDK.
/// seealso:
/// IterableConfig
+ (void)disableDeviceForCurrentUser;
/// Disable this device’s token in Iterable, for all users on this device.
+ (void)disableDeviceForAllUsers;
/// Disable this device’s token in Iterable, for the current user, with custom completion blocks
/// seealso:
/// OnSuccessHandler, OnFailureHandler
/// \param onSuccess <code>OnSuccessHandler</code> to invoke if disabling the token is successful
///
/// \param onFailure <code>OnFailureHandler</code> to invoke if disabling the token fails
///
+ (void)disableDeviceForCurrentUserWithOnSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess onFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Disable this device’s token in Iterable, for all users of this device, with custom completion blocks.
/// seealso:
/// OnSuccessHandler, OnFailureHandler
/// \param onSuccess <code>OnSuccessHandler</code> to invoke if disabling the token is successful
///
/// \param onFailure <code>OnFailureHandler</code> to invoke if disabling the token fails
///
+ (void)disableDeviceForAllUsersWithOnSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess onFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Updates the available user fields
/// seealso:
/// OnSuccessHandler, OnFailureHandler
/// \param dataFields Data fields to store in the user profile
///
/// \param mergeNestedObjects Merge top level objects instead of overwriting
///
/// \param onSuccess <code>OnSuccessHandler</code> to invoke if update is successful
///
/// \param onFailure <code>OnFailureHandler</code> to invoke if update fails
///
+ (void)updateUser:(NSDictionary * _Nonnull)dataFields mergeNestedObjects:(BOOL)mergeNestedObjects onSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess onFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Updates the current user’s email
/// remark:
/// Also updates the current email in this IterableAPIImplementation instance if the API call was successful.
/// seealso:
/// OnSuccessHandler, OnFailureHandler
/// \param newEmail The new email address
///
/// \param onSuccess <code>OnSuccessHandler</code> to invoke if update is successful
///
/// \param onFailure <code>OnFailureHandler</code> to invoke if update fails
///
+ (void)updateEmail:(NSString * _Nonnull)newEmail onSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess onFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Updates the current user’s email, and set the new authentication token
/// remark:
/// Also updates the current email in this internal instance if the API call was successful.
/// seealso:
/// OnSuccessHandler, OnFailureHandler
/// \param newEmail The new email of this user
///
/// \param token The new authentication token for this user, if left out, the SDK will not update the token in any way
///
/// \param onSuccess <code>OnSuccessHandler</code> to invoke if update is successful
///
/// \param onFailure <code>OnFailureHandler</code> to invoke if update fails
///
+ (void)updateEmail:(NSString * _Nonnull)newEmail withToken:(NSString * _Nonnull)token onSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess onFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Tracks what’s in the shopping cart (or equivalent) at this point in time
/// seealso:
/// CommerceItem
/// \param items The list of items in the shopping cart to track
///
+ (void)updateCart:(NSArray<CommerceItem *> * _Nonnull)items;
/// Tracks what’s in the shopping cart (or equivalent) at this point in time
/// seealso:
/// CommerceItem
/// \param items The list of items in the shopping cart to track
///
/// \param onSuccess <code>OnSuccessHandler</code> to invoke if cart is updated successfully
///
/// \param onFailure <code>OnFailureHandler</code> to invoke if cart updating fails
///
+ (void)updateCart:(NSArray<CommerceItem *> * _Nonnull)items onSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess onFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Tracks a purchase
/// seealso:
/// CommerceItem
/// \param withTotal The total purchase amount
///
/// \param items The list of purchased items
///
+ (void)trackPurchase:(NSNumber * _Nonnull)withTotal items:(NSArray<CommerceItem *> * _Nonnull)items;
/// Tracks a purchase with additional data
/// seealso:
/// CommerceItem
/// \param withTotal The total purchase amount
///
/// \param items The list of purchased items
///
/// \param dataFields A <code>Dictionary</code> containing any additional information to save along with the event
///
+ (void)trackPurchase:(NSNumber * _Nonnull)withTotal items:(NSArray<CommerceItem *> * _Nonnull)items dataFields:(NSDictionary * _Nullable)dataFields;
/// Tracks a purchase with additional data and custom completion blocks.
/// seealso:
/// CommerceItem, OnSuccessHandler, OnFailureHandler
/// \param withTotal The total purchase amount
///
/// \param items The list of purchased items
///
/// \param dataFields A <code>Dictionary</code> containing any additional information to save along with the event
///
/// \param onSuccess <code>OnSuccessHandler</code> to invoke if the purchase is tracked successfully
///
/// \param onFailure <code>OnFailureHandler</code> to invoke if tracking the purchase fails
///
+ (void)trackPurchase:(NSNumber * _Nonnull)withTotal items:(NSArray<CommerceItem *> * _Nonnull)items dataFields:(NSDictionary * _Nullable)dataFields onSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess onFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Tracks a purchase with additional data and custom completion blocks.
/// seealso:
/// CommerceItem, OnSuccessHandler, OnFailureHandler
/// \param withTotal The total purchase amount
///
/// \param items The list of purchased items
///
/// \param dataFields A <code>Dictionary</code> containing any additional information to save along with the event
///
/// \param campaignId The <code>campaignId</code> of the push notification that caused this open event
///
/// \param templateId The <code>templateId</code> of the push notification that caused this open event
///
/// \param onSuccess <code>OnSuccessHandler</code> to invoke if the purchase is tracked successfully
///
/// \param onFailure <code>OnFailureHandler</code> to invoke if tracking the purchase fails
///
+ (void)trackPurchase:(NSNumber * _Nonnull)withTotal items:(NSArray<CommerceItem *> * _Nonnull)items dataFields:(NSDictionary * _Nullable)dataFields campaignId:(NSNumber * _Nullable)campaignId templateId:(NSNumber * _Nullable)templateId onSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess onFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Tracks a <code>pushOpen</code> event with a push notification payload
/// \param userInfo the <code>userInfo</code> parameter from the push notification payload
///
+ (void)trackPushOpen:(NSDictionary * _Nonnull)userInfo;
/// Tracks a <code>pushOpen</code> event with a push notification and optional additional data
/// \param userInfo The <code>userInfo</code> parameter from the push notification payload
///
/// \param dataFields A <code>Dictionary</code> containing any additional information to save along with the event
///
+ (void)trackPushOpen:(NSDictionary * _Nonnull)userInfo dataFields:(NSDictionary * _Nullable)dataFields;
/// Tracks a <code>pushOpen</code> event with a push notification, optional additional data, and custom completion blocks
/// seealso:
/// OnSuccessHandler, OnFailureHandler
/// \param userInfo The <code>userInfo</code> parameter from the push notification payload
///
/// \param dataFields A <code>Dictionary</code> containing any additional information to save along with the event
///
/// \param onSuccess <code>OnSuccessHandler</code> to invoke if the open is tracked successfully
///
/// \param onFailure <code>OnFailureHandler</code> to invoke if tracking the open fails
///
+ (void)trackPushOpen:(NSDictionary * _Nonnull)userInfo dataFields:(NSDictionary * _Nullable)dataFields onSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess onFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Tracks a <code>pushOpen</code> event for the specified campaign and template IDs, whether the app was already
/// running when the push was received, and optional additional data
/// remark:
/// Pass in the the relevant campaign data
/// \param campaignId The <code>campaignId</code> of the push notification that caused this open event
///
/// \param templateId The <code>templateId</code> of the push notification that caused this open event
///
/// \param messageId The <code>messageId</code> of the the push notification that caused this open event
///
/// \param appAlreadyRunning This will get merged into <code>dataFields</code>, and it specifies whether
/// the app is already running when the notification was received
///
/// \param dataFields A <code>Dictionary</code> containing any additional information to save along with the event
///
+ (void)trackPushOpen:(NSNumber * _Nonnull)campaignId templateId:(NSNumber * _Nullable)templateId messageId:(NSString * _Nonnull)messageId appAlreadyRunning:(BOOL)appAlreadyRunning dataFields:(NSDictionary * _Nullable)dataFields;
/// Tracks a <code>pushOpen</code> event for the specified campaign and template IDs, whether the app was already
/// running when the push was received, and optional additional data
/// remark:
/// Pass in the the relevant campaign data
/// seealso:
/// OnSuccessHandler, OnFailureHandler
/// \param campaignId The <code>campaignId</code> of the push notification that caused this open event
///
/// \param templateId The <code>templateId</code> of the the push notification that caused this open event
///
/// \param messageId The <code>messageId</code> of the the push notification that caused this open event
///
/// \param appAlreadyRunning This will get merged into <code>dataFields</code>, and it specifies whether
/// the app is already running when the notification was received
///
/// \param dataFields A <code>Dictionary</code> containing any additional information to save along with the event
///
+ (void)trackPushOpen:(NSNumber * _Nonnull)campaignId templateId:(NSNumber * _Nullable)templateId messageId:(NSString * _Nonnull)messageId appAlreadyRunning:(BOOL)appAlreadyRunning dataFields:(NSDictionary * _Nullable)dataFields onSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess onFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Tracks a custom event
/// remark:
/// Pass in the custom event data.
/// \param eventName Name of the event
///
+ (void)track:(NSString * _Nonnull)eventName;
/// Tracks a custom event
/// remark:
/// Pass in the custom event data.
/// \param eventName Name of the event
///
/// \param dataFields A <code>Dictionary</code> containing any additional information to save along with the event
///
+ (void)track:(NSString * _Nonnull)eventName dataFields:(NSDictionary * _Nullable)dataFields;
/// Tracks a custom event
/// remark:
/// Pass in the custom event data.
/// \param eventName Name of the event
///
/// \param dataFields A <code>Dictionary</code> containing any additional information to save along with the event
///
/// \param onSuccess <code>OnSuccessHandler</code> to invoke if the open is tracked successfully
///
/// \param onFailure <code>OnFailureHandler</code> to invoke if tracking the open fails
///
+ (void)track:(NSString * _Nonnull)eventName dataFields:(NSDictionary * _Nullable)dataFields onSuccess:(void (^ _Nullable)(NSDictionary * _Nullable))onSuccess onFailure:(void (^ _Nullable)(NSString * _Nullable, NSData * _Nullable))onFailure;
/// Updates a user’s subscription preferences
/// remark:
/// passing in an empty array will clear subscription list, passing in <code>nil</code> will not modify the list
/// \param emailListIds Email lists to subscribe to
///
/// \param unsubscribedChannelIds List of channels to unsubscribe from
///
/// \param unsubscribedMessageTypeIds List of message types to unsubscribe from
///
+ (void)updateSubscriptions:(NSArray<NSNumber *> * _Nullable)emailListIds unsubscribedChannelIds:(NSArray<NSNumber *> * _Nullable)unsubscribedChannelIds unsubscribedMessageTypeIds:(NSArray<NSNumber *> * _Nullable)unsubscribedMessageTypeIds subscribedMessageTypeIds:(NSArray<NSNumber *> * _Nullable)subscribedMessageTypeIds campaignId:(NSNumber * _Nullable)campaignId templateId:(NSNumber * _Nullable)templateId;
/// Tracks an <code>InAppOpen</code> event
/// By default, the SDK will call this automatically. This is available in case a custom view controller
/// is used for rendering <code>IterableInAppMessage</code>s.
/// seealso:
/// IterableInAppDelegate
/// \param message The Iterable in-app message
///
/// \param location The location from where this message was shown. <code>inbox</code> or <code>inApp</code>.
///
+ (void)trackInAppOpen:(IterableInAppMessage * _Nonnull)message location:(enum InAppLocation)location;
/// Tracks an <code>InAppClick</code> event
/// By default, the SDK will call this automatically. This is available in case a custom view controller
/// is used for rendering <code>IterableInAppMessage</code>s.
/// \param message The message of the notification
///
/// \param location The location from where this message was shown. <code>inbox</code> or <code>inApp</code>.
///
/// \param clickedUrl The URL of the button or link that was clicked
///
+ (void)trackInAppClick:(IterableInAppMessage * _Nonnull)message location:(enum InAppLocation)location clickedUrl:(NSString * _Nonnull)clickedUrl;
/// Tracks an <code>InAppClose</code> event
/// \param message The in-app message
///
/// \param clickedUrl The url that was clicked to close the in-app. It will be <code>nil</code> when the message is closed by clicking <code>back</code>.
///
+ (void)trackInAppClose:(IterableInAppMessage * _Nonnull)message clickedUrl:(NSString * _Nullable)clickedUrl;
/// Tracks an <code>InAppClose</code> event
/// \param message The in-app message
///
/// \param location The location from where this message was shown. <code>inbox</code> or <code>inApp</code>.
///
/// \param clickedUrl The URL that was clicked to close the in-app. It will be <code>nil</code> when the message is closed by clicking <code>back</code>.
///
+ (void)trackInAppClose:(IterableInAppMessage * _Nonnull)message location:(enum InAppLocation)location clickedUrl:(NSString * _Nullable)clickedUrl;
/// Tracks an <code>InAppClose</code> event
/// \param message The in-app message that is being closed
///
/// \param location The location from where this message was shown. <code>inbox</code> or <code>inApp</code>.
///
/// \param source Source is <code>back</code> if back button was clicked to dismiss in-app message. Otherwise source is <code>link</code>.
///
/// \param clickedUrl The url that was clicked to close the in-app. It will be <code>nil</code> when the message is closed by clicking <code>back</code>.
///
+ (void)trackInAppClose:(IterableInAppMessage * _Nonnull)message location:(enum InAppLocation)location source:(enum InAppCloseSource)source clickedUrl:(NSString * _Nullable)clickedUrl;
/// Consumes the notification and removes it from the list of in-app messages
/// \param message The in-app message that is being consumed
///
/// \param location The location from where this message was shown. <code>inbox</code> or <code>inApp</code>.
///
+ (void)inAppConsume:(IterableInAppMessage * _Nonnull)message location:(enum InAppLocation)location;
/// Consumes the notification and removes it from the list of in-app messages
/// \param message The in-app message that is being consumed
///
/// \param location The location from where this message was shown. <code>inbox</code> or <code>inApp</code>.
///
/// \param source The source of deletion <code>inboxSwipe</code> or <code>deleteButton</code>.
///
+ (void)inAppConsume:(IterableInAppMessage * _Nonnull)message location:(enum InAppLocation)location source:(enum InAppDeleteSource)source;
/// Tracks analytics data from a session of using an inbox UI
/// NOTE: this is not normally used publicly, but is needed for our React Native SDK implementation
/// \param inboxSession the inbox session data type to track
///
+ (void)trackInboxSession:(IterableInboxSession * _Nonnull)inboxSession;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
/// <code>IterableAction</code> represents an action defined as a response to user events.
/// It is currently used in push notification actions (open push & action buttons).
SWIFT_CLASS("_TtC11IterableSDK14IterableAction")
@interface IterableAction : NSObject
/// Open the URL or deep link
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull actionTypeOpenUrl;)
+ (NSString * _Nonnull)actionTypeOpenUrl SWIFT_WARN_UNUSED_RESULT;
/// If the type is <code>openUrl</code>, the SDK will call <code>IterableURLDelegate</code> and then try to open the URL if the delegate returned false or was not set.
/// For other types, <code>IterableCustomActionDelegate</code> will be called.
@property (nonatomic, copy) NSString * _Nonnull type;
/// Additional data, its content depends on the action type
@property (nonatomic, copy) NSString * _Nullable data;
/// The text response typed by the user
@property (nonatomic, copy) NSString * _Nullable userInput;
- (BOOL)isOpenUrl SWIFT_WARN_UNUSED_RESULT;
/// Creates a new <code>IterableAction</code> from a dictionary
/// \param dictionary Dictionary containing action data
///
///
/// returns:
/// An <code>IterableAction</code> instance
+ (IterableAction * _Nullable)actionFromDictionary:(NSDictionary * _Nonnull)dictionary SWIFT_WARN_UNUSED_RESULT;
+ (IterableAction * _Nullable)actionOpenUrl:(NSString * _Nonnull)fromUrlString SWIFT_WARN_UNUSED_RESULT;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
enum IterableActionSource : NSInteger;
SWIFT_CLASS("_TtC11IterableSDK21IterableActionContext")
@interface IterableActionContext : NSObject
@property (nonatomic, readonly, strong) IterableAction * _Nonnull action;
@property (nonatomic, readonly) enum IterableActionSource source;
- (nonnull instancetype)initWithAction:(IterableAction * _Nonnull)action source:(enum IterableActionSource)source OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
typedef SWIFT_ENUM(NSInteger, IterableActionSource, closed) {
IterableActionSourcePush = 0,
IterableActionSourceUniversalLink = 1,
IterableActionSourceInApp = 2,
};
@class UIApplication;
@class UNUserNotificationCenter;
@class UNNotificationResponse;
SWIFT_CLASS("_TtC11IterableSDK22IterableAppIntegration")
@interface IterableAppIntegration : NSObject
/// This method handles ‘silent push’ notifications.
/// Call it from your app delegate’s <code>application:didReceiveRemoteNotification:fetchCompletionHandler:</code>.
/// \param application UIApplication singleton object
///
/// \param userInfo Dictionary containing the notification data
///
/// \param completionHandler Completion handler passed from the original call. Iterable will call the completion handler
/// automatically if you pass one. If you handle completionHandler in the app code, pass a nil value to this argument.
///
+ (void)application:(UIApplication * _Nonnull)application didReceiveRemoteNotification:(NSDictionary * _Nonnull)userInfo fetchCompletionHandler:(void (^ _Nullable)(UIBackgroundFetchResult))completionHandler;
/// This method handles user actions on incoming Iterable notifications
/// Call it from your notification center delegate’s <code>userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:</code>.
/// \param center <code>UNUserNotificationCenter</code> singleton object
///
/// \param response Notification response containing the user action and notification data. Passed from the original call.
///
/// \param completionHandler Completion handler passed from the original call. Iterable will call the completion handler automatically if you pass one. If you handle <code>completionHandler</code> in the app code, pass a <code>nil</code> value to this argument.
///
+ (void)userNotificationCenter:(UNUserNotificationCenter * _Nullable)center didReceiveNotificationResponse:(UNNotificationResponse * _Nonnull)response withCompletionHandler:(void (^ _Nullable)(void))completionHandler;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
SWIFT_CLASS("_TtC11IterableSDK23IterableAttributionInfo")
@interface IterableAttributionInfo : NSObject
@property (nonatomic, strong) NSNumber * _Nonnull campaignId;
@property (nonatomic, strong) NSNumber * _Nonnull templateId;
@property (nonatomic, copy) NSString * _Nonnull messageId;
- (nonnull instancetype)initWithCampaignId:(NSNumber * _Nonnull)campaignId templateId:(NSNumber * _Nonnull)templateId messageId:(NSString * _Nonnull)messageId OBJC_DESIGNATED_INITIALIZER;
@property (nonatomic, readonly, copy) NSString * _Nonnull description;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
/// The delegate for getting the authentication token
SWIFT_PROTOCOL("_TtP11IterableSDK20IterableAuthDelegate_")
@protocol IterableAuthDelegate
- (void)onAuthTokenRequestedWithCompletion:(void (^ _Nonnull)(NSString * _Nullable))completion;
@end
SWIFT_PROTOCOL("_TtP11IterableSDK27IterableAuthManagerProtocol_")
@protocol IterableAuthManagerProtocol
- (NSString * _Nullable)getAuthToken SWIFT_WARN_UNUSED_RESULT;
- (void)resetFailedAuthCount;
- (void)requestNewAuthTokenWithHasFailedPriorAuth:(BOOL)hasFailedPriorAuth onSuccess:(void (^ _Nullable)(NSString * _Nullable))onSuccess;
- (void)setNewToken:(NSString * _Nonnull)newToken;
- (void)logoutUser;
@end
enum PushServicePlatform : NSInteger;
@protocol IterableURLDelegate;
@protocol IterableCustomActionDelegate;
@protocol IterableInAppDelegate;
/// Iterable Configuration Object. Use this when initializing the API.
SWIFT_CLASS("_TtC11IterableSDK14IterableConfig")
@interface IterableConfig : NSObject
/// You don’t have to set this variable. Set this value only if you are an existing Iterable customer who has already setup mobile integrations in Iterable Web UI.
/// In that case, set this variable to the push integration name that you have set for <code>APNS</code> in Iterable Web UI.
/// To view your existing integrations, navigate to Settings > Mobile Apps
@property (nonatomic, copy) NSString * _Nullable pushIntegrationName;
/// You don’t have to set this variable. Set this value only if you are an existing Iterable customer who has already setup mobile integrations in Iterable Web UI.
/// In that case, set this variable to the push integration name that you have set for <code>APNS_SANDBOX</code> in Iterable Web UI.
/// To view your existing integrations, navigate to Settings > Mobile Apps
@property (nonatomic, copy) NSString * _Nullable sandboxPushIntegrationName;
/// The APNS (Apple Push Notification Service) environment for the current build of the app.
/// Possible values: <code>production</code>, <code>sandbox</code>, <code>auto</code>
/// Defaults to <code>auto</code> and detects the APNS environment automatically
@property (nonatomic) enum PushServicePlatform pushPlatform;
/// Handles Iterable actions of type <code>openUrl</code>
@property (nonatomic, weak) id <IterableURLDelegate> _Nullable urlDelegate;
/// How to handle IterableActions which are other than <code>openUrl</code>
@property (nonatomic, weak) id <IterableCustomActionDelegate> _Nullable customActionDelegate;
/// Implement this protocol to enable token-based authentication with the Iterable SDK
@property (nonatomic, weak) id <IterableAuthDelegate> _Nullable authDelegate;
/// When set to <code>true</code>, IterableSDK will automatically register and deregister
/// notification tokens.
@property (nonatomic) BOOL autoPushRegistration;
/// When set to true, it will check for deferred deep links on first time app launch
/// after installation from the App Store.
@property (nonatomic) BOOL checkForDeferredDeeplink SWIFT_DEPRECATED_MSG("This flag is no longer supported and will be removed in a future version.");
/// Implement the protocol <code>IterableLogDelegate</code> and set it here to change logging.
/// Out of the box you have the following:
/// <ol>
/// <li>
/// <code>DefaultLogDelegate</code>. It will use OsLog for .error, console for .info and no logging for debug.
/// </li>
/// <li>
/// <code>NoneLogDelegate</code>. No logging messages will be output.
/// </li>
/// <li>
/// <code>AllLogDelegate</code>. This will log everything to console.
/// </li>
/// </ol>
/// The default value is <code>DefaultLogDelegate</code>.
/// It will log everything >= minLogLevel
@property (nonatomic, strong) id <IterableLogDelegate> _Nonnull logDelegate;
/// Implement this protocol to override default in-app behavior.
/// By default, every single in-app will be shown as soon as it is available.
/// If more than 1 in-app is available, we show the first.
@property (nonatomic, strong) id <IterableInAppDelegate> _Nonnull inAppDelegate;
/// How many seconds to wait before showing the next in-app, if there are more than one present
@property (nonatomic) double inAppDisplayInterval;
/// the number of seconds before expiration of the current auth token to get a new auth token
/// will only apply if token-based authentication is enabled, and the current auth token has
/// an expiration date field in it
@property (nonatomic) NSTimeInterval expiringAuthTokenRefreshPeriod;
/// We allow navigation only to urls with <code>https</code> protocol (for deep links within your app or external links).
/// If you want to allow other protocols, such as, <code>http</code>, <code>tel</code> etc., please add them to the list below
@property (nonatomic, copy) NSArray<NSString *> * _Nonnull allowedProtocols;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
/// Custom action handling delegate
SWIFT_PROTOCOL("_TtP11IterableSDK28IterableCustomActionDelegate_")
@protocol IterableCustomActionDelegate
/// Callback called for custom actions from push notifications
/// \param action <code>IterableAction</code> object containing action payload
///
/// \param context Metadata containing the original action and the source: push or universal link.
///
///
/// returns:
/// Boolean value. Reserved for future use.
- (BOOL)handleIterableCustomAction:(IterableAction * _Nonnull)action context:(IterableActionContext * _Nonnull)context SWIFT_WARN_UNUSED_RESULT;
@end
enum IterableInAppContentType : NSInteger;
SWIFT_PROTOCOL("_TtP11IterableSDK20IterableInAppContent_")
@protocol IterableInAppContent
@property (nonatomic, readonly) enum IterableInAppContentType type;
@end
@class UIColor;
SWIFT_CLASS("_TtC11IterableSDK24IterableHtmlInAppContent")
@interface IterableHtmlInAppContent : NSObject <IterableInAppContent>
@property (nonatomic, readonly) enum IterableInAppContentType type;
@property (nonatomic, readonly) UIEdgeInsets edgeInsets;
@property (nonatomic, readonly, copy) NSString * _Nonnull html;
@property (nonatomic, readonly) BOOL shouldAnimate;
@property (nonatomic, readonly, strong) UIColor * _Nullable backgroundColor;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
typedef SWIFT_ENUM(NSInteger, IterableInAppContentType, closed) {
IterableInAppContentTypeHtml = 0,
IterableInAppContentTypeAlert = 1,
IterableInAppContentTypeBanner = 2,
};
/// This protocol allows you to override default behavior when new in-app messages arrive.
SWIFT_PROTOCOL("_TtP11IterableSDK21IterableInAppDelegate_")
@protocol IterableInAppDelegate
/// This method is called when new in-app message is available.
/// The default behavior is to <code>show</code> if you don’t override this method.
/// \param message <code>IterableInAppMessage</code> object containing information regarding in-app to display
///
///
/// returns:
/// Return <code>show</code> to show the in-app or <code>skip</code> to skip this.
- (enum InAppShowResponse)onNewMessage:(IterableInAppMessage * _Nonnull)message SWIFT_WARN_UNUSED_RESULT;
@end
SWIFT_PROTOCOL("_TtP11IterableSDK28IterableInAppManagerProtocol_")
@protocol IterableInAppManagerProtocol
/// Turn on/off automatic displaying of in-apps
/// remark:
/// the default value is <code>false</code>
/// remark:
/// if auto displaying is turned on, the SDK will also immediately retrieve and process in-apps
@property (nonatomic) BOOL isAutoDisplayPaused;
///
/// returns:
/// A list of all in-app messages
- (NSArray<IterableInAppMessage *> * _Nonnull)getMessages SWIFT_WARN_UNUSED_RESULT;
///
/// returns:
/// A list of all inbox messages
- (NSArray<IterableInAppMessage *> * _Nonnull)getInboxMessages SWIFT_WARN_UNUSED_RESULT;
///
/// returns:
/// A count of unread inbox messages
- (NSInteger)getUnreadInboxMessagesCount SWIFT_WARN_UNUSED_RESULT;
/// \param message The message to show.
///
- (void)showMessage:(IterableInAppMessage * _Nonnull)message;
/// \param message The message to show.
///
/// \param consume Set to true to consume the event from the server queue if the message is shown. This should be default.
///
/// \param callback block of code to execute once the user clicks on a link or button in the in-app notification.
/// Note that this callback is called in addition to calling <code>IterableCustomActionDelegate</code> or <code>IterableUrlDelegate</code> on the button action.
///
- (void)showMessage:(IterableInAppMessage * _Nonnull)message consume:(BOOL)consume callbackBlock:(void (^ _Nullable)(NSURL * _Nullable))callback;
/// \param message The message to remove.
///
- (void)removeMessage:(IterableInAppMessage * _Nonnull)message;
/// \param message The message to remove.
///
/// \param location The location from where this message was shown. <code>inbox</code> or <code>inApp</code>.
///
- (void)removeMessage:(IterableInAppMessage * _Nonnull)message location:(enum InAppLocation)location;
/// \param message The message to remove.
///
/// \param location The location from where this message was shown. <code>inbox</code> or <code>inApp</code>.
///
/// \param source The source of deletion <code>inboxSwipe</code> or <code>deleteButton</code>.`
///
- (void)removeMessage:(IterableInAppMessage * _Nonnull)message location:(enum InAppLocation)location source:(enum InAppDeleteSource)source;
/// \param read Whether this inbox message was read
///
/// \param message The inbox message
///
- (void)setRead:(BOOL)read forMessage:(IterableInAppMessage * _Nonnull)message;
/// \param id The id of the message
///
///
/// returns:
/// IterableInAppMessage with the id, if it exists.
- (IterableInAppMessage * _Nullable)getMessageWithId:(NSString * _Nonnull)id SWIFT_WARN_UNUSED_RESULT;
@end
@class IterableInAppTrigger;
@class NSDate;
@class IterableInboxMetadata;
/// A message is comprised of content and whether this message was skipped.
SWIFT_CLASS("_TtC11IterableSDK20IterableInAppMessage")
@interface IterableInAppMessage : NSObject
/// the ID for the in-app message
@property (nonatomic, readonly, copy) NSString * _Nonnull messageId;
/// the campaign ID for this message
@property (nonatomic, readonly, strong) NSNumber * _Nullable campaignId;
/// when to trigger this in-app
@property (nonatomic, readonly, strong) IterableInAppTrigger * _Nonnull trigger;
/// when was this message created
@property (nonatomic, readonly, copy) NSDate * _Nullable createdAt;
/// when to expire this in-app (nil means do not expire)
@property (nonatomic, readonly, copy) NSDate * _Nullable expiresAt;
/// The content of the in-app message
@property (nonatomic, readonly, strong) id <IterableInAppContent> _Nonnull content;
/// Whether to save this message to inbox
@property (nonatomic, readonly) BOOL saveToInbox;
/// Metadata such as title, subtitle etc. needed to display this in-app message in inbox.
@property (nonatomic, readonly, strong) IterableInboxMetadata * _Nullable inboxMetadata;
/// Custom Payload for this message.
@property (nonatomic, readonly, copy) NSDictionary * _Nullable customPayload;
/// Whether this inbox message has been read
@property (nonatomic) BOOL read;
/// Whether this message will be delivered silently to inbox
@property (nonatomic, readonly) BOOL silentInbox;
/// the urgency level of this message (nil will be treated as <code>unassigned</code> when displaying this message)
@property (nonatomic) double priorityLevel;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
enum IterableInAppTriggerType : NSInteger;
SWIFT_CLASS("_TtC11IterableSDK20IterableInAppTrigger")
@interface IterableInAppTrigger : NSObject
@property (nonatomic, readonly) enum IterableInAppTriggerType type;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
/// <code>immediate</code> will try to display the in-app automatically immediately
/// <code>event</code> is used for Push to in-app
/// <code>never</code> will not display the in-app automatically via the SDK
typedef SWIFT_ENUM(NSInteger, IterableInAppTriggerType, closed) {
IterableInAppTriggerTypeImmediate = 0,
IterableInAppTriggerTypeEvent = 1,
IterableInAppTriggerTypeNever = 2,
};
@class UIView;
@class UILabel;
@class UIImageView;
@class NSCoder;
/// If you are creating your own Nib file you must
/// connect the outlets.
SWIFT_CLASS("_TtC11IterableSDK17IterableInboxCell")
@interface IterableInboxCell : UITableViewCell
/// A “dot” view showing that the message is unread
@property (nonatomic, strong) IBOutlet UIView * _Nullable unreadCircleView;
/// The title label
@property (nonatomic, strong) IBOutlet UILabel * _Nullable titleLbl;
/// The sub title label
@property (nonatomic, strong) IBOutlet UILabel * _Nullable subtitleLbl;
/// This shows the time when the message was created
@property (nonatomic, strong) IBOutlet UILabel * _Nullable createdAtLbl;
/// This is the container view for the icon image.
/// You may or may not set it.
/// Set this outlet if you have the icon inside a container view
/// and you want the container to be set to hidden when icons are not
/// present for the message.
@property (nonatomic, strong) IBOutlet UIView * _Nullable iconContainerView;
/// This is the icon image
@property (nonatomic, strong) IBOutlet UIImageView * _Nullable iconImageView;
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated;
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString * _Nullable)reuseIdentifier OBJC_DESIGNATED_INITIALIZER;
@end
/// Encapsulates an Inbox impression of a message
SWIFT_CLASS("_TtC11IterableSDK23IterableInboxImpression")
@interface IterableInboxImpression : NSObject
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
SWIFT_CLASS("_TtC11IterableSDK21IterableInboxMetadata")
@interface IterableInboxMetadata : NSObject
@property (nonatomic, readonly, copy) NSString * _Nullable title;
@property (nonatomic, readonly, copy) NSString * _Nullable subtitle;
@property (nonatomic, readonly, copy) NSString * _Nullable icon;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
@protocol IterableInboxViewControllerViewDelegate;
@class UIViewController;
@class NSBundle;
IB_DESIGNABLE
SWIFT_CLASS("_TtC11IterableSDK37IterableInboxNavigationViewController")
@interface IterableInboxNavigationViewController : UINavigationController
/// If you want to use a custom layout for your Inbox TableViewCell
/// this is where you should override it.
/// Please note that this assumes that the nib is present in the main bundle.
@property (nonatomic, copy) IBInspectable NSString * _Nullable cellNibName;
/// This is the title for the Inbox Navigation Bar
@property (nonatomic, copy) IBInspectable NSString * _Nullable navTitle;
/// Set this to <code>true</code> to show a popup when an inbox message is selected in the list.
/// Set this to <code>false</code>to push inbox message into navigation stack.
@property (nonatomic) IBInspectable BOOL isPopup;
/// Use this to set the title to show when there are no message in the inbox.
@property (nonatomic, copy) IBInspectable NSString * _Nullable noMessagesTitle;
/// Use this to set the message to show when there are no message in the inbox.
@property (nonatomic, copy) IBInspectable NSString * _Nullable noMessagesBody;
/// Set this property to override default inbox display behavior. You should set either this property
/// or <code>viewDelegateClassName</code>property but not both.
@property (nonatomic, strong) id <IterableInboxViewControllerViewDelegate> _Nullable viewDelegate;
/// Set this property if you want to set the view delegate class name in Storyboard
/// and want <code>IterableInboxViewController</code> to create a view delegate class for you.
/// The class name must include the package name as well, e.g., MyModule.CustomInboxViewDelegate
@property (nonatomic, copy) IBInspectable NSString * _Nullable viewDelegateClassName;
/// Whether we should we show large titles for inbox.
/// This does not have any effect below iOS 11.
@property (nonatomic) IBInspectable BOOL largeTitles;
/// Whether to show different sections as grouped.
@property (nonatomic) IBInspectable BOOL groupSections;
/// This initializer should be used when initializing from Code.
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
/// This initializer will be called when initializing from storyboard
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER;
- (void)viewDidLoad;
- (void)viewWillAppear:(BOOL)animated;
- (void)viewWillDisappear:(BOOL)animated;
/// Do not use this
- (nonnull instancetype)initWithRootViewController:(UIViewController * _Nonnull)rootViewController SWIFT_UNAVAILABLE;
/// Do not use this
- (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil SWIFT_UNAVAILABLE;
- (nonnull instancetype)initWithNavigationBarClass:(Class _Nullable)navigationBarClass toolbarClass:(Class _Nullable)toolbarClass SWIFT_UNAVAILABLE;
@end
/// Encapsulates Inbox Session
SWIFT_CLASS("_TtC11IterableSDK20IterableInboxSession")
@interface IterableInboxSession : NSObject
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
@class UITableView;
@class NSIndexPath;
@class UIScrollView;
IB_DESIGNABLE
SWIFT_CLASS("_TtC11IterableSDK27IterableInboxViewController")
@interface IterableInboxViewController : UITableViewController
/// If you want to use a custom layout for your inbox TableViewCell
/// this is the variable you should override. Please note that this assumes
/// that the nib is present in the main bundle.
@property (nonatomic, copy) IBInspectable NSString * _Nullable cellNibName;
/// Set this to <code>true</code> to show a popup when an inbox message is selected in the list.
/// Set this to <code>false</code>to push inbox message into navigation stack.
@property (nonatomic) IBInspectable BOOL isPopup;
/// Use this to set the title to show when there are no message in the inbox.
@property (nonatomic, copy) IBInspectable NSString * _Nullable noMessagesTitle;
/// Use this to set the message to show when there are no message in the inbox.
@property (nonatomic, copy) IBInspectable NSString * _Nullable noMessagesBody;
/// If <code>true</code>, the inbox badge will show a number when there are any unread messages in the inbox.
/// If <code>false</code> it will simply show an indicator if there are any unread messages in the inbox.
@property (nonatomic) IBInspectable BOOL showCountInUnreadBadge;
/// Set this property to override default inbox display behavior. You should set either this property
/// or <code>viewDelegateClassName</code>property but not both.
@property (nonatomic, strong) id <IterableInboxViewControllerViewDelegate> _Nullable viewDelegate;
/// Set this property if you want to set the class name in Storyboard and want <code>IterableInboxViewController</code> to create a
/// view delegate class for you.
/// The class name must include the package name as well, e.g., MyModule.CustomInboxViewDelegate
@property (nonatomic, copy) IBInspectable NSString * _Nullable viewDelegateClassName;
/// You can override these insertion/deletion animations for custom ones
@property (nonatomic) enum UITableViewRowAnimation insertionAnimation;
@property (nonatomic) enum UITableViewRowAnimation deletionAnimation;
- (nonnull instancetype)initWithStyle:(UITableViewStyle)style OBJC_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil OBJC_DESIGNATED_INITIALIZER;
- (void)viewDidLoad;
- (void)viewWillAppear:(BOOL)animated;
- (void)viewWillDisappear:(BOOL)animated;
- (NSInteger)tableView:(UITableView * _Nonnull)_ numberOfRowsInSection:(NSInteger)section SWIFT_WARN_UNUSED_RESULT;
- (UITableViewCell * _Nonnull)tableView:(UITableView * _Nonnull)tableView cellForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath SWIFT_WARN_UNUSED_RESULT;
- (NSInteger)numberOfSectionsInTableView:(UITableView * _Nonnull)_ SWIFT_WARN_UNUSED_RESULT;
- (BOOL)tableView:(UITableView * _Nonnull)_ canEditRowAtIndexPath:(NSIndexPath * _Nonnull)_ SWIFT_WARN_UNUSED_RESULT;
- (void)tableView:(UITableView * _Nonnull)_ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath;
- (void)tableView:(UITableView * _Nonnull)tableView didSelectRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath;
- (void)scrollViewDidScroll:(UIScrollView * _Nonnull)_;
@end
/// Use this protocol to override the default inbox display behavior.
/// Please note that almost properties are <code>optional</code> which means that you don’t have to
/// implement them if the default behavior works for you.
SWIFT_PROTOCOL("_TtP11IterableSDK39IterableInboxViewControllerViewDelegate_")
@protocol IterableInboxViewControllerViewDelegate
/// View delegate must have a public <code>required</code> initializer.
- (nonnull instancetype)init;
@optional
/// By default, all messages are shown.
/// If you want to control which messages are to be shown, return a filter here.
/// You can see an example of how to set a custom filter in our <code>inbox-customization</code> sample app.
@property (nonatomic, readonly, copy) BOOL (^ _Nonnull filter)(IterableInAppMessage * _Nonnull);
/// By default, messages are sorted chronologically.
/// If you don’t want inbox messages to be sorted chronologically, return a relevant comparator here.
/// For example, if you want the latest messages to be displayed you can do so by setting
/// <code>comparator = IterableInboxViewController.DefaultComparator.descending</code>,
/// You may also return any other custom comparator as per your need.
@property (nonatomic, readonly, copy) BOOL (^ _Nonnull comparator)(IterableInAppMessage * _Nonnull, IterableInAppMessage * _Nonnull);
/// If you want to have multiple sections for your inbox, use a mapper which returns the section number for an inbox message.
/// Please note that there is no need to worry about actual section numbers, section numbers are <em>relative</em>, not absolute.
/// As long as all messages in a section are mapped to the same number things will be fine.
/// For example, your mapper can return <code>4</code> for message1 and message2 and <code>5</code> for message3. In this case message1 and message2 will be in section 0
/// and message3 will be in section 1 eventhough the mappings are for <code>4</code> and <code>5</code>.
/// You can see an example of how to set a custom section mapper in our <code>inbox-customization</code> sample app.
@property (nonatomic, readonly, copy) NSInteger (^ _Nonnull messageToSectionMapper)(IterableInAppMessage * _Nonnull);
/// By default message creation time is shown as medium date and short time.
/// Use this method to override the default display for message creation time.
/// Return nil if you don’t want to display time.
/// For example, set <code>dateMapper = IterableInboxViewController.DefaultDateMapper.localizedShortDateShortTime</code>
/// if you want show short date and time.
@property (nonatomic, readonly, copy) NSString * _Nullable (^ _Nonnull dateMapper)(IterableInAppMessage * _Nonnull);
/// Use this property only when you have more than one type of custom table view cells.
/// For example, if you have inbox cells of one type to show informational mesages,
/// and inbox cells of another type to show discount messages.
/// Please note that you must declare all custom nib names here.
///
/// returns:
/// a list of all custom nib names.
@property (nonatomic, readonly, copy) NSArray<NSString *> * _Nonnull customNibNames;
/// A mapper that maps an inbox message to a custom nib.
/// This goes hand in hand with <code>customNibNames</code> property above.
/// You can see an example of how to set a custom nib name mapper in our <code>inbox-customization</code> sample app.
@property (nonatomic, readonly, copy) NSString * _Nullable (^ _Nonnull customNibNameMapper)(IterableInAppMessage * _Nonnull);
/// Use this method to render any additional custom fields other than title, subtitle and createAt.
/// \param cell The table view cell to render
///
/// \param message IterableInAppMessage
///
- (void)renderAdditionalFieldsForCell:(IterableInboxCell * _Nonnull)cell withMessage:(IterableInAppMessage * _Nonnull)message;
@end
@class NSEntityDescription;
@class NSManagedObjectContext;
SWIFT_CLASS_NAMED("IterableTaskManagedObject")
@interface IterableTaskManagedObject : NSManagedObject
- (nonnull instancetype)initWithEntity:(NSEntityDescription * _Nonnull)entity insertIntoManagedObjectContext:(NSManagedObjectContext * _Nullable)context OBJC_DESIGNATED_INITIALIZER;
@end
@interface IterableTaskManagedObject (SWIFT_EXTENSION(IterableSDK))
@property (nonatomic) int64_t attempts;
@property (nonatomic, copy) NSDate * _Nullable createdAt;
@property (nonatomic, copy) NSDate * _Nullable modifiedAt;
@property (nonatomic, copy) NSData * _Nullable data;
@property (nonatomic, copy) NSString * _Nonnull id;
@property (nonatomic, copy) NSString * _Nullable name;
@property (nonatomic, copy) NSDate * _Nullable lastAttemptedAt;
@property (nonatomic) BOOL processing;
@property (nonatomic, copy) NSString * _Nonnull type;
@property (nonatomic, copy) NSDate * _Nonnull scheduledAt;
@property (nonatomic) BOOL failed;
@property (nonatomic) BOOL blocking;
@property (nonatomic, copy) NSDate * _Nonnull requestedAt;
@property (nonatomic, copy) NSData * _Nullable taskFailureData;
@property (nonatomic) int64_t version;
@end
/// Custom URL handling delegate
SWIFT_PROTOCOL("_TtP11IterableSDK19IterableURLDelegate_")
@protocol IterableURLDelegate
/// Callback called for a deep link action. Return true to override default behavior
/// \param url The deep link URL
///
/// \param context Metadata containing the original action and the source: push or universal link.
///
///
/// returns:
/// <code>true</code> if the URL was handled to override default behavior.
- (BOOL)handleIterableURL:(NSURL * _Nonnull)url context:(IterableActionContext * _Nonnull)context SWIFT_WARN_UNUSED_RESULT;
@end
typedef SWIFT_ENUM_NAMED(NSInteger, IterableLogLevel, "LogLevel", closed) {
IterableLogLevelDebug = 1,
IterableLogLevelInfo = 2,
IterableLogLevelError = 3,
};
/// Will log nothing
SWIFT_CLASS("_TtC11IterableSDK15NoneLogDelegate")
@interface NoneLogDelegate : NSObject <IterableLogDelegate>
- (void)log:(enum IterableLogLevel)_ message:(NSString * _Nonnull)_;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
/// Enum representing push platform; apple push notification service, production vs sandbox
typedef SWIFT_ENUM(NSInteger, PushServicePlatform, closed) {
/// The sandbox push service
PushServicePlatformSandbox = 0,
/// The production push service
PushServicePlatformProduction = 1,
/// Detect automatically
PushServicePlatformAuto = 2,
};
@interface UIApplication (SWIFT_EXTENSION(IterableSDK)) <ApplicationStateProviderProtocol>
@end
#if __has_attribute(external_source_symbol)
# pragma clang attribute pop
#endif
#pragma clang diagnostic pop
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment