导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - BBInstantActivity.java 源代码

正在查看: bbinstant v6.24.0 应用的 BBInstantActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.bigbasket.bbinstant.ui;

import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.z;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.navigation.t;
import ch.qos.logback.core.CoreConstants;
import com.adjetter.kapchatsdk.R;
import com.amazonaws.services.s3.internal.Constants;
import com.bigbasket.bbinstant.App;
import com.bigbasket.bbinstant.PermissionHandler;
import com.bigbasket.bbinstant.analytics.moengage.MoEventManager;
import com.bigbasket.bbinstant.analytics.snowplow.PlowUtils;
import com.bigbasket.bbinstant.core.Constants;
import com.bigbasket.bbinstant.core.io.wifi.q;
import com.bigbasket.bbinstant.core.location.entity.Location;
import com.bigbasket.bbinstant.core.machine.impl.l0;
import com.bigbasket.bbinstant.core.persistance.LocationStore;
import com.bigbasket.bbinstant.core.rx.RxUtils;
import com.bigbasket.bbinstant.core.settings.SettingEntity;
import com.bigbasket.bbinstant.core.settings.repository.SettingRepository;
import com.bigbasket.bbinstant.core.utils.StringUtils;
import com.bigbasket.bbinstant.labs.plower.Plower;
import com.bigbasket.bbinstant.labs.plower.events.Connection;
import com.bigbasket.bbinstant.labs.plower.events.f;
import com.bigbasket.bbinstant.ui.aboutus.AboutUsFragment;
import com.bigbasket.bbinstant.ui.common.QRScanActivity;
import com.bigbasket.bbinstant.ui.feedback.NewFeedbackActivity;
import com.bigbasket.bbinstant.ui.help.HelpFragment;
import com.bigbasket.bbinstant.ui.machine.MachineFragment;
import com.bigbasket.bbinstant.ui.offers.FragmentOffers;
import com.bigbasket.bbinstant.ui.order.history.HistoryFragment;
import com.bigbasket.bbinstant.ui.payments.juspay.HyperServiceHolder;
import com.bigbasket.bbinstant.ui.payments.list.PaymentFragment;
import com.bigbasket.bbinstant.ui.payments.list.x;
import com.bigbasket.bbinstant.ui.referral.FragmentReferral;
import com.bigbasket.bbinstant.ui.showcase.FragmentMachineScreen;
import com.google.android.gms.tasks.Task;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.play.core.install.InstallState;
import io.reactivex.Completable;
import io.reactivex.Single;
import io.reactivex.SingleEmitter;
import io.reactivex.SingleOnSubscribe;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import java.io.IOException;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import kotlin.jvm.internal.v;
import org.json.JSONObject;

public class BBInstantActivity extends BaseActivity implements NavigationView.c, View.OnClickListener, com.bigbasket.bbinstant.a, com.bigbasket.bbinstant.c {
    private static final int APP_UPDATE_REQUEST = 1;
    private static final String PN_COUNT = "post_notification_count";
    private com.google.android.play.core.appupdate.b appUpdateManager;
    private BottomNavigationView bottomNavigationView;
    private View contentView;
    private CompositeDisposable disposable = new CompositeDisposable();
    private DrawerLayout drawer;
    private TextView emailText;
    private com.bigbasket.bbinstant.core.maintainance.forceupgrade.b forceUpgradeRepository;
    public HyperServiceHolder hyperServicesHolder;
    private JSONObject initiatePayload;
    private boolean isBackPressed;
    private boolean isErrorScreenVisible;
    private boolean isNavigationBlocked;
    private boolean isScannedFromSplash;
    private FloatingActionButton mScanButton;
    private TextView nameText;
    private NavigationView navigationView;
    private TextView phoneText;
    private ActivityResultLauncher<String> requestPermissionLauncher;
    private Toolbar toolbar;
    private TextView versionText;

    private void checkForForceUpgrade() {
        this.disposable.add(this.forceUpgradeRepository.checkForForceUpgrade().compose(RxUtils.applySingleSchedulers()).subscribe(new Consumer() {
            public final void accept(Object obj) {
                BBInstantActivity.this.lambda$checkForForceUpgrade$2((Boolean) obj);
            }
        }, new Consumer() {
            public final void accept(Object obj) {
                BBInstantActivity.this.lambda$checkForForceUpgrade$3((Throwable) obj);
            }
        }));
    }

