Skip to content

Commit 453d2d0

Browse files
committed
pre-fill phone number if available in AccountFragment
1 parent b86c83a commit 453d2d0

File tree

5 files changed

+33
-13
lines changed

5 files changed

+33
-13
lines changed

rave_android/src/main/java/com/flutterwave/raveandroid/account/AccountFragment.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ public void onAmountValidated(String amountToSet, int visibility) {
236236
amountEt.setText(amountToSet);
237237
}
238238

239+
@Override
240+
public void onPhoneNumberValidated(String phoneNumber, int visibility) {
241+
phoneTil.setVisibility(visibility);
242+
phoneEt.setText(phoneNumber);
243+
}
244+
239245
@Override
240246
public void onDataValidationSuccessful(HashMap<String, ViewObject> dataHashMap) {
241247
presenter.processTransaction(dataHashMap, ravePayInitializer);

rave_android/src/main/java/com/flutterwave/raveandroid/account/AccountUiContract.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ interface View extends AccountContract.AccountInteractor {
2626

2727
void onAmountValidated(String amountToSet, int visibility);
2828

29+
void onPhoneNumberValidated(String phoneNumber, int visibility);
30+
2931
void showDateOfBirth(int isVisible);
3032

3133
void showBVN(int isVisible);

rave_android/src/main/java/com/flutterwave/raveandroid/account/AccountUiPresenter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ public void init(RavePayInitializer ravePayInitializer) {
252252

253253
boolean isEmailValid = emailValidator.isEmailValid(ravePayInitializer.getEmail());
254254
boolean isAmountValid = amountValidator.isAmountValid(ravePayInitializer.getAmount());
255+
boolean isPhoneValid = phoneValidator.isPhoneValid(ravePayInitializer.getPhoneNumber());
255256

256257
if (isEmailValid) {
257258
mView.onEmailValidated(ravePayInitializer.getEmail(), View.GONE);
@@ -263,6 +264,11 @@ public void init(RavePayInitializer ravePayInitializer) {
263264
} else {
264265
mView.onAmountValidated("", View.VISIBLE);
265266
}
267+
if(isPhoneValid){
268+
mView.onPhoneNumberValidated(ravePayInitializer.getPhoneNumber(), View.VISIBLE);
269+
} else {
270+
mView.onPhoneNumberValidated("", View.VISIBLE);
271+
}
266272
}
267273
}
268274

rave_android/src/main/java/com/flutterwave/raveandroid/account/NullAccountView.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ public void onBanksListRetrieved(List<Bank> banks) {
1919

2020
}
2121

22+
@Override
23+
public void onPhoneNumberValidated(String phoneNumber, int visibility) {
24+
25+
}
26+
2227
@Override
2328
public void showProgressIndicator(boolean active) {
2429

rave_android/src/main/res/layout/rave_sdk_fragment_account.xml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@
7777

7878
</com.google.android.material.textfield.TextInputLayout>
7979

80+
<EditText
81+
android:id="@+id/rave_bankEditText"
82+
android:layout_width="match_parent"
83+
android:layout_height="50dp"
84+
android:layout_marginLeft="20dp"
85+
android:layout_marginTop="3dp"
86+
android:layout_marginBottom="5dp"
87+
android:layout_marginRight="20dp"
88+
android:focusableInTouchMode="false"
89+
android:longClickable="false"
90+
android:hint="@string/bank"
91+
android:inputType="numberDecimal" />
92+
93+
8094
<com.google.android.material.textfield.TextInputLayout
8195
app:boxBackgroundColor="@null"
8296
android:id="@+id/rave_accountNumberTil"
@@ -120,19 +134,6 @@
120134

121135
</com.google.android.material.textfield.TextInputLayout>
122136

123-
<EditText
124-
android:id="@+id/rave_bankEditText"
125-
android:layout_width="match_parent"
126-
android:layout_height="50dp"
127-
android:layout_marginLeft="20dp"
128-
android:layout_marginTop="3dp"
129-
android:layout_marginBottom="5dp"
130-
android:layout_marginRight="20dp"
131-
android:focusableInTouchMode="false"
132-
android:longClickable="false"
133-
android:hint="@string/bank"
134-
android:inputType="numberDecimal" />
135-
136137

137138
<EditText
138139
android:id="@+id/rave_dobEditText"

0 commit comments

Comments
 (0)