From 88026134515f27a26b4e05314a057d2a26b15e1f Mon Sep 17 00:00:00 2001 From: Weston Harper Date: Thu, 29 Nov 2018 10:20:09 -0700 Subject: [PATCH] refactor(MainActivity.java): Move cardInfo for stripe into 'createStripeToken' and implement listene re #16 re #17 --- .../java/com/example/snuze/MainActivity.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/java/com/example/snuze/MainActivity.java b/android/app/src/main/java/com/example/snuze/MainActivity.java index 2e65e8c..ae5c798 100644 --- a/android/app/src/main/java/com/example/snuze/MainActivity.java +++ b/android/app/src/main/java/com/example/snuze/MainActivity.java @@ -57,10 +57,8 @@ protected void onCreate(Bundle savedInstanceState) { new MethodCallHandler() { @Override public void onMethodCall(MethodCall call, final Result result) { - System.out.println(call.arguments().toString()); - JSONObject cardInfo = newJSONObject(call.arguments().toString()); - System.out.println(cardInfo); if (call.method.equals("createStripeToken")) { + JSONObject cardInfo = newJSONObject(call.arguments().toString()); Card card = createCard(cardInfo); if (!card.validateCard()) { System.out.println("invalid card format"); @@ -87,5 +85,19 @@ public void onError(Exception error) { } } ); + new MethodChannel(getFlutterView(), ALARM_CHANNEL).setMethodCallHandler( + new MethodCallHandler() { + @Override + public void onMethodCall(MethodCall call, Result result) { + if (call.method.equals("setAlarm")) { + System.out.println("SETTING ALARM"); + System.out.println(call.arguments().toString()); + } else if (call.method.equals("cancelAlarm")) { + System.out.println("CANCELLING ALARM"); + System.out.println(call.arguments().toString()); + } + } + } + ); } }