Skip to content

Commit

Permalink
sending universal link to WebSDK
Browse files Browse the repository at this point in the history
  • Loading branch information
John Saleigh committed Nov 4, 2015
1 parent 83e3306 commit a1d5c0a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions cordova-src/ios/BNCDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

- (void)getInstallData:(CDVInvokedUrlCommand *)command;
- (void)getOpenData:(CDVInvokedUrlCommand *)command;
- (BOOL)handleUserActivity:(NSUserActivity *)userActivity;

+ (NSString *)getUniqueHardwareId:(BOOL *)isReal andIsDebug:(BOOL)debug;
+ (NSString *)getURIScheme;
Expand Down
13 changes: 13 additions & 0 deletions cordova-src/ios/BNCDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@implementation BNCDevice

static NSString *link_click_identifier = nil;
static NSString *universal_link_url = nil;

- (void)pluginInitialize {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenUrl:) name:CDVPluginHandleOpenURLNotification object:nil];
Expand Down Expand Up @@ -79,6 +80,9 @@ - (void)getInstallData:(CDVInvokedUrlCommand *)command {
} else {
[post setObject:[NSNumber numberWithInt:isReferrable] forKey:@"is_referrable"];
}
if (universal_link_url) {
[post setObject:universal_link_url forKey:@"universal_link_url"];
}

CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:post];
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
Expand All @@ -103,12 +107,21 @@ - (void)getOpenData:(CDVInvokedUrlCommand *)command {
[post setObject:[NSNumber numberWithInt:isReferrable] forKey:@"is_referrable"];
}
if (link_click_identifier) [post setObject:link_click_identifier forKey:@"link_identifier"];
if (universal_link_url) {
[post setObject:universal_link_url forKey:@"universal_link_url"];
}

CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:post];
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
}


- (BOOL)handleUserActivity:(NSUserActivity *)userActivity {
universal_link_url = [userActivity.webpageURL absoluteString];

return YES;
}

+ (NSString *)getUniqueHardwareId:(BOOL *)isReal andIsDebug:(BOOL)debug {
NSString *uid = nil;
*isReal = YES;
Expand Down
2 changes: 2 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<param name="onload" value="true" />
</feature>
</config-file>
<header-file src="cordova-src/ios/AppDelegate+BNCDevice.h" />
<source-file src="cordova-src/ios/AppDelegate+BNCDevice.m" />
<header-file src="cordova-src/ios/BNCDevice.h" />
<source-file src="cordova-src/ios/BNCDevice.m" />
</platform>
Expand Down

0 comments on commit a1d5c0a

Please sign in to comment.