diff --git a/android/src/main/java/com/reactlibrary/RNCarnivalModule.java b/android/src/main/java/com/reactlibrary/RNCarnivalModule.java index 6f839eb..844fe5f 100644 --- a/android/src/main/java/com/reactlibrary/RNCarnivalModule.java +++ b/android/src/main/java/com/reactlibrary/RNCarnivalModule.java @@ -99,7 +99,7 @@ protected static void setWrapperInfo() { setWrapperMethod = Carnival.class.getDeclaredMethod("setWrapper", cArg); setWrapperMethod.setAccessible(true); - setWrapperMethod.invoke(null, "React Native", "3.0.2"); + setWrapperMethod.invoke(null, "React Native", "3.0.3"); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { diff --git a/ios/Carnival.framework/Carnival b/ios/Carnival.framework/Carnival index 013e0b5..3af0799 100755 Binary files a/ios/Carnival.framework/Carnival and b/ios/Carnival.framework/Carnival differ diff --git a/ios/Carnival.framework/Headers/Carnival.h b/ios/Carnival.framework/Headers/Carnival.h index 3166296..3a2b850 100644 --- a/ios/Carnival.framework/Headers/Carnival.h +++ b/ios/Carnival.framework/Headers/Carnival.h @@ -16,7 +16,7 @@ #import "CarnivalLogger.h" #import "CarnivalContentItem.h" -#define CARNIVAL_VERSION @"7.3.0-beta" +#define CARNIVAL_VERSION @"8.2.3" FOUNDATION_EXPORT double CarnivalSDKVersionNumber; FOUNDATION_EXPORT const unsigned char CarnivalSDKVersionString[]; @@ -54,7 +54,11 @@ NS_ASSUME_NONNULL_END + (void)startEngine:(nonnull NSString *)appKey; /** - * Sets the Carnival appKey credentials for this app and optionally registers for push notifications with the badge, alert and sound UIUserNotificationType's + * Sets the Carnival appKey credentials for this app and optionally registers for push notifications authorization with the badge, alert and sound UIUserNotificationTypes. + * @note The device will be registered with the Apple Push Notification service and provided with a push notification token regardless of whether registerForPushNotifications is set to YES or NO. This step does not require a user prompt. + * + * On devices running iOS 12+ provisional authorization will be requested if registerForPushNotifications is set to NO, allowing Quiet push notifications to + * be sent to the device. * * @param appKey The appKey you recieved when setting up your app at http://app.carnivalmobile.com . * @param registerForPushNotifications when this parameter is YES the Carnival iOS SDK will automatically register for push notifications @@ -66,17 +70,17 @@ NS_ASSUME_NONNULL_END /** * Sets the logger used by Carnival for any internal informational or debugging logging. - + * @param logger An object implementing the CarnivalLogger protocol. */ + (void)setLogger:(nonnull id)logger; /** * Enables AutoAnalytics tracking for a given array of event sources. This is opt-in as of Carnival 5.0.0. - * + * * @param enableArray - An array of const strings beginning with CarnivalAutoAnalyticsSource. */ -+ (void)enableAutoAnalytics:(nonnull NSArray *)enableArray; ++ (void)enableAutoAnalytics:(nonnull NSArray *)enableArray; /** @name Custom Attributes */ @@ -88,15 +92,6 @@ NS_ASSUME_NONNULL_END */ + (void)setAttributes:(nonnull CarnivalAttributes *)attributes withResponse:(nullable void(^)(NSError *__nullable error))block; -/** - * Syncronously sets a CarnivalAttributes object with Carnival. - * - * @param attributes A nonnull CarnivalAttributes object with the desired attributes set. - * @param error A pointer to an error which will be non-nil if there is an error. - */ -+ (void)setAttributes:(nonnull CarnivalAttributes *)attributes error:(NSError *__nullable *__nullable)error; - - /** * Asyncronously removes a value for a given key. * @@ -105,16 +100,6 @@ NS_ASSUME_NONNULL_END **/ + (void)removeAttributeWithKey:(nonnull NSString *)key withResponse:(nullable void(^)(NSError *__nullable error))block; -/** - * Syncronously removes a value for a given key. - * - * @param key The string value of the key. - * @param error A pointer to an error which will be non-nil if there is an error. - **/ -+ (void)removeAttributeWithKey:(nonnull NSString *)key error:(NSError *__nullable *__nullable)error; - - - /** * Asyncronously clears any of the Attribute, Message Stream, or Event data from the device. * Use this method to clear the device attributes after user logout. @@ -158,6 +143,11 @@ NS_ASSUME_NONNULL_END */ + (void)handleNotification:(nonnull NSDictionary *)notificationDict; +/** + * Tells the Carnival SDK that the notification settings have been updated and that it should synchronize the new settings with the Carnival platform. This method is only required if auto integration has been disabled. It should be called after either the requestAuthorizationWithOptions:completionHandler: or registerUserNotificationSettings: methods have been used to request push notifications authorization. + */ ++ (void)syncNotificationSettings; + /** @name Device details */ /** @@ -176,8 +166,6 @@ NS_ASSUME_NONNULL_END * * @param url the Sailthru Link to be unrolled * @return the destination that the Sailthru link points to, or nil if the link isn't a valid Sailthru Link. - - */ + (NSURL * _Nullable)handleSailthruLink:(NSURL * _Nonnull)url; @@ -199,6 +187,14 @@ NS_ASSUME_NONNULL_END */ + (void)logEvent:(nonnull NSString *)name; +/** + * Logs a custom event with the given name and associated vars. + * + * @param name The name of the custom event to be logged. + * @param vars The associated variables for the event. + */ ++ (void)logEvent:(nonnull NSString *)name withVars:(NSDictionary *__nullable)vars; + /** @name Users */ /** @@ -226,7 +222,7 @@ NS_ASSUME_NONNULL_END * @param sectionID An SPM section ID. The section must be set up to use JSON as the output format. * @param block A block which gets called with an array of CarnivalContentItem objects and a possible error. Cannot be NULL. */ -+ (void)recommendationsWithSection:(NSString *_Nonnull)sectionID withResponse:(nullable void(^)(NSArray * _Nullable contentItems, NSError *__nullable error))block; ++ (void)recommendationsWithSection:(NSString *_Nonnull)sectionID withResponse:(nullable void(^)(NSArray * _Nullable contentItems, NSError *__nullable error))block; /** * Registers that the given pageview with Sailthru SPM. @@ -236,7 +232,7 @@ NS_ASSUME_NONNULL_END * @param tags Tags for this content * @param block The block returned from the asynchronous call. May contain an error. */ -+ (void)trackPageviewWithUrl:(NSURL *_Nonnull)url andTags:(NSArray *_Nonnull)tags andResponse:(nullable void(^)(NSError *__nullable error))block; ++ (void)trackPageviewWithUrl:(NSURL *_Nonnull)url andTags:(NSArray *_Nonnull)tags andResponse:(nullable void(^)(NSError *__nullable error))block; /** * Registers that the given pageview with Sailthru SPM. @@ -255,7 +251,7 @@ NS_ASSUME_NONNULL_END * of content are contained within a section, otherwise just pass a single-item array. * @param block The block returned from the asynchronous call. May contain an error. */ -+ (void)trackImpressionWithSection:(NSString *_Nonnull)sectionID andUrls:(NSArray *_Nonnull)urls andResponse:(nullable void(^)(NSError *__nullable error))block; ++ (void)trackImpressionWithSection:(NSString *_Nonnull)sectionID andUrls:(NSArray *_Nonnull)urls andResponse:(nullable void(^)(NSError *__nullable error))block; /** * Registers an impression - a reasonable expectation that a user has seen a piece of content - with Sailthru SPM. @@ -274,6 +270,21 @@ NS_ASSUME_NONNULL_END */ + (void)trackClickWithSection:(NSString *_Nonnull)sectionID andUrl:(NSURL *_Nonnull)url andResponse:(nullable void(^)(NSError *__nullable error))block; +/** + * Sets the profile vars on the server. + * + * @param vars the vars to set on the server. + * @param block the block returned from the asynchronous call. May contain an error. + */ ++ (void)setProfileVars:(NSDictionary * _Nonnull)vars withResponse:(nullable void(^)(NSError * _Nullable))block; + +/** + * Retrieves the profile vars from the server. + * + * @param block the block returned from the asynchronous call. May contain an error. + */ ++ (void)getProfileVarsWithResponse:(nullable void(^)(NSDictionary * _Nullable, NSError * _Nullable))block; + /** * Enabled location tracking based on IP Address. Tracking location tracking is enabled by default. * Use this method for users who may not want to have their location tracked at all. @@ -285,7 +296,7 @@ NS_ASSUME_NONNULL_END /** * Enable crash tracking for recording sessions which end in a crash. * Warning: This is for advanced uses where in some cases, crash handlers from Test Flight or Fabric (Crashlytics) interrupt Carnival crash detection. - * If you are not experiencing these issues, do not use this method. + * If you are not experiencing these issues, do not use this method. * * @param enabled A boolean value indicating whether or not to install the crash handlers. Defaults to YES. */ diff --git a/ios/Carnival.framework/Headers/CarnivalMessageStream.h b/ios/Carnival.framework/Headers/CarnivalMessageStream.h index 351c8e5..d677bb8 100644 --- a/ios/Carnival.framework/Headers/CarnivalMessageStream.h +++ b/ios/Carnival.framework/Headers/CarnivalMessageStream.h @@ -144,14 +144,14 @@ typedef NS_ENUM(NSInteger, CarnivalImpressionType) { * * @param handler A block object which returns an error which will be non-nil if there was a problem marking the messages as read. */ -+ (void)markMessagesAsRead:(nonnull NSArray *)messages withResponse:(nullable void(^)(NSError *__nullable error))handler; ++ (void)markMessagesAsRead:(nonnull NSArray *)messages withResponse:(nullable void(^)(NSError *__nullable error))handler; /** * Returns an array of Carnival Messages for the device. * * @param block A block which gets called with an array of CarnivalMessage objects and a possbile error. Cannot be NULL. */ -+ (void)messages:(nonnull void (^)(NSArray *__nullable messages, NSError *__nullable error))block; ++ (void)messages:(nonnull void (^)(NSArray *__nullable messages, NSError *__nullable error))block; /** * Removes the message with the given messageID from the Carnival Message Stream diff --git a/ios/Carnival.framework/Info.plist b/ios/Carnival.framework/Info.plist index 271eb9c..a011282 100644 Binary files a/ios/Carnival.framework/Info.plist and b/ios/Carnival.framework/Info.plist differ diff --git a/ios/Carnival.framework/en.lproj/InfoPlist.strings b/ios/Carnival.framework/en.lproj/InfoPlist.strings deleted file mode 100644 index 3967e06..0000000 Binary files a/ios/Carnival.framework/en.lproj/InfoPlist.strings and /dev/null differ diff --git a/ios/Carnival.h b/ios/Carnival.h deleted file mode 100644 index 132b79b..0000000 --- a/ios/Carnival.h +++ /dev/null @@ -1,247 +0,0 @@ -// -// Carnival.h -// Carnival -// -// Created by Carnival Mobile -// Copyright (c) 2015 Carnival Mobile. All rights reserved. -// -// For documentation see http://docs.carnival.io -// - -#import -#import -#import -#import "CarnivalMessageStream.h" -#import "CarnivalAttributes.h" -#import "CarnivalLogger.h" - -#define CARNIVAL_VERSION @"6.1.0" -FOUNDATION_EXPORT double CarnivalSDKVersionNumber; -FOUNDATION_EXPORT const unsigned char CarnivalSDKVersionString[]; - -typedef NS_OPTIONS(NSUInteger, CarnivalDeviceDataType) { - CarnivalDeviceDataTypeAttributes = 1 << 0, - CarnivalDeviceDataTypeMessageStream = 1 << 1, - CarnivalDeviceDataTypeEvents = 1 << 2 -}; - -/* Constants for Auto-Analytics Tracking */ -NS_ASSUME_NONNULL_BEGIN -extern NSString * const CarnivalAutoAnalyticsSourceGoogleAnalytics; -extern NSString * const CarnivalAutoAnalyticsSourceAdobeAnalytics; -extern NSString * const CarnivalAutoAnalyticsSourceMixpanel; -extern NSString * const CarnivalAutoAnalyticsSourceLocalytics; -extern NSString * const CarnivalAutoAnalyticsSourceFlurryAnalytics; -extern NSString * const CarnivalAutoAnalyticsSourceAmplitude; -extern NSString * const CarnivalAutoAnalyticsSourceAll; -NS_ASSUME_NONNULL_END - -@interface Carnival : NSObject - -/** @name Setting up Carnival */ - -/** - * Sets the Carnival appKey credentials for this app. - * - * @param appKey The appKey you recieved when setting up your app at http://app.carnivalmobile.com . - * @discussion An exception will be raised if you do not set your appKey before you call any other methods. - * Make sure your app bundle identifier is the same as whatever it is set to on http://app.carnivalmobile.com . - * - * @warning It is important that this method is called at the earliest possible opportunity (e.g. application:didFinishLaunchingWithOptions:), - * calling it later in the app lifecycle can have unintended consequences. No startEngine: calls (overrides included) must not be called more than once. - */ -+ (void)startEngine:(nonnull NSString *)appKey; - -/** - * Sets the Carnival appKey credentials for this app, and the UIUserNotificationType at the same time. - * - * @param appKey The appKey you recieved when setting up your app at http://app.carnivalmobile.com . - * @param types The UIUserNotificationType attributes you wish to register this app for as defined in UIApplication.h - * see appledocs for more information. If targeting, iOS 7 users, please use UIUserNotificationType anyway. - * @discussion An exception will be raised if you do not set your appKey before you call any other methods. - * Make sure your app bundle identifier is the same as whatever it is on http://app.carnivalmobile.com . - * - * @warning It is important that this method is called at the earliest possible opportunity (e.g. application:didFinishLaunchingWithOptions:), - * calling it later in the app lifecycle can have unintended consequences. No startEngine: calls (overrides included) must not be called more than once. - */ -+ (void)startEngine:(nonnull NSString *)appKey andNotificationTypes:(UIUserNotificationType)types; - -/** - * Sets the Carnival appKey credentials for this app and optionally registers for push notifications with the badge, alert and sound UIUserNotificationType's - * - * @param appKey The appKey you recieved when setting up your app at http://app.carnivalmobile.com . - * @param registerForPushNotifications when this parameter is YES the Carnival iOS SDK will automatically register for push notifications - * - * @warning It is important that this method is called at the earliest possible opportunity (e.g. application:didFinishLaunchingWithOptions:), - * calling it later in the app lifecycle can have unintended consequences. No startEngine: calls (overrides included) must not be called more than once. - */ -+ (void)startEngine:(nonnull NSString *)appKey registerForPushNotifications:(BOOL)registerForPushNotifications; - -/** - * Sets the logger used by Carnival for any internal informational or debugging logging. - - * @param logger An object implementing the CarnivalLogger protocol. - */ -+ (void)setLogger:(nonnull id) logger; - -/** - * Enables AutoAnalytics tracking for a given array of event sources. This is opt-in as of Carnival 5.0.0. - * - * @param enableArray - An array of const strings beginning with CarnivalAutoAnalyticsSource. - */ -+ (void)enableAutoAnalytics:(nonnull NSArray *)enableArray; - -/** @name Custom Attributes */ - -/** - * Asyncronously sets a CarnivalAttributes object with Carnival. - * - * @param attributes A nonnull CarnivalAttributes object with the desired attributes set. - * @param block The block returned from the asyncronous call possibly containing an error. - */ -+ (void)setAttributes:(nonnull CarnivalAttributes *)attributes withResponse:(nullable void(^)(NSError *__nullable error))block; - -/** - * Syncronously sets a CarnivalAttributes object with Carnival. - * - * @param attributes A nonnull CarnivalAttributes object with the desired attributes set. - * @param error A pointer to an error which will be non-nil if there is an error. - */ -+ (void)setAttributes:(nonnull CarnivalAttributes *)attributes error:(NSError *__nullable *__nullable)error; - - -/** - * Asyncronously removes a value for a given key. - * - * @param key The string value of the key. - * @param block The block returned from the asyncronous call possibly containing an error. - **/ -+ (void)removeAttributeWithKey:(nonnull NSString *)key withResponse:(nullable void(^)(NSError *__nullable error))block; - -/** - * Syncronously removes a value for a given key. - * - * @param key The string value of the key. - * @param error A pointer to an error which will be non-nil if there is an error. - **/ -+ (void)removeAttributeWithKey:(nonnull NSString *)key error:(NSError *__nullable *__nullable)error; - - - -/** - * Asyncronously clears any of the Attribute, Message Stream, or Event data from the device. - * Use this method to clear the device attributes after user logout. - * - * @param types A bitwise OR collection of CarnivalDeviceDataType dictating which sets of data to clear. - * @param block The block returned from the asyncronous call possibly containing an error. - **/ -+ (void)clearDeviceData:(CarnivalDeviceDataType)types withResponse:(nullable void(^)(NSError *__nullable error))block; - - -/** @name Badges */ - -/** - * Should clear the application badge automatically when the application launches. - * Defaults to NO on iOS versions below 5, YES on iOS versions above 5. - */ -+ (void)setShouldClearBadgeOnLaunch:(BOOL)shouldClearBadgeOnLaunch; - -/** @name Location tracking */ - -/** - * Forward a location to the Carnival iOS SDK. This method can be used when you're already tracking location in your app and you just want to forward your existing calls to the Carnival iOS SDK. - * - * @param location The location to forward - */ -+ (void)updateLocation:(nonnull CLLocation *)location; - -/** @name Manual Push Notification setup */ - -/** - * Asynchronously registers the APNS token for this device with the Carnival platform. - * - * @param deviceToken The APNS token for the current device. This deviceToken is normally passed back by the application:didRegisterForRemoteNotificationsWithDeviceToken: method. - */ -+ (void)setDeviceTokenInBackground:(nonnull NSData *)deviceToken; - -/** - * Tells the Carnival SDK to handle the notification. - * - * @param notificationDict The userInfo dictionary from the remote notification you want the Carnival SDK to handle. This dictionary is normally passed back to you from the application:didReceiveRemoteNotification: method. - */ -+ (void)handleNotification:(nonnull NSDictionary *)notificationDict; - -/** @name Device details */ - -/** - * Returns the current device's ID as a NSString. - * - * @param completion A block which gets called after the current device is fetched containing the current device's ID - */ -+ (void)deviceID:(nonnull void (^)(NSString *__nullable deviceID, NSError *__nullable error))completion; - -/** @name Enabling/Disabling in-app notifications */ - -/** - * Enables or disables the showing of in-app notifications. - * - * @param enabled A boolean value indicating whether in-app notfications are enabled. - */ -+ (void)setInAppNotificationsEnabled:(BOOL)enabled; - -/** @name Events */ - -/** - * Logs a custom event with the given name. - * - * @param name The name of the custom event to be logged. - */ -+ (void)logEvent:(nonnull NSString *)name; - -/** @name Users */ - -/** - * Sets a user ID for the device. - * - * @param userId The ID of the user to be set. - * - * @param block The block returned from the asyncronous call possibly containing an error. - */ -+ (void)setUserId:(nullable NSString *)userId withResponse:(nullable void(^)(NSError *__nullable error))block; - -/** - * Sets a user email for the device. - * - * @param userEmail The email of the user to be set. - * - * @param block The block returned from the asyncronous call possibly containing an error. - */ -+ (void)setUserEmail:(nullable NSString *)userEmail withResponse:(nullable void(^)(NSError *__nullable error))block; - - -/** - * Enabled location tracking based on IP Address. Tracking location tracking is enabled by default. - * Use this method for users who may not want to have their location tracked at all. - * - * @param enabled A boolean value indicating whether or not to disable location based on IP Address. - */ -+ (void)setGeoIPTrackingEnabled:(BOOL)enabled; - -/** - * Enable crash tracking for recording sessions which end in a crash. - * Warning: This is for advanced uses where in some cases, crash handlers from Test Flight or Fabric (Crashlytics) interrupt Carnival crash detection. - * If you are not experiencing these issues, do not use this method. - * - * @param enabled A boolean value indicating whether or not to install the crash handlers. Defaults to YES. - */ -+ (void)setCrashHandlersEnabled:(BOOL)enabled; - -/** - * Enable automatic integration for Carnival. This must be called BEFORE startEngine, or its overloads. - * Warning: This is for advanced uses where you may not want Carnival to swizzle the following UIApplicationDelegate methods: - * application:didRegisterForRemoteNotificationsWithDeviceToken:, application:didReceiveRemoteNotification:, application:didReceiveRemoteNotification:fetchCompletionHandler: - * @param enabled A boolean value indicating whether or not to swizzle notification related methods. Defaults to YES. - */ -+ (void)setAutoIntegrationEnabled:(BOOL)enabled; - -@end diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2221067..e938ae6 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -66,4 +66,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 976f4fb03ba439b89409fa649e52e062b26edad3 -COCOAPODS: 1.6.1 +COCOAPODS: 1.6.2 diff --git a/ios/RNCarnival.m b/ios/RNCarnival.m index 439a9f1..40d6eb7 100644 --- a/ios/RNCarnival.m +++ b/ios/RNCarnival.m @@ -35,7 +35,7 @@ -(instancetype)initWithDisplayInAppNotifications:(BOOL)displayNotifications { if(self) { self.displayInAppNotifications = displayNotifications; [CarnivalMessageStream setDelegate:self]; - [Carnival setWrapperName:@"React Native" andVersion:@"3.0.2"]; + [Carnival setWrapperName:@"React Native" andVersion:@"3.0.3"]; } return self; } diff --git a/package.json b/package.json index a7f64be..c728b93 100755 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "type": "git", "url": "git+https://github.com/carnivalmobile/carnival-sdk-react-native.git" }, - "version": "3.0.2", + "version": "3.0.3", "devDependencies": { "react-native": "^0.56.0" }