Skip to content

Commit

Permalink
Pushwoosh iOS SDK 6.7.6
Browse files Browse the repository at this point in the history
  • Loading branch information
PushwooshCI committed Oct 15, 2024
1 parent 45f080c commit cd70107
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 36 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ body:
label: Your Pushwoosh iOS SDK version
description: Your iOS SDK version which was integrated to the app. You may find it on the [releases page](https://github.com/Pushwoosh/pushwoosh-ios-sdk/releases)
options:
- 6.7.6
- 6.7.5
- 6.7.4
- 6.7.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#endif

#define PUSHWOOSH_VERSION @"6.7.5"
#define PUSHWOOSH_VERSION @"6.7.6"


@class Pushwoosh, PWMessage, PWNotificationCenterDelegateProxy;
Expand Down
Binary file not shown.
10 changes: 5 additions & 5 deletions XCFramework/PushwooshFramework.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,32 @@
<key>BinaryPath</key>
<string>PushwooshFramework.framework/PushwooshFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>PushwooshFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>PushwooshFramework.framework/PushwooshFramework</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>PushwooshFramework.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#endif

#define PUSHWOOSH_VERSION @"6.7.5"
#define PUSHWOOSH_VERSION @"6.7.6"


@class Pushwoosh, PWMessage, PWNotificationCenterDelegateProxy;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#endif

#define PUSHWOOSH_VERSION @"6.7.5"
#define PUSHWOOSH_VERSION @"6.7.6"


@class Pushwoosh, PWMessage, PWNotificationCenterDelegateProxy;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#endif

#define PUSHWOOSH_VERSION @"6.7.5"
#define PUSHWOOSH_VERSION @"6.7.6"


@class Pushwoosh, PWMessage, PWNotificationCenterDelegateProxy;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</data>
<key>Headers/PushwooshFramework.h</key>
<data>
fFjxqg/04fEkQiqWi0zxyHXkcgE=
JpPhUaderE6i32sW+/v5evqtJz0=
</data>
<key>Info.plist</key>
<data>
Expand Down Expand Up @@ -210,7 +210,7 @@
<dict>
<key>hash2</key>
<data>
UHXrDKwpcemDpu9STGMWTb6az7j2T+u57erKeG0cSx8=
sDXEv7OQjss/ShZbZbEkhIXE0CgPWm2U6m0mx9qUEXw=
</data>
</dict>
<key>Modules/PushwooshFramework.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
Expand Down
12 changes: 6 additions & 6 deletions XCFramework/PushwooshGeozones.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<array>
<dict>
<key>BinaryPath</key>
<string>PushwooshGeozones.framework/Versions/A/PushwooshGeozones</string>
<string>PushwooshGeozones.framework/PushwooshGeozones</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-maccatalyst</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>PushwooshGeozones.framework</string>
<key>SupportedArchitectures</key>
Expand All @@ -19,7 +19,7 @@
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
Expand All @@ -37,9 +37,9 @@
</dict>
<dict>
<key>BinaryPath</key>
<string>PushwooshGeozones.framework/PushwooshGeozones</string>
<string>PushwooshGeozones.framework/Versions/A/PushwooshGeozones</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64_x86_64-maccatalyst</string>
<key>LibraryPath</key>
<string>PushwooshGeozones.framework</string>
<key>SupportedArchitectures</key>
Expand All @@ -50,7 +50,7 @@
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
<string>maccatalyst</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
2 changes: 1 addition & 1 deletion iOS_SDK/Pushwoosh/Pushwoosh.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Pod::Spec.new do |s|

s.name = "Pushwoosh"
s.version = "6.7.5"
s.version = "6.7.6"
s.summary = "Push notifications library by Pushwoosh."
s.platform = :ios

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@interface PWUserNotificationCenterDelegate()

@property (nonatomic, strong) PWPushNotificationsManager *notificationManager;
@property (nonatomic) NSString *lastHash;

@end

Expand All @@ -33,7 +34,6 @@ - (instancetype)initWithNotificationManager:(PWPushNotificationsManager*)manager
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
if ([self isRemoteNotification:notification] && [PWMessage isPushwooshMessage:notification.request.content.userInfo]) {
UNMutableNotificationContent *content = notification.request.content.mutableCopy;

NSMutableDictionary *userInfo = content.userInfo.mutableCopy;
userInfo[@"pw_push"] = @(YES);

Expand All @@ -50,7 +50,14 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNot

completionHandler(UNNotificationPresentationOptionNone);
} else if ([PushNotificationManager pushManager].showPushnotificationAlert || [notification.request.content.userInfo objectForKey:@"pw_push"] == nil) {
completionHandler(UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound);
UNMutableNotificationContent *content = notification.request.content.mutableCopy;

if ([_lastHash isEqualToString:content.userInfo[@"p"]]) {
completionHandler(UNNotificationPresentationOptionNone);
} else {
_lastHash = content.userInfo[@"p"];
completionHandler(UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound);
}
} else {
completionHandler(UNNotificationPresentationOptionNone);
}
Expand Down
2 changes: 1 addition & 1 deletion iOS_SDK/Pushwoosh/Pushwoosh/Public/PushwooshFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#endif

#define PUSHWOOSH_VERSION @"6.7.5"
#define PUSHWOOSH_VERSION @"6.7.6"


@class Pushwoosh, PWMessage, PWNotificationCenterDelegateProxy;
Expand Down
56 changes: 42 additions & 14 deletions iOS_SDK/Pushwoosh/Pushwoosh/Utils/Runtime/PWPushRuntime.ios.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
static IMP pw_original_didFailToRegisterForRemoteNotificationsWithError_Imp;
static IMP pw_original_didReceiveRemoteNotificationWithUserInfo_Imp;
static IMP pw_original_didFinishLaunchingWithOptionsExtension;
static IMP pw_original_didFinishLaunchingWithOptions;

@interface UIApplication (PushwooshRuntime)

Expand Down Expand Up @@ -62,24 +63,12 @@ BOOL dynamicDidFinishLaunchingAutoTest(id self, SEL _cmd, id application, id lau
}

BOOL _replacement_didFinishLaunchingWithOptionsExtensionRequest(id self, SEL _cmd, UIApplication *application, NSDictionary *launchOptions) {
BOOL result = YES;
((BOOL(*)(id, SEL, UIApplication *, NSDictionary *))pw_original_didFinishLaunchingWithOptionsExtension)(self, _cmd, application, launchOptions);

if ([self respondsToSelector:@selector(application:didFinishLaunchingWithOptions:)]) {
result = ((BOOL(*)(id, SEL, UIApplication *, NSDictionary *))pw_original_didFinishLaunchingWithOptionsExtension)(self, _cmd, application, launchOptions);
} else {
[self applicationDidFinishLaunching:application];
result = YES;
}
BOOL result = YES;

[[PWAppLifecycleTrackingManager sharedManager] startTracking];

if ([[UIApplication sharedApplication] respondsToSelector:@selector(pushwooshUseRuntimeMagic)]) {
if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
NSLog(@"Application was launched from a remote notification");
[[PushNotificationManager pushManager] handlePushReceived:launchOptions];
}
}

return result;
}

