Skip to content

Commit

Permalink
release: SDK 1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-roland committed Feb 21, 2023
1 parent 881025d commit 6c40e8e
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 11 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.19.3.zip",
checksum: "5a56179647f66d34c0a4532f28f68241bc1e12e7c391d9593407e47998eabc67"
url: "https://download.batch.com/sdk/ios/spm/BatchSDK-ios_spm-xcframework-1.19.4.zip",
checksum: "32b8ef5a122705f7df47054cab192cc85169bc1f98c4096fd5b640e851424608"
)
]
)
5 changes: 3 additions & 2 deletions Sources/Batch/Modules/Actions/BAActionsCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

@implementation BAActionsCenter {
NSMutableDictionary<NSString *, BatchUserAction *> *registeredActions;
UIPasteboard *_pasteboard;
}

+ (instancetype)instance {
Expand All @@ -49,6 +50,7 @@ + (instancetype)instance {
- (instancetype)init {
self = [super init];
if (self) {
_pasteboard = [UIPasteboard generalPasteboard];
registeredActions = [NSMutableDictionary new];

[self registerInternalAction:[self deeplinkAction]];
Expand Down Expand Up @@ -269,8 +271,7 @@ - (BatchUserAction *)clipboardAction {
id<BatchUserActionSource> _Nullable source) {
NSObject *text = [arguments objectForKey:@"t"];
if ([text isKindOfClass:[NSString class]]) {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = (NSString *)text;
self->_pasteboard.string = (NSString *)text;
} else {
[BALogger publicForDomain:LOGGER_DOMAIN
message:@"An internal error occured while trying to perform a clipboard "
Expand Down
31 changes: 27 additions & 4 deletions Sources/Batch/Modules/Core/BACoreCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#import <Batch/BAEventDispatcherCenter.h>
#import <Batch/BAInjection.h>
#import <Batch/BAApplicationLifecycle.h>

#define LOGGER_DOMAIN @"Core"

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

// Transferring url to application:continueUserActivity:restorationHandler
// Transferring url to application:continueUserActivity:restorationHandler or scene:continueUserActivity:
NSUserActivity *userActivity = [[NSUserActivity alloc] initWithActivityType:NSUserActivityTypeBrowsingWeb];
userActivity.webpageURL = URL;

Boolean errorAlreadyLogged = false;

if (@available(iOS 13.0, *)) {
if ([BAApplicationLifecycle applicationUsesUIScene]) {
UIScene* scene = [[UIApplication sharedApplication].connectedScenes allObjects].firstObject;
id<UISceneDelegate> sceneDelegate = [scene delegate];
if ([sceneDelegate respondsToSelector:@selector(scene:continueUserActivity:)]) {
[sceneDelegate scene:scene continueUserActivity:userActivity];
return YES;
} else {
[BALogger debugForDomain:LOGGER_DOMAIN
message:@"It looks like scene:continueUserActivity: is not "
@"implemented, did you correctly add it to your SceneDelegate?"];
errorAlreadyLogged = true;
}
}
}

id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
if ([appDelegate respondsToSelector:@selector(application:continueUserActivity:restorationHandler:)]) {
[appDelegate application:[UIApplication sharedApplication]
continueUserActivity:userActivity
restorationHandler:nil];
return YES;
} else {
}
if (!errorAlreadyLogged) {
[BALogger debugForDomain:LOGGER_DOMAIN
message:@"It looks like application:continueUserActivity:restorationHandler is not "
@"implemented, did you correctly add it to your AppDelegate ?"];
return NO;
@"implemented, did you correctly add it to your AppDelegate?"];
}

return NO;

}

// Check for potential incompatibilities/misconfigurations, and warn the developer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,15 @@ - (void)webView:(WKWebView *)webView
}

- (void)handleNavigationError:(NSError *)error {
// Ignoring iOS-specific WebKit error PlugInLoadFailed
// Error fired when loading video URL without HTML container
// Shortcut issue : [sc-54815]
if ([error code] == 204) {
[BALogger debugForDomain:BAMSGWebviewPublicLoggerDomain
message:@"WKNavigationDelegate - Ignoring 204 Error (Plug-in handled load)."];
return;
}

if (_nextNavigationErrorOverride != nil) {
error = _nextNavigationErrorOverride;
_nextNavigationErrorOverride = nil;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Batch/Versions.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
Comments should not use the // form, as the plist preprocessor will include them
*/

#define BASDKVersion 1.19.3
#define BASDKVersion 1.19.4
#define BAAPILevel 51
#define BAMessagingAPILevel 12
4 changes: 2 additions & 2 deletions Sources/batchTests/Modules/Actions/builtinActionsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ - (void)testDeeplinkFromActions {
}

- (void)testClipboardAction {
UIPasteboard *pasteboard = [UIPasteboard pasteboardWithName:@"test-pasteboard" create:YES];
[[BAActionsCenter instance] setValue:pasteboard forKey:@"_pasteboard"];
[[BAActionsCenter instance] performAction:@"batch.clipboard" withArgs:@{@"t" : @"je suis un texte"} andSource:nil];

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
XCTAssertTrue([@"je suis un texte" isEqualToString:pasteboard.string]);
}

Expand Down

0 comments on commit 6c40e8e

Please sign in to comment.