Skip to content

Commit

Permalink
release: SDK 1.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-roland committed Jan 5, 2024
1 parent 9ca9011 commit 4815ea2
Show file tree
Hide file tree
Showing 65 changed files with 749 additions and 773 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.20.0.zip",
checksum: "90c5ed03fab1c1708f54eb6eaa8180962e14659cc76fe0bd7f561273818eec94"
url: "https://download.batch.com/sdk/ios/spm/BatchSDK-ios_spm-xcframework-1.21.0.zip",
checksum: "0e1edfbf2df8952552ae62bcfd1262347554af3c993a38c2d0e4eccbcac28c7b"
)
]
)
41 changes: 24 additions & 17 deletions Sources/Batch.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
20 changes: 10 additions & 10 deletions Sources/Batch/BatchCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ typedef NS_ENUM(NSUInteger, BatchOptOutNetworkErrorPolicy) {
/// ``Batch/BatchPush/disableAutomaticIntegration`` before this method, and follow the "Manual Integration" advanced.
/// - Parameters:
/// - key: Your APP's API Key, LIVE or DEV. You can find it on your dashboard.
+ (void)startWithAPIKey:(NSString *_Nonnull)key NS_AVAILABLE_IOS(8_0);
+ (void)startWithAPIKey:(NSString *_Nonnull)key;

/// Handles an URL, if applicable.
///
Expand All @@ -70,15 +70,17 @@ typedef NS_ENUM(NSUInteger, BatchOptOutNetworkErrorPolicy) {

/// Access the default user profile object.
///
/// - Deprecated: Please use Batch User instead
/// - Returns: An instance of ``BatchUserProfile``, or nil
+ (BatchUserProfile *_Nullable)defaultUserProfile
__attribute__((warn_unused_result, deprecated("Please use Batch User instead")))NS_AVAILABLE_IOS(8_0);

/// Control whether Batch should try to use the IDFA or if you forbid it to. (default = YES)
/// - Warning: If you disable this, you might not be able to use IDFA based debugging in your dashboard.
/// As Batch has removed support for automatic IDFA collection, this method does nothing. The SDK will not collect the
/// IDFA from the system.
/// - Warning: This method has been deprecated
/// - Parameters:
/// - use: YES if Batch can try to use the IDFA, NO if you don't want Batch to use the IDFA.
+ (void)setUseIDFA:(BOOL)use NS_AVAILABLE_IOS(8_0);
/// - use: This parameter doesn't do anything
+ (void)setUseIDFA:(BOOL)use __attribute__((deprecated));

/// Set if Batch can use advanced device identifiers (default = YES)
///
Expand All @@ -87,18 +89,16 @@ typedef NS_ENUM(NSUInteger, BatchOptOutNetworkErrorPolicy) {
/// - Device model
/// - Device brand
/// - Carrier name
/// - Important: Disabling this does not automatically disable IDFA collection, please use the appropriate methods to
/// control this.
/// - Parameters:
/// - use: YES if Batch can try to use advanced device information, NO if you don't
+ (void)setUseAdvancedDeviceInformation:(BOOL)use NS_AVAILABLE_IOS(8_0);
+ (void)setUseAdvancedDeviceInformation:(BOOL)use;

/// Set if Batch should send its logs to a custom object of yours.
///
/// - Important: Be careful with your implementation: setting this can impact stability and performance. You should only
/// use it if you know what you are doing.
/// - Parameter loggerDelegate: An object implementing ``Batch/BatchLoggerDelegate``. Weakly retained.
+ (void)setLoggerDelegate:(id<BatchLoggerDelegate> _Nullable)loggerDelegate NS_AVAILABLE_IOS(8_0);
+ (void)setLoggerDelegate:(id<BatchLoggerDelegate> _Nullable)loggerDelegate;

/// Get the debug view controller.
///
Expand Down Expand Up @@ -208,7 +208,7 @@ typedef NS_ENUM(NSUInteger, BatchOptOutNetworkErrorPolicy) {
/// - Important: Make sure to only include the desired subdomain and the top-level domain. Don’t include path and query
/// components or a trailing slash (/).
/// - Parameter domains: An array of your supported associated domains.
+ (void)setAssociatedDomains:(NSArray<NSString *> *_Nonnull)domains NS_AVAILABLE_IOS(8_0);
+ (void)setAssociatedDomains:(NSArray<NSString *> *_Nonnull)domains;

@end

Expand Down
6 changes: 3 additions & 3 deletions Sources/Batch/BatchCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ + (BatchUserProfile *)defaultUserProfile {
return sharedInstance;
}

// Set if Batch can try to use IDFA (default = YES)
// Set if Batch can try to use IDFA. Deprecated.
+ (void)setUseIDFA:(BOOL)use {
[BACenterMulticastDelegate setUseIDFA:use];
[BALogger publicForDomain:nil message:@"Ignoring 'setUseIDFA' API call: Batch has removed support for IDFA."];
}

+ (void)setLoggerDelegate:(id<BatchLoggerDelegate>)loggerDelegate NS_AVAILABLE_IOS(8_0) {
+ (void)setLoggerDelegate:(id<BatchLoggerDelegate>)loggerDelegate {
[[[BACoreCenter instance] configuration] setLoggerDelegate:loggerDelegate];
}

Expand Down
45 changes: 22 additions & 23 deletions Sources/Batch/BatchPush.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
/// You can call this method from any thread.
/// - Warning: __Deprecated:__ This method is deprectaed. You don't need to do anything else besides removing this call,
/// Batch Push will still work as expected.
+ (void)setupPush NS_AVAILABLE_IOS(8_0)
+ (void)setupPush
__attribute__((deprecated("setupPush is deprecated. You don't need to do anything else besides removing this call, "
"Batch Push will still work as expected.")));

Expand All @@ -95,7 +95,7 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
/// system settings. Default value is: `BatchNotificationTypeBadge | BatchNotificationTypeSound |
/// BatchNotificationTypeAlert`.
/// - Parameter type: A bit mask specifying the types of notifications the app accepts.
+ (void)setRemoteNotificationTypes:(BatchNotificationType)type NS_AVAILABLE_IOS(8_0);
+ (void)setRemoteNotificationTypes:(BatchNotificationType)type;

/// Method to trigger the iOS popup that asks the user if they wants to allow notifications to be displayed, then
/// get a Push token.
Expand All @@ -105,7 +105,7 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
/// You should call this at a strategic moment, like at the end of your welcome.
///
/// Batch will automatically ask for a push token when the user replies.
+ (void)requestNotificationAuthorization NS_AVAILABLE_IOS(8_0);
+ (void)requestNotificationAuthorization;

/// Method to ask iOS for a provisional notification authorization.
///
Expand All @@ -116,15 +116,15 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
/// from the statusbar when unlocked.
///
/// This method does nothing on iOS 11 or lower.
+ (void)requestProvisionalNotificationAuthorization NS_AVAILABLE_IOS(8_0);
+ (void)requestProvisionalNotificationAuthorization;

/// Ask iOS to refresh the push token. If the app didn't prompt the user for consent yet, this will not be done.
///
/// You should call this at the start of your app, to make sure Batch always gets a valid token after app updates.
+ (void)refreshToken NS_AVAILABLE_IOS(8_0);
+ (void)refreshToken;

/// Open the system settings on your applications' notification settings.
+ (void)openSystemNotificationSettings NS_AVAILABLE_IOS(8_0);
+ (void)openSystemNotificationSettings;

/// Method to trigger the iOS popup that asks the user if they wants to allow Push Notifications, then get a Push token.
/// (Deprecated)
Expand All @@ -135,7 +135,7 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
/// Equivalent to calling ``BatchPush/requestNotificationAuthorization``
/// - Warning: __Deprecated:__ This method is deprectaed. Use ``BatchPush/requestNotificationAuthorization`` and
/// ``BatchPush/refreshToken`` separately. More info in our documentation.
+ (void)registerForRemoteNotifications NS_AVAILABLE_IOS(8_0)__attribute__((
+ (void)registerForRemoteNotifications __attribute__((
deprecated("Use requestNotificationAuthorization and refreshToken separately. More info in our documentation.")));

/// Method to trigger the iOS popup that asks the user if they want to allow Push Notifications and register to APNS.
Expand All @@ -152,8 +152,8 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
/// - Warning: __Deprecated:__ Use ``BatchPush/setNotificationsCategories:`` and
/// ``BatchPush/registerForRemoteNotifications`` separately.
+ (void)registerForRemoteNotificationsWithCategories:(nullable NSSet *)categories
NS_AVAILABLE_IOS(8_0)
__attribute__((deprecated("Use setNotificationCategories and registerForRemoteNotifications separately.")));

__attribute__((deprecated("Use setNotificationCategories and registerForRemoteNotifications separately.")));

/// Set the notification action categories to iOS.
///
Expand All @@ -164,19 +164,19 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
/// groups of actions a notification may include. If you try to register `UIUserNotificationCategory` instances on iOS
/// 10, Batch will automatically do a best effort conversion to `UNNotificationCategory`. If you don't want this
/// behaviour, please use the standard `UIApplication` methods.
+ (void)setNotificationsCategories:(nullable NSSet *)categories NS_AVAILABLE_IOS(8_0);
+ (void)setNotificationsCategories:(nullable NSSet *)categories;

/// Clear the application's badge on the homescreen.
///
/// You do not need to call this if you already called ``BatchPush/dismissNotifications``.
+ (void)clearBadge NS_AVAILABLE_IOS(8_0);
+ (void)clearBadge;

/// Clear the app's notifications in the notification center. Also clears your badge.
///
/// Call this when you want to remove the notifications. Your badge is removed afterwards, so if you want one, you need
/// to set it up again.
/// - Important: Be careful, this method also clears your badge.
+ (void)dismissNotifications NS_AVAILABLE_IOS(8_0);
+ (void)dismissNotifications;

/// Set whether Batch Push should automatically try to handle deeplinks.
///
Expand All @@ -190,37 +190,37 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
/// - Important: If Batch is set to handle your deeplinks, it will *automatically* call the fetch completion handler (if
/// applicable) with `UIBackgroundFetchResultNewData.
/// - Parameter handleDeeplinks: Whether Batch should handle deeplinks automatically.
+ (void)enableAutomaticDeeplinkHandling:(BOOL)handleDeeplinks NS_AVAILABLE_IOS(8_0);
+ (void)enableAutomaticDeeplinkHandling:(BOOL)handleDeeplinks;

/// Get Batch Push's deeplink from a notification's userInfo.
///
/// - Parameter userData The notification's payload.
/// - Returns: Batch's Deeplink, or nil if not found.
+ (nullable NSString *)deeplinkFromUserInfo:(nonnull NSDictionary *)userData NS_AVAILABLE_IOS(8_0);
+ (nullable NSString *)deeplinkFromUserInfo:(nonnull NSDictionary *)userData;

/// Get the last known push token.
///
/// Your application should still register for remote notifications once per launch, in order to keep this value valid.
/// - Important: The returned token might be outdated and invalid if this method is called too early in your application
/// lifecycle.
/// - Returns: A push token, nil if unavailable.
+ (nullable NSString *)lastKnownPushToken NS_AVAILABLE_IOS(8_0);
+ (nullable NSString *)lastKnownPushToken;

/// Disable the push's automatic integration.
///
/// If you call this, you are responsible of forwarding your application's delegate and
/// `UNUserNotificationCenterDelegate` calls to Batch. If you don't, some parts of the SDK and Dashboard will break.
/// Calling this method automatically calls `disableAutomaticNotificationCenterIntegration`.
/// - Important: This must be called before you start Batch, or it will have no effect.
+ (void)disableAutomaticIntegration NS_AVAILABLE_IOS(8_0);
+ (void)disableAutomaticIntegration;

/// Registers a device token to Batch.
///
/// You should call this method in `application:didRegisterForRemoteNotificationsWithDeviceToken:`.
/// - Important: If you didn't call ``BatchPush/disableAutomaticIntegration``, this method will have no effect.
/// If you called it but don't implement this method, Batch's push features will __NOT__ work.
/// - Parameter token: The untouched `deviceToken` NSData argument given to you in the application delegate method.
+ (void)handleDeviceToken:(nonnull NSData *)token NS_AVAILABLE_IOS(8_0);
+ (void)handleDeviceToken:(nonnull NSData *)token;

/// Check if the received push is a Batch one.
///
Expand All @@ -229,7 +229,7 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
/// - Parameter userInfo: The untouched `userInfo` NSDictionary argument given to you in the application delegate
/// method.
/// - Returns: Wheter it is a Batch'sPush. If it returns true, you should not handle the push.
+ (BOOL)isBatchPush:(nonnull NSDictionary *)userInfo NS_AVAILABLE_IOS(8_0);
+ (BOOL)isBatchPush:(nonnull NSDictionary *)userInfo;

/// Make Batch process a notification. (Deprecated)
///
Expand All @@ -255,8 +255,7 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
/// - userInfo: The untouched `userInfo` NSDictionary argument given to you in the application delegate method.
/// - identifier: The action's identifier. Used for tracking purposes: it can match your raw action name, or be a more
/// user-friendly string.
+ (void)handleNotification:(nonnull NSDictionary *)userInfo
actionIdentifier:(nullable NSString *)identifier NS_AVAILABLE_IOS(8_0);
+ (void)handleNotification:(nonnull NSDictionary *)userInfo actionIdentifier:(nullable NSString *)identifier;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
Expand Down Expand Up @@ -289,7 +288,7 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
+ (void)handleUserNotificationCenter:(nonnull UNUserNotificationCenter *)center
willPresentNotification:(nonnull UNNotification *)notification
willShowSystemForegroundAlert:(BOOL)willShowSystemForegroundAlert
NS_AVAILABLE_IOS(10_0)NS_SWIFT_NAME(handle(userNotificationCenter:willPresent:willShowSystemForegroundAlert:));
NS_SWIFT_NAME(handle(userNotificationCenter:willPresent:willShowSystemForegroundAlert:));

/// Make Batch process a background notification open/action.
///
Expand All @@ -299,8 +298,8 @@ typedef NS_ENUM(NSUInteger, BatchNotificationSource) {
/// - center: Original center argument.
/// - response: Original response argument.
+ (void)handleUserNotificationCenter:(nonnull UNUserNotificationCenter *)center
didReceiveNotificationResponse:(nonnull UNNotificationResponse *)response NS_AVAILABLE_IOS(10_0)
NS_SWIFT_NAME(handle(userNotificationCenter:didReceive:));
didReceiveNotificationResponse:(nonnull UNNotificationResponse *)response
NS_SWIFT_NAME(handle(userNotificationCenter:didReceive:));

@end

Expand Down
5 changes: 0 additions & 5 deletions Sources/Batch/BatchPush.m
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,11 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
if (self.showForegroundNotifications) {
options = UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound;

// TODO: Remove ifdef once we Xcode 12 supports macOS 11 Big Sur
#ifdef __IPHONE_14_0
if (@available(iOS 14.0, *)) {
options = options | UNNotificationPresentationOptionList | UNNotificationPresentationOptionBanner;
} else {
options = options | UNNotificationPresentationOptionAlert;
}
#else
options = options | UNNotificationPresentationOptionAlert;
#endif
}

if (completionHandler) {
Expand Down
5 changes: 5 additions & 0 deletions Sources/Batch/BatchUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ typedef NS_ENUM(NSUInteger, BatchEmailSubscriptionState) {
/// - Parameter identifier: User identifier.
- (void)setIdentifier:(nullable NSString *)identifier;

/// Set the user attribution identifier.
///
/// - Parameter attributionID: A valid UUID string or null to reset.
- (void)setAttributionIdentifier:(nullable NSString *)attributionID;

/// Set the user email.
///
/// - Important: This method requires to already have a registered identifier for the user
Expand Down
4 changes: 4 additions & 0 deletions Sources/Batch/BatchUser.m
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ - (void)setIdentifier:(nullable NSString *)identifier {
[_backingImpl setIdentifier:identifier];
}

- (void)setAttributionIdentifier:(nullable NSString *)attributionID {
[_backingImpl setAttributionIdentifier:attributionID];
}

- (BOOL)setEmail:(nullable NSString *)email error:(NSError **)error {
return [_backingImpl setEmail:email error:error];
}
Expand Down
14 changes: 3 additions & 11 deletions Sources/Batch/Defined.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@
} \
*error = nil;

// Enable IDFA related code
// Even though IDFA collection is based on AdSupport being linked to the app,
// some users might want to remove all IDFA references from the code.
// This is a quick hack until we properly move towards IDFA collection into a plugin.
// Note: this does NOT remove AppTrackingTransparency related code
#ifndef BATCH_ENABLE_IDFA
#define BATCH_ENABLE_IDFA 1
#endif

// BAVersion, BALevel and BAMessagingLevel have moved into Version.h and have been renamed
// Their values are not documented there because the Info.plist header parser is pretty dumb and will include comments
// If you need to get the user facing BAVersion, use BACoreCenter.sdkVersion
Expand Down Expand Up @@ -67,15 +58,16 @@
#define kParametersSystemPreviousAppVersionKey @"app.version.previous"

#define kParametersIDsPatternKey @"app.ids.pattern"
#define kParametersIDsPatternValue \
@"s,da,ada,did,cus,tath,dla,dre,dtz,osv,de,apv,apc,bid,pl,lvl,mlvl,pid,plv,brv,attid_e"
#define kParametersIDsPatternValue @"s,da,did,cus,idfa,dla,dre,dtz,osv,de,apv,apc,bid,pl,lvl,mlvl,pid,plv,brv"

#define kParametersAdvancedIDsPatternKey @"app.ids.pattern_advanced"
#define kParametersAdvancedIDsPatternValue @"dty,sop"

#define kParametersCustomUserIDKey @"app.id.custom"
#define kParametersAppLanguageKey @"app.language"
#define kParametersAppRegionKey @"app.region"
#define kParametersAttributionIDKey @"app.id.attribution"

#define kParametersAppProfileVersionKey @"app.profile.version"

#define kParametersDateFormat @"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS'Z'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

- (void)application:(UIApplication *)application
didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings NS_AVAILABLE_IOS(8_0);
didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;

#pragma clang diagnostic pop

Expand Down
Loading

0 comments on commit 4815ea2

Please sign in to comment.