Browse Source

Merge branch 'UIChanges' into MYRewards

new_design
Mukesh Dhungana 2 years ago
parent
commit
7508647b37
  1. 7
      app/src/main/java/com/remit/jmecustomer/common/customwidgets/CustomAlertDialog.java
  2. 11
      app/src/main/java/com/remit/jmecustomer/features/home/model/HomeViewRelatedDTOV2.java
  3. 2
      app/src/main/java/com/remit/jmecustomer/features/home/presenter/HomeV2PresenterInterface.java
  4. 7
      app/src/main/java/com/remit/jmecustomer/features/home/presenter/HomeViewModel.java
  5. 15
      app/src/main/java/com/remit/jmecustomer/features/home/view/HomeActivityV2.java
  6. 3
      app/src/main/java/com/remit/jmecustomer/features/home/view/HomeFragmentV2.java
  7. 15
      app/src/main/java/com/remit/jmecustomer/features/mynotifications/presenter/MyNotificationViewModel.java
  8. 4
      app/src/main/java/com/remit/jmecustomer/features/mynotifications/view/MyNotificationListingFragment.java

7
app/src/main/java/com/remit/jmecustomer/common/customwidgets/CustomAlertDialog.java

@ -64,10 +64,11 @@ public class CustomAlertDialog extends DialogFragment {
break; break;
case FAILED: case FAILED:
String walletNumber = RemitApplication.getStorage().getString(PrefKeys.USER_WALLET_NUMBER, "");
//String walletNumber = RemitApplication.getStorage().getString(PrefKeys.USER_WALLET_NUMBER, "");
String memberShipId = RemitApplication.getStorage().getString(PrefKeys.USER_REFERRAL_CODE, "");
String message = getString(R.string.error_text); String message = getString(R.string.error_text);
if (walletNumber.length() > 0)
message += " - (" + walletNumber + ")";
if (memberShipId.length() > 0)
message += " - (" + memberShipId + ")";
dialogTitleTxt.setText(message); dialogTitleTxt.setText(message);
logo = AnimatedVectorDrawableCompat.create(getActivity(), R.drawable.avd_fail_transition); logo = AnimatedVectorDrawableCompat.create(getActivity(), R.drawable.avd_fail_transition);
break; break;

11
app/src/main/java/com/remit/jmecustomer/features/home/model/HomeViewRelatedDTOV2.java

@ -12,7 +12,7 @@ public class HomeViewRelatedDTOV2 {
private String availableBalance; private String availableBalance;
private String rewardPoint; private String rewardPoint;
private String referralCode; private String referralCode;
private String notificationCount;
public HomeViewRelatedDTOV2(boolean shouldShowKycView, String kycMessage, String kycTitle, boolean disableKYCViewClick, String userName, String availableBalance, String rewardPoint, boolean isPennyTestPending, boolean hasRequestedPennyTest, String pennyTestTitle, String pennyTestMessage, boolean shouldShowAutoDebitNotice, String autoDebitTitle, String autoDebitBody) { public HomeViewRelatedDTOV2(boolean shouldShowKycView, String kycMessage, String kycTitle, boolean disableKYCViewClick, String userName, String availableBalance, String rewardPoint, boolean isPennyTestPending, boolean hasRequestedPennyTest, String pennyTestTitle, String pennyTestMessage, boolean shouldShowAutoDebitNotice, String autoDebitTitle, String autoDebitBody) {
@ -22,7 +22,7 @@ public class HomeViewRelatedDTOV2 {
} }
public HomeViewRelatedDTOV2(String userName, String availableBalance,String yearlyLimit, String rewardPoint , String bankName,String walletNo, HomeNotificationViewDTO homeNotificationViewDTO,boolean shouldShowTermsAndCondition,String referralCode) {
public HomeViewRelatedDTOV2(String userName, String availableBalance, String yearlyLimit, String rewardPoint, String bankName, String walletNo, HomeNotificationViewDTO homeNotificationViewDTO, boolean shouldShowTermsAndCondition, String referralCode, String notificationCount) {
this.userName = userName; this.userName = userName;
this.availableBalance = availableBalance; this.availableBalance = availableBalance;
this.yearlyLimit = yearlyLimit; this.yearlyLimit = yearlyLimit;
@ -33,7 +33,9 @@ public class HomeViewRelatedDTOV2 {
this.walletNo = walletNo; this.walletNo = walletNo;
this.shouldShowTermsAndCondition = shouldShowTermsAndCondition; this.shouldShowTermsAndCondition = shouldShowTermsAndCondition;
this.referralCode = referralCode; this.referralCode = referralCode;
this.notificationCount = notificationCount;
} }
public String getUserName() { public String getUserName() {
return userName; return userName;
} }
@ -47,7 +49,6 @@ public class HomeViewRelatedDTOV2 {
} }
public HomeNotificationViewDTO getHomeNotificationViewDTO() { public HomeNotificationViewDTO getHomeNotificationViewDTO() {
return homeNotificationViewDTO; return homeNotificationViewDTO;
} }
@ -71,4 +72,8 @@ public class HomeViewRelatedDTOV2 {
public String getReferralCode() { public String getReferralCode() {
return referralCode; return referralCode;
} }
public String getNotificationCount() {
return notificationCount;
}
} }

2
app/src/main/java/com/remit/jmecustomer/features/home/presenter/HomeV2PresenterInterface.java

@ -41,6 +41,7 @@ public interface HomeV2PresenterInterface extends BasePresenterInterface {
void setNewToken(String newToken); void setNewToken(String newToken);
void showChangedNotification(String noticeCount);
LiveData<HomeViewRelatedDTOV2> subscribeToHomeRelatedDataEvent(); LiveData<HomeViewRelatedDTOV2> subscribeToHomeRelatedDataEvent();
@ -75,6 +76,7 @@ public interface HomeV2PresenterInterface extends BasePresenterInterface {
void showFingerprintAvailablityToUser(); void showFingerprintAvailablityToUser();
void showChangedNotification(String noticeCount);
} }
} }

