正在查看: Cashalo v2.25.0.0 应用的 InquiryActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Cashalo v2.25.0.0 应用的 InquiryActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.withpersona.sdk2.inquiry.internal;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.AttributeSet;
import androidx.activity.ComponentActivity;
import androidx.activity.result.ActivityResultCaller;
import androidx.activity.result.PickVisualMediaRequest;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.os.BundleCompat;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.SavedStateHandle;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import coil.ImageLoader;
import com.squareup.workflow1.Workflow;
import com.squareup.workflow1.WorkflowInterceptor;
import com.squareup.workflow1.ui.AndroidRenderWorkflowKt;
import com.squareup.workflow1.ui.ViewRegistry;
import com.squareup.workflow1.ui.WorkflowLayout;
import com.withpersona.sdk2.inquiry.internal.InquiryActivity;
import com.withpersona.sdk2.inquiry.internal.InquiryWorkflow;
import com.withpersona.sdk2.inquiry.internal.error_reporting.ExceptionUtilsKt;
import com.withpersona.sdk2.inquiry.internal.fallbackmode.ApiControllerModule;
import com.withpersona.sdk2.inquiry.internal.fallbackmode.ApiControllerParams;
import com.withpersona.sdk2.inquiry.internal.fallbackmode.LocalStaticInquiryTemplate;
import com.withpersona.sdk2.inquiry.internal.fallbackmode.StaticInquiryTemplate;
import com.withpersona.sdk2.inquiry.internal.network.InquiryModule;
import com.withpersona.sdk2.inquiry.launchers.DocumentLaunchersModule;
import com.withpersona.sdk2.inquiry.launchers.DocumentLaunchersModuleKt;
import com.withpersona.sdk2.inquiry.launchers.DocumentSelectLauncherModule;
import com.withpersona.sdk2.inquiry.launchers.DocumentSelectLauncherModuleKt;
import com.withpersona.sdk2.inquiry.launchers.PermissionsLauncherModule;
import com.withpersona.sdk2.inquiry.launchers.PermissionsLauncherModuleKt;
import com.withpersona.sdk2.inquiry.launchers.ReusableActivityResultLauncher;
import com.withpersona.sdk2.inquiry.modal.ModalWorkflow;
import com.withpersona.sdk2.inquiry.network.NetworkModule;
import com.withpersona.sdk2.inquiry.nfc.PassportNfcReaderConfig;
import com.withpersona.sdk2.inquiry.nfc.PassportNfcReaderLauncherModule;
import com.withpersona.sdk2.inquiry.nfc.PassportNfcReaderLauncherModuleKt;
import com.withpersona.sdk2.inquiry.nfc.PassportNfcReaderOutput;
import com.withpersona.sdk2.inquiry.shared.data_collection.DataCollectorModule;
import com.withpersona.sdk2.inquiry.shared.data_collection.DummyDataCollector;
import com.withpersona.sdk2.inquiry.shared.data_collection.RealDataCollector;
import com.withpersona.sdk2.inquiry.shared.device.AppSetIDHelper;
import java.util.List;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.jvm.internal.SuspendFunction;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.reflect.KFunction;
import kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.channels.BufferOverflow;
import kotlinx.coroutines.channels.Channel;
import kotlinx.coroutines.channels.ChannelKt;
import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
@Metadata(d1 = {"\u0000R\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0011\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\b\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0000\u0018\u0000 A2\u00020\u0001:\u0002ABB\u0005¢\u0006\u0002\u0010\u0002J\u0012\u00109\u001a\u00020:2\b\u0010;\u001a\u0004\u0018\u00010<H\u0014J\b\u0010=\u001a\u00020:H\u0014J\b\u0010>\u001a\u00020:H\u0014J\b\u0010?\u001a\u00020:H\u0014J\b\u0010@\u001a\u00020\bH\u0002R\u0016\u0010\u0003\u001a\u0004\u0018\u00010\u00048BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006R\u0014\u0010\u0007\u001a\u00020\b8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\t\u0010\nR\u0014\u0010\u000b\u001a\u00020\f8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\r\u0010\u000eR\u0016\u0010\u000f\u001a\u0004\u0018\u00010\u00048BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0010\u0010\u0006R\u0016\u0010\u0011\u001a\u0004\u0018\u00010\u00128BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0013\u0010\u0014R\u0016\u0010\u0015\u001a\u0004\u0018\u00010\u00048BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0016\u0010\u0006R\u0016\u0010\u0017\u001a\u0004\u0018\u00010\u00048BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0018\u0010\u0006R\u0014\u0010\u0019\u001a\u00020\b8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u001a\u0010\nR\u0016\u0010\u001b\u001a\u0004\u0018\u00010\u00048BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u001c\u0010\u0006R\u0014\u0010\u001d\u001a\u00020\u00048BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u001e\u0010\u0006R\u0016\u0010\u001f\u001a\u0004\u0018\u00010\u00048BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b \u0010\u0006R\u0014\u0010!\u001a\u00020\b8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\"\u0010\nR\u0016\u0010#\u001a\u0004\u0018\u00010$8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b%\u0010&R\u0016\u0010'\u001a\u0004\u0018\u00010\u00048BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b(\u0010\u0006R\u0016\u0010)\u001a\u0004\u0018\u00010\u00048BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b*\u0010\u0006R\u0016\u0010+\u001a\u0004\u0018\u00010,8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b-\u0010.R\u0016\u0010/\u001a\u0004\u0018\u00010\u00048BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b0\u0010\u0006R\u0014\u00101\u001a\u00020\b8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b2\u0010\nR\u001b\u00103\u001a\u0002048BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b7\u00108\u001a\u0004\b5\u00106¨\u0006C"}, d2 = {"Lcom/withpersona/sdk2/inquiry/internal/InquiryActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "accountId", "", "getAccountId", "()Ljava/lang/String;", "enableErrorLogging", "", "getEnableErrorLogging", "()Z", "environment", "Lcom/withpersona/sdk2/inquiry/internal/Environment;", "getEnvironment", "()Lcom/withpersona/sdk2/inquiry/internal/Environment;", "environmentId", "getEnvironmentId", "fieldsWrapper", "Lcom/withpersona/sdk2/inquiry/internal/InquiryFieldsMap;", "getFieldsWrapper", "()Lcom/withpersona/sdk2/inquiry/internal/InquiryFieldsMap;", "inquiryId", "getInquiryId", "referenceId", "getReferenceId", "returnCollectedData", "getReturnCollectedData", "routingCountry", "getRoutingCountry", "serverEndpoint", "getServerEndpoint", "sessionToken", "getSessionToken", "shouldAutoFallback", "getShouldAutoFallback", "staticInquiryTemplate", "Lcom/withpersona/sdk2/inquiry/internal/fallbackmode/StaticInquiryTemplate;", "getStaticInquiryTemplate", "()Lcom/withpersona/sdk2/inquiry/internal/fallbackmode/StaticInquiryTemplate;", "templateId", "getTemplateId", "templateVersion", "getTemplateVersion", "theme", "", "getTheme", "()Ljava/lang/Integer;", "themeSetId", "getThemeSetId", "useServerStyles", "getUseServerStyles", "viewModel", "Lcom/withpersona/sdk2/inquiry/internal/InquiryActivity$InquiryViewModel;", "getViewModel", "()Lcom/withpersona/sdk2/inquiry/internal/InquiryActivity$InquiryViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "onCreate", "", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onPause", "onResume", "validateArgumentsOrFinish", "Companion", "InquiryViewModel", "inquiry-internal_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class InquiryActivity extends AppCompatActivity {
public static final Companion INSTANCE = new Companion(null);
private static final String DEFAULT_SERVER_ENDPOINT = "https://withpersona.com";
private final Lazy viewModel;
public InquiryActivity() {
final ComponentActivity componentActivity = (ComponentActivity) this;
final Function0 function0 = null;
this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(InquiryViewModel.class), new Function0<ViewModelStore>() {
{
super(0);
}
public final ViewModelStore m309invoke() {
ViewModelStore viewModelStore = componentActivity.getViewModelStore();
Intrinsics.checkNotNullExpressionValue(viewModelStore, "viewModelStore");
return viewModelStore;
}
}, new Function0<ViewModelProvider.Factory>() {
{
super(0);
}
public final ViewModelProvider.Factory m308invoke() {
ViewModelProvider.Factory defaultViewModelProviderFactory = componentActivity.getDefaultViewModelProviderFactory();
Intrinsics.checkNotNullExpressionValue(defaultViewModelProviderFactory, "defaultViewModelProviderFactory");
return defaultViewModelProviderFactory;
}
}, new Function0<CreationExtras>() {
{
super(0);
}
public final CreationExtras m310invoke() {
CreationExtras creationExtras;
Function0 function02 = function0;
if (function02 != null && (creationExtras = (CreationExtras) function02.invoke()) != null) {
return creationExtras;
}
CreationExtras defaultViewModelCreationExtras = componentActivity.getDefaultViewModelCreationExtras();
Intrinsics.checkNotNullExpressionValue(defaultViewModelCreationExtras, "this.defaultViewModelCreationExtras");
return defaultViewModelCreationExtras;
}
});
}
private final String getTemplateId() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getString(InquiryIntentKeys.TEMPLATE_ID);
}
return null;
}
private final String getTemplateVersion() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getString(InquiryIntentKeys.TEMPLATE_VERSION);
}
return null;
}
private final String getInquiryId() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getString(InquiryIntentKeys.INQUIRY_ID);
}
return null;
}
private final String getSessionToken() {
String string;
Bundle extras = getIntent().getExtras();
if (extras == null || (string = extras.getString(InquiryIntentKeys.SESSION_TOKEN)) == null) {
return null;
}
return "Bearer " + string;
}
private final String getReferenceId() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getString(InquiryIntentKeys.REFERENCE_ID);
}
return null;
}
private final String getAccountId() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getString(InquiryIntentKeys.ACCOUNT_ID);
}
return null;
}
private final InquiryFieldsMap getFieldsWrapper() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return (InquiryFieldsMap) BundleCompat.getParcelable(extras, InquiryIntentKeys.FIELDS_MAP, InquiryFieldsMap.class);
}
return null;
}
private final Integer getTheme() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return Integer.valueOf(extras.getInt(InquiryIntentKeys.THEME));
}
return null;
}
private final StaticInquiryTemplate getStaticInquiryTemplate() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return (StaticInquiryTemplate) BundleCompat.getParcelable(extras, InquiryIntentKeys.STATIC_INQUIRY_TEMPLATE, StaticInquiryTemplate.class);
}
return null;
}
private final Environment getEnvironment() {
Bundle extras = getIntent().getExtras();
String string = extras != null ? extras.getString(InquiryIntentKeys.ENVIRONMENT) : null;
if (string != null) {
int hashCode = string.hashCode();
if (hashCode != -2056856391) {
if (hashCode == -1711584601 && string.equals("SANDBOX")) {
return Environment.SANDBOX;
}
} else if (string.equals("PRODUCTION")) {
return Environment.PRODUCTION;
}
}
return Environment.PRODUCTION;
}
private final String getEnvironmentId() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getString(InquiryIntentKeys.ENVIRONMENT_ID);
}
return null;
}
private final boolean getEnableErrorLogging() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getBoolean(InquiryIntentKeys.ENABLE_ERROR_LOGGING, true);
}
return true;
}
private final boolean getUseServerStyles() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getBoolean(InquiryIntentKeys.USE_SERVER_STYLES, true);
}
return true;
}
private final String getRoutingCountry() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getString(InquiryIntentKeys.ROUTING_COUNTRY);
}
return null;
}
private final boolean getReturnCollectedData() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getBoolean(InquiryIntentKeys.RETURN_COLLECTED_DATA, false);
}
return false;
}
private final boolean getShouldAutoFallback() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getBoolean(InquiryIntentKeys.SHOULD_AUTO_FALLBACK, false);
}
return false;
}
private final String getServerEndpoint() {
Bundle extras = getIntent().getExtras();
String string = extras != null ? extras.getString(InquiryIntentKeys.SERVER_ENDPOINT, DEFAULT_SERVER_ENDPOINT) : null;
return string == null ? DEFAULT_SERVER_ENDPOINT : string;
}
private final String getThemeSetId() {
Bundle extras = getIntent().getExtras();
if (extras != null) {
return extras.getString(InquiryIntentKeys.THEME_SET_ID);
}
return null;
}
public final InquiryViewModel getViewModel() {
return (InquiryViewModel) this.viewModel.getValue();
}
protected void onCreate(Bundle savedInstanceState) {
String str;
DummyDataCollector dummyDataCollector;
ApiControllerModule apiControllerModule;
InquiryWorkflow.Props.TemplateProps templateProps;
Context context = (Context) this;
ExceptionUtilsKt.clearLastError(context);
if (getEnableErrorLogging()) {
ExceptionUtilsKt.registerExceptionHandler(context);
}
super.onCreate(savedInstanceState);
if (validateArgumentsOrFinish()) {
Intent intent = new Intent();
intent.putExtra(InquiryIntentKeys.PERSONA_ACTIVITY_RESULT, "INQUIRY_CANCELED");
intent.putExtra(InquiryIntentKeys.INQUIRY_ID, getInquiryId());
intent.putExtra(InquiryIntentKeys.SESSION_TOKEN, INSTANCE.removeBearer(getSessionToken()));
Unit unit = Unit.INSTANCE;
setResult(0, intent);
Integer theme = getTheme();
if (theme != null) {
setTheme(theme.intValue());
}
String packageName = getPackageName();
Intrinsics.checkNotNullExpressionValue(packageName, "packageName");
int i = 2;
AttributeSet attributeSet = null;
if (StringsKt.startsWith$default(packageName, "com.withpersona", false, 2, (Object) null)) {
str = getServerEndpoint();
} else {
str = DEFAULT_SERVER_ENDPOINT;
}
if (getReturnCollectedData()) {
dummyDataCollector = getViewModel().getDataCollector();
} else {
dummyDataCollector = new DummyDataCollector();
}
if (getShouldAutoFallback()) {
apiControllerModule = new ApiControllerModule(ApiControllerParams.Fallback.INSTANCE);
} else {
StaticInquiryTemplate staticInquiryTemplate = getStaticInquiryTemplate();
LocalStaticInquiryTemplate localStaticInquiryTemplate = staticInquiryTemplate instanceof LocalStaticInquiryTemplate ? (LocalStaticInquiryTemplate) staticInquiryTemplate : null;
if (localStaticInquiryTemplate != null) {
apiControllerModule = new ApiControllerModule(new ApiControllerParams.Offline(localStaticInquiryTemplate.getResourceId()));
} else {
apiControllerModule = new ApiControllerModule(ApiControllerParams.Fallback.INSTANCE);
}
}
InquiryComponent build = DaggerInquiryComponent.builder().inquiryActivityModule(new InquiryActivityModule(this)).documentLaunchersModule(new DocumentLaunchersModule(getViewModel().getPictureLaunchResultLauncher$inquiry_internal_release(), getViewModel().getDocumentsSelectResultLauncher$inquiry_internal_release(), getViewModel().getSelectFromPhotoLibraryLauncher$inquiry_internal_release())).documentSelectLauncherModule(new DocumentSelectLauncherModule(getViewModel().getDocumentSelectResultLauncher$inquiry_internal_release())).permissionsLauncherModule(new PermissionsLauncherModule(getViewModel().getRequestPermissionResultLauncher$inquiry_internal_release())).passportNfcReaderLauncherModule(new PassportNfcReaderLauncherModule(getViewModel().getPassportNfcReaderLauncher$inquiry_internal_release())).networkModule(new NetworkModule(getUseServerStyles(), getRoutingCountry())).dataCollectorModule(new DataCollectorModule(dummyDataCollector)).inquiryModule(new InquiryModule(str)).apiControllerModule(apiControllerModule).build();
build.fallbackModeManager().setShouldAutoFallback(getShouldAutoFallback() || getStaticInquiryTemplate() != null);
InquiryViewModel viewModel = getViewModel();
Environment environment = getEnvironment();
String environmentId = getEnvironmentId();
if (getInquiryId() != null) {
String inquiryId = getInquiryId();
Intrinsics.checkNotNull(inquiryId);
templateProps = new InquiryWorkflow.Props.InquiryProps(inquiryId, getSessionToken(), getEnvironmentId(), getEnvironment(), getTheme());
} else {
String templateId = getTemplateId();
String templateVersion = getTemplateVersion();
String accountId = getAccountId();
String referenceId = getReferenceId();
InquiryFieldsMap fieldsWrapper = getFieldsWrapper();
templateProps = new InquiryWorkflow.Props.TemplateProps(templateId, templateVersion, accountId, referenceId, getEnvironmentId(), fieldsWrapper != null ? fieldsWrapper.getFields() : null, getThemeSetId(), getStaticInquiryTemplate(), getShouldAutoFallback(), getEnvironment(), getTheme());
}
InquiryWorkflow.Props props = templateProps;
Intrinsics.checkNotNullExpressionValue(build, "component");
viewModel.init$inquiry_internal_release((ActivityResultCaller) this, build, props, environment, environmentId);
WorkflowLayout workflowLayout = new WorkflowLayout(context, attributeSet, i, attributeSet);
Lifecycle lifecycle = getLifecycle();
Intrinsics.checkNotNullExpressionValue(lifecycle, "lifecycle");
workflowLayout.start(lifecycle, (Flow) getViewModel().getRenderings(), getViewModel().viewRegistry());
setContentView(workflowLayout);
BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new InquiryActivity$onCreate$4(this, build, null), 3, (Object) null);
}
}
protected void onPause() {
super.onPause();
if (isFinishing()) {
ExceptionUtilsKt.unregisterExceptionHandler((Context) this);
}
}
protected void onDestroy() {
super.onDestroy();
getViewModel().onDestroy();
}
private final boolean validateArgumentsOrFinish() {
String sessionToken = getSessionToken();
if (sessionToken == null || !StringsKt.contains$default(sessionToken, '\n', false, 2, (Object) null)) {
return true;
}
Intent intent = new Intent();
intent.putExtra(InquiryIntentKeys.PERSONA_ACTIVITY_RESULT, "INQUIRY_ERROR");
intent.putExtra(InquiryIntentKeys.ERROR_DEBUG_MESSAGE, InquiryErrorMessages.sessionTokenError);
Unit unit = Unit.INSTANCE;
setResult(0, intent);
finish();
return false;
}
@Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\u0005\u001a\u0004\u0018\u00010\u0004*\u0004\u0018\u00010\u0004R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0006"}, d2 = {"Lcom/withpersona/sdk2/inquiry/internal/InquiryActivity$Companion;", "", "()V", "DEFAULT_SERVER_ENDPOINT", "", "removeBearer", "inquiry-internal_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final String removeBearer(String str) {
if (str != null) {
return StringsKt.substringAfter$default(str, "Bearer ", (String) null, 2, (Object) null);
}
return null;
}
}
@Metadata(d1 = {"\u0000\u009c\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J7\u00103\u001a\u0002042\u0006\u00105\u001a\u0002062\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u001f\u001a\u00020!2\u0006\u0010\u0015\u001a\u00020\u00162\b\u0010\u0017\u001a\u0004\u0018\u00010\u000eH\u0000¢\u0006\u0002\b7J\u0006\u00108\u001a\u000204J\u000e\u00109\u001a\u0002042\u0006\u0010:\u001a\u00020;J\u0010\u0010<\u001a\u0002042\u0006\u00105\u001a\u000206H\u0002J\u0011\u0010-\u001a\u00020/H\u0086@ø\u0001\u0000¢\u0006\u0002\u0010=J\u0006\u0010>\u001a\u00020?R\u0010\u0010\u0005\u001a\u0004\u0018\u00010\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u0011\u0010\u0007\u001a\u00020\b¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\nR(\u0010\u000b\u001a\u0016\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u000e0\r\u0012\u0006\u0012\u0004\u0018\u00010\u000f0\fX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0010\u0010\u0011R,\u0010\u0012\u001a\u001a\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u000e0\r\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u000f0\u00130\fX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0014\u0010\u0011R\u000e\u0010\u0015\u001a\u00020\u0016X\u0082.¢\u0006\u0002\n\u0000R\u0010\u0010\u0017\u001a\u0004\u0018\u00010\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R \u0010\u0018\u001a\u000e\u0012\u0004\u0012\u00020\u0019\u0012\u0004\u0012\u00020\u001a0\fX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u001b\u0010\u0011R \u0010\u001c\u001a\u000e\u0012\u0004\u0012\u00020\u000f\u0012\u0004\u0012\u00020\u001d0\fX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u001e\u0010\u0011R\u0014\u0010\u001f\u001a\b\u0012\u0004\u0012\u00020!0 X\u0082.¢\u0006\u0002\n\u0000R'\u0010\"\u001a\b\u0012\u0004\u0012\u00020$0#8FX\u0086\u0084\u0002¢\u0006\u0012\n\u0004\b)\u0010*\u0012\u0004\b%\u0010&\u001a\u0004\b'\u0010(R \u0010+\u001a\u000e\u0012\u0004\u0012\u00020\u000e\u0012\u0004\u0012\u00020\u001d0\fX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b,\u0010\u0011R\u0014\u0010-\u001a\b\u0012\u0004\u0012\u00020/0.X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R&\u00100\u001a\u0014\u0012\u0004\u0012\u000201\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u000f0\u00130\fX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b2\u0010\u0011\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006@"}, d2 = {"Lcom/withpersona/sdk2/inquiry/internal/InquiryActivity$InquiryViewModel;", "Landroidx/lifecycle/ViewModel;", "savedStateHandle", "Landroidx/lifecycle/SavedStateHandle;", "(Landroidx/lifecycle/SavedStateHandle;)V", "component", "Lcom/withpersona/sdk2/inquiry/internal/InquiryComponent;", "dataCollector", "Lcom/withpersona/sdk2/inquiry/shared/data_collection/RealDataCollector;", "getDataCollector", "()Lcom/withpersona/sdk2/inquiry/shared/data_collection/RealDataCollector;", "documentSelectResultLauncher", "Lcom/withpersona/sdk2/inquiry/launchers/ReusableActivityResultLauncher;", "", "", "Landroid/net/Uri;", "getDocumentSelectResultLauncher$inquiry_internal_release", "()Lcom/withpersona/sdk2/inquiry/launchers/ReusableActivityResultLauncher;", "documentsSelectResultLauncher", "", "getDocumentsSelectResultLauncher$inquiry_internal_release", "environment", "Lcom/withpersona/sdk2/inquiry/internal/Environment;", "environmentId", "passportNfcReaderLauncher", "Lcom/withpersona/sdk2/inquiry/nfc/PassportNfcReaderConfig;", "Lcom/withpersona/sdk2/inquiry/nfc/PassportNfcReaderOutput;", "getPassportNfcReaderLauncher$inquiry_internal_release", "pictureLaunchResultLauncher", "", "getPictureLaunchResultLauncher$inquiry_internal_release", "props", "Lkotlinx/coroutines/flow/MutableStateFlow;", "Lcom/withpersona/sdk2/inquiry/internal/InquiryWorkflow$Props;", "renderings", "Lkotlinx/coroutines/flow/StateFlow;", "", "getRenderings$annotations", "()V", "getRenderings", "()Lkotlinx/coroutines/flow/StateFlow;", "renderings$delegate", "Lkotlin/Lazy;", "requestPermissionResultLauncher", "getRequestPermissionResultLauncher$inquiry_internal_release", "result", "Lkotlinx/coroutines/channels/Channel;", "Lcom/withpersona/sdk2/inquiry/internal/InquiryWorkflow$Output;", "selectFromPhotoLibraryLauncher", "Landroidx/activity/result/PickVisualMediaRequest;", "getSelectFromPhotoLibraryLauncher$inquiry_internal_release", "init", "", "activityResultCaller", "Landroidx/activity/result/ActivityResultCaller;", "init$inquiry_internal_release", "onDestroy", "refreshAppSetId", "applicationContext", "Landroid/content/Context;", "registerActivityLaunchers", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "viewRegistry", "Lcom/squareup/workflow1/ui/ViewRegistry;", "inquiry-internal_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class InquiryViewModel extends ViewModel {
private InquiryComponent component;
private final RealDataCollector dataCollector;
private final ReusableActivityResultLauncher<String[], Uri> documentSelectResultLauncher;
private final ReusableActivityResultLauncher<String[], List<Uri>> documentsSelectResultLauncher;
private Environment environment;
private String environmentId;
private final ReusableActivityResultLauncher<PassportNfcReaderConfig, PassportNfcReaderOutput> passportNfcReaderLauncher;
private final ReusableActivityResultLauncher<Uri, Boolean> pictureLaunchResultLauncher;
private MutableStateFlow<InquiryWorkflow.Props> props;
private final Lazy renderings;
private final ReusableActivityResultLauncher<String, Boolean> requestPermissionResultLauncher;
private final Channel<InquiryWorkflow.Output> result;
private final SavedStateHandle savedStateHandle;
private final ReusableActivityResultLauncher<PickVisualMediaRequest, List<Uri>> selectFromPhotoLibraryLauncher;
public static void getRenderings$annotations() {
}
public InquiryViewModel(SavedStateHandle savedStateHandle) {
Intrinsics.checkNotNullParameter(savedStateHandle, "savedStateHandle");
this.savedStateHandle = savedStateHandle;
this.result = ChannelKt.Channel$default(0, (BufferOverflow) null, (Function1) null, 7, (Object) null);
this.dataCollector = new RealDataCollector(savedStateHandle);
this.pictureLaunchResultLauncher = DocumentLaunchersModuleKt.createTakePictureLauncher();
this.selectFromPhotoLibraryLauncher = DocumentLaunchersModuleKt.createOpenFromPhotoLibraryLauncher();
this.documentsSelectResultLauncher = DocumentLaunchersModuleKt.createOpenDocumentsLauncher();
this.requestPermissionResultLauncher = PermissionsLauncherModuleKt.createRequestPermissionResultLauncher();
this.documentSelectResultLauncher = DocumentSelectLauncherModuleKt.createOpenDocumentLauncher();
this.passportNfcReaderLauncher = PassportNfcReaderLauncherModuleKt.createPassportNfcReaderLauncher();
this.renderings = LazyKt.lazy(new Function0<StateFlow<? extends Object>>() {
{
super(0);
}
public final StateFlow<Object> invoke() {
InquiryComponent inquiryComponent;
SavedStateHandle savedStateHandle2;
MutableStateFlow mutableStateFlow;
Channel channel;
inquiryComponent = InquiryActivity.InquiryViewModel.this.component;
if (inquiryComponent != null) {
ModalWorkflow modalWorkflow = new ModalWorkflow(inquiryComponent.workflow());
CoroutineScope viewModelScope = ViewModelKt.getViewModelScope(InquiryActivity.InquiryViewModel.this);
savedStateHandle2 = InquiryActivity.InquiryViewModel.this.savedStateHandle;
mutableStateFlow = InquiryActivity.InquiryViewModel.this.props;
if (mutableStateFlow == null) {
Intrinsics.throwUninitializedPropertyAccessException("props");
mutableStateFlow = null;
}
channel = InquiryActivity.InquiryViewModel.this.result;
Function2 function2 = (KFunction) new AnonymousClass1(channel);
return AndroidRenderWorkflowKt.renderWorkflowIn((Workflow) modalWorkflow, viewModelScope, (StateFlow) mutableStateFlow, savedStateHandle2, (List<? extends WorkflowInterceptor>) Interceptors.INSTANCE.getInterceptors(), function2);
}
throw new IllegalArgumentException("Required value was null.".toString());
}
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
class AnonymousClass1 extends FunctionReferenceImpl implements Function2<InquiryWorkflow.Output, Continuation<? super Unit>, Object>, SuspendFunction {
AnonymousClass1(Object obj) {
super(2, obj, Channel.class, "send", "send(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", 0);
}
public final Object invoke(InquiryWorkflow.Output output, Continuation<? super Unit> continuation) {
return ((Channel) this.receiver).send(output, continuation);
}
}
});
}
public final RealDataCollector getDataCollector() {
return this.dataCollector;
}
public final ReusableActivityResultLauncher<Uri, Boolean> getPictureLaunchResultLauncher$inquiry_internal_release() {
return this.pictureLaunchResultLauncher;
}
public final ReusableActivityResultLauncher<PickVisualMediaRequest, List<Uri>> getSelectFromPhotoLibraryLauncher$inquiry_internal_release() {
return this.selectFromPhotoLibraryLauncher;
}
public final ReusableActivityResultLauncher<String[], List<Uri>> getDocumentsSelectResultLauncher$inquiry_internal_release() {
return this.documentsSelectResultLauncher;
}
public final ReusableActivityResultLauncher<String, Boolean> getRequestPermissionResultLauncher$inquiry_internal_release() {
return this.requestPermissionResultLauncher;
}
public final ReusableActivityResultLauncher<String[], Uri> getDocumentSelectResultLauncher$inquiry_internal_release() {
return this.documentSelectResultLauncher;
}
public final ReusableActivityResultLauncher<PassportNfcReaderConfig, PassportNfcReaderOutput> getPassportNfcReaderLauncher$inquiry_internal_release() {
return this.passportNfcReaderLauncher;
}
public final void init$inquiry_internal_release(ActivityResultCaller activityResultCaller, InquiryComponent component, InquiryWorkflow.Props props, Environment environment, String environmentId) {
Intrinsics.checkNotNullParameter(activityResultCaller, "activityResultCaller");
Intrinsics.checkNotNullParameter(component, "component");
Intrinsics.checkNotNullParameter(props, "props");
Intrinsics.checkNotNullParameter(environment, "environment");
this.component = component;
this.environment = environment;
this.environmentId = environmentId;
MutableStateFlow<InquiryWorkflow.Props> mutableStateFlow = this.props;
if (mutableStateFlow != null) {
if (mutableStateFlow == null) {
Intrinsics.throwUninitializedPropertyAccessException("props");
mutableStateFlow = null;
}
mutableStateFlow.setValue(props);
} else {
this.props = StateFlowKt.MutableStateFlow(props);
}
registerActivityLaunchers(activityResultCaller);
}
public final StateFlow<Object> getRenderings() {
return (StateFlow) this.renderings.getValue();
}
public final ViewRegistry viewRegistry() {
InquiryComponent inquiryComponent = this.component;
if (inquiryComponent != null) {
return inquiryComponent.viewRegistry();
}
throw new IllegalArgumentException("Required value was null.".toString());
}
public final Object result(Continuation<? super InquiryWorkflow.Output> continuation) {
return this.result.receive(continuation);
}
public final void onDestroy() {
ImageLoader imageLoader;
InquiryComponent inquiryComponent = this.component;
if (inquiryComponent == null || (imageLoader = inquiryComponent.imageLoader()) == null) {
return;
}
imageLoader.shutdown();
}
private final void registerActivityLaunchers(ActivityResultCaller activityResultCaller) {
this.pictureLaunchResultLauncher.register(activityResultCaller);
this.selectFromPhotoLibraryLauncher.register(activityResultCaller);
this.documentsSelectResultLauncher.register(activityResultCaller);
this.requestPermissionResultLauncher.register(activityResultCaller);
this.documentSelectResultLauncher.register(activityResultCaller);
this.passportNfcReaderLauncher.register(activityResultCaller);
}
public final void refreshAppSetId(Context applicationContext) {
AppSetIDHelper appSetIdHelper;
Intrinsics.checkNotNullParameter(applicationContext, "applicationContext");
InquiryComponent inquiryComponent = this.component;
if (inquiryComponent == null || (appSetIdHelper = inquiryComponent.appSetIdHelper()) == null) {
return;
}
appSetIdHelper.refreshAppSetId(applicationContext);
}
}
protected void onResume() {
super.onResume();
InquiryViewModel viewModel = getViewModel();
Context applicationContext = getApplicationContext();
Intrinsics.checkNotNullExpressionValue(applicationContext, "this.applicationContext");
viewModel.refreshAppSetId(applicationContext);
}
}