- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
67 lines
3.0 KiB
Java
67 lines
3.0 KiB
Java
package com.vungle.ads.internal.util;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import com.google.android.gms.drive.DriveFile;
|
|
import com.vungle.ads.AnalyticsClient;
|
|
import com.vungle.ads.internal.ui.PresenterAdOpenCallback;
|
|
import com.vungle.ads.internal.util.ActivityManager;
|
|
import com.vungle.ads.internal.util.Logger;
|
|
import java.net.URISyntaxException;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class ExternalRouter {
|
|
public static final ExternalRouter INSTANCE = new ExternalRouter();
|
|
private static final String TAG = ExternalRouter.class.getSimpleName();
|
|
|
|
private ExternalRouter() {
|
|
}
|
|
|
|
public static final boolean launch(String str, String str2, Context context, ActivityManager.LeftApplicationCallback leftApplicationCallback, PresenterAdOpenCallback presenterAdOpenCallback) {
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
if ((str != null && str.length() != 0) || (str2 != null && str2.length() != 0)) {
|
|
boolean z = !(context instanceof Activity);
|
|
try {
|
|
ExternalRouter externalRouter = INSTANCE;
|
|
ActivityManager.Companion.startWhenForeground(context, externalRouter.getIntentFromUrl(str, z), externalRouter.getIntentFromUrl(str2, z), leftApplicationCallback, presenterAdOpenCallback);
|
|
return true;
|
|
} catch (Exception e) {
|
|
if (str != null && str.length() != 0) {
|
|
AnalyticsClient.INSTANCE.logError$vungle_ads_release(312, "Fail to open " + str, (r13 & 4) != 0 ? null : "", (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null);
|
|
} else {
|
|
AnalyticsClient.INSTANCE.logError$vungle_ads_release(314, "Fail to open " + str2, (r13 & 4) != 0 ? null : "", (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null);
|
|
}
|
|
Logger.Companion companion = Logger.Companion;
|
|
String TAG2 = TAG;
|
|
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
|
|
companion.e(TAG2, "Error while opening url" + e.getLocalizedMessage());
|
|
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
|
|
companion.d(TAG2, "Cannot open url " + str2);
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private final Intent getIntentFromUrl(String str, boolean z) {
|
|
Intent intent = null;
|
|
if (str != null) {
|
|
try {
|
|
if (str.length() != 0) {
|
|
intent = Intent.parseUri(str, 0);
|
|
}
|
|
} catch (URISyntaxException e) {
|
|
Logger.Companion companion = Logger.Companion;
|
|
String TAG2 = TAG;
|
|
Intrinsics.checkNotNullExpressionValue(TAG2, "TAG");
|
|
companion.e(TAG2, "url format is not correct " + e.getLocalizedMessage());
|
|
}
|
|
}
|
|
if (intent != null && z) {
|
|
intent.setFlags(DriveFile.MODE_READ_ONLY);
|
|
}
|
|
return intent;
|
|
}
|
|
}
|