Skip to content

Commit

Permalink
release: SDK 1.20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-roland committed Jul 27, 2023
1 parent 6f7f7a7 commit 9ca9011
Show file tree
Hide file tree
Showing 302 changed files with 4,369 additions and 6,012 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ let package = Package(
targets: [
.binaryTarget(
name: "Batch",
url: "https://download.batch.com/sdk/ios/spm/BatchSDK-ios_spm-xcframework-1.19.5.zip",
checksum: "9dec44e2163ac9ca28e8874985af8defb102c12ae8c7a98e6a51d83119b778cc"
url: "https://download.batch.com/sdk/ios/spm/BatchSDK-ios_spm-xcframework-1.20.0.zip",
checksum: "90c5ed03fab1c1708f54eb6eaa8180962e14659cc76fe0bd7f561273818eec94"
)
]
)
179 changes: 50 additions & 129 deletions Sources/Batch.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions Sources/Batch/BAErrorHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,31 @@

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, BAInternalFailReason)
{
typedef NS_ENUM(NSInteger, BAInternalFailReason) {
/*!
A network problem occurred.
*/
BAInternalFailReasonNetworkError = -10,
BAInternalFailReasonNetworkError = -10,

/*!
Invalid API key.
*/
BAInternalFailReasonInvalidAPIKey = -20,
BAInternalFailReasonInvalidAPIKey = -20,

/*!
Deactivated API Key.
*/
BAInternalFailReasonDeactivatedAPIKey = -30,
BAInternalFailReasonDeactivatedAPIKey = -30,

/*!
Another problem occurred. A retry can succeed
*/
BAInternalFailReasonUnexpectedError = -50,
BAInternalFailReasonUnexpectedError = -50,

/*!
Batch has been globally opted out from
*/
BAInternalFailReasonOptedOut = -60
BAInternalFailReasonOptedOut = -60
};
typedef NSInteger BatchFailReason;

Expand Down
4 changes: 2 additions & 2 deletions Sources/Batch/BANotificationCenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#import <Foundation/Foundation.h>

// Batch notifications:
#define kNotificationBatchStarts @"notification.start"
#define kNotificationBatchStops @"notification.stop"
#define kNotificationBatchStarts @"notification.start"
#define kNotificationBatchStops @"notification.stop"

/*!
@class BANotificationCenter
Expand Down
12 changes: 6 additions & 6 deletions Sources/Batch/Batch.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ FOUNDATION_EXPORT double BatchVersionNumber;
//! Project version string for Batch.
FOUNDATION_EXPORT const unsigned char BatchVersionString[];

#import <Batch/BatchActions.h>
#import <Batch/BatchCore.h>
#import <Batch/BatchPush.h>
#import <Batch/BatchEventData.h>
#import <Batch/BatchEventDispatcher.h>
#import <Batch/BatchInbox.h>
#import <Batch/BatchLogger.h>
#import <Batch/BatchUser.h>
#import <Batch/BatchMessaging.h>
#import <Batch/BatchActions.h>
#import <Batch/BatchInbox.h>
#import <Batch/BatchEventData.h>
#import <Batch/BatchMessagingModels.h>
#import <Batch/BatchPush.h>
#import <Batch/BatchUser.h>
#import <Batch/BatchUserAttribute.h>
#import <Batch/BatchEventDispatcher.h>
146 changes: 60 additions & 86 deletions Sources/Batch/BatchActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,123 +10,97 @@

#pragma mark Action sources

/**
Represents an action source.
Can be used to get more information about the context of the action, such as the full push payload, if coming from a push.
*/
/// Represents an action source.
///
/// Can be used to get more information about the context of the action, such as the full push payload, if coming from a
/// push.
@protocol BatchUserActionSource <NSObject>

@end

/**
Source that's only set when an action was manually triggered by +[BatchActions performActionIdentifiedBy:withArguments:]
*/
/// Source that's only set when an action was manually triggered by
/// ``BatchActions/performActionIdentifiedBy:withArguments:``
@interface BatchManualUserActionSource : NSObject <BatchUserActionSource>

@end

#pragma mark Action model

typedef void (^BatchUserActionBlock)(NSString* _Nonnull identifier, NSDictionary<NSString*, id>* _Nonnull arguments, id<BatchUserActionSource> _Nullable source);
typedef void (^BatchUserActionBlock)(NSString *_Nonnull identifier,
NSDictionary<NSString *, id> *_Nonnull arguments,
id<BatchUserActionSource> _Nullable source);

/**
Represents an action that can be triggered by the user from anywhere.
*/
/// Represents an action that can be triggered by the user from anywhere.
@interface BatchUserAction : NSObject

/**
Create a new BatchUserAction object with the following parameters
Be careful, as the action block can be invoked on any thread. You should never make any assumption about which thread you're on when this is called.
@param identifier The unique action identifier. Should be unique in your app (not case-sensitive).
@param actionBlock The action block that will be invoked when Batch wants to execute your action. Can be called from any thread: never make any assumption about which thread you're on when this is called.
@returns A BatchUserAction instance constructed from the given parameters.
*/
+ (nonnull instancetype)userActionWithIdentifier:(nonnull NSString*)identifier
/// Create a new ``BatchUserAction`` object with the following parameters.
///
/// - Important: Be careful, as the action block can be invoked on any thread. You should never make any assumption
/// about which thread you're on when this is called.
/// - Parameters:
/// - identifier: The unique action identifier. Should be unique in your app (not case-sensitive).
/// - actionBlock: The action block that will be invoked when Batch wants to execute your action. Can be called from
/// any thread: never make any assumption about which thread you're on when this is called.
/// - Returns: A ``BatchUserAction`` instance constructed from the given parameters.
+ (nonnull instancetype)userActionWithIdentifier:(nonnull NSString *)identifier
actionBlock:(nonnull BatchUserActionBlock)actionBlock;

/**
Action identifier. Should be unique in your app.
*/
/// Action identifier. Should be unique in your app.
@property (readonly, nonnull) NSString *identifier;

/**
Action block to invoke when Batch wants to perform your action.
Be careful, as it can be invoked on any thread. You should never make any assumption about which thread you're on when this is called.
*/
/// Action block to invoke when Batch wants to perform your action.
///
/// - Important: Be careful, as it can be invoked on any thread. You should never make any assumption about which thread
/// you're on when this is called.
@property (readonly, nonnull) BatchUserActionBlock actionBlock;

@end

#pragma mark Action module

/**
Batch's Actions module
*/
/// Batch's Actions module
@interface BatchActions : NSObject

/**
Register an action with Batch.
If an action already exists for that identifier, it will be replaced. Identifiers are not case-sensitive.
Note that the action identifier cannot start with "batch.", as they are reserved by the SDK.
Trying to register such an action will throw an error.
@param action The action to register
@returns An NSError pointer if the action couldn't be registered, nil otherwise
*/
+ (nullable NSError*)registerAction:(nonnull BatchUserAction*)action;

/**
Unregister an action from Batch.
Trying to unregister an action that has not be registered will silently fail.
Note that trying to unregister an action that starts with "batch." will fail silently.
@param actionIdentifier The action's identifier. Not case-sensitive
*/
+ (void)unregisterActionIdentifier:(nonnull NSString*)actionIdentifier NS_SWIFT_NAME(unregister(actionIdentifier:));

/**
Perform an action registered with Batch.
The action source will be BatchManualUserActionSource.
Note that manually trying to trigger builtin actions (prefixed by "batch.") will not work.
@param identifier The action identifier. Case-unsensitive. Cannot be nil.
@param args A dictionary containing the action arguments. Cannot be nil.
@returns YES if the action was performed, NO if no action was found or another error occurred
*/
+ (BOOL)performActionIdentifiedBy:(nonnull NSString*)identifier withArguments:(nonnull NSDictionary<NSString*, id>*)args NS_SWIFT_NAME(perform(actionIdentifier:arguments:));
/// Register an action with Batch.
///
/// If an action already exists for that identifier, it will be replaced. Identifiers are not case-sensitive.
/// - Note: The action identifier cannot start with "batch.", as they are reserved by the SDK. Trying to register such
/// an action will throw an error.
/// - Parameter action: The action to register
+ (nullable NSError *)registerAction:(nonnull BatchUserAction *)action;

/// Unregister an action from Batch.
///
/// - Note: Trying to unregister an action that has not be registered or to unregister an action that starts with
/// "batch." will silently fail.
/// - Parameter actionIdentifier: The action's identifier. Not case-sensitive.
+ (void)unregisterActionIdentifier:(nonnull NSString *)actionIdentifier NS_SWIFT_NAME(unregister(actionIdentifier:));

/// Perform an action registered with Batch.
///
/// - Note: Manually trying to trigger builtin actions (prefixed by "batch.") will not work.
/// - Parameters:
/// - identifier: The action identifier. Case-unsensitive. Cannot be nil.
/// - args: A dictionary containing the action arguments. Cannot be nil.
/// - Returns: YES if the action was performed, NO if no action was found or another error occurred
+ (BOOL)performActionIdentifiedBy:(nonnull NSString *)identifier
withArguments:(nonnull NSDictionary<NSString *, id> *)args
NS_SWIFT_NAME(perform(actionIdentifier:arguments:));

@end

/**
BatchActions error code constants.
*/
enum
{
/**
Internal error
*/
/// BatchActions error code constants.
enum {

/// Internal error
BatchActionErrorUnknown = -1001,

/**
Can be multiple things: nil action, nil or empty identifier string, nil action block
*/

/// Can be multiple things: nil action, nil or empty identifier string, nil action block
BatchActionErrorInvalidArgument = -1002,

/**
This action identifier is reserved and cannot be used. Note that actions cannot begin by "batch."
*/

/// This action identifier is reserved and cannot be used. Note that actions cannot begin by "batch."
BatchActionErrorReservedIdentifier = -1003
};

/**
@typedef BatchActionError
*/
/// @typedef BatchActionError
typedef NSInteger BatchActionError;
Loading

0 comments on commit 9ca9011

Please sign in to comment.