    private void checkIfAppIsDownloadedInFlexibleMode() {
        this.appUpdateManager.getAppUpdateInfo().addOnSuccessListener(new com.google.android.gms.tasks.e() {
            public final void onSuccess(Object obj) {
                BBInstantActivity.this.lambda$checkIfAppIsDownloadedInFlexibleMode$0((com.google.android.play.core.appupdate.a) obj);
            }
        });
    }

    private void checkIfAppIsDownloadedInImmediateMode() {
        this.appUpdateManager.getAppUpdateInfo().addOnSuccessListener(new com.google.android.gms.tasks.e() {
            public final void onSuccess(Object obj) {
                BBInstantActivity.this.lambda$checkIfAppIsDownloadedInImmediateMode$1((com.google.android.play.core.appupdate.a) obj);
            }
        });
    }

    private void checkIfFeedbackRequired() {
        if (com.bigbasket.bbinstant.core.persistance.c.get().getDefaultsBoolean("IS_FEEDBACK_REQUIRED", false).booleanValue()) {
            com.bigbasket.bbinstant.core.persistance.c.get().clearPreferences("IS_FEEDBACK_REQUIRED");
            PlowUtils.ScreenViewHelper.trackOnFeedbackScreenOnSplash();
            startFeedbackActivity();
        }
    }