Expand Down Expand Up @@ -282,6 +271,7 @@ - (void)performSwizzlingForDelegate:(id<UIApplicationDelegate>)delegate proxy:(i

Class delegateClass = [delegate class];

[self swizzle_didFinishLaunchingWithOptions:delegateClass];
[self swizzle_didRegisterForRemoteNotificationsWithDeviceToken:delegateClass];
[self swizzle_didFailToRegisterForRemoteNotificationsWithError:delegateClass];
[self swizzle_didReceiveRemoteNotification:delegateClass];
Expand All @@ -301,6 +291,11 @@ - (void)performSwizzlingForDelegate:(id<UIApplicationDelegate>)delegate proxy:(i
[self pw_setDelegate:proxy ? : delegate];
}

- (void)swizzle_didFinishLaunchingWithOptions:(Class)delegateClass {
Method originalMethod = class_getInstanceMethod(delegateClass, @selector(application:didFinishLaunchingWithOptions:));
pw_original_didFinishLaunchingWithOptions = method_setImplementation(originalMethod, (IMP)_replacement_didFinishLaunchingWithOptions);
}

- (void)swizzle_didFinishLaunchingWithOptionsForExtensionRequest:(Class)delegateClass {
static BOOL swizzleDone = NO;
if (swizzleDone)
Expand Down Expand Up @@ -335,6 +330,39 @@ void _replacement_didRegisterForRemoteNotificationWithToken(id self, SEL _cmd, U
}
}


BOOL _replacement_didFinishLaunchingWithOptions(id self, SEL _cmd, UIApplication *application, NSDictionary *launchOptions) {
BOOL result = YES;

if ([self respondsToSelector:@selector(application:didFinishLaunchingWithOptions:)]) {
result = ((BOOL(*)(id, SEL, UIApplication *, NSDictionary *))pw_original_didFinishLaunchingWithOptions)(self, _cmd, application, launchOptions);
} else {
[self applicationDidFinishLaunching:application];
result = YES;
}

if (![[PWPreferences preferences] hasAppCode]) {
// pushwoosh has not been initialized yet
return result;
}

if (![PushNotificationManager pushManager].delegate) {
if ([[UIApplication sharedApplication] respondsToSelector:@selector(getPushwooshDelegate)]) {
[PushNotificationManager pushManager].delegate = [[UIApplication sharedApplication] getPushwooshDelegate];
} else {
[PushNotificationManager pushManager].delegate = (NSObject<PushNotificationDelegate> *)self;
}
}

if (![UNUserNotificationCenter currentNotificationCenter].delegate) {
//this function will also handle UIApplicationLaunchOptionsLocationKey
[[PushNotificationManager pushManager] handlePushReceived:launchOptions];
}

return result;
}


void _replacement_didFailToRegisterForRemoteNotificationsWithError(id self, SEL _cmd, UIApplication *application, NSError *error) {
if ([self respondsToSelector:@selector(application:didFailToRegisterForRemoteNotificationsWithError:)]) {
((void(*)(id, SEL, UIApplication*, NSError*))pw_original_didFailToRegisterForRemoteNotificationsWithError_Imp)(self, _cmd, application, error);
Expand Down
2 changes: 1 addition & 1 deletion iOS_SDK/Pushwoosh/PushwooshXCFramework.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Pod::Spec.new do |s|

s.name = "PushwooshXCFramework"
s.version = "6.7.5"
s.version = "6.7.6"
s.summary = "Push notifications library by Pushwoosh."
s.platform = :ios

Expand Down

0 comments on commit cd70107

Please sign in to comment.