Skip to content

Commit

Permalink
[FEAT] Implemented userCompletedAction() method and some minor code r…
Browse files Browse the repository at this point in the history
…efactoring.
  • Loading branch information
Renemari Padillo committed Jan 14, 2016
1 parent cb295a9 commit 9c2021f
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions src/android/BranchSDK.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
/**
* cordova.exec() method reference.
* All exec() calls goes to this part.
*
* @param action [Action name/label to execute]
* @param args [Action parameters to pass]
* @param callbackContext [Callback function]
*/
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
Expand All @@ -50,6 +54,9 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
} else if (action.equals("setIdentity")) {
this.setIdentity(args.getString(0));
return true;
} else if (action.equals("userCompletedAction")) {
this.userCompletedAction(args.getString(0));
return true;
}

return false;
Expand Down Expand Up @@ -77,7 +84,7 @@ private void initSession() {
/**
* Enable debug mode for the app.
*
* @param isEnable - Boolean flag value to enable/disable debugging mode
* @param isEnable [Boolean flag value to enable/disable debugging mode]
*/
private void setDebug(boolean isEnable) {

Expand All @@ -95,9 +102,9 @@ private void setDebug(boolean isEnable) {
/**
* Set instance identity.
*
* @param newIdentity - The identity name/identity for the current session
* @param newIdentity [The identity name/identity for the current session]
*/
private void setIdentity(string newIdentity) {
private void setIdentity(String newIdentity) {

Log.d(LCAT, "start setIdentity()");

Expand All @@ -108,6 +115,22 @@ private void setIdentity(string newIdentity) {

}

/**
* Set user completed action
*
* @param action [Name of the completed user action]
*/
private void userCompletedAction(String action) {

Log.d(LCAT, "start userCompletedAction()");

activity = this.cordova.getActivity();
instance = Branch.getInstance(activity);

instance.userCompletedAction(action);

}

//////////////////////////////////////////////////
//----------- INNER CLASS LISTENERS ------------//
//////////////////////////////////////////////////
Expand Down

0 comments on commit 9c2021f

Please sign in to comment.