    private JSONObject createInitiatePayload() {
        JSONObject jSONObject = new JSONObject();
        JSONObject jSONObject2 = new JSONObject();
        try {
            jSONObject2.put(HyperServiceHolder.PayloadConstants.ACTION_NAME, HyperServiceHolder.PayloadConstants.ACTION_VALUE);
            jSONObject2.put(HyperServiceHolder.PayloadConstants.MERCHANT_ID_NAME, com.bigbasket.bbinstant.core.persistance.d.get().getSettings().getJuspayMerchantId());
            jSONObject2.put("clientId", com.bigbasket.bbinstant.core.persistance.d.get().getSettings().getJuspayClientId());
            jSONObject2.put(HyperServiceHolder.PayloadConstants.ENV, HyperServiceHolder.PayloadConstants.ENV_VALUE_PROD);
            jSONObject.put(HyperServiceHolder.PayloadConstants.REQUEST, "" + UUID.randomUUID());
            jSONObject.put("service", HyperServiceHolder.PayloadConstants.SERVICE_VALUE);
            jSONObject.put(HyperServiceHolder.PayloadConstants.PAYLOAD_NAME, jSONObject2);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jSONObject;
    }

    private Single<Location> fetchLocation(final String str) {
        return Single.create(new SingleOnSubscribe() {
            public final void subscribe(SingleEmitter singleEmitter) {
                BBInstantActivity.lambda$fetchLocation$10(str, singleEmitter);
            }
        });
    }

    private String getMachineId(Intent intent) {
        String contents = com.google.zxing.integration.android.a.parseActivityResult(-1, intent).getContents();
        if (contents != null && contents.contains("mid=")) {
            String[] split = contents.split("mid=");
            if (split.length > 1) {
                return split[1];
            }
        }
        return null;
    }

    private void initUI() {
        this.contentView = findViewById(R.id.container);
        this.navigationView = findViewById(2131362376);
        this.bottomNavigationView = findViewById(2131361918);
        this.drawer = (DrawerLayout) findViewById(2131362057);
        this.mScanButton = findViewById(2131362094);
        this.phoneText = (TextView) this.navigationView.getHeaderView(0).findViewById(2131362635);
        this.nameText = (TextView) this.navigationView.getHeaderView(0).findViewById(2131362626);
        this.emailText = (TextView) this.navigationView.getHeaderView(0).findViewById(2131362611);
        this.versionText = (TextView) findViewById(2131362651);
    }

    private void initiatePaymentsSDK() {
        if (this.hyperServicesHolder.isInitiated()) {
            return;
        }
        JSONObject createInitiatePayload = createInitiatePayload();
        this.initiatePayload = createInitiatePayload;
        this.hyperServicesHolder.initiate(createInitiatePayload);
    }

    public void lambda$checkForForceUpgrade$2(Boolean bool) throws Exception {
        if (bool.booleanValue()) {
            showDialogForForceUpgrade();
        }
    }

    public void lambda$checkForForceUpgrade$3(Throwable th) throws Exception {
        PlowUtils.Debug.log(getString(2131886237));
    }

    public void lambda$checkIfAppIsDownloadedInFlexibleMode$0(com.google.android.play.core.appupdate.a aVar) {
        if (aVar.installStatus() == 11) {
            popupSnackbarForCompleteUpdate();
        }
    }

    public void lambda$checkIfAppIsDownloadedInImmediateMode$1(com.google.android.play.core.appupdate.a aVar) {
        if (aVar.updateAvailability() == 3) {
            try {
                this.appUpdateManager.startUpdateFlowForResult(aVar, 1, this, 1);
            } catch (IntentSender.SendIntentException e) {
                e.getLocalizedMessage();
            }
        }
    }

    public static void lambda$fetchLocation$10(java.lang.String r3, io.reactivex.SingleEmitter r4) throws java.lang.Exception {
        throw new UnsupportedOperationException("Method not decompiled: com.bigbasket.bbinstant.ui.BBInstantActivity.lambda$fetchLocation$10(java.lang.String, io.reactivex.SingleEmitter):void");
    }

    public void lambda$onBackPressed$7() throws Exception {
        this.isBackPressed = false;
    }

    public void lambda$onQrResult$8(String str, Location location) throws Exception {
        if (this.isScannedFromSplash) {
            this.isScannedFromSplash = false;
            l0.get().forceSwitchMachineNetwork(true);
        }
        switchFragment(MachineFragment.instance(str));
        LocationStore.get().pushRecentLocation(location);
        PlowUtils.ScreenViewHelper.trackMachineScreen(getCurrentFragmentName(), f.i.SCAN_BUTTON_CLICK, f.s.ONLINE);
        PlowUtils.ConnectionHelper.trackScanEvent(Connection.f.SUCCESS, str);
    }

    public void lambda$onQrResult$9(Throwable th) throws Exception {
        if (th.getCause() instanceof IOException) {
            Toast.makeText(this, "No internet. Please try again", 0).show();
        } else {
            Toast.makeText(this, 2131886129, 0).show();
        }
        PlowUtils.ConnectionHelper.trackScanEvent(Connection.f.FAIL, "");
        if (this.isScannedFromSplash) {
            onNavigationItemSelected(this.navigationView.getMenu().getItem(0));
            this.isScannedFromSplash = false;
        }
    }

    public void lambda$popupSnackbarForCompleteUpdate$6(View view) {
        this.appUpdateManager.completeUpdate();
    }

    public static void lambda$showDialogForForceUpgrade$4(InstallState installState) {
    }

    public void lambda$showDialogForForceUpgrade$5(com.google.android.play.core.appupdate.a aVar) {
        if (aVar.updateAvailability() == 2 && aVar.isUpdateTypeAllowed(1)) {
            try {
                startUpdate(this.appUpdateManager, aVar);
            } catch (IntentSender.SendIntentException e) {
                Objects.requireNonNull(e.getLocalizedMessage());
            }
        }
    }

    public static void lambda$updateCache$11(SettingEntity settingEntity) throws Exception {
        com.bigbasket.bbinstant.core.persistance.d.get().saveSettings(settingEntity);
    }

    private void manageMenuVisibility() {
        this.navigationView.getMenu().findItem(2131362374).setVisible(Boolean.parseBoolean(com.bigbasket.bbinstant.core.persistance.d.get().getSettings().getEnableReferral()));
    }

    private void onFeedBack() {
        if (this.isNavigationBlocked) {
            showNavigationBlockedToast();
        } else {
            startFeedbackActivity();
        }
        this.drawer.closeDrawer(z.START);
    }

    private void onQrResult(Intent intent) {
        final String machineId = getMachineId(intent);
        if (machineId != null) {
            this.disposable.add(fetchLocation(machineId).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer() {
                public final void accept(Object obj) {
                    BBInstantActivity.this.lambda$onQrResult$8(machineId, (Location) obj);
                }
            }, new Consumer() {
                public final void accept(Object obj) {
                    BBInstantActivity.this.lambda$onQrResult$9((Throwable) obj);
                }
            }));
            return;
        }
        Toast.makeText(this, 2131886128, 0).show();
        if (this.isScannedFromSplash) {
            onNavigationItemSelected(this.navigationView.getMenu().getItem(0));
            this.isScannedFromSplash = false;
        }
    }

