diff --git a/android/src/main/java/com/onesignal/flutter/OneSignalUser.java b/android/src/main/java/com/onesignal/flutter/OneSignalUser.java index 54d59a6..09d6f5e 100644 --- a/android/src/main/java/com/onesignal/flutter/OneSignalUser.java +++ b/android/src/main/java/com/onesignal/flutter/OneSignalUser.java @@ -54,10 +54,11 @@ else if (call.method.contentEquals("OneSignal#removeTags")) private void setLanguage(MethodCall call, Result result) { String language = call.argument("language"); - if (language != null && language.length() == 0) - language = null; - - OneSignal.getUser().setLanguage(language); + if (language != null && language.length() == 0) { + language = null; + } + OneSignal.getUser().setLanguage(language); + replySuccess(result, null); } private void addAliases(MethodCall call, Result result) { @@ -65,6 +66,7 @@ private void addAliases(MethodCall call, Result result) { // a ClassCastException will be thrown try { OneSignal.getUser().addAliases((Map) call.arguments); + replySuccess(result, null); } catch(ClassCastException e) { replyError(result, "OneSignal", "addAliases failed with error: " + e.getMessage() + "\n" + e.getStackTrace(), null); } @@ -75,6 +77,7 @@ private void removeAliases(MethodCall call, Result result) { // a ClassCastException will be thrown try { OneSignal.getUser().removeAliases((List) call.arguments); + replySuccess(result, null); } catch(ClassCastException e) { replyError(result, "OneSignal", "removeAliases failed with error: " + e.getMessage() + "\n" + e.getStackTrace(), null); } @@ -83,27 +86,29 @@ private void removeAliases(MethodCall call, Result result) { private void addEmail(MethodCall call, Result result) { OneSignal.getUser().addEmail((String) call.arguments); replySuccess(result, null); - } + } - private void removeEmail(MethodCall call, Result result) { + private void removeEmail(MethodCall call, Result result) { OneSignal.getUser().removeEmail((String) call.arguments); replySuccess(result, null); - } + } - private void addSms(MethodCall call, Result result) { + private void addSms(MethodCall call, Result result) { OneSignal.getUser().addSms((String) call.arguments); replySuccess(result, null); - } + } - private void removeSms(MethodCall call, Result result) { + private void removeSms(MethodCall call, Result result) { OneSignal.getUser().removeSms((String) call.arguments); replySuccess(result, null); - } - private void addTags(MethodCall call, Result result) { + } + + private void addTags(MethodCall call, Result result) { // call.arguments is being casted to a Map so a try-catch with // a ClassCastException will be thrown try { OneSignal.getUser().addTags((Map) call.arguments); + replySuccess(result, null); } catch(ClassCastException e) { replyError(result, "OneSignal", "addTags failed with error: " + e.getMessage() + "\n" + e.getStackTrace(), null); } @@ -114,10 +119,9 @@ private void removeTags(MethodCall call, Result result) { // a ClassCastException will be thrown try { OneSignal.getUser().removeTags((List) call.arguments); + replySuccess(result, null); } catch(ClassCastException e) { replyError(result, "OneSignal", "deleteTags failed with error: " + e.getMessage() + "\n" + e.getStackTrace(), null); } } - - }