7
app/src/main/java/com/remit/jmecustomer/features/home/presenter/HomeViewModel.java

@ -121,6 +121,10 @@ public class HomeViewModel extends BaseViewModel implements HomeV2PresenterInter
} }
} }
@Override
public void showChangedNotification(String noticeCount) {
view.showChangedNotification(noticeCount);
}
@Override @Override
public void postEmailCodeToVerify(String OTP) { public void postEmailCodeToVerify(String OTP) {
@ -303,7 +307,8 @@ public class HomeViewModel extends BaseViewModel implements HomeV2PresenterInter
userInfoModelV2.getWalletNumber(), userInfoModelV2.getWalletNumber(),
notificationViewDTO, notificationViewDTO,
shouldShowTermsAndCondition, shouldShowTermsAndCondition,
userInfoModelV2.getReferralCode()
userInfoModelV2.getReferralCode(),
userInfoModelV2.getNotificationCount()
)); ));
//If no notification is generated then we can show privileged Operation View //If no notification is generated then we can show privileged Operation View

15
app/src/main/java/com/remit/jmecustomer/features/home/view/HomeActivityV2.java

@ -130,8 +130,10 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra
ImageView iv_close; ImageView iv_close;
@BindView(R.id.content_view) @BindView(R.id.content_view)
ViewGroup content_view; ViewGroup content_view;
@BindView(R.id.notificationCountTxtView) @BindView(R.id.notificationCountTxtView)
TextView notificationCountTxtView; TextView notificationCountTxtView;
private Fragment currentFragment; private Fragment currentFragment;
private FragmentManager manager; private FragmentManager manager;
// private HomeV2PresenterInterface presenter; // private HomeV2PresenterInterface presenter;
@ -164,11 +166,6 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra
RemitApplication.getStorage().edit().putString(PrefKeys.USER_FCM_ID, token); RemitApplication.getStorage().edit().putString(PrefKeys.USER_FCM_ID, token);
} }
}); });
String noticeCount = RemitApplication.getStorage().getString(PrefKeys.NOTIFICATION_COUNT, "");
if (!noticeCount.isEmpty()) {
notificationCountTxtView.setText(RemitApplication.getStorage().getString(PrefKeys.NOTIFICATION_COUNT, ""));
notificationCountTxtView.setVisibility(View.VISIBLE);
}
} }
private void performDefaultAction(Bundle savedInstanceState) { private void performDefaultAction(Bundle savedInstanceState) {
@ -702,5 +699,13 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra
showExitConfirmationDialog(); showExitConfirmationDialog();
} }
} }
@Override
public void showChangedNotification(String noticeCount) {
if (!noticeCount.isEmpty()) {
notificationCountTxtView.setText(RemitApplication.getStorage().getString(PrefKeys.NOTIFICATION_COUNT, ""));
notificationCountTxtView.setVisibility(View.VISIBLE);
}
}
} }

