Skip to content

Commit

Permalink
[FIX] Removed some callbacks for methods that doesn't need one. Updat…
Browse files Browse the repository at this point in the history
…ed testbed app.
  • Loading branch information
renesansz committed Jan 26, 2016
1 parent 78242c4 commit 0056944
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 49 deletions.
12 changes: 6 additions & 6 deletions src/android/io/branch/BranchSDK.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
} else if (action.equals("redeemRewards")) {
this.redeemRewards(args.getInt(0));
return true;
} else if (action.equals("creditHistory")) {
this.creditHistory();
} else if (action.equals("getCreditHistory")) {
this.getCreditHistory();
return true;
} else if (action.equals("createBranchUniversalObject")) {
this.createBranchUniversalObject(args.getJSONObject(0));
Expand Down Expand Up @@ -587,7 +587,7 @@ private void userCompletedAction(String action, JSONObject metaData)
* <p>Gets the credit history of the specified bucket and triggers a callback to handle the
* response.</p>
*/
private void creditHistory()
private void getCreditHistory()
{

Log.d(LCAT, "start creditHistory()");
Expand Down Expand Up @@ -717,7 +717,7 @@ public void onLinkCreate(String url, BranchError error) {
return;
}

Log.d(LCAT, result.toString());
Log.d(LCAT, response.toString());
callbackContext.success(response);

} else {
Expand All @@ -733,7 +733,7 @@ public void onLinkCreate(String url, BranchError error) {
return;
}

Log.d(LCAT, result.toString());
Log.d(LCAT, response.toString());
callbackContext.error(response);

}
Expand Down Expand Up @@ -786,7 +786,7 @@ public void onLinkShareResponse(String sharedLink, String sharedChannel, BranchE
}
}

Log.d(LCAT, result.toString());
Log.d(LCAT, response.toString());

}

Expand Down
58 changes: 15 additions & 43 deletions testbed/www/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var app = {
}

SetDebug(true);
InitSession();

}
};
Expand All @@ -56,27 +57,19 @@ function SetDebug(isEnabled)
{
console.log('Trigger SetDebug()');

Branch.setDebug(isEnabled).then(function (res) {
console.log(res);
alert('Success: ' + JSON.stringify(res));
InitSession();
}).catch(function (err) {
console.error('Set debug fail: ' + err);
alert('Set debug fail: ' + err);
});
Branch.setDebug(isEnabled);

alert('Debug mode enabled');
}

function InitSession()
{
console.log('Trigger InitSession()');

Branch.initSession().then(function (res) {
console.log("Initialized Successfully:" + JSON.stringify(res));
alert('Success: ' + JSON.stringify(res));
}).catch(function (err) {
console.error('Error: ' + err);
alert('Error: ' + JSON.stringify(err));
});
Branch.initSession();

alert('Initialized Success');

}

function CustomAction()
Expand All @@ -85,13 +78,7 @@ function CustomAction()

var action = document.getElementById('custom-action').value;

Branch.userCompletedAction(action).then(function (res) {
console.log(res);
alert('Success: ' + JSON.stringify(res));
}).catch(function (err) {
console.error(err);
alert('Error: ' + JSON.stringify(err));
});
Branch.userCompletedAction(action);
}

function GetLatestReferringParams()
Expand Down Expand Up @@ -139,13 +126,9 @@ function Logout()
{
console.log('Trigger Logout()');

Branch.logout().then(function (res) {
console.log(res);
alert('Success: ' + JSON.stringify(res));
}).catch(function (err) {
console.error(err);
alert('Error: ' + JSON.stringify(err));
});
Branch.logout();

alert('Logout');
}

var branchUniversalObj = null;
Expand Down Expand Up @@ -181,14 +164,9 @@ function RegisterView()
{
console.log('Trigger RegisterView()');

Branch.registerView().then(function (res) {
console.log(res);
alert('Success: ' + JSON.stringify(res));
}).catch(function (err) {
console.error(err);
alert('Error: ' + JSON.stringify(err));
});
Branch.registerView();

alert('Success');
}

function GenerateShortUrl()
Expand Down Expand Up @@ -244,13 +222,7 @@ function ShowShareSheet()
$windows_phone_url: 'win-phone'
};

Branch.showShareSheet(properties, controlParams).then(function (res) {
console.log(res);
alert('Success: ' + JSON.stringify(res));
}).catch(function (err) {
console.error(err);
alert('Error: ' + JSON.stringify(err));
});
Branch.showShareSheet(properties, controlParams);
}

function ListOnSpotlight()
Expand Down

0 comments on commit 0056944

Please sign in to comment.