导航菜单

页面标题

页面副标题

Oolka v2.4.42 - HVRudderstackManager.java 源代码

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

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


package co.hyperverge.hypersnapsdk.analytics.rudderstack;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;
import co.hyperverge.hyperkyc.data.models.HyperKycConfig;
import co.hyperverge.hypersnapsdk.BuildConfig;
import co.hyperverge.hypersnapsdk.HyperSnapSDK;
import co.hyperverge.hypersnapsdk.analytics.AnalyticsTrackerService;
import co.hyperverge.hypersnapsdk.analytics.Event;
import co.hyperverge.hypersnapsdk.analytics.mixpanel.Keys;
import co.hyperverge.hypersnapsdk.helpers.SDKInternalConfig;
import co.hyperverge.hypersnapsdk.helpers.SPHelper;
import co.hyperverge.hypersnapsdk.helpers.TimingUtils;
import co.hyperverge.hypersnapsdk.model.LivenessResponse;
import co.hyperverge.hypersnapsdk.objects.ExternalConfigs;
import co.hyperverge.hypersnapsdk.objects.HVDocConfig;
import co.hyperverge.hypersnapsdk.objects.HVError;
import co.hyperverge.hypersnapsdk.objects.HVFaceConfig;
import co.hyperverge.hypersnapsdk.objects.HVResponse;
import co.hyperverge.hypersnapsdk.objects.HyperSnapParams;
import co.hyperverge.hypersnapsdk.objects.HyperSnapSDKConfig;
import co.hyperverge.hypersnapsdk.utils.AppConstants;
import co.hyperverge.hypersnapsdk.utils.Utils;
import com.google.gson.Gson;
import com.rudderstack.android.sdk.core.RudderClient;
import com.rudderstack.android.sdk.core.RudderConfig;
import com.rudderstack.android.sdk.core.RudderOption;
import com.rudderstack.android.sdk.core.RudderProperty;
import com.rudderstack.android.sdk.core.RudderTraits;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class HVRudderstackManager implements AnalyticsTrackerService {
    private static final String COLUMN_NAME = "MobileSDK";
    private static final String DATA_PLANE_URL = "https://hypervergekrba.dataplane.rudderstack.com";
    private static final String DEBUG_WRITE_KEY = "2XvRW6McXBVE48ehkV4mVPPLJHO";
    private static final String RELEASE_WRITE_KEY = "2Mz2HdkvpsXBOej2qkEwocZho4j";
    private static final String TAG = "co.hyperverge.hypersnapsdk.analytics.rudderstack.HVRudderstackManager";
    private static HVRudderstackManager rudderstackManager;
    private final Context context;
    private HVDocConfig hvDocConfig;
    private HVFaceConfig hvFaceConfig;
    private final RudderClient rudderClient;

    private HVRudderstackManager(Context context) {
        this.context = context;
        this.rudderClient = RudderClient.getInstance(context, getWriteKey(), new RudderConfig.Builder().withDataPlaneUrl(DATA_PLANE_URL).withTrackLifecycleEvents(false).withRecordScreenViews(false).build());
    }

    private String getBase64EncodedImage(String str) {
        try {
            Bitmap decodeFile = BitmapFactory.decodeFile(str);
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            decodeFile.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
            return Base64.encodeToString(byteArrayOutputStream.toByteArray(), 0);
        } catch (Exception e) {
            Utils.getErrorMessage(e);
            return null;
        }
    }

    private Map<String, Object> getCommonProperties() {
        HashMap hashMap = new HashMap();
        try {
            String transactionID = SPHelper.getTransactionID();
            String name = HyperSnapSDK.getInstance().getHyperSnapSDKConfig().getHyperSnapRegion().name();
            String appId = HyperSnapSDK.getInstance().getHyperSnapSDKConfig().getAppId();
            String deviceAbi = Utils.getDeviceAbi();
            hashMap.put("transactionId", transactionID);
            hashMap.put("region", name);
            hashMap.put(HyperKycConfig.APP_ID, appId);
            hashMap.put("sdkVersion", BuildConfig.HYPERSNAP_VERSION_NAME);
            hashMap.put("abiArch", deviceAbi);
            ExternalConfigs externalConfigs = HyperSnapSDK.getInstance().getHyperSnapSDKConfig().getExternalConfigs();
            if (externalConfigs != null) {
                HashMap<String, String> metadataMap = externalConfigs.getMetadataMap();
                for (String str : metadataMap.keySet()) {
                    hashMap.put(str, metadataMap.get(str));
                }
            }
            hashMap.put("shouldEnableSSLPinning", Boolean.valueOf(HyperSnapSDK.getInstance().getHyperSnapSDKConfig().isShouldEnableSSLPinning()));
            hashMap.put("shouldUseSignature", Boolean.valueOf(HyperSnapSDK.getInstance().getHyperSnapSDKConfig().isShouldUseSignature()));
            hashMap.put("shouldLogOnlyErrors", Boolean.valueOf(HyperSnapSDK.getInstance().getHyperSnapSDKConfig().isShouldLogOnlyErrors()));
            hashMap.put("shouldReturnRawResponse", Boolean.valueOf(HyperSnapSDK.getInstance().getHyperSnapSDKConfig().isShouldReturnRawResponse()));
            hashMap.put("connectTimeOut", String.valueOf(HyperSnapSDK.getInstance().getHyperSnapSDKConfig().getConnectTimeOut()));
            hashMap.put("readTimeOut", String.valueOf(HyperSnapSDK.getInstance().getHyperSnapSDKConfig().getReadTimeOut()));
            hashMap.put("writeTimeOut", String.valueOf(HyperSnapSDK.getInstance().getHyperSnapSDKConfig().getWriteTimeOut()));
            hashMap.put("shouldUseSensorBiometrics", Boolean.valueOf(HyperSnapSDK.getInstance().getHyperSnapSDKConfig().isShouldUseSensorBiometrics()));
            hashMap.put("shouldUseLocation", Boolean.valueOf(HyperSnapSDK.getInstance().getHyperSnapSDKConfig().isShouldUseLocation()));
        } catch (Exception e) {
            Utils.getErrorMessage(e);
            SDKInternalConfig.getInstance().getErrorMonitoringService(this.context).sendErrorMessage(e);
        }
        return hashMap;
    }

    private Map<String, Object> getDocConfigProperties() {
        HashMap hashMap = new HashMap();
        hashMap.put(HVDocConfig.KEY, this.hvDocConfig);
        return hashMap;
    }

    private Map<String, Object> getFaceConfigProperties() {
        HashMap hashMap = new HashMap();
        hashMap.put("hvFaceConfig", this.hvFaceConfig);
        hashMap.put("cameraLevel", AppConstants.cameraLevel);
        hashMap.put("cameraType", AppConstants.cameraType);
        return hashMap;
    }

    private String getFileFormat(String str) {
        try {
            return str.substring(str.lastIndexOf(".") + 1);
        } catch (Exception e) {
            Utils.getErrorMessage(e);
            return null;
        }
    }

    private Map<String, Object> getHyperSnapSDKConfigProperties(HyperSnapSDKConfig hyperSnapSDKConfig) {
        HashMap hashMap = new HashMap();
        hashMap.put("hyperSnapSDKConfig", hyperSnapSDKConfig);
        return hashMap;
    }

    private String getImageSize(String str) {
        try {
            Bitmap decodeFile = BitmapFactory.decodeFile(str);
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            decodeFile.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
            return (byteArrayOutputStream.toByteArray().length / 1024.0d) + " KB";
        } catch (Exception e) {
            Utils.getErrorMessage(e);
            return null;
        }
    }

    public static HVRudderstackManager getInstance(Context context) {
        if (rudderstackManager == null) {
            rudderstackManager = new HVRudderstackManager(context);
        }
        return rudderstackManager;
    }

    private String getVideoSize(String str) {
        return (new File(str).length() / 1024) + "KB";
    }

    private String getWriteKey() {
        return Utils.isReleaseBuild(this.context) ? RELEASE_WRITE_KEY : DEBUG_WRITE_KEY;
    }

    private void pushRudderAnalyticsIdentifyEvent(String str, String str2, Map<String, Object> map) {
        if (map == null) {
            map = new HashMap<>();
        }
        map.putAll(getCommonProperties());
        RudderProperty rudderProperty = new RudderProperty();
        rudderProperty.putValue(map);
        rudderProperty.putValue(Keys.HV_EVENT, str2);
        RudderTraits rudderTraits = new RudderTraits();
        rudderTraits.put("properties", rudderProperty);
        if (Utils.isReleaseBuild(this.context)) {
            this.rudderClient.identify(str, rudderTraits, (RudderOption) null);
            return;
        }
        StringBuilder sb = new StringBuilder();
        sb.append("Event : ");
        sb.append(new Gson().toJson(rudderTraits));
    }

    private void pushRudderAnalyticsScreenEvent(String str, String str2, Map<String, Object> map) {
        if (map == null) {
            map = new HashMap<>();
        }
        Map<String, Object> commonProperties = getCommonProperties();
        Map<String, Object> faceConfigProperties = getFaceConfigProperties();
        Map<String, Object> docConfigProperties = getDocConfigProperties();
        map.putAll(commonProperties);
        if (str2 != null) {
            switch (str2) {
                case "NetworkEvent":
                    map.putAll(faceConfigProperties);
                    map.putAll(docConfigProperties);
                    break;
                case "FaceEvent":
                    map.putAll(faceConfigProperties);
                    break;
                case "DocEvent":
                    map.putAll(docConfigProperties);
                    break;
                default:
                    StringBuilder sb = new StringBuilder();
                    sb.append(str2);
                    sb.append(" : Not implemented");
                    break;
            }
        }
        RudderProperty rudderProperty = new RudderProperty();
        rudderProperty.putValue(map);
        rudderProperty.putValue(Keys.HV_EVENT, str);
        if (Utils.isReleaseBuild(this.context)) {
            this.rudderClient.screen(COLUMN_NAME, rudderProperty);
            return;
        }
        StringBuilder sb2 = new StringBuilder();
        sb2.append("Event : ");
        sb2.append(new Gson().toJson(rudderProperty));
        this.rudderClient.screen(COLUMN_NAME, rudderProperty);
    }

    private void pushRudderAnalyticsTrackEvent(String str, String str2, Map<String, Object> map) {
        if (map == null) {
            map = new HashMap<>();
        }
        Map<String, Object> commonProperties = getCommonProperties();
        Map<String, Object> faceConfigProperties = getFaceConfigProperties();
        Map<String, Object> docConfigProperties = getDocConfigProperties();
        map.putAll(commonProperties);
        if (str2 != null) {
            switch (str2) {
                case "NetworkEvent":
                    map.putAll(faceConfigProperties);
                    map.putAll(docConfigProperties);
                    break;
                case "FaceEvent":
                    map.putAll(faceConfigProperties);
                    break;
                case "DocEvent":
                    map.putAll(docConfigProperties);
                    break;
                default:
                    StringBuilder sb = new StringBuilder();
                    sb.append(str2);
                    sb.append(" : Not implemented");
                    break;
            }
        }
        RudderProperty rudderProperty = new RudderProperty();
        rudderProperty.putValue(map);
        rudderProperty.putValue(Keys.HV_EVENT, str);
        if (Utils.isReleaseBuild(this.context)) {
            this.rudderClient.track(COLUMN_NAME, rudderProperty);
            return;
        }
        StringBuilder sb2 = new StringBuilder();
        sb2.append("Event : ");
        sb2.append(new Gson().toJson(rudderProperty));
        this.rudderClient.track(COLUMN_NAME, rudderProperty);
    }

    @Override
    public void logCameraPermissionDeniedError() {
    }

    @Override
    public void logCameraPermissionsGranted(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_CAMERA_PERMISSION_GRANTED, null, hashMap);
    }

    @Override
    public void logCameraPermissionsRejected(HVError hVError, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_CAMERA_PERMISSION_DENIED, null, hashMap);
    }

    @Override
    public void logCameraPermissionsRequested() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_CAMERA_PERMISSION_REQUESTED, null, null);
    }

    @Override
    public void logCheckBrandingAPIError(String str, int i) {
    }

    @Override
    public void logCheckBrandingAPISuccess() {
    }

    @Override
    public void logDocumentAPICallFailed(HVResponse hVResponse, HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_API_CALL_FAILED, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentAPIPost(String str, String str2) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.API_URL, str);
        hashMap.put(Keys.CONTENT_TYPE, Keys.FORM_DATA);
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_API_POST, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentAPIResponseReceived(HVResponse hVResponse, String str, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ATTEMPTS, Integer.valueOf(hVResponse.getAttemptsCount()));
        hashMap.put("action", hVResponse.getAction());
        hashMap.put(Keys.RESPONSE_TIME, Long.valueOf(j));
        hashMap.put(Keys.IMAGE_SIZE, getImageSize(str));
        hashMap.put(Keys.IMAGE_FORMAT, getFileFormat(str));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_API_RESPONSE_RECEIVED, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentCaptureButtonClicked(HVDocConfig hVDocConfig, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        hashMap.put(Keys.DOCUMENT_SIDE, hVDocConfig.getDocumentSide());
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_CAPTURE_BUTTON_CLICKED, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentCaptureFailed(HVError hVError, HVDocConfig hVDocConfig, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_CAPTURE_FAILED, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentCaptureFlashButtonClicked() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_FLASH_BUTTON_CLICKED, Keys.DOC_EVENT, null);
    }

    @Override
    public void logDocumentCaptureSaved(HVDocConfig hVDocConfig, String str, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        hashMap.put(Keys.IMAGE_SIZE, getImageSize(str));
        hashMap.put(Keys.IMAGE_FORMAT, getFileFormat(str));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_CAPTURE_SAVED, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentCaptureScreenBackPressed() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_CAPTURE_BACK_PRESSED, Keys.DOC_EVENT, null);
    }

    @Override
    public void logDocumentCaptureScreenLaunched() {
        pushRudderAnalyticsScreenEvent(Event.EVENT_DOCUMENT_CAPTURE_SCREEN_LAUNCHED, Keys.DOC_EVENT, null);
    }

    @Override
    public void logDocumentCaptureScreenLoadFailure(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_CAPTURE_SCREEN_LOAD_FAILURE, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentCaptureScreenLoadSuccess(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_CAPTURE_SCREEN_LOAD_SUCCESS, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentCaptureScreenOpened(HVDocConfig hVDocConfig) {
    }

    @Override
    public void logDocumentCaptureSuccessful(HVDocConfig hVDocConfig, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_CAPTURE_SUCCESSFUL, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentCloseClicked() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_CLOSE_CLICKED, Keys.DOC_EVENT, null);
    }

    @Override
    public void logDocumentDocFlowStarted(HVDocConfig hVDocConfig) {
        this.hvDocConfig = hVDocConfig;
    }

    @Override
    public void logDocumentInstructionsScreenEnabled() {
    }

    @Override
    public void logDocumentInstructionsScreenLaunched() {
        pushRudderAnalyticsScreenEvent(Event.EVENT_DOCUMENT_INSTRUCTIONS_SCREEN_LAUNCHED, Keys.DOC_EVENT, null);
    }

    @Override
    public void logDocumentInstructionsScreenLoadFailure(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_INSTRUCTIONS_SCREEN_LOAD_FAILURE, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentInstructionsScreenLoadSuccess(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_INSTRUCTIONS_SCREEN_LOAD_SUCCESS, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentInstructionsScreenProceedButtonClicked(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_INSTRUCTIONS_SCREEN_PROCEED_BUTTON_CLICKED, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentPickerScreenCloseClicked() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_PICKER_SCREEN_CLOSE_CLICKED, Keys.DOC_EVENT, null);
    }

    @Override
    public void logDocumentPickerScreenDocumentCaptureButtonClicked(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_PICKER_SCREEN_DOCUMENT_CAPTURE_CLICKED, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentPickerScreenDocumentUploadButtonClicked(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_PICKER_SCREEN_DOCUMENT_UPLOAD_CLICKED, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentPickerScreenLaunched() {
        pushRudderAnalyticsScreenEvent(Event.EVENT_DOCUMENT_PICKER_SCREEN_LAUNCHED, Keys.DOC_EVENT, null);
    }

    @Override
    public void logDocumentPickerScreenLoadFailure(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_PICKER_SCREEN_LOAD_FAILURE, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentPickerScreenLoadSuccess(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_PICKER_SCREEN_LOAD_SUCCESS, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentRetakeScreenBackPressed() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_RETAKE_BACK_PRESSED, Keys.DOC_EVENT, null);
    }

    @Override
    public void logDocumentRetakeScreenLaunched() {
        pushRudderAnalyticsScreenEvent(Event.EVENT_DOCUMENT_RETAKE_SCREEN_LAUNCHED, Keys.DOC_EVENT, null);
    }

    @Override
    public void logDocumentRetakeScreenLoadFailure(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_RETAKE_SCREEN_LOAD_FAILURE, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentRetakeScreenLoadSuccess(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_RETAKE_SCREEN_LOAD_SUCCESS, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentRetakeScreenRetakeButtonClicked(HVDocConfig hVDocConfig, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        hashMap.put(Keys.DOCUMENT_SIDE, hVDocConfig.getDocumentSide());
        hashMap.put(Keys.NUMBER_OF_DOCUMENT_RETRY_ATTEMPTS, Integer.valueOf(SPHelper.getAttemptsCountForImage(hVDocConfig.ocrEndpoint, hVDocConfig.getSuffixForDocument())));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_RETAKE_SCREEN_RETAKE_BUTTON_CLICKED, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentReviewScreenBackPressed() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_REVIEW_BACK_PRESSED, Keys.DOC_EVENT, null);
    }

    @Override
    public void logDocumentReviewScreenConfirmButtonClicked(HVDocConfig hVDocConfig, int i, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        hashMap.put(Keys.DOCUMENT_SIDE, hVDocConfig.getDocumentSide());
        hashMap.put(Keys.NUMBER_OF_DOCUMENT_RETAKE_ATTEMPTS, Integer.valueOf(i));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_REVIEW_SCREEN_CONFIRM_BUTTON_CLICKED, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentReviewScreenLaunched() {
        pushRudderAnalyticsScreenEvent(Event.EVENT_DOCUMENT_REVIEW_SCREEN_LAUNCHED, Keys.DOC_EVENT, null);
    }

    @Override
    public void logDocumentReviewScreenLoadFailure(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_REVIEW_SCREEN_LOAD_FAILURE, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentReviewScreenLoadSuccess(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_REVIEW_SCREEN_LOAD_SUCCESS, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logDocumentReviewScreenRetakeButtonClicked(HVDocConfig hVDocConfig, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        hashMap.put(Keys.DOCUMENT_SIDE, hVDocConfig.getDocumentSide());
        pushRudderAnalyticsTrackEvent(Event.EVENT_DOCUMENT_REVIEW_SCREEN_RETAKE_BUTTON_CLICKED, Keys.DOC_EVENT, hashMap);
    }

    @Override
    public void logFaceCaptureTimedOut() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_CAPTURE_TIMEOUT, Keys.FACE_EVENT, null);
    }

    @Override
    public void logFaceDetectorMissing(String str) {
    }

    @Override
    public void logFaceDetectorTimedOut() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_DETECTOR_TIMEOUT, Keys.FACE_EVENT, null);
    }

    @Override
    public void logFaceMatchAPICallFailed(HVResponse hVResponse, HVError hVError, String str) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_FACE_MATCH_API_CALL_FAILED, Keys.NETWORK_EVENT, hashMap);
    }

    @Override
    public void logFaceMatchAPIPost(String str, String str2, String str3, String str4) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.API_URL, str);
        hashMap.put(Keys.CONTENT_TYPE, Keys.FORM_DATA);
        pushRudderAnalyticsTrackEvent(Event.EVENT_FACE_MATCH_API_POST, Keys.NETWORK_EVENT, hashMap);
    }

    @Override
    public void logFaceMatchAPIResponseReceived(HVResponse hVResponse, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ATTEMPTS, Integer.valueOf(hVResponse.getAttemptsCount()));
        hashMap.put("action", hVResponse.getAction());
        hashMap.put(Keys.RESPONSE_TIME, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_FACE_MATCH_API_RESPONSE_RECEIVED, Keys.NETWORK_EVENT, hashMap);
    }

    @Override
    public void logFaceMatchEnabled() {
    }

    @Override
    public void logFaceMatchFailed(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_FACE_MATCH_FAILED, Keys.NETWORK_EVENT, hashMap);
    }

    @Override
    public void logFaceMatchSuccess() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_FACE_MATCH_SUCCESS, Keys.NETWORK_EVENT, new HashMap());
    }

    @Override
    public void logGenericTrackEvent(String str, Map<String, Object> map) {
        pushRudderAnalyticsTrackEvent(str, null, map);
    }

    @Override
    public void logHardwareError() {
    }

    @Override
    public void logHyperSnapSDKInitError(String str) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_MESSAGE, str);
        pushRudderAnalyticsTrackEvent(Event.EVENT_HYPERNSAPSDK_INIT_ERROR, null, hashMap);
    }

    @Override
    public void logHyperSnapSDKInitialised() {
        TimingUtils timingUtils = new TimingUtils();
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.SDK_INITIALISATION_TIMESTAMP, Long.valueOf(timingUtils.getNowTime()));
        hashMap.put(Keys.IP_ADDRESS, Utils.getIPAddress(true));
        pushRudderAnalyticsIdentifyEvent(UUID.randomUUID() + "_HyperSnapSDKInitialised", Event.EVENT_HYPERSNAPSDK_INITIALISED, hashMap);
    }

    @Override
    public void logIdAPIFailed(boolean z, String str, String str2, int i, String str3) {
    }

    @Override
    public void logIdAPISuccessful(boolean z, String str, String str2, long j) {
    }

    @Override
    public void logIdCaptureReviewScreenLaunched() {
    }

    @Override
    public void logIdCaptureReviewScreenRetake() {
    }

    @Override
    public void logIdOldReviewScreenEvents(HVDocConfig hVDocConfig, String str) {
    }

    @Override
    public void logIdScreenClosedByUser(HVDocConfig hVDocConfig) {
    }

    @Override
    public void logLivenessAPIFailed(HVError hVError, LivenessResponse livenessResponse, HVFaceConfig hVFaceConfig) {
    }

    @Override
    public void logLivenessAPISuccessful(LivenessResponse livenessResponse, HVFaceConfig hVFaceConfig, long j) {
    }

    @Override
    public void logQRParseFailed() {
    }

    @Override
    public void logQRScannerFailed(HVError hVError) {
    }

    @Override
    public void logQRScannerLaunched() {
    }

    @Override
    public void logRemoteConfigAPIError(String str, int i) {
    }

    @Override
    public void logRemoteConfigAPISuccess() {
    }

    @Override
    public void logSelfieAPICallFailed(LivenessResponse livenessResponse, HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_API_CALL_FAILED, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieAPIPost(String str, String str2) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.API_URL, str);
        hashMap.put(Keys.CONTENT_TYPE, Keys.FORM_DATA);
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_API_POST, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieAPIResponseReceived(LivenessResponse livenessResponse, String str, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.STATUS_CODE, livenessResponse.getHttpStatusCode());
        hashMap.put(Keys.RESPONSE_TIME, Long.valueOf(j));
        hashMap.put(Keys.IMAGE_SIZE, getImageSize(str));
        hashMap.put(Keys.IMAGE_FORMAT, getFileFormat(str));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_API_RESPONSE_RECEIVED, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieCameraOpen() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_CAMERA_OPEN, Keys.FACE_EVENT, null);
    }

    @Override
    public void logSelfieCaptureButtonClicked(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_CAPTURE_BUTTON_CLICKED, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieCaptureFailed(HVError hVError, HVFaceConfig hVFaceConfig, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_CAPTURE_FAILED, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieCaptureFlipCameraButtonClicked() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_FLIP_CAMERA_BUTTON_CLICKED, Keys.FACE_EVENT, null);
    }

    @Override
    public void logSelfieCaptureSaved(HVFaceConfig hVFaceConfig, String str, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        hashMap.put(Keys.IMAGE_SIZE, getImageSize(str));
        hashMap.put(Keys.IMAGE_FORMAT, getFileFormat(str));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_CAPTURE_SAVED, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieCaptureScreenBackPressed() {
    }

    @Override
    public void logSelfieCaptureScreenLaunched() {
        pushRudderAnalyticsScreenEvent(Event.EVENT_SELFIE_CAPTURE_SCREEN_LAUNCHED, Keys.FACE_EVENT, null);
    }

    @Override
    public void logSelfieCaptureScreenLoadFailure(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_CAPTURE_SCREEN_LOAD_FAILURE, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieCaptureScreenLoadSuccess(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_CAPTURE_SCREEN_LOAD_SUCCESS, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieCaptureScreenOpened(HVFaceConfig hVFaceConfig) {
    }

    @Override
    public void logSelfieCaptureSuccessful(HVFaceConfig hVFaceConfig, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_CAPTURE_SUCCESSFUL, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieCloseClicked() {
    }

    @Override
    public void logSelfieFlowStarted(HVFaceConfig hVFaceConfig) {
        this.hvFaceConfig = hVFaceConfig;
        pushRudderAnalyticsTrackEvent(Event.EVENT_FACE_FLOW_STARTED, Keys.FACE_EVENT, new HashMap(getFaceConfigProperties()));
    }

    @Override
    public void logSelfieInstructionsScreenEnabled() {
        pushRudderAnalyticsScreenEvent(Event.EVENT_SELFIE_INSTRUCTIONS_SCREEN_ENABLED, Keys.FACE_EVENT, null);
    }

    @Override
    public void logSelfieInstructionsScreenLaunched() {
        pushRudderAnalyticsScreenEvent(Event.EVENT_SELFIE_INSTRUCTIONS_SCREEN_LAUNCHED, Keys.FACE_EVENT, null);
    }

    @Override
    public void logSelfieInstructionsScreenLoadFailure(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_INSTRUCTIONS_SCREEN_LOAD_FAILURE, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieInstructionsScreenLoadSuccess(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_INSTRUCTIONS_SCREEN_LOAD_SUCCESS, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieInstructionsScreenProceedButtonClicked(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_INSTRUCTIONS_SCREEN_PROCEED_BUTTON_CLICKED, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieRetakeScreenBackPressed() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_RETAKE_BACK_PRESSED, Keys.FACE_EVENT, null);
    }

    @Override
    public void logSelfieRetakeScreenLaunched() {
        pushRudderAnalyticsScreenEvent(Event.EVENT_SELFIE_RETAKE_LAUNCHED, Keys.FACE_EVENT, null);
    }

    @Override
    public void logSelfieRetakeScreenLoadFailure(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_RETAKE_LOAD_FAILURE, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieRetakeScreenLoadSuccess(long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_RETAKE_LOAD_SUCCESS, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieRetakeScreenRetakeButtonClicked(HVFaceConfig hVFaceConfig, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        hashMap.put(Keys.NUMBER_OF_FACE_RETRY_ATTEMPTS, Integer.valueOf(SPHelper.getAttemptsCountForImage(hVFaceConfig.getLivenessEndpoint(), "")));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_RETAKE_BUTTON_CLICKED, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieScreenClosedByUser(HVFaceConfig hVFaceConfig) {
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_CAPTURE_CLOSED_BY_USER, Keys.FACE_EVENT, null);
    }

    @Override
    public void logSelfieVideoRecordFailed(HVError hVError, long j) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_VIDEO_RECORD_FAILED, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSelfieVideoRecordSuccessful(String str, long j, long j2) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TIME_SPENT, Long.valueOf(j2));
        hashMap.put(Keys.VIDEO_SIZE, getVideoSize(str));
        hashMap.put(Keys.VIDEO_FORMAT, getFileFormat(str));
        hashMap.put(Keys.VIDEO_DURATION, Long.valueOf(j));
        pushRudderAnalyticsTrackEvent(Event.EVENT_SELFIE_VIDEO_RECORD_SUCCESSFUL, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSensorDataPostFailure(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_SENSOR_DATA_POST_FAILURE, Keys.FACE_EVENT, hashMap);
    }

    @Override
    public void logSensorDataPostSuccessful() {
        pushRudderAnalyticsTrackEvent(Event.EVENT_SENSOR_DATA_POST_SUCCESSFUL, null, null);
    }

    @Override
    public void logTextMatchAPICallFailed(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_TEXT_MATCH_API_CALL_FAILED, Keys.NETWORK_EVENT, hashMap);
    }

    @Override
    public void logTextMatchAPIFailed(boolean z, String str, String str2, int i, String str3) {
    }

    @Override
    public void logTextMatchAPIMethodCalled() {
    }

    @Override
    public void logTextMatchAPIPost() {
    }

    @Override
    public void logTextMatchAPIResponseReceived() {
    }

    @Override
    public void logTextMatchAPISuccessful(boolean z, String str, String str2, HyperSnapParams.FaceMatchMode faceMatchMode, long j) {
    }

    @Override
    public void logUserSessionEnded(String str) {
        HashMap hashMap = new HashMap();
        if (str != null) {
            hashMap.put("state", str);
        }
        if (hashMap.isEmpty()) {
            hashMap = null;
        }
        pushRudderAnalyticsTrackEvent(Event.EVENT_USER_SESSION_ENDED, null, hashMap);
    }

    @Override
    public void logUserSessionStarted(boolean z) {
        String transactionID = SPHelper.getTransactionID();
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.TRANSACTION_ID_SET_BY_CLIENT, Boolean.valueOf(z));
        hashMap.put("transactionId", transactionID);
        pushRudderAnalyticsTrackEvent(Event.EVENT_USER_SESSION_STARTED, null, hashMap);
    }

    @Override
    public void logValidationAPICallFailed(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_VALIDATION_API_CALL_FAILED, Keys.NETWORK_EVENT, hashMap);
    }

    @Override
    public void logValidationAPIFailed(String str, int i, String str2) {
    }

    @Override
    public void logValidationAPIPost() {
    }

    @Override
    public void logValidationAPIResponseReceived() {
    }

    @Override
    public void logValidationAPISuccess(String str, long j) {
    }

    @Override
    public void logVerifyAlignmentAPICallFailed(HVError hVError) {
        HashMap hashMap = new HashMap();
        hashMap.put(Keys.ERROR_CODE, Integer.valueOf(hVError.getErrorCode()));
        hashMap.put(Keys.ERROR_MESSAGE, hVError.getErrorMessage());
        pushRudderAnalyticsTrackEvent(Event.EVENT_VERIFY_ALIGNMENT_API_CALL_FAILED, Keys.NETWORK_EVENT, hashMap);
    }

    @Override
    public void logVerifyAlignmentAPIFailed(boolean z, String str, String str2, int i, String str3) {
    }

    @Override
    public void logVerifyAlignmentAPIPost() {
    }

    @Override
    public void logVerifyAlignmentAPIResponseReceived() {
    }

    @Override
    public void logVerifyAlignmentAPISuccess(boolean z, String str, String str2, long j) {
    }
}