导航菜单

页面标题

页面副标题

TruCred v1.1.3 - SplashActivity.java 源代码

正在查看: TruCred v1.1.3 应用的 SplashActivity.java JAVA 源代码文件

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


package com.veloz.app.ui;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.location.Address;
import android.net.Uri;
import android.os.Build;
import android.text.Html;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.lifecycle.Observer;
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustDeeplink;
import com.adjust.sdk.AdjustEvent;
import com.adjust.sdk.OnAdidReadListener;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.DeviceUtils;
import com.blankj.utilcode.util.LanguageUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.NetworkUtils;
import com.blankj.utilcode.util.PhoneUtils;
import com.blankj.utilcode.util.SDCardUtils;
import com.blankj.utilcode.util.SPUtils;
import com.blankj.utilcode.util.StringUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.firebase.messaging.FirebaseMessaging;
import com.lzy.okgo.model.Progress;
import com.veloz.app.R$id;
import com.veloz.app.R$layout;
import com.veloz.app.R$string;
import com.veloz.app.R$style;
import com.veloz.app.VelozApplication;
import com.veloz.app.base.BaseActivity;
import com.veloz.app.cache.LocationCache;
import com.veloz.app.cache.LoginInfoCache;
import com.veloz.app.constant.Constant;
import com.veloz.app.databinding.SplashActivityBinding;
import com.veloz.app.dialog.AppUpdateDialog;
import com.veloz.app.dialog.MyBottomSheetDialog;
import com.veloz.app.entity.JumpInfo;
import com.veloz.app.entity.LocationEntity;
import com.veloz.app.entity.RequestHeader;
import com.veloz.app.entity.UpdateAppVersionInfo;
import com.veloz.app.my.MyActivity;
import com.veloz.app.ui.SplashActivity;
import com.veloz.app.ui.home.HomeActivity;
import com.veloz.app.ui.login.LoginActivity;
import com.veloz.app.ui.web.CommonWebViewActivity;
import com.veloz.app.utils.Constants;
import com.veloz.app.utils.GeoCoderHelper;
import com.veloz.app.utils.MyDeviceInfoUtils;
import com.veloz.app.utils.SensorsHelper;
import com.veloz.app.utils.StaticC;
import com.veloz.app.utils.TimerTaskUtils;
import org.json.JSONException;
import org.json.JSONObject;

public class SplashActivity extends MyActivity<SplashActivityBinding, SplashActivityViewModel> {
    public MyBottomSheetDialog e;
    public final String[] f = {"Extranet test environment[27095]", "External network dev environment[17095]", "Production environment"};
    public int g = 0;
    public AppUpdateDialog i;

    public final void C() {
        FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener() {
            @Override
            public final void onComplete(Task task) {
                SplashActivity.this.F(task);
            }
        });
    }

    public final void D() {
        if (!StringUtils.isTrimEmpty(LoginInfoCache.e())) {
            P();
            startActivity(HomeActivity.class).go();
            finish();
        } else if (SPUtils.getInstance().getBoolean(Constants.b, true)) {
            O();
        } else if (NetworkUtils.isConnected()) {
            ((SplashActivityViewModel) this.vm).e();
        } else {
            s();
        }
    }

    public final void E() {
        Intent intent = getIntent();
        if (intent == null || !intent.hasExtra("page")) {
            if (isTaskRoot()) {
                return;
            }
            String action = getIntent().getAction();
            if (intent.hasCategory("android.intent.category.LAUNCHER") && action != null && action.equals("android.intent.action.MAIN")) {
                finish();
                return;
            }
            return;
        }
        try {
            JSONObject jSONObject = new JSONObject(intent.getStringExtra("page"));
            String string = jSONObject.getString("openUrl");
            boolean z2 = jSONObject.getBoolean("needLogin");
            Constant.b = string;
            SensorsHelper.f("home", "pushUrl", string);
            if (!StringUtils.isTrimEmpty(string)) {
                if ("openHome".equals(string)) {
                    startActivity(HomeActivity.class).go();
                    finish();
                } else if (string.contains("registerHome")) {
                    if (StringUtils.isTrimEmpty(LoginInfoCache.e())) {
                        startActivity(HomeActivity.class).go();
                        startActivity(LoginActivity.class).go();
                        finish();
                    }
                } else if (!z2) {
                    startActivity(CommonWebViewActivity.class).with(Progress.URL, string).go();
                } else if (!StringUtils.isTrimEmpty(LoginInfoCache.e())) {
                    startActivity(CommonWebViewActivity.class).with(Progress.URL, string).go();
                }
            }
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }
    }

    public final void F(Task task) {
        if (!task.isSuccessful()) {
            LogUtils.e(new Object[]{"Fetching FCM registration token failed", task.getException()});
        } else {
            StaticC.a = (String) task.getResult();
            ThreadUtils.executeBySingle(new ThreadUtils.SimpleTask<Object>() {
                public RequestHeader doInBackground() {
                    LoginInfoCache.f(LoginInfoCache.b());
                    RequestHeader requestHeader = new RequestHeader();
                    requestHeader.setAdid(Constant.c);
                    requestHeader.setAppMac(MyDeviceInfoUtils.b());
                    requestHeader.setDeviceBrand(Build.BRAND);
                    requestHeader.setDeviceCpuArchitecture(Build.CPU_ABI2);
                    requestHeader.setDeviceDiskStorageSpace(SDCardUtils.getExternalTotalSize() + "");
                    requestHeader.setDeviceModel(DeviceUtils.getModel());
                    requestHeader.setDeviceNo(DeviceUtils.getUniqueDeviceId());
                    requestHeader.setAppCode(Constants.a);
                    requestHeader.setDeviceOs("Android");
                    requestHeader.setDeviceOsImage(MyDeviceInfoUtils.d(SplashActivity.this) + "*" + MyDeviceInfoUtils.c(SplashActivity.this));
                    requestHeader.setDeviceProvidersName(PhoneUtils.getSimOperatorName());
                    requestHeader.setDeviceStorageSpace(SDCardUtils.getInternalTotalSize() + "");
                    requestHeader.setDeviceSystemLanguage(LanguageUtils.getSystemLanguage().toString());
                    requestHeader.setDeviceWifiSsid("");
                    requestHeader.setGaid(VelozApplication.getInstance().getGaid());
                    LocationEntity a = LocationCache.a();
                    if (a != null) {
                        requestHeader.setGpsLatitude(a.getLatitude());
                        requestHeader.setGpsLongitude(a.getLongitude());
                        Address a2 = GeoCoderHelper.a(SplashActivity.this, Double.valueOf(a.getLatitude()), Double.valueOf(a.getLongitude()));
                        if (a2 != null) {
                            requestHeader.setGpsAddressCity(a2.getLocality());
                            requestHeader.setGpsAddressProvince(a2.getAdminArea());
                            requestHeader.setGpsAddressStreet(a2.getThoroughfare());
                        }
                    }
                    requestHeader.setMobileOsVersion(DeviceUtils.getSDKVersionName());
                    return requestHeader;
                }

                public void onSuccess(Object obj) {
                    ((SplashActivityViewModel) ((BaseActivity) SplashActivity.this).vm).c((RequestHeader) obj);
                }
            });
        }
    }

    public final void G(UpdateAppVersionInfo updateAppVersionInfo) {
        if (updateAppVersionInfo == null) {
            D();
        } else if (updateAppVersionInfo.versionCode > AppUtils.getAppVersionCode()) {
            N(updateAppVersionInfo);
        } else {
            D();
        }
    }

    public final void H(JumpInfo jumpInfo) {
        if (jumpInfo != null) {
            if (jumpInfo.jumpPage == 1) {
                P();
                startActivity(HomeActivity.class).go();
            }
            if (jumpInfo.jumpPage == 2) {
                startActivity(LoginActivity.class).go();
            }
            finish();
        }
    }

    public final void I(View view) {
        if (!NetworkUtils.isConnected()) {
            s();
            return;
        }
        SPUtils.getInstance().put(Constants.b, false);
        ((SplashActivityViewModel) this.vm).e();
        this.e.dismiss();
    }

    public final void J(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        Constant.c = str;
        C();
    }

    public final void K() {
        Adjust.getAdid(new OnAdidReadListener() {
            public final void onAdidRead(String str) {
                SplashActivity.this.J(str);
            }
        });
    }

    @Override
    public void o(SplashActivityBinding splashActivityBinding, SplashActivityViewModel splashActivityViewModel) {
        E();
        super.o(splashActivityBinding, splashActivityViewModel);
        splashActivityBinding.a(splashActivityViewModel);
        r();
    }

    public final void M(String str) {
        try {
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
            intent.addFlags(268435456);
            startActivity(intent);
        } catch (ActivityNotFoundException unused) {
            startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=com.example.app")));
        }
    }

    public final void N(UpdateAppVersionInfo updateAppVersionInfo) {
        SensorsHelper.b("updateDialog");
        if (this.i == null) {
            this.i = new AppUpdateDialog();
        }
        this.i.setData(updateAppVersionInfo);
        this.i.setOnClickListener(new AppUpdateDialog.OnClickListener() {
            @Override
            public void a(UpdateAppVersionInfo updateAppVersionInfo2) {
                if (StringUtils.isTrimEmpty(updateAppVersionInfo2.appUpdateUrl)) {
                    StringUtils.isTrimEmpty(updateAppVersionInfo2.fileUrl);
                } else {
                    SplashActivity.this.M(updateAppVersionInfo2.appUpdateUrl);
                }
            }

            @Override
            public void onClose() {
                VelozApplication.checkUpdateAppFlag = false;
                SplashActivity.this.D();
            }
        });
        AppUpdateDialog appUpdateDialog = this.i;
        if (appUpdateDialog != null) {
            if (appUpdateDialog.isAdded() && this.i.isVisible() && this.i.getDialog() != null && this.i.getDialog().isShowing()) {
                return;
            }
            showDialog(this.i);
        }
    }

    public final void O() {
        if (SPUtils.getInstance().getBoolean(Constants.b, true)) {
            Adjust.trackEvent(new AdjustEvent("e25848"));
        }
        if (this.e == null) {
            this.e = new MyBottomSheetDialog(this, R$style.BottomSheetDialogStyle);
        }
        RelativeLayout relativeLayout = (RelativeLayout) LayoutInflater.from(this).inflate(R$layout.layout_bottom_protocol, (ViewGroup) null);
        Button button = (Button) relativeLayout.findViewById(R$id.btn_acuerdo);
        ((TextView) relativeLayout.findViewById(R$id.content)).setText(Html.fromHtml(getResources().getString(R$string.permission_statement_content)));
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SplashActivity.this.I(view);
            }
        });
        this.e.setContentView(relativeLayout);
        BottomSheetBehavior.M((View) relativeLayout.getParent()).h0(false);
        this.e.setCancelable(false);
        this.e.setCanceledOnTouchOutside(false);
        this.e.show();
    }

    public final void P() {
        Adjust.processDeeplink(new AdjustDeeplink(getIntent().getData()), getApplicationContext());
        TimerTaskUtils.c("uploadAdjustAttribution", 10000L, new TimerTaskUtils.TaskCallback() {
            @Override
            public final void a() {
                SplashActivity.this.K();
            }
        });
    }

    @Override
    public void initData() {
        SPUtils.getInstance().put(Constants.f914o, "https://cum.creditumex.com/");
        ((SplashActivityViewModel) this.vm).d();
    }

    @Override
    public void m() {
    }

    @Override
    public int myView() {
        return R$layout.splash_activity;
    }

    @Override
    public void p() {
        ((SplashActivityViewModel) this.vm).c.observe(this, new Observer() {
            public final void onChanged(Object obj) {
                SplashActivity.this.G((UpdateAppVersionInfo) obj);
            }
        });
        ((SplashActivityViewModel) this.vm).b.observe(this, new Observer() {
            public final void onChanged(Object obj) {
                SplashActivity.this.H((JumpInfo) obj);
            }
        });
    }
}