Skip to content

Commit

Permalink
[FIX] Share share callbacks should be disregarded in iOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Renemari Padillo committed Apr 3, 2016
1 parent d1a3120 commit c1121d9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/ios/BranchSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ - (void)registerView:(CDVInvokedUrlCommand*)command
- (void)generateShortUrl:(CDVInvokedUrlCommand*)command
{
NSLog(@"start generateShortUrl");
NSDictionary *arg1 = [command.arguments objectAtIndex:0];
NSDictionary *arg2 = [command.arguments objectAtIndex:1];
NSDictionary *arg1 = [command.arguments objectAtIndex:1];
NSDictionary *arg2 = [command.arguments objectAtIndex:2];

BranchLinkProperties *props = [[BranchLinkProperties alloc] init];

Expand Down Expand Up @@ -508,12 +508,12 @@ - (void)showShareSheet:(CDVInvokedUrlCommand*)command
NSLog(@"start showShareSheet");
NSString *shareText = @"Share Link";

if ([command.arguments count] >= 3) {
shareText = [command.arguments objectAtIndex:2];
if ([command.arguments count] >= 4) {
shareText = [command.arguments objectAtIndex:3];
}

NSDictionary *arg1 = [command.arguments objectAtIndex:0];
NSDictionary *arg2 = [command.arguments objectAtIndex:1];
NSDictionary *arg1 = [command.arguments objectAtIndex:1];
NSDictionary *arg2 = [command.arguments objectAtIndex:2];

BranchLinkProperties *linkProperties = [[BranchLinkProperties alloc] init];

Expand Down
22 changes: 16 additions & 6 deletions www/branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* All methods are promisified, therefore you can call .then(successCallback, errorCallback) for any of the method
* called for executing success or error callbacks.
*/

var exec = require('cordova/exec');
var deviceVendor = window.clientInformation.vendor;
var _API_CLASS = 'BranchSDK'; // SDK Class

/**
Expand Down Expand Up @@ -286,14 +288,18 @@ Branch.prototype.createBranchUniversalObject = function (options) {
* @param (Function) callback
*/
obj.onShareSheetLaunched = function (callback) {

executeCallback('onShareLinkDialogLaunched', callback, [obj.instanceId]);

if (deviceVendor.indexOf('Apple') < 0) {
executeCallback('onShareLinkDialogLaunched', callback, [obj.instanceId]);
}

};

obj.onShareSheetDismissed = function (callback) {

executeCallback('onShareLinkDialogDismissed', callback, [obj.instanceId]);
if (deviceVendor.indexOf('Apple') < 0) {
executeCallback('onShareLinkDialogDismissed', callback, [obj.instanceId]);
}

}

Expand All @@ -304,7 +310,9 @@ Branch.prototype.createBranchUniversalObject = function (options) {
*/
obj.onLinkShareResponse = function (callback) {

executeCallback('onLinkShareResponse', callback, [obj.instanceId]);
if (deviceVendor.indexOf('Apple') < 0) {
executeCallback('onLinkShareResponse', callback, [obj.instanceId]);
}

};

Expand All @@ -314,8 +322,10 @@ Branch.prototype.createBranchUniversalObject = function (options) {
* @param (Function) callback
*/
obj.onChannelSelected = function (callback) {

executeCallback('onChannelSelected', callback, [obj.instanceId]);

if (deviceVendor.indexOf('Apple') < 0) {
executeCallback('onChannelSelected', callback, [obj.instanceId]);
}

};

Expand Down

0 comments on commit c1121d9

Please sign in to comment.