Skip to content

Commit 473b72a

Browse files
author
hamzat@flutterwave.com
committed
mask cvv, hide the saved cards button in case they're no saved cards
1 parent a01c960 commit 473b72a

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

raveandroid/src/main/java/com/flutterwave/raveandroid/card/CardContract.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ interface View {
4343
void displayFee(String charge_amount, Payload payload, int why);
4444

4545
void showFetchFeeFailed(String s);
46+
47+
void hideSavedCardsButton();
4648
}
4749

4850
interface UserActionsListener {
@@ -65,6 +67,8 @@ interface UserActionsListener {
6567
void saveThisCard(String email, String flwRef, String secretKey);
6668

6769
void fetchFee(Payload payload, int reason);
70+
71+
void checkForSavedCards(String email);
6872
}
6973

7074
}

raveandroid/src/main/java/com/flutterwave/raveandroid/card/CardFragment.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
124124
pcidss_tv = (TextView) v.findViewById(R.id.pcidss_compliant_tv);
125125
progressContainer = (FrameLayout) v.findViewById(R.id.progressContainer);
126126

127+
ravePayInitializer = ((RavePayActivity) getActivity()).getRavePayInitializer();
127128

128129
TransformFilter filter = new TransformFilter() {
129130
public final String transformUrl(final Matcher match, String url) {
@@ -151,6 +152,8 @@ public void onClick(View v) {
151152
}
152153
});
153154

155+
presenter.checkForSavedCards(ravePayInitializer.getEmail());
156+
154157
savedCardBtn.setOnClickListener(new View.OnClickListener() {
155158
@Override
156159
public void onClick(View v) {
@@ -190,7 +193,6 @@ public void onDialogExpirationSet(int reference, int year, int monthOfYear) {
190193
bottomSheetBehaviorOTP = BottomSheetBehavior.from(otpLayout);
191194
bottomSheetBehaviorVBV = BottomSheetBehavior.from(vbvLayout);
192195

193-
ravePayInitializer = ((RavePayActivity) getActivity()).getRavePayInitializer();
194196

195197
if (Utils.isEmailValid(ravePayInitializer.getEmail())) {
196198
emailTil.setVisibility(GONE);
@@ -729,6 +731,11 @@ public void showFetchFeeFailed(String s) {
729731
showToast(s);
730732
}
731733

734+
@Override
735+
public void hideSavedCardsButton() {
736+
savedCardBtn.setVisibility(GONE);
737+
}
738+
732739
// Manages the behavior when URLs are loaded
733740
private class MyBrowser extends WebViewClient {
734741
@SuppressWarnings("deprecation")

raveandroid/src/main/java/com/flutterwave/raveandroid/card/CardPresenter.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,17 @@ public void onError(String message) {
302302

303303
}
304304

305+
@Override
306+
public void checkForSavedCards(String email) {
307+
SharedPrefsRequestImpl sharedMgr = new SharedPrefsRequestImpl(context);
308+
309+
List<SavedCard> cards = sharedMgr.getSavedCards(email);
310+
311+
if (cards == null || cards.size() == 0) {
312+
mView.hideSavedCardsButton();
313+
}
314+
}
315+
305316
@Override
306317
public void requeryTxForToken(final String flwRef, final String SECKEY) {
307318

raveandroid/src/main/res/layout/fragment_card.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
android:layout_width="match_parent"
118118
android:layout_height="wrap_content"
119119
android:hint="@string/cvc_cvv2"
120-
android:inputType="number"
120+
android:inputType="numberPassword"
121121
android:maxLength="4"
122122
android:id="@+id/cvvTv"
123123
android:imeOptions="actionDone"

0 commit comments

Comments
 (0)