Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Commit

Permalink
refactor(MainActivity.java): Move cardInfo for stripe into 'createStr…
Browse files Browse the repository at this point in the history
…ipeToken' and implement listene

re #16 re #17
  • Loading branch information
wesharper committed Nov 29, 2018
1 parent dc986ba commit 8802613
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions android/app/src/main/java/com/example/snuze/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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());
}
}
}
);
}
}

0 comments on commit 8802613

Please sign in to comment.