3
app/src/main/java/com/remit/jmecustomer/features/home/view/HomeFragmentV2.java

@ -22,6 +22,8 @@ import androidx.transition.Transition;
import androidx.transition.TransitionListenerAdapter; import androidx.transition.TransitionListenerAdapter;
import androidx.transition.TransitionManager; import androidx.transition.TransitionManager;
import com.remit.jmecustomer.RemitApplication;
import com.remit.jmecustomer.base.PrefKeys;
import com.remit.jmecustomer.features.home.adapters.HomeMenuRvAdapterV2; import com.remit.jmecustomer.features.home.adapters.HomeMenuRvAdapterV2;
import com.remit.jmecustomer.features.home.model.HomeNotificationViewDTO; import com.remit.jmecustomer.features.home.model.HomeNotificationViewDTO;
import com.remit.jmecustomer.features.home.model.HomeViewRelatedDTOV2; import com.remit.jmecustomer.features.home.model.HomeViewRelatedDTOV2;
@ -234,6 +236,7 @@ public class HomeFragmentV2 extends BaseFragment implements
tv_namelabel.setText(homeViewRelatedDTOV2.getUserName()); tv_namelabel.setText(homeViewRelatedDTOV2.getUserName());
tv_yearly_remaining.setText(homeViewRelatedDTOV2.getAvailableBalance()); tv_yearly_remaining.setText(homeViewRelatedDTOV2.getAvailableBalance());
tv_wallet_no.setText(homeViewRelatedDTOV2.getReferralCode()); tv_wallet_no.setText(homeViewRelatedDTOV2.getReferralCode());
homeViewModel.showChangedNotification(homeViewRelatedDTOV2.getNotificationCount());
} }

15
app/src/main/java/com/remit/jmecustomer/features/mynotifications/presenter/MyNotificationViewModel.java

@ -246,15 +246,18 @@ public class MyNotificationViewModel extends BaseViewModel implements MyNotifica
} }
} }
public class UpdateNoticeObserver extends GenericApiObserverResponseV2<List<MyNotificationDTO>> {
@Override
protected Type getDataType() {
return TypeToken.getParameterized(UpdateNoticeObserver.class).getType();
}
public class UpdateNoticeObserver extends GenericApiObserverResponseV2<MyNotificationDTO> {
@Override @Override
protected void onSuccess(GenericResponseDataModel<List<MyNotificationDTO>> t) {
protected void onSuccess(GenericResponseDataModel<MyNotificationDTO> t) {
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) {
List<MyNotificationDTO> list = noticeListLiveData.getValue();
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getRowId().equals(selectedNotice.getRowId())) {
list.get(i).setIsRead("1");
}
}
noticeListLiveData.setValue(list);
//noticeListLiveData.setValue(t.); //noticeListLiveData.setValue(t.);
} else { } else {
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null);

4
app/src/main/java/com/remit/jmecustomer/features/mynotifications/view/MyNotificationListingFragment.java

@ -73,11 +73,11 @@ public class MyNotificationListingFragment extends BaseFragment implements MyNot
} }
private void handleNoticeClicked(MyNotificationDTO itemModel) { private void handleNoticeClicked(MyNotificationDTO itemModel) {
if (itemModel.getIsClickable() != null && itemModel.getIsClickable().equals("Y")) {
new ViewModelProvider(getActivity()).get(MyNotificationViewModel.class).updateNotification(itemModel.getRowId());
if (itemModel.getIsClickable() != null && itemModel.getIsClickable().equals("Y") && !itemModel.getUrl().isEmpty()) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(itemModel.getUrl())); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(itemModel.getUrl()));
startActivity(browserIntent); startActivity(browserIntent);
} }
new ViewModelProvider(getActivity()).get(MyNotificationViewModel.class).updateNotification(itemModel.getRowId());
// if (itemModel.getType().equals("0")) { // if (itemModel.getType().equals("0")) {
// new ViewModelProvider(getActivity()).get(MyNotificationViewModel.class).fetchNoticeDetail(itemModel); // new ViewModelProvider(getActivity()).get(MyNotificationViewModel.class).fetchNoticeDetail(itemModel);
// } else if (itemModel.getType().equals("1")) { // } else if (itemModel.getType().equals("1")) {

Loading…
Cancel
Save