|
|
@ -1,21 +1,17 @@ |
|
|
|
package com.gmeremit.online.gmeremittance_native.homeV2.view; |
|
|
|
|
|
|
|
import android.app.AlarmManager; |
|
|
|
import android.app.PendingIntent; |
|
|
|
import android.content.Context; |
|
|
|
import android.content.DialogInterface; |
|
|
|
import android.content.Intent; |
|
|
|
import android.content.res.Configuration; |
|
|
|
import android.content.res.Resources; |
|
|
|
import android.graphics.Color; |
|
|
|
import android.os.Build; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.os.Handler; |
|
|
|
import android.support.annotation.Nullable; |
|
|
|
import android.support.annotation.RequiresApi; |
|
|
|
import android.support.design.widget.NavigationView; |
|
|
|
import android.support.v4.app.Fragment; |
|
|
|
import android.support.v4.app.FragmentManager; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.support.v4.content.ContextCompat; |
|
|
|
import android.support.v4.widget.DrawerLayout; |
|
|
|
import android.support.v7.app.AlertDialog; |
|
|
@ -39,27 +35,29 @@ import com.gmeremit.online.gmeremittance_native.homeV2.presenter.HomeV2Presenter |
|
|
|
import com.gmeremit.online.gmeremittance_native.homeV2.presenter.HomeV2PresenterInterface; |
|
|
|
import com.gmeremit.online.gmeremittance_native.int_notification.view.IntNotificationView; |
|
|
|
import com.gmeremit.online.gmeremittance_native.recipientV2.view.recipientlisting.RecipientListingV2Activity; |
|
|
|
import com.gmeremit.online.gmeremittance_native.resendV2.view.ReSendMoneyV2Activity; |
|
|
|
import com.gmeremit.online.gmeremittance_native.resendV2.view.TransactionListingV2Activity; |
|
|
|
import com.gmeremit.online.gmeremittance_native.resetpassV2.view.ResetPassV2Activity; |
|
|
|
import com.gmeremit.online.gmeremittance_native.settings.view.FingerprintEnablePromptActivity; |
|
|
|
import com.gmeremit.online.gmeremittance_native.settings.view.SettingsView; |
|
|
|
import com.gmeremit.online.gmeremittance_native.static_pages.view.AboutGME; |
|
|
|
import com.gmeremit.online.gmeremittance_native.static_pages.view.SupportActivity; |
|
|
|
import com.gmeremit.online.gmeremittance_native.transactionhistoryV2.view.TransactionHistoryActivityV2; |
|
|
|
import com.gmeremit.online.gmeremittance_native.transactionpasspromt.view.TransactionBiometricPromptDialog; |
|
|
|
import com.gmeremit.online.gmeremittance_native.user_profile.view.ProfileActivity; |
|
|
|
import com.gmeremit.online.gmeremittance_native.utils.Utils; |
|
|
|
import com.gmeremit.online.gmeremittance_native.walletstatementV2.view.WalletStatementV2Activity; |
|
|
|
import com.gmeremit.online.gmeremittance_native.withdrawV2.view.WithdrawV2Activity; |
|
|
|
import com.text.drawable.TextDrawable; |
|
|
|
|
|
|
|
import java.util.Locale; |
|
|
|
import com.zoyi.channel.plugin.android.ChannelIO; |
|
|
|
import com.zoyi.channel.plugin.android.ChannelPluginCompletionStatus; |
|
|
|
import com.zoyi.channel.plugin.android.ChannelPluginListener; |
|
|
|
import com.zoyi.channel.plugin.android.Guest; |
|
|
|
import com.zoyi.channel.plugin.android.OnBootListener; |
|
|
|
import com.zoyi.channel.plugin.android.model.etc.PushEvent; |
|
|
|
|
|
|
|
import butterknife.BindView; |
|
|
|
import butterknife.ButterKnife; |
|
|
|
import butterknife.OnClick; |
|
|
|
|
|
|
|
import static com.zoyi.channel.plugin.android.ChannelPluginCompletionStatus.SUCCESS; |
|
|
|
|
|
|
|
|
|
|
|
public class HomeActivityV2 extends BaseActivity implements HomeParentViewContractV2, HomeV2PresenterInterface.HomeV2ContractInterface { |
|
|
|
|
|
|
@ -77,7 +75,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
TextView btn_withdraw; |
|
|
|
@BindView(R.id.view_about_gme) |
|
|
|
View about_gme; |
|
|
|
// @BindView(R.id.view_support) |
|
|
|
// @BindView(R.id.view_support) |
|
|
|
// View support; |
|
|
|
@BindView(R.id.view_setting) |
|
|
|
View settings; |
|
|
@ -86,12 +84,16 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
@BindView(R.id.iv_close) |
|
|
|
ImageView iv_close; |
|
|
|
|
|
|
|
@BindView(R.id.notificationCounterTxtView) |
|
|
|
TextView notificationCounterTxtView; |
|
|
|
|
|
|
|
private Fragment currentFragment; |
|
|
|
private FragmentManager manager; |
|
|
|
private HomeV2PresenterInterface presenter; |
|
|
|
private static int WITHDRAW_AMOUNT_REQUEST_CODE =24943; |
|
|
|
private static int SEND_MONEY_REQUEST_CODE =24944; |
|
|
|
public static final String PROMPT_FINGERPRINT_BUNDLE_FLAG="bundleKeyPromptFlag"; |
|
|
|
private static int WITHDRAW_AMOUNT_REQUEST_CODE = 24943; |
|
|
|
private static int SEND_MONEY_REQUEST_CODE = 24944; |
|
|
|
public static final String PROMPT_FINGERPRINT_BUNDLE_FLAG = "bundleKeyPromptFlag"; |
|
|
|
private ChannelIOEventListener channelIOEventListener; |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
@ -105,8 +107,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
@Override |
|
|
|
protected void onNewIntent(Intent intent) { |
|
|
|
super.onNewIntent(intent); |
|
|
|
if(intent!=null&&intent.getBooleanExtra(BUNDLE_ACTION_FETCH_ALL_DATA,false)&¤tFragment instanceof HomeFragmentV2) |
|
|
|
{ |
|
|
|
if (intent != null && intent.getBooleanExtra(BUNDLE_ACTION_FETCH_ALL_DATA, false) && currentFragment instanceof HomeFragmentV2) { |
|
|
|
((HomeFragmentV2) currentFragment).startPulltoRefresh(true); |
|
|
|
presenter.getRequiredData(); |
|
|
|
} |
|
|
@ -114,7 +115,9 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
|
|
|
|
private void initialize() { |
|
|
|
manager = getSupportFragmentManager(); |
|
|
|
presenter = new HomeV2Presenter(this,getIntent().getBooleanExtra(PROMPT_FINGERPRINT_BUNDLE_FLAG,false)); |
|
|
|
presenter = new HomeV2Presenter(this, getIntent().getBooleanExtra(PROMPT_FINGERPRINT_BUNDLE_FLAG, false)); |
|
|
|
channelIOEventListener = new ChannelIOEventListener(); |
|
|
|
ChannelIO.setChannelPluginListener(channelIOEventListener); |
|
|
|
} |
|
|
|
|
|
|
|
private void performDefaultAction(Bundle savedInstanceState) { |
|
|
@ -180,11 +183,11 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@OnClick({R.id.iv_help, R.id.iv_nav, R.id.btn_withdraw, R.id.view_about_gme, R.id.view_setting, R.id.view_logout, R.id.iv_close, R.id.iv_notification,R.id.manageAccountsViewGroup,R.id.view_transaction_report}) |
|
|
|
@OnClick({R.id.iv_help, R.id.iv_nav, R.id.btn_withdraw, R.id.view_about_gme, R.id.view_setting, R.id.view_logout, R.id.iv_close, R.id.iv_notification, R.id.manageAccountsViewGroup, R.id.view_transaction_report}) |
|
|
|
public void onClick(View view) { |
|
|
|
switch (view.getId()) { |
|
|
|
case R.id.iv_help: |
|
|
|
CustomerSupportFragment newFragment = CustomerSupportFragment.newInstance(); |
|
|
|
CustomerSupportFragment newFragment = CustomerSupportFragment.newInstance(presenter.getPersistedRecentNotification()); |
|
|
|
newFragment.show(getSupportFragmentManager(), "dialog"); |
|
|
|
showDrawer(false); |
|
|
|
break; |
|
|
@ -193,7 +196,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
break; |
|
|
|
case R.id.btn_withdraw: |
|
|
|
showDrawer(false); |
|
|
|
new Handler().postDelayed(this::openWithdrawScreen,200); |
|
|
|
new Handler().postDelayed(this::openWithdrawScreen, 200); |
|
|
|
break; |
|
|
|
case R.id.view_about_gme: |
|
|
|
showDrawer(false); |
|
|
@ -230,6 +233,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void showLogoutConfirmationDialog() { |
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this); |
|
|
|
|
|
|
@ -328,7 +332,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
|
|
|
|
@Override |
|
|
|
public void showAutoDebitListingScreen() { |
|
|
|
startActivity(new Intent(HomeActivityV2.this,AutoDebitAccountListingV2Activity.class)); |
|
|
|
startActivity(new Intent(HomeActivityV2.this, AutoDebitAccountListingV2Activity.class)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -341,12 +345,20 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public HomeV2PresenterInterface getPresenter() { |
|
|
|
return presenter; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public OnBootListener getChannelOnBootListener() { |
|
|
|
if (channelIOEventListener == null) { |
|
|
|
channelIOEventListener = new ChannelIOEventListener(); |
|
|
|
ChannelIO.setChannelPluginListener(channelIOEventListener); |
|
|
|
} |
|
|
|
return channelIOEventListener; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void showResendMoneyView() { |
|
|
|
String unverifiedMessage = presenter.checkIfUserVerified(); |
|
|
@ -384,7 +396,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
txtBalance.setText(getString(R.string.na_text)); |
|
|
|
} |
|
|
|
|
|
|
|
if(fullname!=null&&fullname.length()>0) { |
|
|
|
if (fullname != null && fullname.length() > 0) { |
|
|
|
TextDrawable drawable = TextDrawable.builder().buildRound(String.valueOf(fullname.toUpperCase().charAt(0)), getResources().getColor(R.color.blue)); |
|
|
|
profileTextImageView.setImageDrawable(drawable); |
|
|
|
} |
|
|
@ -392,20 +404,20 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void showKYCVerifiedIfRequired(boolean shouldShowView, String message, String title, boolean disableKYCViewClick,Runnable callback) { |
|
|
|
public void showKYCVerifiedIfRequired(boolean shouldShowView, String message, String title, boolean disableKYCViewClick, Runnable callback) { |
|
|
|
if (currentFragment instanceof HomeFragmentV2) |
|
|
|
((HomeFragmentV2) currentFragment).showKYCVerifiedIfRequired(shouldShowView, message, title, disableKYCViewClick,callback); |
|
|
|
((HomeFragmentV2) currentFragment).showKYCVerifiedIfRequired(shouldShowView, message, title, disableKYCViewClick, callback); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void showPennyTestViewIfRequired(boolean showView, String pennyTestTitle, String pennyTestMessage) { |
|
|
|
if (currentFragment instanceof HomeFragmentV2) |
|
|
|
((HomeFragmentV2) currentFragment).showPennyTestViewIfRequired(showView, pennyTestMessage,pennyTestTitle,null); |
|
|
|
((HomeFragmentV2) currentFragment).showPennyTestViewIfRequired(showView, pennyTestMessage, pennyTestTitle, null); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void showUpdateScreen(String build, String info, boolean isForceUpdate) { |
|
|
|
if(!this.presenter.shouldNotPromptAppUpdate()) { |
|
|
|
if (!this.presenter.shouldNotPromptAppUpdate()) { |
|
|
|
new Handler().postDelayed(() -> { |
|
|
|
Intent intent = new Intent(HomeActivityV2.this, AppUpdateActivity.class); |
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); |
|
|
@ -426,8 +438,8 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
|
|
|
|
@Override |
|
|
|
public void showFingerprintAvailablityToUser() { |
|
|
|
Intent intent=new Intent(this, FingerprintEnablePromptActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
Intent intent = new Intent(this, FingerprintEnablePromptActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -441,28 +453,27 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
|
|
|
|
@Override |
|
|
|
public void showPrivilegedOperationView(Boolean action) { |
|
|
|
View withdrawView= nav_drawer.findViewById(R.id.btn_withdraw); |
|
|
|
View withdrawView = nav_drawer.findViewById(R.id.btn_withdraw); |
|
|
|
|
|
|
|
View manageAccountDivider=nav_drawer.findViewById(R.id.manageAccountsDivider); |
|
|
|
View manageAccountViewGroup=nav_drawer.findViewById(R.id.manageAccountsViewGroup); |
|
|
|
View manageAccountDivider = nav_drawer.findViewById(R.id.manageAccountsDivider); |
|
|
|
View manageAccountViewGroup = nav_drawer.findViewById(R.id.manageAccountsViewGroup); |
|
|
|
|
|
|
|
View transactionReportDivider=nav_drawer.findViewById(R.id.manageTransactionReportDivider); |
|
|
|
View transactionReportView=nav_drawer.findViewById(R.id.view_transaction_report); |
|
|
|
View transactionReportDivider = nav_drawer.findViewById(R.id.manageTransactionReportDivider); |
|
|
|
View transactionReportView = nav_drawer.findViewById(R.id.view_transaction_report); |
|
|
|
|
|
|
|
if(action) { |
|
|
|
withdrawView.setVisibility(View.VISIBLE); |
|
|
|
manageAccountDivider.setVisibility(View.VISIBLE); |
|
|
|
manageAccountViewGroup.setVisibility(View.VISIBLE); |
|
|
|
transactionReportDivider.setVisibility(View.VISIBLE); |
|
|
|
transactionReportView.setVisibility(View.VISIBLE); |
|
|
|
} |
|
|
|
else { |
|
|
|
withdrawView.setVisibility(View.INVISIBLE); |
|
|
|
manageAccountDivider.setVisibility(View.GONE); |
|
|
|
manageAccountViewGroup.setVisibility(View.GONE); |
|
|
|
transactionReportDivider.setVisibility(View.GONE); |
|
|
|
transactionReportView.setVisibility(View.GONE); |
|
|
|
} |
|
|
|
if (action) { |
|
|
|
withdrawView.setVisibility(View.VISIBLE); |
|
|
|
manageAccountDivider.setVisibility(View.VISIBLE); |
|
|
|
manageAccountViewGroup.setVisibility(View.VISIBLE); |
|
|
|
transactionReportDivider.setVisibility(View.VISIBLE); |
|
|
|
transactionReportView.setVisibility(View.VISIBLE); |
|
|
|
} else { |
|
|
|
withdrawView.setVisibility(View.INVISIBLE); |
|
|
|
manageAccountDivider.setVisibility(View.GONE); |
|
|
|
manageAccountViewGroup.setVisibility(View.GONE); |
|
|
|
transactionReportDivider.setVisibility(View.GONE); |
|
|
|
transactionReportView.setVisibility(View.GONE); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -470,20 +481,19 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
if (walletNumber == null || walletNumber.length() <= 0) { |
|
|
|
walletNumber = getString(R.string.na_text); |
|
|
|
} |
|
|
|
if(bankName!=null&&bankName.length()>1) |
|
|
|
bankName=" ("+bankName+") "; |
|
|
|
if (bankName != null && bankName.length() > 1) |
|
|
|
bankName = " (" + bankName + ") "; |
|
|
|
|
|
|
|
String gmeWalletNo=getString(R.string.gme_wallet_no_text); |
|
|
|
controlNo.setText(Html.fromHtml(gmeWalletNo+" <b><font color='#ed1c24'> " + walletNumber + "</font></b>" +bankName)); |
|
|
|
String gmeWalletNo = getString(R.string.gme_wallet_no_text); |
|
|
|
controlNo.setText(Html.fromHtml(gmeWalletNo + " <b><font color='#ed1c24'> " + walletNumber + "</font></b>" + bankName)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { |
|
|
|
super.onActivityResult(requestCode, resultCode, data); |
|
|
|
if(requestCode==APP_UPDATE_REQUEST&&resultCode==RESULT_OK) |
|
|
|
{ |
|
|
|
this.presenter.storeAppUpdateDecision(data.getBooleanExtra(AppUpdateActivity.APP_UPDATE_NOT_NOW_TEMPORARY,false)); |
|
|
|
if (requestCode == APP_UPDATE_REQUEST && resultCode == RESULT_OK) { |
|
|
|
this.presenter.storeAppUpdateDecision(data.getBooleanExtra(AppUpdateActivity.APP_UPDATE_NOT_NOW_TEMPORARY, false)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -493,6 +503,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
protected void onDestroy() { |
|
|
|
super.onDestroy(); |
|
|
|
presenter.onViewDestroyed(); |
|
|
|
ChannelIO.setChannelPluginListener(null); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -509,4 +520,84 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra |
|
|
|
public void onBackPressed() { |
|
|
|
showExitConfirmationDialog(); |
|
|
|
} |
|
|
|
|
|
|
|
class ChannelIOEventListener implements ChannelPluginListener, OnBootListener { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void willShowMessenger() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void willHideMessenger() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onChangeBadge(int count) { |
|
|
|
String countString; |
|
|
|
if(count>99) |
|
|
|
countString="99+"; |
|
|
|
else |
|
|
|
countString=count+""; |
|
|
|
|
|
|
|
presenter.persistNotificationCount(countString); |
|
|
|
notificationCounterTxtView.setText(countString); |
|
|
|
notificationCounterTxtView.setVisibility(View.VISIBLE); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onReceivePush(PushEvent pushEvent) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean onClickChatLink(String url) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean onClickRedirectUrl(String url) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onChangeProfile(String key, @Nullable Object value) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onCompletion(ChannelPluginCompletionStatus status, @Nullable Guest guest) { |
|
|
|
if (status == SUCCESS) { |
|
|
|
ChannelIO.open(HomeActivityV2.this); |
|
|
|
} else { |
|
|
|
String serviceNotAvailable = getString(R.string.service_not_available); |
|
|
|
switch (status) { |
|
|
|
case NOT_INITIALIZED: |
|
|
|
serviceNotAvailable += "(1)"; |
|
|
|
break; |
|
|
|
case NETWORK_TIMEOUT: |
|
|
|
serviceNotAvailable += "(2)"; |
|
|
|
break; |
|
|
|
case NOT_AVAILABLE_VERSION: |
|
|
|
serviceNotAvailable += "(3)"; |
|
|
|
break; |
|
|
|
case SERVICE_UNDER_CONSTRUCTION: |
|
|
|
serviceNotAvailable += "(4)"; |
|
|
|
break; |
|
|
|
case REQUIRE_PAYMENT: |
|
|
|
serviceNotAvailable += "(5)"; |
|
|
|
break; |
|
|
|
case ACCESS_DENIED: |
|
|
|
serviceNotAvailable += "(6)"; |
|
|
|
break; |
|
|
|
case UNKNOWN_ERROR: |
|
|
|
serviceNotAvailable += "(7)"; |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
showPopUpMessage(serviceNotAvailable, CustomAlertDialog.AlertType.FAILED, null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |