导航菜单

页面标题

页面副标题

Oolka v2.4.42 - HVFaceInstructionActivity.java 源代码

正在查看: Oolka v2.4.42 应用的 HVFaceInstructionActivity.java JAVA 源代码文件

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


package co.hyperverge.hypersnapsdk.activities;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Spanned;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import co.hyperverge.hypersnapsdk.R;
import co.hyperverge.hypersnapsdk.helpers.CustomTextStringConst;
import co.hyperverge.hypersnapsdk.helpers.HVLottieHelper;
import co.hyperverge.hypersnapsdk.helpers.SDKInternalConfig;
import co.hyperverge.hypersnapsdk.helpers.TimingUtils;
import co.hyperverge.hypersnapsdk.listeners.PermDialogCallback;
import co.hyperverge.hypersnapsdk.model.HVJSONObject;
import co.hyperverge.hypersnapsdk.objects.HVBaseConfig;
import co.hyperverge.hypersnapsdk.objects.HVError;
import co.hyperverge.hypersnapsdk.objects.HVFaceConfig;
import co.hyperverge.hypersnapsdk.providers.CallbackProvider;
import co.hyperverge.hypersnapsdk.utils.HVLogUtils;
import co.hyperverge.hypersnapsdk.utils.HyperSnapUIConfigUtil;
import co.hyperverge.hypersnapsdk.utils.TextConfigUtils;
import co.hyperverge.hypersnapsdk.utils.Utils;
import com.airbnb.lottie.LottieAnimationView;
import com.google.android.material.button.MaterialButton;
import org.json.JSONException;

public class HVFaceInstructionActivity extends HVBaseActivity {
    public static final int CANCEL_SELFIE = 3;
    public static final int PROCEED_SELFIE = 2;
    private static final String TAG = "co.hyperverge.hypersnapsdk.activities.HVFaceInstructionActivity";
    private MaterialButton btnProceed;
    private HVFaceConfig faceConfig;
    private TextView tvSubtitle;
    private TextView tvTitle;
    private final TimingUtils screenLoadSuccessTimingUtils = new TimingUtils();
    private final TimingUtils proceedButtonClickTimingUtils = new TimingUtils();

    private void findViews() {
        HVLogUtils.d(TAG, "findViews() called");
        MaterialButton findViewById = findViewById(R.id.proceed_button);
        this.btnProceed = findViewById;
        findViewById.setEnabled(true);
        ImageView imageView = (ImageView) findViewById(R.id.ivBack);
        imageView.setEnabled(true);
        this.tvTitle = (TextView) findViewById(R.id.tvTitle);
        this.tvSubtitle = (TextView) findViewById(R.id.tvSubtitle);
        this.btnProceed.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                HVFaceInstructionActivity.this.lambda$findViews$0(view);
            }
        });
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                HVFaceInstructionActivity.this.lambda$findViews$1(view);
            }
        });
    }

    public void lambda$findViews$0(View view) {
        view.setEnabled(false);
        if (SDKInternalConfig.getInstance().isShouldLogAnalyticsForThisUser() && SDKInternalConfig.getInstance().getAnalyticsTrackerService() != null) {
            SDKInternalConfig.getInstance().getAnalyticsTrackerService().logSelfieInstructionsScreenProceedButtonClicked(this.proceedButtonClickTimingUtils.getTimeDifferenceLong().longValue());
        }
        proceedToSelfie();
    }

    public void lambda$findViews$1(View view) {
        view.setEnabled(false);
        onBackPressed();
    }

    private void loadAnimation() {
        HVLogUtils.d(TAG, "loadAnimation() called");
        HVLottieHelper.load((LottieAnimationView) findViewById(R.id.lavFaceInstructions), HVLottieHelper.FACE_INSTRUCTION, HVLottieHelper.State.START, null);
    }

    private void sendOperationCancelled() {
        HVLogUtils.d(TAG, "sendOperationCancelled() called");
        try {
            HVBaseActivity.callCompletionHandler(CallbackProvider.get().injectCallback(), new HVError(3, getResources().getString(R.string.operation_cancelled)), null);
        } catch (Exception e) {
            HVLogUtils.e(TAG, "sendOperationCancelled(): exception = [" + Utils.getErrorMessage(e) + "]", e);
            Utils.getErrorMessage(e);
            if (SDKInternalConfig.getInstance().getErrorMonitoringService() != null) {
                SDKInternalConfig.getInstance().getErrorMonitoringService().sendErrorMessage(e);
            }
        }
    }

    @Override
    public void lambda$checkAndWaitForRemoteConfig$0() {
        super.lambda$checkAndWaitForRemoteConfig$0();
    }

    @Override
    public HVBaseConfig getBaseConfig() {
        return this.faceConfig;
    }

    @Override
    public void handleCloseAction() {
        super.handleCloseAction();
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
        HVLogUtils.d(TAG, "onActivityResult() called with: requestCode = [" + i + "], resultCode = [" + i2 + "], data = [" + intent + "]");
        if (i == 2 && i2 == -1) {
            finish();
        }
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }

    @Override
    public void onCloseActivity() {
        HVLogUtils.d(TAG, "onCloseActivity() called");
        sendOperationCancelled();
        finish();
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        String str = TAG;
        HVLogUtils.d(str, "onCreate() called with: savedInstanceState = [" + bundle + "]");
        this.screenLoadSuccessTimingUtils.init();
        setContentView(R.layout.hv_activity_face_instruction);
        if (bundle != null) {
            if (SDKInternalConfig.getInstance().isShouldLogAnalyticsForThisUser() && SDKInternalConfig.getInstance().getAnalyticsTrackerService() != null) {
                SDKInternalConfig.getInstance().getAnalyticsTrackerService().logSelfieInstructionsScreenLoadFailure(new HVError(2, "savedInstance is not null"));
            }
            HVLogUtils.d(str, "onCreate() savedInstance is not null, finishing activity");
            finish();
            return;
        }
        findViews();
        boolean booleanExtra = getIntent().getBooleanExtra("shouldUseBackCam", false);
        this.faceConfig = (HVFaceConfig) getIntent().getSerializableExtra("hvFaceConfig");
        HVJSONObject hVJSONObject = null;
        setupBranding(null);
        try {
            Bundle extras = getIntent().getExtras();
            if (extras != null) {
                hVJSONObject = new HVJSONObject(extras.getString("customUIStrings"));
            }
        } catch (JSONException e) {
            HVLogUtils.e(TAG, "onCreate(): customUIStrings exception = [" + Utils.getErrorMessage(e) + "]", e);
            Utils.getErrorMessage(e);
            if (SDKInternalConfig.getInstance().isShouldLogAnalyticsForThisUser() && SDKInternalConfig.getInstance().getAnalyticsTrackerService() != null) {
                SDKInternalConfig.getInstance().getAnalyticsTrackerService().logSelfieInstructionsScreenLoadFailure(new HVError(2, Utils.getErrorMessage(e)));
            }
        }
        if (hVJSONObject != null) {
            try {
                if (hVJSONObject.has("faceInstructionsTitleTypeFace") && hVJSONObject.getInt("faceInstructionsTitleTypeFace") > 0) {
                    this.tvTitle.setTypeface(ResourcesCompat.h(getApplicationContext(), hVJSONObject.getInt("faceInstructionsTitleTypeFace")));
                }
                if (hVJSONObject.hasAndNotEmpty("faceInstructionsProceedBackCamTypeFace") && hVJSONObject.getInt("faceInstructionsProceedBackCamTypeFace") > 0) {
                    this.btnProceed.setTypeface(ResourcesCompat.h(getApplicationContext(), hVJSONObject.getInt("faceInstructionsProceedBackCamTypeFace")));
                }
                Spanned text = TextConfigUtils.getText(hVJSONObject, CustomTextStringConst.FaceCaptureTextConfigs.FACE_INSTRUCTIONS_TITLE, CustomTextStringConst.FaceCaptureTextConfigs.TEXT_CONFIG_FACE_INSTRUCTIONS_TITLE);
                if (text != null) {
                    this.tvTitle.setText(text);
                }
                Spanned text2 = TextConfigUtils.getText(hVJSONObject, CustomTextStringConst.FaceCaptureTextConfigs.FACE_INSTRUCTIONS_DESC, CustomTextStringConst.FaceCaptureTextConfigs.TEXT_CONFIG_FACE_INSTRUCTIONS_DESC);
                if (text2 != null) {
                    this.tvSubtitle.setText(text2);
                }
                if (booleanExtra) {
                    Spanned text3 = TextConfigUtils.getText(hVJSONObject, "faceInstructionsProceedBackCam", "faceInstructionsProceedBackCam", getResources().getString(R.string.faceInstructionsProceedBackCam));
                    if (text3 != null) {
                        this.btnProceed.setText(text3);
                    }
                } else {
                    Spanned text4 = TextConfigUtils.getText(hVJSONObject, "faceInstructionsProceed", "faceInstructions_button", getResources().getString(R.string.faceInstructionsProceed));
                    if (text4 != null) {
                        this.btnProceed.setText(text4);
                    }
                }
            } catch (JSONException e2) {
                HVLogUtils.e(TAG, "onCreate(): exception = [" + Utils.getErrorMessage(e2) + "]", e2);
                Utils.getErrorMessage(e2);
                if (SDKInternalConfig.getInstance().isShouldLogAnalyticsForThisUser() && SDKInternalConfig.getInstance().getAnalyticsTrackerService() != null) {
                    SDKInternalConfig.getInstance().getAnalyticsTrackerService().logSelfieInstructionsScreenLoadFailure(new HVError(2, Utils.getErrorMessage(e2)));
                }
            }
        }
        if (SDKInternalConfig.getInstance().isShouldLogAnalyticsForThisUser() && SDKInternalConfig.getInstance().getAnalyticsTrackerService() != null) {
            SDKInternalConfig.getInstance().getAnalyticsTrackerService().logSelfieInstructionsScreenLoadSuccess(this.screenLoadSuccessTimingUtils.getTimeDifferenceLong().longValue());
            SDKInternalConfig.getInstance().getAnalyticsTrackerService().logSelfieInstructionsScreenLaunched();
            this.proceedButtonClickTimingUtils.init();
        }
        loadAnimation();
        HyperSnapUIConfigUtil.getInstance().customiseTitleTextView(this.tvTitle);
        HyperSnapUIConfigUtil.getInstance().customiseDescriptionTextView(this.tvSubtitle);
        HyperSnapUIConfigUtil.getInstance().customisePrimaryButton(this.btnProceed);
        HyperSnapUIConfigUtil.getInstance().customiseClientLogo((ImageView) findViewById(R.id.clientLogo));
    }

    @Override
    public void onRemoteConfigFetchDone() {
        HVLogUtils.d(TAG, "onRemoteConfigFetchDone() called");
    }

    public void onSaveInstanceState(@NonNull Bundle bundle) {
        super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
        HVLogUtils.d(TAG, "onSaveInstanceState() called with: outState = [" + bundle + "]");
    }

    @Override
    public boolean onSupportNavigateUp() {
        return super.onSupportNavigateUp();
    }

    public void proceedToSelfie() {
        HVLogUtils.d(TAG, "proceedToSelfie() called");
        Intent intent = new Intent((Context) this, (Class<?>) HVFaceActivity.class);
        intent.putExtra("hvFaceConfig", (HVFaceConfig) getIntent().getSerializableExtra("hvFaceConfig"));
        this.btnProceed.setEnabled(true);
        startActivityForResult(intent, 2);
    }

    @Override
    public boolean shouldAllowActivityClose() {
        return true;
    }

    @Override
    public boolean shouldShowCloseAlert() {
        return this.faceConfig.shouldShowCloseAlert();
    }

    @Override
    public void showCameraPermissionBS(Spanned spanned, Spanned spanned2, Spanned spanned3, PermDialogCallback permDialogCallback) {
        super.showCameraPermissionBS(spanned, spanned2, spanned3, permDialogCallback);
    }

    @Override
    public Context updateBaseContextLocale(Context context) {
        return super.updateBaseContextLocale(context);
    }
}