package o; import android.app.Activity; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import java.io.File; import java.io.IOException; /* loaded from: classes5.dex */ public final class fPR { final Context a; private final C13087fQa b; final InterfaceC13393fZL c; Activity d; final InterfaceC13393fZL e; public fPR(Context context, C13087fQa c13087fQa) { C14957gcv.e(context, ""); C14957gcv.e(c13087fQa, ""); this.a = context; this.d = null; this.b = c13087fQa; HBt hBt = new HBt(this); C14957gcv.e(hBt, ""); this.e = new fZZ(hBt); Sts sts = Sts.a; C14957gcv.e(sts, ""); this.c = new fZZ(sts); } public final void c(String str, String str2, boolean z) { Intent createChooser; C14957gcv.e(str, ""); Intent intent = new Intent(); intent.setAction("android.intent.action.SEND"); intent.setType("text/plain"); intent.putExtra("android.intent.extra.TEXT", str); intent.putExtra("android.intent.extra.SUBJECT", str2); if (z) { createChooser = Intent.createChooser(intent, null, PendingIntent.getBroadcast(this.a, 0, new Intent(this.a, (Class) fPY.class), ((Number) this.c.e()).intValue() | 134217728).getIntentSender()); } else { createChooser = Intent.createChooser(intent, null); } C14957gcv.c(createChooser, ""); aBR_(createChooser, z); } /* JADX INFO: Access modifiers changed from: package-private */ public final void aBR_(Intent intent, boolean z) { Activity activity = this.d; if (activity == null) { intent.addFlags(268435456); if (z) { this.b.d("dev.fluttercommunity.plus/share/unavailable"); } this.a.startActivity(intent); return; } if (z) { C14957gcv.e(activity); activity.startActivityForResult(intent, 22643); } else { C14957gcv.e(activity); activity.startActivity(intent); } } /* JADX INFO: Access modifiers changed from: package-private */ public static String a(String str) { if (str != null) { String str2 = str; if (gdZ.d((CharSequence) str2, (CharSequence) "/", false)) { String substring = str.substring(0, gdZ.e((CharSequence) str2, "/", 0, false)); C14957gcv.c((Object) substring, ""); return substring; } } return "*"; } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean e(File file) { Activity activity; try { String canonicalPath = file.getCanonicalPath(); C14957gcv.c((Object) canonicalPath, ""); Activity activity2 = this.d; if (activity2 != null) { C14957gcv.e(activity2); activity = activity2; } else { activity = this.a; } String canonicalPath2 = new File(activity.getCacheDir(), "share_plus").getCanonicalPath(); C14957gcv.c((Object) canonicalPath2, ""); return gdZ.e(canonicalPath, canonicalPath2, false); } catch (IOException unused) { return false; } } /* loaded from: classes5.dex */ static final class HBt extends AbstractC14961gcz implements InterfaceC14890gbN { private fPR c; @Override // o.InterfaceC14890gbN public final /* synthetic */ String invoke() { Activity activity; StringBuilder sb = new StringBuilder(); fPR fpr = this.c; Activity activity2 = fpr.d; if (activity2 != null) { C14957gcv.e(activity2); activity = activity2; } else { activity = fpr.a; } sb.append(activity.getPackageName()); sb.append(".flutter.share_provider"); return sb.toString(); } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ HBt(fPR fpr) { super(0); this.c = fpr; } } /* loaded from: classes5.dex */ static final class Sts extends AbstractC14961gcz implements InterfaceC14890gbN { public static final Sts a = new Sts(); @Override // o.InterfaceC14890gbN public final /* synthetic */ Integer invoke() { return 33554432; } Sts() { super(0); } } }