//todo send to background
private void logout(JSONArray args) {
        if (args == null || args.length() == 0) {
            return;
        }
        try {
            if (args.length() >= 5) {
                JSONArray jsonArray = args.getJSONArray(2);
                ArrayList<String> clientScopes = new ArrayList<String>();
                if (jsonArray != null) {
                    for (int i = 0; i < jsonArray.length(); i++) {
                        clientScopes.add(jsonArray.get(i).toString());
                    }
                }
                this.clientId = args.getString(0);
                this.clientSecret = args.getString(1);
                this.clientScopes = clientScopes;
                this.clientRedirectUri = args.getString(3);
                this.production = args.getBoolean(4);
                //todo send to background
                SSOHelper.logout(this.cordova.getActivity(), clientId, clientSecret, production);
                this.callbackContext.success();
            }
        } catch (JSONException e) {
            e.printStackTrace();
            callbackContext.error(e.getMessage());
        }
    }
this.clientRedirectUri = args.getString(3);
this.production = args.getBoolean(4);
//todo send to background
SSOHelper.logout(this.cordova.getActivity(), clientId, clientSecret, production);
this.callbackContext.success();
if (jsonArray != null) {
for (int i = 0; i < jsonArray.length(); i++) {
clientScopes.add(jsonArray.get(i).toString());
}
}
this.clientId = args.getString(0);
this.clientSecret = args.getString(1);
this.clientScopes = clientScopes;
this.clientRedirectUri = args.getString(3);
this.production = args.getBoolean(4);
//todo send to background
SSOHelper.logout(this.cordova.getActivity(), clientId, clientSecret, production);
this.callbackContext.success();
}
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error(e.getMessage());
}
}
private void logout(JSONArray args) {
if (args == null || args.length() == 0) {
return;
}
try {
if (args.length() >= 5) {
JSONArray jsonArray = args.getJSONArray(2);
ArrayList<String> clientScopes = new ArrayList<String>();
if (jsonArray != null) {
for (int i = 0; i < jsonArray.length(); i++) {
clientScopes.add(jsonArray.get(i).toString());
}
}
this.clientId = args.getString(0);
this.clientSecret = args.getString(1);
this.clientScopes = clientScopes;
this.clientRedirectUri = args.getString(3);
this.production = args.getBoolean(4);
//todo send to background
SSOHelper.logout(this.cordova.getActivity(), clientId, clientSecret, production);
this.callbackContext.success();
}
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error(e.getMessage());
}
}