导航菜单

页面标题

页面副标题

Cashalo v2.25.0.0 - e.java 源代码

正在查看: Cashalo v2.25.0.0 应用的 e.java JAVA 源代码文件

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


package com.oriente.cashalo.page.fragment;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.facebook.drawee.drawable.ScalingUtils;
import com.facebook.drawee.view.SimpleDraweeView;
import com.fullstory.FS;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.installations.FirebaseInstallations;
import com.google.firebase.installations.InstallationTokenResult;
import com.google.firebase.messaging.CommonNotificationBuilder;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue;
import com.google.gson.JsonSyntaxException;
import com.oriente.adapter.R;
import com.oriente.adapter.analytics.impl.CommonAnalytics;
import com.oriente.adapter.config.AdapterUtils;
import com.oriente.adapter.config.ValueConfig;
import com.oriente.adapter.http.request.FetchHolder;
import com.oriente.adapter.http.request.FetchNode;
import com.oriente.adapter.http.request.PreFetchListener;
import com.oriente.adapter.page.BaseRefreshUiFragment;
import com.oriente.adapter.widget.AutoScrollBanner;
import com.oriente.callback.DefaultCallback;
import com.oriente.cashalo.businese.c;
import com.oriente.cashalo.page.activity.CommonActivity;
import com.oriente.cashalo.page.activity.MainActivity;
import com.oriente.cashalo.page.model.entity.CashModel;
import com.oriente.cashalo.page.view.RollingNoticeView;
import com.oriente.cashalo.service.CommonService;
import com.oriente.cashalo.service.model.borrow.BannerItem;
import com.oriente.cashalo.service.model.borrow.CouponModel;
import com.oriente.cashalo.service.model.borrow.CustomMarketingListModel;
import com.oriente.cashalo.service.model.borrow.HomeItem;
import com.oriente.cashalo.service.model.borrow.HomeProduct;
import com.oriente.cashalo.service.model.borrow.HomeProductModel;
import com.oriente.cashalo.service.model.borrow.HomeTitle;
import com.oriente.cashalo.service.model.borrow.IconListModel;
import com.oriente.cashalo.service.model.borrow.ProductListModel;
import com.oriente.cashalo.service.model.borrow.RepayModel;
import com.oriente.cashalo.service.model.borrow.ShowOnlineModel;
import com.oriente.cashalo.service.model.borrow.StoreListModel;
import com.oriente.cashalo.service.model.common.Notifications;
import com.oriente.cashalo.service.model.common.RollingNotification;
import com.oriente.cashalo.service.model.config.BannerConfig;
import com.oriente.cashalo.service.model.config.ConfigSwitch;
import com.oriente.cashalo.service.model.config.ConfigSwitchType;
import com.oriente.cashalo.utils.OrientUtils;
import com.oriente.cashalo.utils.SmsUtils;
import com.oriente.core.internal.ScreenName;
import com.oriente.core.page.OnlineUri;
import com.oriente.core.page.RouterUri;
import com.oriente.core.page.jump.BackModel;
import com.oriente.core.page.jump.Jumper;
import com.oriente.core.router.Router;
import com.oriente.core.router.RouterScene;
import com.oriente.core.store.cache.GlobalSession;
import com.oriente.core.utils.ResUtils;
import com.oriente.core.utils.StringUtils;
import com.oriente.http.callback.RequestCallback;
import com.oriente.http.image.ImageDisplay;
import com.oriente.http.model.RequestContext;
import com.oriente.http.model.RequestResult;
import com.oriente.manager.OrientManager;
import com.oriente.moduleapi.AnalyticsService;
import com.oriente.notify.NotificationHelper;
import com.oriente.plugin.PluginResult;
import com.oriente.plugin.PluginResultCallback;
import com.oriente.plugin.module.AppPlugin;
import com.oriente.plugin.module.BorrowPlugin;
import com.oriente.plugin.module.UserPlugin;
import com.oriente.plugin.module.VerifyPlugin;
import com.oriente.qrcodelibrary.DisplayUtil;
import com.oriente.uikit.group.NestRefreshLayout;
import com.oriente.uikit.group.PageScrollView;
import com.oriente.uikit.group.ScrollLayout;
import com.oriente.uikit.group.WidgetLayout;
import com.oriente.uikit.utils.ViewUtils;
import com.oriente.uimodule.alert.Alert;
import com.oriente.uimodule.alert.AlertBuilder;
import com.oriente.user.UserUtils;
import com.snap.stuffing.api.DynamicAppManager;
import dagger.android.support.AndroidSupportInjection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;

@ScreenName("homepage")
public class e extends BaseRefreshUiFragment implements View.OnClickListener, c.a, OnItemClickListener, OnItemChildClickListener, PreFetchListener, BorrowPlugin.AppSwitchCallback {
    private com.oriente.cashalo.page.adapter.j c;
    private com.oriente.cashalo.businese.c d;
    private AutoScrollBanner<SimpleDraweeView, BannerConfig> e;
    private String f;
    private AlertBuilder g;
    private Boolean h;
    private PageScrollView i;
    private TextView j;
    private ConstraintLayout k;
    private RollingNoticeView l;
    private ImageView m;
    private ImageView n;

