导航菜单

页面标题

页面副标题

Rilo v2.0.21 - LinkForegroundActivity.java 源代码

正在查看: Rilo v2.0.21 应用的 LinkForegroundActivity.java JAVA 源代码文件

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


package com.stripe.android.link;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.browser.customtabs.CustomTabsIntent;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;

@Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0000\u0018\u0000 \u00112\u00020\u0001:\u0001\u0011B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0002J\b\u0010\t\u001a\u00020\u0006H\u0002J\u0012\u0010\n\u001a\u00020\u00062\b\u0010\u000b\u001a\u0004\u0018\u00010\fH\u0016J\u0010\u0010\r\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0016J\b\u0010\u000e\u001a\u00020\u0006H\u0014J\u0010\u0010\u000f\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\fH\u0014R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0012"}, d2 = {"Lcom/stripe/android/link/LinkForegroundActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "hasLaunchedPopup", "", "handleRedirectIfAvailable", "", "intent", "Landroid/content/Intent;", "launchPopup", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onNewIntent", "onResume", "onSaveInstanceState", "outState", "Companion", "link_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class LinkForegroundActivity extends AppCompatActivity {
    public static final String ACTION_REDIRECT = "LinkForegroundActivity.redirect";

    public static final Companion INSTANCE = new Companion(null);
    public static final String EXTRA_FAILURE = "LinkFailure";
    public static final String EXTRA_POPUP_URL = "LinkPopupUrl";
    public static final int RESULT_COMPLETE = 49871;
    public static final int RESULT_FAILURE = 91367;
    private static final String SAVED_STATE_HAS_LAUNCHED_POPUP = "LinkHasLaunchedPopup";
    private boolean hasLaunchedPopup;

    @Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u0004J\u0018\u0010\u0010\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\b\u0010\u0011\u001a\u0004\u0018\u00010\u0012R\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0013"}, d2 = {"Lcom/stripe/android/link/LinkForegroundActivity$Companion;", "", "()V", "ACTION_REDIRECT", "", "EXTRA_FAILURE", "EXTRA_POPUP_URL", "RESULT_COMPLETE", "", "RESULT_FAILURE", "SAVED_STATE_HAS_LAUNCHED_POPUP", "createIntent", "Landroid/content/Intent;", "context", "Landroid/content/Context;", "popupUrl", "redirectIntent", "uri", "Landroid/net/Uri;", "link_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private Companion() {
        }

        public final Intent createIntent(Context context, String popupUrl) {
            Intrinsics.checkNotNullParameter(context, "context");
            Intrinsics.checkNotNullParameter(popupUrl, "popupUrl");
            Intent putExtra = new Intent(context, (Class<?>) LinkForegroundActivity.class).putExtra(LinkForegroundActivity.EXTRA_POPUP_URL, popupUrl);
            Intrinsics.checkNotNullExpressionValue(putExtra, "Intent(context, LinkFore…XTRA_POPUP_URL, popupUrl)");
            return putExtra;
        }

        public final Intent redirectIntent(Context context, Uri uri) {
            Intrinsics.checkNotNullParameter(context, "context");
            Intent intent = new Intent(context, (Class<?>) LinkForegroundActivity.class);
            intent.setAction(LinkForegroundActivity.ACTION_REDIRECT);
            intent.setData(uri);
            intent.addFlags(603979776);
            return intent;
        }
    }

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.hasLaunchedPopup = savedInstanceState != null ? savedInstanceState.getBoolean(SAVED_STATE_HAS_LAUNCHED_POPUP) : false;
        Intent intent = getIntent();
        Intrinsics.checkNotNullExpressionValue(intent, "intent");
        handleRedirectIfAvailable(intent);
    }

    protected void onSaveInstanceState(Bundle outState) {
        Intrinsics.checkNotNullParameter(outState, "outState");
        super.onSaveInstanceState(outState);
        outState.putBoolean(SAVED_STATE_HAS_LAUNCHED_POPUP, this.hasLaunchedPopup);
    }

    public void onNewIntent(Intent intent) {
        Intrinsics.checkNotNullParameter(intent, "intent");
        super.onNewIntent(intent);
        handleRedirectIfAvailable(intent);
    }

    protected void onResume() {
        super.onResume();
        if (isFinishing()) {
            return;
        }
        if (this.hasLaunchedPopup) {
            setResult(0);
            finish();
        } else {
            launchPopup();
        }
    }

    private final void handleRedirectIfAvailable(Intent intent) {
        if (Intrinsics.areEqual(intent.getAction(), ACTION_REDIRECT)) {
            setResult(RESULT_COMPLETE, intent);
            finish();
        }
    }

    private final void launchPopup() {
        Uri uri;
        String string;
        this.hasLaunchedPopup = true;
        Bundle extras = getIntent().getExtras();
        if (extras == null || (string = extras.getString(EXTRA_POPUP_URL)) == null) {
            uri = null;
        } else {
            uri = Uri.parse(string);
            Intrinsics.checkNotNullExpressionValue(uri, "parse(this)");
        }
        if (uri == null) {
            setResult(0);
            finish();
            return;
        }
        try {
            new CustomTabsIntent.Builder().setShareState(2).build().launchUrl((Context) this, uri);
        } catch (ActivityNotFoundException e) {
            setResult(RESULT_FAILURE, new Intent().putExtra(EXTRA_FAILURE, e));
            finish();
        }
    }
}