Picsart v24.6版本的 MD5 值为:21a61631d94e54da68d2ad9268b8b9d9
以下内容为反编译后的 DrawProjectSyncActivity.java 源代码,内容仅作参考
package com.picsart.draw;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.os.storage.StorageManager;
import android.os.storage.StorageVolume;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.activity.ComponentActivity;
import androidx.work.ExistingWorkPolicy;
import androidx.work.OutOfQuotaPolicy;
import androidx.work.WorkInfo;
import com.picsart.studio.R;
import com.picsart.studio.apiv3.model.LinkedText;
import com.picsart.studio.common.constants.SourceParam;
import com.picsart.studio.views.PicsartProgressOverlay;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import kotlin.LazyThreadSafetyMode;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import myobfuscated.b6.w;
import myobfuscated.c6.l;
import myobfuscated.h4.p;
import myobfuscated.h4.r;
import myobfuscated.h4.z;
import myobfuscated.i.c;
import myobfuscated.ik2.f;
import myobfuscated.ik2.h;
import myobfuscated.jk2.n;
import myobfuscated.jl1.d;
import myobfuscated.mn2.k;
import myobfuscated.qz1.d;
import myobfuscated.s5.i;
import myobfuscated.wj0.a0;
import myobfuscated.wj0.y;
import myobfuscated.x7.b0;
import myobfuscated.x7.e;
import myobfuscated.x7.f0;
import myobfuscated.xk2.q;
import org.jetbrains.annotations.NotNull;
import org.koin.androidx.viewmodel.scope.ScopeExtKt;
import org.koin.core.scope.Scope;
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u00002\u00020\u0001:\u0001\u0004B\u0007¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0005"}, d2 = {"Lcom/picsart/draw/DrawProjectSyncActivity;", "Lmyobfuscated/jl1/d;", "<init>", "()V", com.inmobi.commons.core.configs.a.d, "_editor_drawing_compileGlobalReleaseKotlin"}, k = 1, mv = {1, 9, 0})
public final class DrawProjectSyncActivity extends d {
public static final int d = 0;
@NotNull
public final h a;
@NotNull
public final myobfuscated.h.b<Uri> b;
public myobfuscated.ep0.a c;
public static final class a extends c {
@Override
public final Intent a(ComponentActivity context, Object obj) {
StorageVolume primaryStorageVolume;
Intent createOpenDocumentTreeIntent;
Uri uri = (Uri) obj;
Intrinsics.checkNotNullParameter(context, "context");
Object systemService = context.getSystemService("storage");
Intrinsics.f(systemService, "null cannot be cast to non-null type android.os.storage.StorageManager");
primaryStorageVolume = ((StorageManager) systemService).getPrimaryStorageVolume();
createOpenDocumentTreeIntent = primaryStorageVolume.createOpenDocumentTreeIntent();
Intrinsics.checkNotNullExpressionValue(createOpenDocumentTreeIntent, "createOpenDocumentTreeIntent(...)");
Parcelable parcelableExtra = createOpenDocumentTreeIntent.getParcelableExtra("android.provider.extra.INITIAL_URI");
Intrinsics.f(parcelableExtra, "null cannot be cast to non-null type android.net.Uri");
String uri2 = ((Uri) parcelableExtra).toString();
Intrinsics.checkNotNullExpressionValue(uri2, "toString(...)");
String r = k.r(uri2, "/root/", "/document/", false);
Uri parse = Uri.parse(r + "%3APicsart%2Fdrawing%2Ftracked");
Intrinsics.checkNotNullExpressionValue(parse, "parse(...)");
Intrinsics.checkNotNullParameter(context, "context");
Intent intent = new Intent("android.intent.action.OPEN_DOCUMENT_TREE");
if (Build.VERSION.SDK_INT >= 26 && uri != null) {
intent.putExtra("android.provider.extra.INITIAL_URI", uri);
}
Intent putExtra = intent.addFlags(195).putExtra("android.provider.extra.INITIAL_URI", parse);
Intrinsics.checkNotNullExpressionValue(putExtra, "putExtra(...)");
return putExtra;
}
}
public static final class b implements r, myobfuscated.xk2.k {
public final Function1 a;
public b(Function1 function) {
Intrinsics.checkNotNullParameter(function, "function");
this.a = function;
}
@Override
@NotNull
public final f<?> b() {
return this.a;
}
public final boolean equals(Object obj) {
if ((obj instanceof r) && (obj instanceof myobfuscated.xk2.k)) {
return Intrinsics.c(this.a, ((myobfuscated.xk2.k) obj).b());
}
return false;
}
public final int hashCode() {
return this.a.hashCode();
}
@Override
public final void y1(Object obj) {
this.a.invoke(obj);
}
}
public DrawProjectSyncActivity() {
final Function0<Bundle> a2 = ScopeExtKt.a();
this.a = kotlin.a.a(LazyThreadSafetyMode.NONE, new Function0<a0>() {
{
super(0);
}
@Override
@NotNull
public final a0 invoke() {
ComponentActivity componentActivity = ComponentActivity.this;
myobfuscated.yp2.a aVar = r2;
Function0 function0 = a2;
Function0 function02 = r4;
z viewModelStore = componentActivity.getViewModelStore();
myobfuscated.i4.a a3 = myobfuscated.pp2.a.a((Bundle) function0.invoke(), componentActivity);
if (a3 == null) {
a3 = componentActivity.getDefaultViewModelCreationExtras();
Intrinsics.checkNotNullExpressionValue(a3, "this.defaultViewModelCreationExtras");
}
myobfuscated.i4.a aVar2 = a3;
Scope a4 = myobfuscated.jp2.a.a(componentActivity);
myobfuscated.el2.d b2 = q.a.b(a0.class);
Intrinsics.checkNotNullExpressionValue(viewModelStore, "viewModelStore");
return myobfuscated.op2.a.a(b2, viewModelStore, null, aVar2, aVar, a4, function02);
}
});
myobfuscated.h.b<Uri> registerForActivityResult = registerForActivityResult(new myobfuscated.i.a(), new myobfuscated.w00.b(this, 2));
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResult(...)");
this.b = registerForActivityResult;
}
public static void L(final DrawProjectSyncActivity this$0, Uri uri) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
if (uri == null) {
this$0.finish();
return;
}
this$0.getContentResolver().takePersistableUriPermission(uri, 3);
if (this$0.O().k) {
this$0.finish();
}
a0 O = this$0.O();
O.getClass();
Intrinsics.checkNotNullParameter(uri, "uri");
HashMap hashMap = new HashMap();
hashMap.put("tree_uri", uri.toString());
androidx.work.b bVar = new androidx.work.b(hashMap);
androidx.work.b.e(bVar);
Intrinsics.checkNotNullExpressionValue(bVar, "build(...)");
i.a g = new i.a(DrawingProjectsRecoveryWorker.class).g(bVar);
OutOfQuotaPolicy policy = OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST;
g.getClass();
Intrinsics.checkNotNullParameter(policy, "policy");
w wVar = g.c;
wVar.q = true;
wVar.r = policy;
Context context = O.d;
androidx.work.impl.a h = androidx.work.impl.a.h(context);
ExistingWorkPolicy existingWorkPolicy = ExistingWorkPolicy.KEEP;
h.getClass();
h.c("drawing_projects_recovery_work", existingWorkPolicy, Collections.singletonList(g.a("drawing_recovery").b()));
androidx.work.impl.a h2 = androidx.work.impl.a.h(context);
p a2 = l.a(h2.c.y().c(), w.v, h2.d);
Intrinsics.checkNotNullExpressionValue(a2, "getWorkInfosByTagLiveData(...)");
a2.e(this$0, new b(new Function1<List<? extends WorkInfo>, Unit>() {
{
super(1);
}
@Override
public Unit invoke(List<? extends WorkInfo> list) {
invoke2((List<WorkInfo>) list);
return Unit.a;
}
public final void invoke2(List<WorkInfo> list) {
String str;
DrawProjectSyncActivity drawProjectSyncActivity = DrawProjectSyncActivity.this;
int i = DrawProjectSyncActivity.d;
a0 O2 = drawProjectSyncActivity.O();
String value = TextUtils.isEmpty(O2.i) ? SourceParam.CREATE_FLOW.getValue() : O2.i;
if (TextUtils.isEmpty(O2.h)) {
str = "";
} else {
String str2 = O2.h;
String str3 = kotlin.text.d.w(str2, "?", false) ? "&" : "?";
str = str2 + str3 + "analytic-source=" + value + "&source-sid=" + O2.g + "&" + O2.f;
}
if (str.length() > 0) {
myobfuscated.d42.h.g(DrawProjectSyncActivity.this, str);
DrawProjectSyncActivity.this.finish();
}
for (WorkInfo workInfo : list) {
if (workInfo.b == WorkInfo.State.FAILED && workInfo.c.b("EMPTY_FOLDER", false)) {
DrawProjectSyncActivity.M(DrawProjectSyncActivity.this);
} else if (workInfo.b == WorkInfo.State.RUNNING && workInfo.e.c("progress", 0) > 0) {
DrawProjectSyncActivity.this.finish();
}
}
}
}));
}
public static final void M(DrawProjectSyncActivity drawProjectSyncActivity) {
drawProjectSyncActivity.getClass();
myobfuscated.qz1.d dVar = new myobfuscated.qz1.d(drawProjectSyncActivity, 1, null, null, null, null, true);
dVar.c(new myobfuscated.x7.a(5, drawProjectSyncActivity, dVar));
dVar.g(new f0(2, dVar, drawProjectSyncActivity));
dVar.l(drawProjectSyncActivity.getString(R.string.drawing_folder_empty));
dVar.j(false);
dVar.k(drawProjectSyncActivity.getString(R.string.drawing_couldnt_detect_projects));
dVar.m.setText(drawProjectSyncActivity.getString(R.string.drawing_try_again));
dVar.h(drawProjectSyncActivity.getString(R.string.gen_cancel));
dVar.a();
d.a m = dVar.m();
if (m != null) {
m.setOnCancelListener(new myobfuscated.fi0.b(drawProjectSyncActivity, 1));
}
}
public final a0 O() {
return (a0) this.a.getValue();
}
@Override
public final void onCreate(Bundle bundle) {
super.onCreate(bundle);
View inflate = getLayoutInflater().inflate(R.layout.activity_draw_project_sync, (ViewGroup) null, false);
if (inflate == null) {
throw new NullPointerException("rootView");
}
PicsartProgressOverlay picsartProgressOverlay = (PicsartProgressOverlay) inflate;
myobfuscated.ep0.a aVar = new myobfuscated.ep0.a(picsartProgressOverlay, picsartProgressOverlay);
Intrinsics.checkNotNullExpressionValue(aVar, "inflate(...)");
this.c = aVar;
setContentView(picsartProgressOverlay);
myobfuscated.ep0.a aVar2 = this.c;
if (aVar2 == null) {
Intrinsics.n("binding");
throw null;
}
aVar2.b.setVisibility(0);
O().l.e(this, new b(new Function1<Throwable, Unit>() {
{
super(1);
}
@Override
public Unit invoke(Throwable th) {
invoke2(th);
return Unit.a;
}
public final void invoke2(Throwable th) {
Toast.makeText(DrawProjectSyncActivity.this, (int) R.string.something_went_wrong, 0).show();
DrawProjectSyncActivity.this.finish();
}
}));
O().m.e(this, new b(new Function1<Boolean, Unit>() {
{
super(1);
}
@Override
public Unit invoke(Boolean bool) {
invoke2(bool);
return Unit.a;
}
public final void invoke2(Boolean bool) {
Intrinsics.e(bool);
if (bool.booleanValue()) {
DrawProjectSyncActivity drawProjectSyncActivity = DrawProjectSyncActivity.this;
int i = DrawProjectSyncActivity.d;
drawProjectSyncActivity.getClass();
myobfuscated.qz1.d dVar = new myobfuscated.qz1.d(drawProjectSyncActivity, 1, null, null, null, null, true);
dVar.c(new b0(3, drawProjectSyncActivity, dVar));
dVar.g(new e(5, dVar, drawProjectSyncActivity));
dVar.l(drawProjectSyncActivity.getString(R.string.drawing_cant_find_projects));
dVar.j(false);
dVar.k(drawProjectSyncActivity.getString(R.string.drawing_tap_use_folder));
String string = drawProjectSyncActivity.getString(R.string.done_tap_here);
Intrinsics.checkNotNullExpressionValue(string, "getString(...)");
String lowerCase = string.toLowerCase(Locale.ROOT);
Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(Locale.ROOT)");
dVar.E = n.b(new LinkedText(lowerCase, "https://support.picsart.com/hc/en-us/articles/4402643676049"));
dVar.m.setText(drawProjectSyncActivity.getString(R.string.drawing_recover_projects));
dVar.h(drawProjectSyncActivity.getString(R.string.gen_cancel));
dVar.a();
d.a m = dVar.m();
if (m != null) {
m.setOnCancelListener(new y(drawProjectSyncActivity, 0));
}
}
}
}));
O().n.e(this, new b(new Function1<Boolean, Unit>() {
{
super(1);
}
@Override
public Unit invoke(Boolean bool) {
invoke2(bool);
return Unit.a;
}
public final void invoke2(Boolean bool) {
Intrinsics.e(bool);
if (bool.booleanValue()) {
DrawProjectSyncActivity drawProjectSyncActivity = DrawProjectSyncActivity.this;
int i = DrawProjectSyncActivity.d;
drawProjectSyncActivity.getClass();
myobfuscated.qz1.d dVar = new myobfuscated.qz1.d(drawProjectSyncActivity, 1, null, null, null, null, true);
dVar.c(new myobfuscated.dr1.f(5, drawProjectSyncActivity, dVar));
dVar.g(new myobfuscated.x7.a0(5, dVar, drawProjectSyncActivity));
dVar.l(drawProjectSyncActivity.getString(R.string.drawing_assign_folder));
dVar.j(false);
dVar.k(drawProjectSyncActivity.getString(R.string.drawing_store_projects_proceeding));
dVar.m.setText(drawProjectSyncActivity.getString(R.string.drawing_select_folder));
dVar.h(drawProjectSyncActivity.getString(R.string.gen_cancel));
dVar.a();
d.a m = dVar.m();
if (m != null) {
m.setOnCancelListener(new myobfuscated.wj0.z(drawProjectSyncActivity, 0));
}
}
}
}));
O().o.e(this, new b(new Function1<Boolean, Unit>() {
{
super(1);
}
@Override
public Unit invoke(Boolean bool) {
invoke2(bool);
return Unit.a;
}
public final void invoke2(Boolean bool) {
Intrinsics.e(bool);
if (bool.booleanValue()) {
DrawProjectSyncActivity.M(DrawProjectSyncActivity.this);
}
}
}));
a0 O = O();
Intent intent = getIntent();
Intrinsics.checkNotNullExpressionValue(intent, "getIntent(...)");
O.getClass();
Intrinsics.checkNotNullParameter(intent, "intent");
String stringExtra = intent.getStringExtra("session_id");
if (stringExtra == null) {
stringExtra = "";
}
O.g = stringExtra;
String stringExtra2 = intent.getStringExtra("action");
if (stringExtra2 == null) {
stringExtra2 = "";
}
O.h = stringExtra2;
String stringExtra3 = intent.getStringExtra("custom_source");
O.i = stringExtra3 != null ? stringExtra3 : "";
O.j = intent.getBooleanExtra("assign_folder", false);
O.k = intent.getBooleanExtra("is_for_save_from_editor", false);
int length = O.h.length();
androidx.lifecycle.r rVar = O.e;
if (length != 0 || O.j) {
rVar.h(Boolean.TRUE, "assign_folder_dialog");
} else {
rVar.h(Boolean.TRUE, "recover_dialog");
}
}
}