    @Inject
    DynamicAppManager o;
    CashModel p;
    private ActivityResultLauncher<String> r;
    private RecyclerView t;
    private LinearLayoutManager u;
    private FirebaseRemoteConfig v;
    private ConstraintLayout x;
    private boolean a = true;
    private boolean b = true;
    private int q = 3;
    private AutoScrollBanner.IBannerFactory<SimpleDraweeView, BannerConfig> s = new a();
    private RollingNoticeView.b w = new c();

    class a implements AutoScrollBanner.IBannerFactory<SimpleDraweeView, BannerConfig> {
        a() {
        }

        @Override
        public SimpleDraweeView buildBannerView(Context context, int i, BannerConfig bannerConfig) {
            int i2 = R.mipmap.herobanner;
            String schema = bannerConfig.getSchema();
            String imageUrl = bannerConfig.getImageUrl();
            SimpleDraweeView simpleDraweeView = new SimpleDraweeView(context);
            if (StringUtils.isInvisible(imageUrl)) {
                ImageDisplay.with(simpleDraweeView).scaleType(ScalingUtils.ScaleType.FIT_XY).round(DisplayUtil.dip2px(context, 6.0f)).display(i2);
            } else {
                ImageDisplay.with(simpleDraweeView).scaleType(ScalingUtils.ScaleType.FIT_XY).holderImage(i2).round(DisplayUtil.dip2px(context, 6.0f)).display(imageUrl);
            }
            simpleDraweeView.setTag(R.id.widgetLayoutViewIndexType, schema);
            simpleDraweeView.setTag(com.oriente.cashalo.R.id.widgetLayoutViewIndex, Integer.valueOf(i));
            return simpleDraweeView;
        }

        @Override
        public void onClick(View view) {
            String str = (String) view.getTag(R.id.widgetLayoutViewIndexType);
            int intValue = ((Integer) view.getTag(com.oriente.cashalo.R.id.widgetLayoutViewIndex)).intValue();
            if (StringUtils.isVisible(str)) {
                CommonAnalytics.banner(e.this.getPageId(), "banner", str, intValue + 1);
                Router.from(e.this).deliver(str, RouterScene.INNER);
            }
        }
    }

    class b implements ScrollLayout.OnScrollChangeListener {
        final View a;

        b(View view) {
            this.a = view;
        }

        public void onScrollChanged(int i, int i2, int i3, int i4) {
            if (i2 > 200) {
                this.a.setBackgroundColor(ResUtils.color(R.color.ori_white));
            } else {
                this.a.setBackgroundColor(ResUtils.color(R.color.ori_window));
            }
        }

        public void onScrollStateChanged(int i, int i2) {
        }
    }

    class c implements RollingNoticeView.b {
        c() {
        }

        @Override
        public SpannableStringBuilder a(RollingNotification rollingNotification) {
            return rollingNotification.show();
        }

        @Override
        public void b(RollingNotification rollingNotification) {
            if (rollingNotification == null || StringUtils.isInvisibleOrNull(rollingNotification.schema)) {
                return;
            }
            CommonAnalytics.analyticsClick(e.this.getPageId(), "", "NotificationBar", CommonAnalytics.toProperties("type", rollingNotification.type, new Object[0]));
            Router.from(e.this).deliver(rollingNotification.schema, RouterScene.INNER);
        }
    }

    class d implements RequestCallback<Integer> {
        d() {
        }

        public void onRequestFinished(RequestContext<Integer> requestContext, RequestResult<Integer> requestResult) {
            if (requestResult.isSuccessFull()) {
                GlobalSession.put(ValueConfig.SMS_STATUS, requestResult.getResult());
            } else {
                GlobalSession.put(ValueConfig.SMS_STATUS, 0);
            }
        }
    }

    class C0022e implements PluginResultCallback {
        final f a;

        C0022e(f fVar) {
            this.a = fVar;
        }

        public void onPluginResult(PluginResult pluginResult) {
            if (pluginResult.isSuccess()) {
                e.this.a(true);
            }
            this.a.a(pluginResult.isSuccess());
        }
    }

    interface f {
        void a(boolean z);
    }

    public static void a(PluginResult pluginResult) {
    }

    public static void b(PluginResult pluginResult) {
    }

    public static void c(PluginResult pluginResult) {
    }

    private void d() {
        AppPlugin plugin = OrientManager.getPlugin(AppPlugin.class);
        if (plugin.isPopupDetailShowing(this, (Bundle) null)) {
            return;
        }
        plugin.checkShowPopupDetail(this, Jumper.obtain(new Object[]{"targetPage", "1"}));
    }

    public static void e(boolean z) {
    }

    public static void f(boolean z) {
    }

    public static void g(boolean z) {
    }

    private void h(boolean z) {
        a(j());
        i(z);
        a();
    }