    private void parseDeeplink(Bundle bundle) {
        String string;
        if (bundle == null || (string = bundle.getString("deeplink")) == null) {
            return;
        }
        if ("machineFragment".equals(string)) {
            String string2 = bundle.getString(HyperServiceHolder.PayloadConstants.ACTION_NAME);
            if (string2 == null) {
                return;
            }
            if ("scanQr".equals(string2)) {
                this.isScannedFromSplash = true;
                PlowUtils.ConnectionHelper.trackScanEvent(Connection.f.ATTEMPT, "");
                onScan();
                return;
            } else if ("showcase".equals(string2)) {
                switchFragment(new FragmentMachineScreen());
            }
        }
        if ("Offers".equals(string)) {
            if (TextUtils.isEmpty(bundle.getString(Constants.URL_ENCODING))) {
                return;
            } else {
                switchFragment(FragmentOffers.newInstance(bundle));
            }
        }
        if ("help".equals(string)) {
            Bundle bundle2 = new Bundle();
            bundle2.putString(Connection.Key.DATA, bundle.getString(Connection.Key.DATA));
            switchFragment(HelpFragment.newInstance(bundle2));
        }
    }

    private void popupSnackbarForCompleteUpdate() {
        Snackbar make = Snackbar.make(findViewById(2131362057), "An update has just been downloaded.", -2);
        make.setAction("RESTART", new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                BBInstantActivity.this.lambda$popupSnackbarForCompleteUpdate$6(view);
            }
        });
        make.setActionTextColor(androidx.core.content.a.getColor(this, 2131099931));
        make.show();
    }

    private void setNavigationDrawer() {
        androidx.appcompat.app.a aVar = new androidx.appcompat.app.a(this, this.drawer, this.toolbar, 2131886388, 2131886387);
        this.drawer.addDrawerListener(aVar);
        aVar.syncState();
        this.navigationView.setNavigationItemSelectedListener(this);
        this.bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.b() {
            public final boolean onNavigationItemSelected(MenuItem menuItem) {
                return BBInstantActivity.this.onNavigationItemSelected(menuItem);
            }
        });
    }

    private void setShowCaseValue() {
        if (shouldShowCaseAppear()) {
            com.bigbasket.bbinstant.core.persistance.c.get().setDefaultsBoolean(Constants.Preference.SHOULD_SHOW_CASE_APPEAR, false);
        }
    }

    private void setToolBar() {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        this.toolbar = toolbar;
        setSupportActionBar(toolbar);
    }

    public void setUpMoenageNotification(boolean z) {
        if (z) {
            com.moengage.pushbase.b.getInstance().pushPermissionResponse(App.get(), z);
            com.moengage.pushbase.b.getInstance().updatePushPermissionRequestCount(App.get(), com.bigbasket.bbinstant.core.persistance.c.get().getIntDefaults(PN_COUNT));
            com.moengage.pushbase.b.getInstance().setUpNotificationChannels(App.get());
        }
    }

    private void setUserInfo() {
        this.phoneText.setText(com.bigbasket.bbinstant.core.persistance.e.get().getUser().getUser().getPhoneNo());
        this.versionText.setText("Version: " + StringUtils.getAppVersion(this));
        String firstName = com.bigbasket.bbinstant.core.persistance.e.get().getUser().getUser().getFirstName();
        TextView textView = this.nameText;
        if ("NA".equals(firstName)) {
            firstName = "";
        }
        textView.setText(firstName);
        String email = com.bigbasket.bbinstant.core.persistance.e.get().getUser().getUser().getEmail();
        this.emailText.setText("NA".equals(email) ? "" : email);
    }

    private void setupPostNotification() {
        if (Build.VERSION.SDK_INT >= 33) {
            this.requestPermissionLauncher = registerForActivityResult(new ActivityResultContract<String, Boolean>() {
                @Override
                public Intent createIntent(Context context, String str) {
                    v.checkNotNullParameter(context, CoreConstants.CONTEXT_SCOPE_VALUE);
                    v.checkNotNullParameter(str, "input");
                    return ActivityResultContracts$RequestMultiplePermissions.Companion.createIntent$activity_release(new String[]{str});
                }

                @Override
                public ActivityResultContract.a getSynchronousResult(Context context, String str) {
                    v.checkNotNullParameter(context, CoreConstants.CONTEXT_SCOPE_VALUE);
                    v.checkNotNullParameter(str, "input");
                    if (androidx.core.content.a.checkSelfPermission(context, str) == 0) {
                        return new ActivityResultContract.a(Boolean.TRUE);
                    }
                    return null;
                }

                @Override
                public Boolean parseResult(int i, Intent intent) {
                    if (intent == null || i != -1) {
                        return Boolean.FALSE;
                    }
                    int[] intArrayExtra = intent.getIntArrayExtra(ActivityResultContracts$RequestMultiplePermissions.EXTRA_PERMISSION_GRANT_RESULTS);
                    boolean z = false;
                    if (intArrayExtra != null) {
                        int length = intArrayExtra.length;
                        int i2 = 0;
                        while (true) {
                            if (i2 >= length) {
                                break;
                            }
                            if (intArrayExtra[i2] == 0) {
                                z = true;
                                break;
                            }
                            i2++;
                        }
                    }
                    return Boolean.valueOf(z);
                }
            }, new androidx.activity.result.a() {
                @Override
                public final void onActivityResult(Object obj) {
                    BBInstantActivity.this.setUpMoenageNotification(((Boolean) obj).booleanValue());
                }
            });
            if (PermissionHandler.checkPushNotificationPermission(this)) {
                setUpMoenageNotification(true);
                return;
            }
            this.requestPermissionLauncher.launch("android.permission.POST_NOTIFICATIONS");
            com.bigbasket.bbinstant.core.persistance.c.get().setDefaults(PN_COUNT, com.bigbasket.bbinstant.core.persistance.c.get().getIntDefaults(PN_COUNT, 0) + 1);
        }
    }

    private boolean shouldShowCaseAppear() {
        return com.bigbasket.bbinstant.core.persistance.c.get().getDefaultsBoolean(Constants.Preference.SHOULD_SHOW_CASE_APPEAR, true).booleanValue();
    }

    private void showDialogForForceUpgrade() {
        Task appUpdateInfo = this.appUpdateManager.getAppUpdateInfo();
        this.appUpdateManager.registerListener(new com.google.android.play.core.install.b() {
            public final void onStateUpdate(Object obj) {
                BBInstantActivity.lambda$showDialogForForceUpgrade$4((InstallState) obj);
            }
        });
        appUpdateInfo.addOnSuccessListener(new com.google.android.gms.tasks.e() {
            public final void onSuccess(Object obj) {
                BBInstantActivity.this.lambda$showDialogForForceUpgrade$5((com.google.android.play.core.appupdate.a) obj);
            }
        });
    }

    private void startFeedbackActivity() {
        startActivity(new Intent(this, (Class<?>) NewFeedbackActivity.class));
    }

    private void startUpdate(com.google.android.play.core.appupdate.b bVar, com.google.android.play.core.appupdate.a aVar) throws IntentSender.SendIntentException {
        bVar.startUpdateFlowForResult(aVar, 1, this, 1);
    }

    private void syncNavbars(MenuItem menuItem) {
        MenuItem findItem = this.navigationView.getMenu().findItem(menuItem.getItemId());
        MenuItem findItem2 = this.bottomNavigationView.getMenu().findItem(menuItem.getItemId());
        if (findItem != null) {
            findItem.setChecked(true);
        }
        if (findItem2 != null) {
            findItem2.setChecked(true);
        }
    }

    private void toggleBottomNavigationEnabling(boolean z) {
        for (int i = 0; i < this.bottomNavigationView.getMenu().size(); i++) {
            this.bottomNavigationView.getMenu().getItem(i).setEnabled(z);
        }
    }

    private void updateCache() {
        new SettingRepository().getSettings().subscribeOn(Schedulers.io()).subscribe(new Consumer() {
            public final void accept(Object obj) {
                BBInstantActivity.lambda$updateCache$11((SettingEntity) obj);
            }
        }, new q());
    }

    public void blockNavigation() {
        this.isNavigationBlocked = true;
        toggleBottomNavigationEnabling(false);
    }

    public Fragment getCurrentFragment() {
        return getSupportFragmentManager().findFragmentById(R.id.container);
    }

    public String getCurrentFragmentName() {
        Fragment currentFragment = getCurrentFragment();
        if (currentFragment == null) {
            return null;
        }
        return currentFragment.getClass().getName();
    }

    public boolean isNavigationBlocked() {
        return this.isNavigationBlocked;
    }

    public void loadFragment(NavigationFragment navigationFragment, String str, boolean z) {
        showToolbar(navigationFragment.getHasToolbar());
        getSupportFragmentManager().beginTransaction().add(R.id.container, navigationFragment).addToBackStack("").commitAllowingStateLoss();
    }

    @Override
    protected void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i != 22) {
            if (i != 49374) {
                return;
            }
            if (i2 != -1 || intent == null) {
                onNavigationItemSelected(this.navigationView.getMenu().getItem(0));
                return;
            } else {
                onQrResult(intent);
                return;
            }
        }
        if (getCurrentFragment() == null || !(getCurrentFragment() instanceof PaymentFragment) || getCurrentFragment().isRemoving()) {
            return;
        }
        if (i2 == -1) {
            intent.putExtra(x.KEY_VERIFIED_PAY_TYPE, com.bigbasket.bbinstant.core.payments.newiml.q.AMAZONPAY.value());
            ((PaymentFragment) getCurrentFragment()).onResultApay(i, i2, intent);
        } else if (i2 == 0) {
            Toast.makeText(this, 2131886468, 0).show();
            StringBuilder sb = new StringBuilder();
            sb.append("");
            sb.append(intent.getExtras().get("Error"));
        }
    }

    @Override
    public void onBackPressed() {
        if (this.drawer.isDrawerOpen(z.START)) {
            this.drawer.closeDrawer(z.START);
        } else {
            if (this.isBackPressed) {
                super.onBackPressed();
                return;
            }
            this.isBackPressed = true;
            Toast.makeText(App.get(), "Please click Back again to exit", 0).show();
            Completable.timer(2L, TimeUnit.SECONDS).subscribeOn(Schedulers.io()).subscribe(new Action() {
                public final void run() {
                    BBInstantActivity.this.lambda$onBackPressed$7();
                }
            });
        }
    }

    @Override
    public void onClick(View view) {
        if (view.getId() != 2131362094) {
            return;
        }
        onScan();
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(2131558431);
        setToolBar();
        initUI();
        manageMenuVisibility();
        this.disposable = new CompositeDisposable();
        this.mScanButton.setOnClickListener(this);
        setNavigationDrawer();
        setUserInfo();
        updateCache();
        Completable.fromAction(new Action() {
            public final void run() {
                MoEventManager.setMoEngageUserAttributes();
            }
        }).subscribeOn(Schedulers.io()).subscribe();
        setupPostNotification();
        if (bundle == null && getIntent().getBundleExtra("extras") == null) {
            onNavigationItemSelected(this.navigationView.getMenu().getItem(0));
        } else {
            parseDeeplink(getIntent().getBundleExtra("extras"));
        }
        this.forceUpgradeRepository = com.bigbasket.bbinstant.core.maintainance.forceupgrade.a.a();
        this.appUpdateManager = com.google.android.play.core.appupdate.c.create(this);
        checkIfFeedbackRequired();
        this.hyperServicesHolder = new HyperServiceHolder(this);
        initiatePaymentsSDK();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        this.disposable.clear();
    }

    @Override
    public void onErrorVisibilityChange(boolean z) {
        this.isErrorScreenVisible = z;
    }

    public boolean onNavigationItemSelected(MenuItem menuItem) {
        Fragment aboutUsFragment;
        if (menuItem.getItemId() != 2131362368) {
            setShowCaseValue();
        }
        switch (menuItem.getItemId()) {
            case 2131362363:
                aboutUsFragment = new AboutUsFragment();
                break;
            case t.nav_controller_view_tag:
            case 2131362365:
            case androidx.navigation.fragment.e.nav_host_fragment_container:
            case 2131362370:
            default:
                aboutUsFragment = null;
                break;
            case 2131362366:
                onFeedBack();
                return true;
            case 2131362367:
                aboutUsFragment = new HelpFragment();
                break;
            case 2131362368:
                aboutUsFragment = new MachineFragment();
                PlowUtils.ScreenViewHelper.trackMachineScreen(getCurrentFragmentName(), f.i.NAV_DRAWER_ITEM_CLICKED, f.s.ONLINE);
                break;
            case 2131362371:
                aboutUsFragment = new FragmentOffers();
                break;
            case 2131362372:
                aboutUsFragment = new HistoryFragment();
                break;
            case 2131362373:
                aboutUsFragment = new PaymentFragment();
                break;
            case 2131362374:
                aboutUsFragment = new FragmentReferral();
                break;
        }
        if ((aboutUsFragment == null || this.isNavigationBlocked) && !(aboutUsFragment instanceof MachineFragment)) {
            showNavigationBlockedToast();
        } else {
            getSupportFragmentManager().beginTransaction().replace(R.id.container, aboutUsFragment).commitAllowingStateLoss();
            syncNavbars(menuItem);
        }
        this.drawer.closeDrawer(z.START);
        return true;
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        if (intent.getBundleExtra("extras") != null) {
            parseDeeplink(intent.getBundleExtra("extras"));
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        checkIfAppIsDownloadedInImmediateMode();
        checkForForceUpgrade();
        com.bigbasket.bbinstant.core.utils.f.INSTANCE.isDeviceRooted(this);
    }

    @Override
    public void onRootCheckComplete(boolean z) {
        if (z) {
            finish();
        }
    }

    public void onScan() {
        if (this.isErrorScreenVisible) {
            Plower.get().track(new f.r(f.t.ERROR_SCREEN, f.i.SCAN_BUTTON_CLICK));
        }
        com.google.zxing.integration.android.a aVar = new com.google.zxing.integration.android.a(this);
        aVar.setDesiredBarcodeFormats(new String[]{"QR_CODE"});
        aVar.setBeepEnabled(true);
        aVar.setOrientationLocked(true);
        aVar.setCameraId(0);
        aVar.setCaptureActivity(QRScanActivity.class);
        aVar.initiateScan();
    }

    @Override
    protected void onStart() {
        super.onStart();
        com.moengage.inapp.a.getInstance().showInApp(this);
    }

    public void openDrawer() {
        this.drawer.openDrawer(z.START);
    }

    @Override
    public void setTitle(int i) {
        ((TextView) this.toolbar.findViewById(2131362671)).setText("");
    }

    public void showNavigationBlockedToast() {
        Snackbar.make(this.navigationView, 2131886386, -1).show();
    }

    public void showToolbar(boolean z) {
        this.toolbar.setVisibility(z ? 0 : 8);
    }

    public void switchFragment(NavigationFragment navigationFragment) {
        showToolbar(navigationFragment.getHasToolbar());
        getSupportFragmentManager().beginTransaction().replace(R.id.container, navigationFragment).commitAllowingStateLoss();
    }

    public void unblockNavigation() {
        this.isNavigationBlocked = false;
        toggleBottomNavigationEnabling(true);
    }

    public void syncNavbars() {
        int menuId;
        MenuItem findItem;
        Fragment currentFragment = getCurrentFragment();
        if (!(currentFragment instanceof NavigationFragment) || (menuId = ((NavigationFragment) currentFragment).menuId()) == -1 || (findItem = this.navigationView.getMenu().findItem(menuId)) == null) {
            return;
        }
        syncNavbars(findItem);
    }
}