Skip to content
This repository was archived by the owner on Jan 12, 2019. It is now read-only.

Commit a03ad30

Browse files
author
Jay Patel
committed
Removed ReactContext instance
- Fixes #1
1 parent ba7cad4 commit a03ad30

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

android/src/main/java/io/card/react/ReactCardIOModule.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ public class ReactCardIOModule extends ReactContextBaseJavaModule implements Act
2323
private android.widget.Toast mostRecentToast;
2424
private static final int REQUEST_CARD_SCAN = 10;
2525

26-
private ReactApplicationContext reactContext;
2726
private Callback successCallback, failureCallback;
2827
private Promise promise;
2928

3029
public ReactCardIOModule(ReactApplicationContext reactContext) {
3130
super(reactContext);
32-
this.reactContext = reactContext;
33-
this.reactContext.addActivityEventListener(this);
31+
getReactApplicationContext().addActivityEventListener(this);
3432
}
3533

3634
@Override
@@ -52,7 +50,7 @@ public void canScan(Promise promise) throws JSONException {
5250
public void scan(ReadableMap options, Promise promise) {
5351
this.promise = promise;
5452

55-
Intent scanIntent = new Intent(this.reactContext, CardIOActivity.class);
53+
Intent scanIntent = new Intent(getReactApplicationContext(), CardIOActivity.class);
5654
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, this.getOptionBoolean(options, "requireExpiry", false)); // default: false
5755
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, this.getOptionBoolean(options, "requireCVV", false)); // default: false
5856
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, this.getOptionBoolean(options, "requirePostalCode", false)); // default: false
@@ -69,7 +67,7 @@ public void scan(ReadableMap options, Promise promise) {
6967
scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_CONFIRMATION, this.getOptionBoolean(options, "suppressConfirmation", false)); // default: false
7068
scanIntent.putExtra(CardIOActivity.EXTRA_HIDE_CARDIO_LOGO, this.getOptionBoolean(options, "hideCardIOLogo", false)); // default: false
7169

72-
this.reactContext.startActivityForResult(scanIntent, REQUEST_CARD_SCAN, null);
70+
getReactApplicationContext().startActivityForResult(scanIntent, REQUEST_CARD_SCAN, null);
7371
}
7472

7573
@Override

0 commit comments

Comments
 (0)