    private void i() {
        this.r = registerForActivityResult(new ActivityResultContracts.RequestPermission(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                e.this.a((Boolean) obj);
            }
        });
    }

    private boolean j() {
        UserPlugin plugin = OrientManager.getPlugin(UserPlugin.class);
        return plugin != null && plugin.isLogin();
    }

    private boolean k() {
        Boolean bool = this.h;
        if (bool == null || bool.booleanValue() == j()) {
            return false;
        }
        this.h = Boolean.valueOf(j());
        return true;
    }

    private void m() {
        CommonService.smsStatus(new RequestContext.Builder(this).build(new d()));
    }

    private void n() {
        if (Build.VERSION.SDK_INT < 33 || b()) {
            return;
        }
        this.r.launch("android.permission.POST_NOTIFICATIONS");
    }

    private void o() {
        ConstraintLayout constraintLayout = this.k;
        if (constraintLayout != null) {
            constraintLayout.setVisibility(8);
        }
        ConstraintLayout constraintLayout2 = this.x;
        if (constraintLayout2 != null) {
            ViewGroup.LayoutParams layoutParams = (WidgetLayout.LayoutParams) constraintLayout2.getLayoutParams();
            ((WidgetLayout.LayoutParams) layoutParams).bottomMargin = ResUtils.dip2px(4.0f);
            this.x.setLayoutParams(layoutParams);
        }
    }

    private void p() {
        ConstraintLayout constraintLayout = this.k;
        if (constraintLayout != null) {
            constraintLayout.setVisibility(0);
        }
        TextView textView = this.j;
        if (textView != null) {
            textView.setVisibility(8);
        }
        RollingNoticeView rollingNoticeView = this.l;
        if (rollingNoticeView != null) {
            rollingNoticeView.a((List<RollingNotification>) null);
        }
        ConstraintLayout constraintLayout2 = this.x;
        if (constraintLayout2 != null) {
            ViewGroup.LayoutParams layoutParams = (WidgetLayout.LayoutParams) constraintLayout2.getLayoutParams();
            ((WidgetLayout.LayoutParams) layoutParams).bottomMargin = ResUtils.dip2px(40.0f);
            this.x.setLayoutParams(layoutParams);
        }
    }

    private void q() {
        FragmentManager childFragmentManager = getChildFragmentManager();
        if (childFragmentManager.findFragmentByTag("HomePageCordovaFragment") == null) {
            childFragmentManager.beginTransaction().replace(R.id.key_borrow_container, new l(), "HomePageCordovaFragment").commit();
        } else {
            l findFragmentByTag = childFragmentManager.findFragmentByTag("HomePageCordovaFragment");
            findFragmentByTag.onVisibleChanged(true);
            childFragmentManager.beginTransaction().show(findFragmentByTag);
        }
    }

    private void r() {
        CommonAnalytics.analyticsClick(getPageId(), "", "Notifications");
        Router.from(this).deliver(RouterUri.NOTIFICATION_CENTER, RouterScene.INNER);
    }

    private void s() {
        for (Map.Entry<String, FirebaseRemoteConfigValue> entry : this.v.getAll().entrySet()) {
            entry.getKey();
            entry.getValue().asString();
        }
        String string = this.v.getString("home_page_cash_config");
        if (!StringUtils.isVisibleUnNull(string)) {
            this.c.b();
            return;
        }
        try {
            CashModel cashModel = (CashModel) AdapterUtils.getGson().fromJson(string, CashModel.class);
            this.p = cashModel;
            if (StringUtils.isInvisibleOrNull(cashModel.getAmount()) && StringUtils.isInvisibleOrNull(this.p.getMinLoanAmount()) && StringUtils.isInvisibleOrNull(this.p.getMaxLoanAmount())) {
                this.c.b();
            } else {
                this.c.a(this.p);
            }
        } catch (JsonSyntaxException unused) {
            this.c.b();
        }
    }

    public void l() {
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("https://m.me/HowToPayCashaloSupport"));
        if (getActivity() != null) {
            getActivity().startActivity(intent);
        }
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (com.oriente.cashalo.R.id.ll_help == id) {
            h();
            return;
        }
        if (com.oriente.cashalo.R.id.ll_connect_us == id) {
            if (!j()) {
                a(new f() {
                    @Override
                    public final void a(boolean z) {
                        e.e(z);
                    }
                });
                return;
            } else {
                CommonAnalytics.analyticsClick(getPageId(), "Chat with us");
                l();
                return;
            }
        }
        if (com.oriente.cashalo.R.id.imgMsg == id || com.oriente.cashalo.R.id.txtMsg == id) {
            if (j()) {
                r();
                return;
            } else {
                a(new f() {
                    @Override
                    public final void a(boolean z) {
                        e.f(z);
                    }
                });
                return;
            }
        }
        if (com.oriente.user.R.id.tv_bottom_login == id) {
            CommonAnalytics.analyticsClick(getPageId(), "Login");
            a(new f() {
                @Override
                public final void a(boolean z) {
                    e.g(z);
                }
            });
            return;
        }
        if (com.oriente.user.R.id.tv_bottom_sign_up == id) {
            CommonAnalytics.analyticsClick(getPageId(), "SignUp");
            a(new PluginResultCallback() {
                public final void onPluginResult(PluginResult pluginResult) {
                    e.a(pluginResult);
                }
            });
            return;
        }
        if (com.oriente.cashalo.R.id.imgScan == id) {
            CommonAnalytics.analyticsClick(getPageId(), "PayViaQR");
            OrientManager.getPlugin(VerifyPlugin.class).codeScanPlugin(this, Jumper.obtain(new Object[]{ValueConfig.BUNDLE_TAB_INDEX, 0, ValueConfig.BUNDLE_SCAN_FACTORY, "QRMixMpfCouponFactory", ValueConfig.BUNDLE_SCAN_SOURCE, 1}), new PluginResultCallback() {
                public final void onPluginResult(PluginResult pluginResult) {
                    e.b(pluginResult);
                }
            });
            return;
        }
        int i = com.oriente.cashalo.R.id.imgMore;
        if (i == id || com.oriente.cashalo.R.id.txtMore == id) {
            if (i == id) {
                CommonAnalytics.analyticsClick(getPageId(), "ProductPicture");
            }
            a(new f() {
                @Override
                public final void a(boolean z) {
                    e.this.d(z);
                }
            });
        }
    }

    @Override
    protected void onContentViewCreated(View view, Bundle bundle, Bundle bundle2) {
        this.mTitleBar.setVisibility(8);
        this.h = Boolean.valueOf(j());
        this.d = new com.oriente.cashalo.businese.c(getPageId(), this);
        View inflate = LayoutInflater.from(view.getContext()).inflate(com.oriente.cashalo.R.layout.layout_home_noti_bar, (ViewGroup) null, false);
        setHeaderView(inflate, false);
        this.e = (AutoScrollBanner) ViewUtils.view(view, com.oriente.cashalo.R.id.autoBanner);
        b(f());
        this.k = ViewUtils.view(view, com.oriente.cashalo.R.id.login_guide_container);
        this.t = ViewUtils.view(view, com.oriente.cashalo.R.id.productRecyclerView);
        this.c = new com.oriente.cashalo.page.adapter.j(this, null, this);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
        this.u = linearLayoutManager;
        this.t.setLayoutManager(linearLayoutManager);
        this.t.setAdapter(this.c);
        this.c.setOnItemClickListener(this);
        this.c.addChildClickViewIds(new int[]{com.oriente.cashalo.R.id.tvCashApply, com.oriente.cashalo.R.id.repayNowTv, com.oriente.cashalo.R.id.repayAmountTv});
        this.c.setOnItemChildClickListener(this);
        TextView textView = (TextView) ViewUtils.view(inflate, com.oriente.cashalo.R.id.txtMsg);
        this.j = textView;
        textView.setOnClickListener(this);
        PageScrollView view2 = ViewUtils.view(view, com.oriente.cashalo.R.id.scrollViewPage);
        this.i = view2;
        view2.setOnScrollChangeListener(new b(inflate));
        ViewUtils.view(inflate, com.oriente.cashalo.R.id.imgMsg).setOnClickListener(this);
        ViewUtils.view(view, com.oriente.cashalo.R.id.login_guide_container).setOnClickListener(this);
        ViewUtils.view(view, com.oriente.user.R.id.tv_bottom_login).setOnClickListener(this);
        ViewUtils.view(view, com.oriente.user.R.id.tv_bottom_sign_up).setOnClickListener(this);
        ViewUtils.view(view, com.oriente.cashalo.R.id.ll_connect_us).setOnClickListener(this);
        ViewUtils.view(view, com.oriente.cashalo.R.id.ll_help).setOnClickListener(this);
        ImageView imageView = (ImageView) ViewUtils.view(inflate, com.oriente.cashalo.R.id.imgScan);
        this.m = imageView;
        imageView.setOnClickListener(this);
        this.n = (ImageView) ViewUtils.view(inflate, com.oriente.cashalo.R.id.logo);
        RollingNoticeView rollingNoticeView = (RollingNoticeView) ViewUtils.view(view, com.oriente.cashalo.R.id.rnc);
        this.l = rollingNoticeView;
        rollingNoticeView.setOuterListener(this.w);
        this.x = ViewUtils.view(view, com.oriente.cashalo.R.id.bottom_help_container);
        i();
        c();
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        AndroidSupportInjection.inject(this);
    }

    @Override
    protected View onCreateContentView(LayoutInflater layoutInflater, ViewGroup viewGroup) {
        return layoutInflater.inflate(com.oriente.cashalo.R.layout.fragment_home_borrow, viewGroup, false);
    }

    public void onDestroy() {
        super.onDestroy();
        AlertBuilder alertBuilder = this.g;
        if (alertBuilder == null || !Alert.isShow(alertBuilder).booleanValue()) {
            return;
        }
        Alert.dismiss(this.g);
    }

    @Override
    public void onFetchHolderAttached(FetchHolder fetchHolder, boolean z) {
    }

    @Override
    public void onFetchNodeComplete(FetchNode fetchNode, FetchHolder fetchHolder) {
    }

    public void onItemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
        a(i, view.getId());
    }

    public void onItemClick(BaseQuickAdapter<?, ?> baseQuickAdapter, View view, int i) {
        int id = view.getId();
        if (com.oriente.cashalo.R.id.moreContainer == id) {
            c(i);
        } else if (com.oriente.cashalo.R.id.storeContainer != id && com.oriente.cashalo.R.id.bannerImage == id) {
            b(i);
        }
    }

    public boolean onKeyBack(boolean z) {
        return BackModel.handle(this, getBackModel());
    }

    public void onRefresh(NestRefreshLayout nestRefreshLayout, boolean z) {
        if (z) {
            h(false);
        }
    }

    public void onSwitchApp(String str) {
        try {
            OrientManager.getPlugin(AnalyticsService.class).flush();
        } catch (Exception unused) {
        }
        r.a(this.o, str);
    }

    @Override
    public void onVisibleChanged(boolean z) {
        super.onVisibleChanged(z);
        if (z) {
            if (j() && UserUtils.getUser() != null && UserUtils.getUser().isSRF()) {
                q();
                return;
            }
            if (!this.a && k()) {
                this.b = true;
                this.i.scrollTo(0, 0);
            }
            this.a = false;
            h(true);
            e();
            d();
        }
        AutoScrollBanner<SimpleDraweeView, BannerConfig> autoScrollBanner = this.e;
        if (autoScrollBanner != null) {
            autoScrollBanner.toggleAutoScrollPage(z);
        }
    }

    @Override
    public void refreshRequest(int i, int i2) {
    }

    public void a(Boolean bool) {
        final Context context;
        if (bool.booleanValue() || getActivity() == null || shouldShowRequestPermissionRationale("android.permission.POST_NOTIFICATIONS") || (context = getContext()) == null) {
            return;
        }
        Alert.from(getContext()).message(ResUtils.string(R.string.ori_permission_first_guide_user_open_notify)).button(ResUtils.string(R.string.ori_permission_deny), ResUtils.string(R.string.ori_permission_allow)).dismissTouchOut(false).dismissBackpress(false).callback(new Alert.IAlertAction() {
            public final void onAlertAction(AlertBuilder alertBuilder, int i) {
                e.a(context, alertBuilder, i);
            }
        }).show();
    }

    private void b(List<BannerConfig> list) {
        if (list == null || list.isEmpty()) {
            list = f();
        }
        this.e.buildAndSetAdapter(getActivity(), list, this.s);
        this.e.setRebuildAdapterIfDataSetChanged(true);
        this.e.setPageCycleEnable(true);
        this.e.setAutoScrollDuration(5000);
        this.e.toggleAutoScrollPage(true);
    }

    private void c() {
        Context context = getContext();
        if (context == null) {
            return;
        }
        NotificationHelper notificationHelper = NotificationHelper.INSTANCE;
        if (notificationHelper.canSendMessage(context, ResUtils.string(com.oriente.cashalo.R.string.default_notification_channel_id)) && notificationHelper.canSendMessage(context, CommonNotificationBuilder.FCM_FALLBACK_NOTIFICATION_CHANNEL)) {
            return;
        }
        n();
    }

    private void e() {
        AlertBuilder alertBuilder = this.g;
        if ((alertBuilder == null || !Alert.isShow(alertBuilder).booleanValue()) && j() && getContext() != null) {
            NotificationHelper notificationHelper = NotificationHelper.INSTANCE;
            if (notificationHelper.canSendMessage(getContext(), ResUtils.string(com.oriente.cashalo.R.string.default_notification_channel_id)) && notificationHelper.canSendMessage(getContext(), CommonNotificationBuilder.FCM_FALLBACK_NOTIFICATION_CHANNEL)) {
                return;
            }
            this.d.a(false);
        }
    }

    private List<BannerConfig> f() {
        return Collections.singletonList(new BannerConfig("", "res:///" + R.mipmap.herobanner, ""));
    }

    void g() {
        FirebaseInstallations.getInstance().getToken(false).addOnCompleteListener(new OnCompleteListener() {
            public final void onComplete(Task task) {
                e.a(task);
            }
        });
        this.v = FirebaseRemoteConfig.getInstance();
        this.v.setConfigSettingsAsync(new FirebaseRemoteConfigSettings.Builder().setMinimumFetchIntervalInSeconds(0L).build());
        this.v.fetchAndActivate().addOnCompleteListener(new OnCompleteListener() {
            public final void onComplete(Task task) {
                e.this.b(task);
            }
        });
    }

    public void i(boolean z) {
        com.oriente.cashalo.businese.c cVar = this.d;
        if (cVar != null) {
            cVar.c(z);
            this.d.b(z);
            if (j()) {
                this.d.e();
                this.d.d();
                this.d.c();
                m();
            }
        }
    }

    public void d(boolean z) {
        Router.from(this).deliver(OnlineUri.STORE_MAP_PAGE_ONLINE, RouterScene.INNER);
    }

    private void h() {
        CommonAnalytics.analyticsClick(getPageId(), "", "HelpCenter");
        Jumper.from(this).fragment(HelpCenterFragment.class).jumpActivity(CommonActivity.class);
    }

    private void d(HomeProductModel homeProductModel) {
        if (c(homeProductModel)) {
            this.c.setList(b(homeProductModel));
        } else {
            this.c.setNewInstance((List) null);
        }
        g();
    }

    @Override
    public void l(RequestResult<List<RollingNotification>> requestResult) {
        RollingNoticeView rollingNoticeView;
        if (requestResult == null || requestResult.getResult() == null || !requestResult.isBizSuccess() || (rollingNoticeView = this.l) == null) {
            return;
        }
        rollingNoticeView.a((List<RollingNotification>) requestResult.getResult());
    }

    private void b(int i) {
        CommonAnalytics.analyticsClick(getPageId(), "ShopInStoreBanner");
        com.oriente.cashalo.page.adapter.j jVar = this.c;
        if (jVar == null || jVar.getData() == null || i < 0 || i >= this.c.getItemCount()) {
            return;
        }
        HomeItem homeItem = (HomeItem) this.c.getItem(i);
        if (homeItem instanceof BannerItem) {
            BannerItem bannerItem = (BannerItem) homeItem;
            if (StringUtils.isVisibleUnNull(bannerItem.bannerUrl)) {
                Router.from(this).deliver(bannerItem.bannerUrl, RouterScene.INNER);
            }
        }
    }

    @Override
    public void d(RequestResult<ConfigSwitch> requestResult) {
        if (requestResult == null || requestResult.getResult() == null || !((ConfigSwitch) requestResult.getResult()).getIsShow()) {
            return;
        }
        AlertBuilder from = Alert.from(getActivity());
        this.g = from;
        from.message(ResUtils.string(R.string.ori_permission_tip_for_open_notification_permission)).button(ResUtils.string(R.string.ori_common_btn_cancel), ResUtils.string(R.string.ori_common_btn_open_settings)).dismissTouchOut(false).dismissBackpress(false).callback(new Alert.IAlertAction() {
            public final void onAlertAction(AlertBuilder alertBuilder, int i) {
                e.this.a(alertBuilder, i);
            }
        }).show();
    }

    private void c(int i) {
        HomeItem homeItem;
        com.oriente.cashalo.page.adapter.j jVar = this.c;
        if (jVar == null || jVar.getData() == null || i < 0 || i >= this.c.getItemCount() || (homeItem = (HomeItem) this.c.getItem(i)) == null || !(homeItem instanceof HomeTitle)) {
            return;
        }
        CommonAnalytics.analyticsClick(getPageId(), "OnlineItemsMore");
        HomeTitle homeTitle = (HomeTitle) homeItem;
        if (homeTitle.getType() == 9) {
            CommonAnalytics.analyticsClick(getPageId(), "ShopInStoresMore");
            if (StringUtils.isVisibleUnNull(homeTitle.getMoreUrl())) {
                Router.from(this).deliver(homeTitle.getMoreUrl(), RouterScene.INNER);
            }
        }
    }

    public void b(boolean z) {
        Router.from(this).deliver(ValueConfig.URL_DOMAIN_MPF + "mpf/choose-amount?fromOthers=1", RouterScene.INNER);
    }

    @Override
    public void i(RequestResult<List<BannerConfig>> requestResult) {
        if (requestResult == null || requestResult.getResult() == null || !requestResult.isBizSuccess()) {
            return;
        }
        b((List<BannerConfig>) requestResult.getResult());
    }

    public static void a(Context context, AlertBuilder alertBuilder, int i) {
        if (i == 4) {
            OrientUtils.openNotificationSettings(context);
        }
    }

    public void b(final String str, boolean z) {
        Integer num = (Integer) GlobalSession.getAs(ValueConfig.SMS_STATUS, 0);
        CommonAnalytics.analyticsImportantStep(CommonAnalytics.toProperties("sms_status", num, new Object[0]));
        AppPlugin plugin = OrientManager.getPlugin(AppPlugin.class);
        SmsUtils smsUtils = SmsUtils.INSTANCE;
        if (smsUtils.isSwitchOn(num.intValue())) {
            plugin.requestSmsPermission(this, smsUtils.isSwitchMandatory(num.intValue()), new DefaultCallback() {
                @Override
                public final void onDefaultCallback(boolean z2) {
                    e.this.a(str, z2);
                }
            });
            smsUtils.uploadSmsCount(this, new Function1() {
                public final Object invoke(Object obj) {
                    Unit b2;
                    b2 = e.b((Boolean) obj);
                    return b2;
                }
            });
        } else {
            this.f = str;
            OrientManager.getPlugin(BorrowPlugin.class).borrow(this, Jumper.obtain(new Object[]{"scenarioCode", this.f}), false, this);
        }
    }

    public void a(boolean z) {
        if (z) {
            o();
        } else {
            p();
        }
    }

    private void a() {
        com.oriente.cashalo.businese.c cVar = this.d;
        if (cVar == null) {
            return;
        }
        cVar.a();
    }

    public void c(boolean z) {
        Router.from(this).deliver(ValueConfig.URL_DOMAIN_MPF + "mpf/statements", RouterScene.INNER);
    }

    private boolean c(HomeProductModel homeProductModel) {
        List<HomeProductModel.IconModel> list;
        List<HomeProduct> list2;
        HomeProductModel.ShopInStore shopInStore;
        HomeProductModel.ShopOnline shopOnline;
        List<HomeProductModel.ShopOnlineItem> list3;
        List<HomeProductModel.Product> list4;
        return homeProductModel != null && (homeProductModel.repayment != null || (((list = homeProductModel.icon) != null && list.size() > 0) || !(((list2 = homeProductModel.category) == null || list2.size() <= 0) && homeProductModel.customMarketing == null && (((shopInStore = homeProductModel.shopInStore) == null || (list4 = shopInStore.products) == null || list4.size() <= 0) && ((shopOnline = homeProductModel.shopOnline) == null || (list3 = shopOnline.shopCategory) == null || list3.size() <= 0)))));
    }

    private void a(int i, int i2) {
        if (i2 == com.oriente.cashalo.R.id.tvCashApply) {
            a(i);
            return;
        }
        if (i2 == com.oriente.cashalo.R.id.repayNowTv) {
            CommonAnalytics.analyticsClick(getPageId(), "RepayNow");
            a(new f() {
                @Override
                public final void a(boolean z) {
                    e.this.b(z);
                }
            });
        } else if (i2 == com.oriente.cashalo.R.id.repayAmountTv) {
            a(new f() {
                @Override
                public final void a(boolean z) {
                    e.this.c(z);
                }
            });
        }
    }

    private void a(int i) {
        HomeItem homeItem;
        com.oriente.cashalo.page.adapter.j jVar = this.c;
        if (jVar == null || i < 0 || i >= jVar.getItemCount() || (homeItem = (HomeItem) this.c.getItem(i)) == null || !(homeItem instanceof HomeProduct)) {
            return;
        }
        HomeProduct homeProduct = (HomeProduct) homeItem;
        CommonAnalytics.analyticsClick(getPageId(), "", "ApplyNow", CommonAnalytics.toProperties("product_type", homeProduct.type, new Object[0]));
        if (homeProduct.isCash()) {
            a(homeProduct.type);
        }
    }

    private void a(final String str) {
        CommonAnalytics.analyticsClick(getPageId(), "", "Cash");
        a(new f() {
            @Override
            public final void a(boolean z) {
                e.this.b(str, z);
            }
        });
    }

    public void a(String str, boolean z) {
        if (z) {
            SmsUtils.INSTANCE.getAndUploadSmsData(this);
            this.f = str;
            OrientManager.getPlugin(BorrowPlugin.class).borrow(this, Jumper.obtain(new Object[]{"scenarioCode", this.f}), false, this);
        }
        CommonAnalytics.analyticsRequestAuth(getPageId(), CommonAnalytics.toProperties("result", z ? "allow" : "deny", "auth_name", "sms"));
    }

    public static Unit b(Boolean bool) {
        bool.booleanValue();
        return null;
    }

    public void b(Task task) {
        if (task.isSuccessful()) {
            s();
        } else {
            this.c.b();
        }
    }

    private List<HomeItem> b(HomeProductModel homeProductModel) {
        List<HomeProductModel.Product> list;
        ArrayList arrayList = new ArrayList();
        RepayModel repayModel = homeProductModel.repayment;
        if (repayModel != null) {
            repayModel.setItemType(11);
            arrayList.add(repayModel);
        }
        List<HomeProductModel.IconModel> list2 = homeProductModel.icon;
        if (list2 != null && list2.size() > 0) {
            Iterator<HomeProductModel.IconModel> it = homeProductModel.icon.iterator();
            while (it.hasNext()) {
                it.next().setSpanSize(1);
            }
            IconListModel iconListModel = new IconListModel(homeProductModel.icon);
            iconListModel.setItemType(HomeItem.ICON_LIST);
            arrayList.add(iconListModel);
        }
        List<HomeProduct> list3 = homeProductModel.category;
        if (list3 != null && list3.size() > 0) {
            int i = 0;
            while (true) {
                if (i >= homeProductModel.category.size()) {
                    break;
                }
                HomeProduct homeProduct = homeProductModel.category.get(i);
                if (homeProduct.show && homeProduct.isCash()) {
                    homeProduct.setItemType(HomeItem.CASH);
                    arrayList.add(homeProduct);
                    break;
                }
                i++;
            }
        }
        HomeProductModel.CustomMarketing customMarketing = homeProductModel.customMarketing;
        if (customMarketing != null && (list = customMarketing.productList) != null && list.size() > 0) {
            HomeProductModel.CustomMarketing customMarketing2 = homeProductModel.customMarketing;
            HomeTitle homeTitle = new HomeTitle(customMarketing2.title, "", customMarketing2.iconImage, 12);
            homeTitle.setItemType(HomeItem.TITLE);
            arrayList.add(homeTitle);
            CustomMarketingListModel customMarketingListModel = new CustomMarketingListModel(homeProductModel.customMarketing.productList, "");
            customMarketingListModel.setItemType(12);
            arrayList.add(customMarketingListModel);
        }
        if (homeProductModel.shopInStore != null) {
            HomeTitle homeTitle2 = new HomeTitle(ResUtils.string(com.oriente.cashalo.R.string.ori_home_borrow_title_borrow_shop_in_store), homeProductModel.shopInStore.moreUrl, 9);
            homeTitle2.setItemType(HomeItem.TITLE);
            arrayList.add(homeTitle2);
            if (StringUtils.isVisibleUnNull(homeProductModel.shopInStore.bannerImageUrl)) {
                HomeProductModel.ShopInStore shopInStore = homeProductModel.shopInStore;
                BannerItem bannerItem = new BannerItem(shopInStore.bannerUrl, shopInStore.bannerImageUrl);
                bannerItem.setItemType(14);
                arrayList.add(bannerItem);
            }
            HomeProductModel.ShopInStore shopInStore2 = homeProductModel.shopInStore;
            List<HomeProductModel.Product> list4 = shopInStore2.products;
            if (list4 != null && list4.size() > 0) {
                Iterator<HomeProductModel.Product> it2 = shopInStore2.products.iterator();
                while (it2.hasNext()) {
                    it2.next().setSpanSize(1);
                }
                ProductListModel productListModel = new ProductListModel(shopInStore2.products, shopInStore2.moreUrl);
                productListModel.setItemType(9);
                arrayList.add(productListModel);
            }
            List<HomeProductModel.Store> list5 = shopInStore2.stores;
            if (list5 != null && list5.size() > 0) {
                Iterator<HomeProductModel.Store> it3 = shopInStore2.stores.iterator();
                while (it3.hasNext()) {
                    it3.next().setSpanSize(1);
                }
                StoreListModel storeListModel = new StoreListModel(shopInStore2.stores);
                storeListModel.setItemType(10);
                arrayList.add(storeListModel);
            }
        }
        HomeProductModel.ShopOnline shopOnline = homeProductModel.shopOnline;
        if (shopOnline != null && a(shopOnline)) {
            HomeTitle homeTitle3 = new HomeTitle(homeProductModel.shopOnline.shopOnlineName, null, HomeItem.DEFAULT);
            homeTitle3.setItemType(HomeItem.TITLE);
            arrayList.add(homeTitle3);
            List<HomeProductModel.ShopOnlineItem> list6 = homeProductModel.shopOnline.shopCategory;
            if (list6 != null && list6.size() > 0) {
                ShowOnlineModel showOnlineModel = new ShowOnlineModel(homeProductModel.shopOnline.shopCategory);
                showOnlineModel.setItemType(15);
                arrayList.add(showOnlineModel);
            }
        }
        return arrayList;
    }

    private void a(PluginResultCallback pluginResultCallback) {
        UserPlugin plugin = OrientManager.getPlugin(UserPlugin.class);
        if (plugin != null) {
            plugin.signUp(this, pluginResultCallback);
        }
    }

    @Override
    public void a(HomeProductModel homeProductModel) {
        if (homeProductModel != null) {
            List<ConfigSwitch> list = homeProductModel.extraSwitches;
            if (list != null && list.size() > 0) {
                for (ConfigSwitch configSwitch : homeProductModel.extraSwitches) {
                    if (configSwitch.isShopOnline() && !configSwitch.getIsShow() && (getActivity() instanceof MainActivity)) {
                        getActivity().c();
                    }
                }
            }
            setRefreshComplete();
            d(homeProductModel);
        }
        if (j() && this.b) {
            this.b = false;
            this.d.b();
        }
    }

    public static void a(Task task) {
        if (task.isSuccessful() && task.getResult() != null) {
            ((InstallationTokenResult) task.getResult()).getToken();
        } else {
            FS.log_e("alex Installations", "Unable to get Installation auth token");
        }
    }

    private boolean a(HomeProductModel.ShopOnline shopOnline) {
        List<HomeProductModel.ShopOnlineItem> list;
        if (shopOnline == null || (list = shopOnline.shopCategory) == null || list.size() <= 0) {
            return false;
        }
        Iterator<HomeProductModel.ShopOnlineItem> it = shopOnline.shopCategory.iterator();
        while (it.hasNext()) {
            List<HomeProductModel.ShopOnlineChildItem> list2 = it.next().storeList;
            if (list2 != null && list2.size() >= 2) {
                return true;
            }
        }
        return false;
    }

    @Override
    public void a(RequestResult<Notifications> requestResult, Notifications notifications) {
        if (requestResult == null || !requestResult.isBizSuccess() || notifications == null) {
            return;
        }
        this.j.setVisibility(notifications.unreadCount > 0 ? 0 : 8);
    }

    public void a(AlertBuilder alertBuilder, int i) {
        if (i != 4 || getActivity() == null) {
            return;
        }
        NotificationHelper.INSTANCE.openSetting(getActivity(), getActivity().getPackageName());
    }

    @Override
    public void a(RequestResult<List<CouponModel>> requestResult, List<CouponModel> list) {
        if (!requestResult.isBizSuccess() || list == null || list.size() <= 0) {
            return;
        }
        if (OrientManager.getPlugin(AppPlugin.class).isExtraSwitchOn(this, ConfigSwitchType.COUPON.type + "")) {
            OrientManager.getPlugin(BorrowPlugin.class).showCoupons(this, Jumper.obtain(new Object[]{ValueConfig.BUNDLE_TAB_INDEX, list}), new PluginResultCallback() {
                public final void onPluginResult(PluginResult pluginResult) {
                    e.c(pluginResult);
                }
            });
        }
    }

    private void a(f fVar) {
        UserPlugin plugin = OrientManager.getPlugin(UserPlugin.class);
        if (plugin != null) {
            plugin.login(this, Jumper.obtain(new Object[]{ValueConfig.BUNDLE_IS_FROM_HYBRID, Boolean.FALSE}), new C0022e(fVar));
        }
    }

    private boolean b() {
        return Build.VERSION.SDK_INT < 33 || ContextCompat.checkSelfPermission(requireContext(), "android.permission.POST_NOTIFICATIONS") == 0;
    }
}