Skip to content

Commit

Permalink
Release v2.5.0
Browse files Browse the repository at this point in the history
Release v2.5.0
  • Loading branch information
ketanshikharebsft authored Apr 5, 2024
2 parents 0dbd54b + 91fca9e commit 35f6a14
Show file tree
Hide file tree
Showing 29 changed files with 492 additions and 123 deletions.
2 changes: 1 addition & 1 deletion BlueShift-iOS-Extension-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "BlueShift-iOS-Extension-SDK"
s.version = "2.4.3"
s.version = "2.5.0"
s.summary = "iOS SDK for Push Notification Service Extension and Content Extension to support image and carousel image push notifications"
s.homepage = "https://github.com/blueshift-labs/Blueshift-iOS-SDK"
s.license = { :type => "MIT", :file => "LICENSE.md" }
Expand Down
2 changes: 1 addition & 1 deletion BlueShift-iOS-Extension-SDK/BlueshiftExtensionConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@

#define kAutoUpdateBadge @"auto_update_badge"

#define kBlueshiftExtensionSDKVersion @"2.4.3"
#define kBlueshiftExtensionSDKVersion @"2.5.0"

#endif
4 changes: 2 additions & 2 deletions BlueShift-iOS-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "BlueShift-iOS-SDK"
s.version = "2.4.3"
s.version = "2.5.0"
s.summary = "iOS SDK for integrating Rich Push & In App Notifications, Universal Links and Analytics"
s.homepage = "https://github.com/blueshift-labs/Blueshift-iOS-SDK"
s.license = { :type => "MIT", :file => "LICENSE.md" }
Expand All @@ -11,7 +11,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = "9.0"
s.ios.source_files = "BlueShift-iOS-SDK/**/*.{h,m}"
s.ios.public_header_files = "BlueShift-iOS-SDK/**/*.h"
s.ios.resources = "BlueShift-iOS-SDK/**/*.{xcdatamodeld,xcdatamodel,png,xib}"
s.ios.resource_bundles = {"BlueShift-iOS-SDK_BlueShift_iOS_SDK" => ["BlueShift-iOS-SDK/**/*.{xcdatamodeld,xcdatamodel,png,xib}"] }
s.ios.exclude_files = "BlueShift-iOS-SDK/include/**/*.{h,m}"
s.ios.framework = "CoreData"
end
8 changes: 8 additions & 0 deletions BlueShift-iOS-SDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
918B835C275F93BB0015ADF9 /* BlueshiftVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 918B835B275F93BB0015ADF9 /* BlueshiftVersion.h */; settings = {ATTRIBUTES = (Public, ); }; };
91E498E22927822A0073B7FB /* BlueshiftInboxViewModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 91E498E02927822A0073B7FB /* BlueshiftInboxViewModel.h */; settings = {ATTRIBUTES = (Public, ); }; };
91E498E32927822A0073B7FB /* BlueshiftInboxViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 91E498E12927822A0073B7FB /* BlueshiftInboxViewModel.m */; };
91F36A7F2B6235DC00CB5341 /* BlueshiftIntegrationSwizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = 91F36A7E2B6235DC00CB5341 /* BlueshiftIntegrationSwizzle.h */; settings = {ATTRIBUTES = (Public, ); }; };
91F36A812B6235E500CB5341 /* BlueshiftIntegrationSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = 91F36A802B6235E500CB5341 /* BlueshiftIntegrationSwizzle.m */; };
91F3EA562AEBAACE0062E3B8 /* BlueshiftWebViewBrowserDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 91F3EA552AEBA1C40062E3B8 /* BlueshiftWebViewBrowserDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
91F4704A27282E7B00A0E84C /* BatchEventEntity.h in Headers */ = {isa = PBXBuildFile; fileRef = 9186B5C1271ED9EA00D425AF /* BatchEventEntity.h */; settings = {ATTRIBUTES = (Public, ); }; };
91F4704B27282F4200A0E84C /* BlueShiftiCarousel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9186B679271EDA0C00D425AF /* BlueShiftiCarousel.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -285,6 +287,8 @@
918B835B275F93BB0015ADF9 /* BlueshiftVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlueshiftVersion.h; sourceTree = "<group>"; };
91E498E02927822A0073B7FB /* BlueshiftInboxViewModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BlueshiftInboxViewModel.h; sourceTree = "<group>"; };
91E498E12927822A0073B7FB /* BlueshiftInboxViewModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BlueshiftInboxViewModel.m; sourceTree = "<group>"; };
91F36A7E2B6235DC00CB5341 /* BlueshiftIntegrationSwizzle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlueshiftIntegrationSwizzle.h; sourceTree = "<group>"; };
91F36A802B6235E500CB5341 /* BlueshiftIntegrationSwizzle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlueshiftIntegrationSwizzle.m; sourceTree = "<group>"; };
91F3EA552AEBA1C40062E3B8 /* BlueshiftWebViewBrowserDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BlueshiftWebViewBrowserDelegate.h; sourceTree = "<group>"; };
91F4705F2728342400A0E84C /* ios.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = ios.modulemap; sourceTree = "<group>"; };
91F470602728342B00A0E84C /* ios.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = ios.modulemap; sourceTree = "<group>"; };
Expand Down Expand Up @@ -394,6 +398,8 @@
9186B5D5271ED9EB00D425AF /* BatchEventEntity.m */,
9186B5EF271ED9EF00D425AF /* BlueShift.h */,
9186B5EA271ED9EE00D425AF /* BlueShift.m */,
91F36A7E2B6235DC00CB5341 /* BlueshiftIntegrationSwizzle.h */,
91F36A802B6235E500CB5341 /* BlueshiftIntegrationSwizzle.m */,
9186B5D1271ED9EB00D425AF /* BlueShiftAppData.h */,
9186B5E5271ED9EB00D425AF /* BlueShiftAppData.m */,
9186B5BB271ED9EA00D425AF /* BlueShiftAppDelegate.h */,
Expand Down Expand Up @@ -597,6 +603,7 @@
912C78FF29EFFB7A0086E641 /* BlueshiftInboxAPIManager.h in Headers */,
9186B66E271ED9FB00D425AF /* BlueShiftNotificationModalViewController.h in Headers */,
9186B65C271ED9FB00D425AF /* BlueShiftNotificationViewController.h in Headers */,
91F36A7F2B6235DC00CB5341 /* BlueshiftIntegrationSwizzle.h in Headers */,
91F3EA562AEBAACE0062E3B8 /* BlueshiftWebViewBrowserDelegate.h in Headers */,
910EB3512A9C7E2E00989E87 /* BlueshiftWebBrowserViewController.h in Headers */,
);
Expand Down Expand Up @@ -795,6 +802,7 @@
9186B666271ED9FB00D425AF /* BlueShiftInAppNotification.m in Sources */,
9186B61A271ED9EF00D425AF /* BlueshiftEventAnalyticsHelper.m in Sources */,
9186B5FC271ED9EF00D425AF /* BlueShiftRequestOperation.m in Sources */,
91F36A812B6235E500CB5341 /* BlueshiftIntegrationSwizzle.m in Sources */,
9186B619271ED9EF00D425AF /* BlueShiftConfig.m in Sources */,
9186B616271ED9EF00D425AF /* BlueShiftSDKDataModel.xcdatamodeld in Sources */,
9186B609271ED9EF00D425AF /* BlueShiftDeviceData.m in Sources */,
Expand Down
10 changes: 9 additions & 1 deletion BlueShift-iOS-SDK/BatchEventEntity.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ - (void)insertEntryParametersList:(NSArray *)parametersArray andNextRetryTimeSta
if (context) {
@try {
if (parametersArray) {
self.paramsArray = [NSKeyedArchiver archivedDataWithRootObject:parametersArray];
if (@available(iOS 11.0, *)) {
NSError* error;
self.paramsArray = [NSKeyedArchiver archivedDataWithRootObject:parametersArray requiringSecureCoding:NO error:&error];
if (error) {
[BlueshiftLog logError:error withDescription:@"Failed to archive the object" methodName:[NSString stringWithUTF8String:__PRETTY_FUNCTION__]];
}
} else {
self.paramsArray = [NSKeyedArchiver archivedDataWithRootObject:parametersArray];
}
}
self.nextRetryTimeStamp = [NSNumber numberWithDouble:nextRetryTimeStamp];
self.retryAttemptsCount = [NSNumber numberWithInteger:retryAttemptsCount];
Expand Down
10 changes: 7 additions & 3 deletions BlueShift-iOS-SDK/BlueShift.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@ NS_ASSUME_NONNULL_BEGIN

+ (instancetype _Nullable)sharedInstance;

/// Initialise the SDK using BlueShiftConfig
/// Initialise the SDK manually using `BlueShiftConfig`. You will need to call SDK functions in the callbacks provided by iOS.
/// @param config BlueShiftConfig object
+ (void) initWithConfiguration:(BlueShiftConfig *)config;
/// Refer to https://developer.blueshift.com/docs/include-configure-initialize-the-ios-sdk-in-the-app#initialize-the-sdk for more information.
+ (void)initWithConfiguration:(BlueShiftConfig *)config;

+ (void) autoIntegration DEPRECATED_MSG_ATTRIBUTE("This method is deprecated, and will be replaced by the auto-integration using method swizzling. This method will be removed in a future SDK version.");
/// Initialise the SDK automatically with `BlueShiftConfig`. SDK will take care of handling all the iOS callbacks with the help of automatic integration.
/// @param config BlueShiftConfig object
/// Refer to https://developer.blueshift.com/docs/include-configure-initialize-the-ios-sdk-in-the-app#initialize-the-sdk for more information.
+ (void)initWithConfigurationAndAutoIntegrate:(BlueShiftConfig*)config;

- (void) setPushDelegate: (id) obj DEPRECATED_MSG_ATTRIBUTE("This method is deprecated, and will be removed in a future SDK version.");
- (void) setPushParamDelegate: (id) obj DEPRECATED_MSG_ATTRIBUTE("This method is deprecated, and will be removed in a future SDK version.");
Expand Down
88 changes: 68 additions & 20 deletions BlueShift-iOS-SDK/BlueShift.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import "BlueshiftInboxMessage.h"
#import "InAppNotificationEntity.h"
#import "BlueshiftInboxManager.h"
#import "BlueshiftIntegrationSwizzle.h"

BlueShiftInAppNotificationManager *_inAppNotificationMananger;
static BlueShift *_sharedBlueShiftInstance = nil;
Expand All @@ -38,7 +39,7 @@ + (instancetype) sharedInstance {
}

#pragma mark SDK initialisation
+ (void) initWithConfiguration:(BlueShiftConfig *)config {
+ (void)initWithConfiguration:(BlueShiftConfig *)config {
if([NSThread isMainThread] == YES) {
[[BlueShift sharedInstance] setupWithConfiguration:config];
} else {
Expand All @@ -48,14 +49,20 @@ + (void) initWithConfiguration:(BlueShiftConfig *)config {
}
}

+ (void) autoIntegration {
dispatch_async(dispatch_get_main_queue(), ^(void) {
[[BlueShift sharedInstance] setAppDelegate];
});
}

- (void)setAppDelegate {
[UIApplication sharedApplication].delegate = [BlueShift sharedInstance].appDelegate;
+ (void)initWithConfigurationAndAutoIntegrate:(BlueShiftConfig*)config {
void (^completionBlock)(void) = ^ {
Class appDelegateClass = [[UIApplication sharedApplication].delegate class];
[appDelegateClass swizzleHostAppDelegate];

[[BlueShift sharedInstance] setupWithConfiguration:config];
};
if([NSThread isMainThread] == YES) {
completionBlock();
} else {
dispatch_async(dispatch_get_main_queue(), ^{
completionBlock();
});
}
}

- (void)resetSDKConfig {
Expand Down Expand Up @@ -124,6 +131,8 @@ - (void) setupWithConfiguration:(BlueShiftConfig *)config {
// Initialise core data
[_sharedBlueShiftInstance.appDelegate initializeCoreData];

[self trackAppInstallOrUpdateEvent];

// Set up Push notifications and delegates
BlueShiftUserNotificationCenterDelegate *blueShiftUserNotificationCenterDelegate = [[BlueShiftUserNotificationCenterDelegate alloc] init];
_sharedBlueShiftInstance.userNotificationDelegate = blueShiftUserNotificationCenterDelegate;
Expand Down Expand Up @@ -208,22 +217,24 @@ - (void) setupWithConfiguration:(BlueShiftConfig *)config {
}
}

[self setupObservers];

[self logSDKInitializationDetails];

// Fire app open if device token is already present, else delay it till app receives device token.
if ([self getDeviceToken]) {
[_sharedBlueShiftInstance.appDelegate trackAppOpenOnAppLaunch:nil];
}

// Send any existing cached non batch/track events to Blueshift irrespecitive of SDK Tracking enabled status
[BlueShiftRequestQueue processRequestsInQueue];
[self runAfterSDKInitialisation];
} @catch (NSException *exception) {
[BlueshiftLog logException:exception withDescription:@"Failed to initialise SDK." methodName:[NSString stringWithUTF8String:__PRETTY_FUNCTION__]];
}
}

- (void)runAfterSDKInitialisation {
[self logSDKInitializationDetails];

[self setupObservers];

// Fire app open event
[_sharedBlueShiftInstance.appDelegate trackAppOpenOnAppLaunch:nil];

// Send any existing cached non batch/track events to Blueshift irrespecitive of SDK Tracking enabled status
[BlueShiftRequestQueue processRequestsInQueue];
}

/// Print debug logs on SDK initialization
- (void)logSDKInitializationDetails {
if (_sharedBlueShiftInstance.config.debug == YES) {
Expand Down Expand Up @@ -1147,4 +1158,41 @@ - (BOOL)createInAppNotificationForInboxMessage:(BlueshiftInboxMessage* _Nullable
return NO;
}

#pragma mark Auto send app install/app update

/// Automatically detects new App install or App update and sends the app_install or app_update event to Blueshift.
- (void)trackAppInstallOrUpdateEvent {
@try {
NSString* savedAppVersion = [[NSUserDefaults standardUserDefaults] valueForKey:kBSLastOpenedAppVersion];
NSString* lastModifiedUNAuthorizationStatus = [self.appDelegate getLastModifiedUNAuthorizationStatus];
NSString *currentAppVersion = BlueShiftAppData.currentAppData.appVersion;

if (!savedAppVersion && !lastModifiedUNAuthorizationStatus) {
//New app install
[self updateCurrentAppversion:currentAppVersion];
NSDictionary * params = @{kBSAppInstalledAt: [BlueshiftEventAnalyticsHelper getCurrentUTCTimestamp]};
[self trackEventForEventName:kBSAppInstallEvent andParameters:params canBatchThisEvent:NO];
} else {
if (!savedAppVersion) {
//SDK update from old version to app_install supported version
//Send App update
[self updateCurrentAppversion:currentAppVersion];
NSDictionary * params = @{kBSAppUpdatedAt: [BlueshiftEventAnalyticsHelper getCurrentUTCTimestamp]};
[self trackEventForEventName:kBSAppUpdateEvent andParameters:params canBatchThisEvent:NO];
} else if (![savedAppVersion isEqualToString:currentAppVersion]) {
//App update
[self updateCurrentAppversion:currentAppVersion];
NSDictionary * params = @{kBSPrevAppVersion: savedAppVersion,
kBSAppUpdatedAt: [BlueshiftEventAnalyticsHelper getCurrentUTCTimestamp]};
[self trackEventForEventName:kBSAppUpdateEvent andParameters:params canBatchThisEvent:NO];
}
}
} @catch (NSException *exception) {
}
}

- (void)updateCurrentAppversion:(NSString*)currentAppVersion {
[[NSUserDefaults standardUserDefaults] setValue:currentAppVersion forKey:kBSLastOpenedAppVersion];
}

@end
Loading

0 comments on commit 35f6a14

Please sign in to comment.