Skip to content

Commit 6c40e8e

Browse files
committed
release: SDK 1.19.4
1 parent 881025d commit 6c40e8e

File tree

6 files changed

+44
-11
lines changed

6 files changed

+44
-11
lines changed

Package.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ let package = Package(
1818
targets: [
1919
.binaryTarget(
2020
name: "Batch",
21-
url: "https://download.batch.com/sdk/ios/spm/BatchSDK-ios_spm-xcframework-1.19.3.zip",
22-
checksum: "5a56179647f66d34c0a4532f28f68241bc1e12e7c391d9593407e47998eabc67"
21+
url: "https://download.batch.com/sdk/ios/spm/BatchSDK-ios_spm-xcframework-1.19.4.zip",
22+
checksum: "32b8ef5a122705f7df47054cab192cc85169bc1f98c4096fd5b640e851424608"
2323
)
2424
]
2525
)

Sources/Batch/Modules/Actions/BAActionsCenter.m

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
@implementation BAActionsCenter {
3636
NSMutableDictionary<NSString *, BatchUserAction *> *registeredActions;
37+
UIPasteboard *_pasteboard;
3738
}
3839

3940
+ (instancetype)instance {
@@ -49,6 +50,7 @@ + (instancetype)instance {
4950
- (instancetype)init {
5051
self = [super init];
5152
if (self) {
53+
_pasteboard = [UIPasteboard generalPasteboard];
5254
registeredActions = [NSMutableDictionary new];
5355

5456
[self registerInternalAction:[self deeplinkAction]];
@@ -269,8 +271,7 @@ - (BatchUserAction *)clipboardAction {
269271
id<BatchUserActionSource> _Nullable source) {
270272
NSObject *text = [arguments objectForKey:@"t"];
271273
if ([text isKindOfClass:[NSString class]]) {
272-
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
273-
pasteboard.string = (NSString *)text;
274+
self->_pasteboard.string = (NSString *)text;
274275
} else {
275276
[BALogger publicForDomain:LOGGER_DOMAIN
276277
message:@"An internal error occured while trying to perform a clipboard "

Sources/Batch/Modules/Core/BACoreCenter.m

+27-4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
#import <Batch/BAEventDispatcherCenter.h>
4141
#import <Batch/BAInjection.h>
42+
#import <Batch/BAApplicationLifecycle.h>
4243

4344
#define LOGGER_DOMAIN @"Core"
4445

@@ -439,21 +440,43 @@ - (BOOL)openUniversalLinkIfPossible:(NSURL *)URL {
439440
[BALogger debugForDomain:LOGGER_DOMAIN
440441
message:@"Transferring universal link '%@' to UIApplication", URL.absoluteString];
441442

442-
// Transferring url to application:continueUserActivity:restorationHandler
443+
// Transferring url to application:continueUserActivity:restorationHandler or scene:continueUserActivity:
443444
NSUserActivity *userActivity = [[NSUserActivity alloc] initWithActivityType:NSUserActivityTypeBrowsingWeb];
444445
userActivity.webpageURL = URL;
446+
447+
Boolean errorAlreadyLogged = false;
448+
449+
if (@available(iOS 13.0, *)) {
450+
if ([BAApplicationLifecycle applicationUsesUIScene]) {
451+
UIScene* scene = [[UIApplication sharedApplication].connectedScenes allObjects].firstObject;
452+
id<UISceneDelegate> sceneDelegate = [scene delegate];
453+
if ([sceneDelegate respondsToSelector:@selector(scene:continueUserActivity:)]) {
454+
[sceneDelegate scene:scene continueUserActivity:userActivity];
455+
return YES;
456+
} else {
457+
[BALogger debugForDomain:LOGGER_DOMAIN
458+
message:@"It looks like scene:continueUserActivity: is not "
459+
@"implemented, did you correctly add it to your SceneDelegate?"];
460+
errorAlreadyLogged = true;
461+
}
462+
}
463+
}
464+
445465
id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
446466
if ([appDelegate respondsToSelector:@selector(application:continueUserActivity:restorationHandler:)]) {
447467
[appDelegate application:[UIApplication sharedApplication]
448468
continueUserActivity:userActivity
449469
restorationHandler:nil];
450470
return YES;
451-
} else {
471+
}
472+
if (!errorAlreadyLogged) {
452473
[BALogger debugForDomain:LOGGER_DOMAIN
453474
message:@"It looks like application:continueUserActivity:restorationHandler is not "
454-
@"implemented, did you correctly add it to your AppDelegate ?"];
455-
return NO;
475+
@"implemented, did you correctly add it to your AppDelegate?"];
456476
}
477+
478+
return NO;
479+
457480
}
458481

459482
// Check for potential incompatibilities/misconfigurations, and warn the developer

Sources/Batch/Modules/Messaging/UI/BAMSGWebviewViewController.m

+9
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,15 @@ - (void)webView:(WKWebView *)webView
625625
}
626626

627627
- (void)handleNavigationError:(NSError *)error {
628+
// Ignoring iOS-specific WebKit error PlugInLoadFailed
629+
// Error fired when loading video URL without HTML container
630+
// Shortcut issue : [sc-54815]
631+
if ([error code] == 204) {
632+
[BALogger debugForDomain:BAMSGWebviewPublicLoggerDomain
633+
message:@"WKNavigationDelegate - Ignoring 204 Error (Plug-in handled load)."];
634+
return;
635+
}
636+
628637
if (_nextNavigationErrorOverride != nil) {
629638
error = _nextNavigationErrorOverride;
630639
_nextNavigationErrorOverride = nil;

Sources/Batch/Versions.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
Comments should not use the // form, as the plist preprocessor will include them
1212
*/
1313

14-
#define BASDKVersion 1.19.3
14+
#define BASDKVersion 1.19.4
1515
#define BAAPILevel 51
1616
#define BAMessagingAPILevel 12

Sources/batchTests/Modules/Actions/builtinActionsTest.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ - (void)testDeeplinkFromActions {
8686
}
8787

8888
- (void)testClipboardAction {
89+
UIPasteboard *pasteboard = [UIPasteboard pasteboardWithName:@"test-pasteboard" create:YES];
90+
[[BAActionsCenter instance] setValue:pasteboard forKey:@"_pasteboard"];
8991
[[BAActionsCenter instance] performAction:@"batch.clipboard" withArgs:@{@"t" : @"je suis un texte"} andSource:nil];
90-
91-
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
9292
XCTAssertTrue([@"je suis un texte" isEqualToString:pasteboard.string]);
9393
}
9494

0 commit comments

Comments
 (0)