Joi Chat v2.0.4版本的 MD5 值为:a2be861183b8d7b3c0099889dd61911f
以下内容为反编译后的 DownLoadManager.java 源代码,内容仅作参考
package me.opq.arch.ext.download;
import android.os.Looper;
import android.support.v4.media.a;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.facebook.appevents.internal.ViewHierarchyConstants;
import java.io.File;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.MainCoroutineDispatcher;
import me.opq.arch.ext.util.LogExtKt;
import okhttp3.OkHttpClient;
import okhttp3.ResponseBody;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import retrofit2.Response;
import retrofit2.Retrofit;
@Metadata(d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\rJI\u0010\u000e\u001a\u00020\u000b2\u0006\u0010\u000f\u001a\u00020\r2\u0006\u0010\u0010\u001a\u00020\r2\u0006\u0010\u0011\u001a\u00020\r2\u0006\u0010\u0012\u001a\u00020\r2\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u0018H\u0082@ø\u0001\u0000¢\u0006\u0002\u0010\u0019J\u0006\u0010\u001a\u001a\u00020\u000bJ\u0006\u0010\u001b\u001a\u00020\u000bJC\u0010\u001c\u001a\u00020\u000b2\u0006\u0010\u000f\u001a\u00020\r2\u0006\u0010\u0010\u001a\u00020\r2\u0006\u0010\u0011\u001a\u00020\r2\u0006\u0010\u0012\u001a\u00020\r2\b\b\u0002\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u0016H\u0086@ø\u0001\u0000¢\u0006\u0002\u0010\u001dJ\u000e\u0010\u001e\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\rR#\u0010\u0003\u001a\n \u0005*\u0004\u0018\u00010\u00040\u00048BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\b\u0010\t\u001a\u0004\b\u0006\u0010\u0007\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u001f"}, d2 = {"Lme/opq/arch/ext/download/DownLoadManager;", "", "()V", "retrofitBuilder", "Lretrofit2/Retrofit;", "kotlin.jvm.PlatformType", "getRetrofitBuilder", "()Lretrofit2/Retrofit;", "retrofitBuilder$delegate", "Lkotlin/Lazy;", "cancel", "", "key", "", "doDownLoad", ViewHierarchyConstants.TAG_KEY, "url", "savePath", "saveName", "reDownload", "", "loadListener", "Lme/opq/arch/ext/download/OnDownLoadListener;", "coroutineScope", "Lkotlinx/coroutines/CoroutineScope;", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLme/opq/arch/ext/download/OnDownLoadListener;Lkotlinx/coroutines/CoroutineScope;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "doDownLoadCancelAll", "doDownLoadPauseAll", "downLoad", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLme/opq/arch/ext/download/OnDownLoadListener;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "pause", "app_release"}, k = 1, mv = {1, 9, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_CONSTRAINT_VERTICAL_CHAINSTYLE)
@SourceDebugExtension({"SMAP\nDownLoadManager.kt\nKotlin\n*S Kotlin\n*F\n+ 1 DownLoadManager.kt\nme/opq/arch/ext/download/DownLoadManager\n+ 2 _Maps.kt\nkotlin/collections/MapsKt___MapsKt\n*L\n1#1,188:1\n215#2,2:189\n215#2,2:191\n*S KotlinDebug\n*F\n+ 1 DownLoadManager.kt\nme/opq/arch/ext/download/DownLoadManager\n*L\n77#1:189,2\n86#1:191,2\n*E\n"})
public final class DownLoadManager {
@NotNull
public static final DownLoadManager INSTANCE = new DownLoadManager();
@NotNull
private static final Lazy retrofitBuilder = LazyKt.lazy(new Function0<Retrofit>() {
@Override
public final Retrofit invoke() {
Retrofit.Builder baseUrl = new Retrofit.Builder().baseUrl("https://www.baidu.com");
OkHttpClient.Builder builder = new OkHttpClient.Builder();
TimeUnit timeUnit = TimeUnit.SECONDS;
return baseUrl.client(builder.connectTimeout(10L, timeUnit).readTimeout(5L, timeUnit).writeTimeout(5L, timeUnit).build()).build();
}
});
private DownLoadManager() {
}
public final Object doDownLoad(String str, String str2, String str3, String str4, boolean z4, OnDownLoadListener onDownLoadListener, CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
DownLoadManager$doDownLoad$1 downLoadManager$doDownLoad$1;
String str5;
Continuation continuation2;
Object obj;
OnDownLoadListener onDownLoadListener2;
Throwable th;
String str6;
MainCoroutineDispatcher main;
DownLoadManager$doDownLoad$6 downLoadManager$doDownLoad$6;
Object obj2;
long j5;
MainCoroutineDispatcher main2;
DownLoadManager$doDownLoad$4 downLoadManager$doDownLoad$4;
String str7;
Object obj3;
String str8;
DownLoadManager downLoadManager;
String str9;
String str10;
long j6;
OnDownLoadListener onDownLoadListener3;
String str11;
long j7;
String str12;
String str13;
String str14;
OnDownLoadListener onDownLoadListener4;
ResponseBody responseBody;
String str15 = str;
OnDownLoadListener onDownLoadListener5 = onDownLoadListener;
if (continuation instanceof DownLoadManager$doDownLoad$1) {
downLoadManager$doDownLoad$1 = (DownLoadManager$doDownLoad$1) continuation;
int i5 = downLoadManager$doDownLoad$1.label;
if ((i5 & Integer.MIN_VALUE) != 0) {
downLoadManager$doDownLoad$1.label = i5 - Integer.MIN_VALUE;
Object obj4 = downLoadManager$doDownLoad$1.result;
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
switch (downLoadManager$doDownLoad$1.label) {
case 0:
ResultKt.throwOnFailure(obj4);
DownLoadPool downLoadPool = DownLoadPool.INSTANCE;
CoroutineScope scopeFromKey = downLoadPool.getScopeFromKey(str15);
if (scopeFromKey == null || !CoroutineScopeKt.isActive(scopeFromKey)) {
if (scopeFromKey != null && !CoroutineScopeKt.isActive(scopeFromKey)) {
LogExtKt.logi$default(a.l("key ", str15, " 已经在队列中 但是已经不再活跃 remove"), null, 1, null);
downLoadPool.removeExitSp(str15);
}
if (str4.length() == 0) {
MainCoroutineDispatcher main3 = Dispatchers.getMain();
DownLoadManager$doDownLoad$2 downLoadManager$doDownLoad$2 = new DownLoadManager$doDownLoad$2(onDownLoadListener5, str15, null);
downLoadManager$doDownLoad$1.label = 1;
if (BuildersKt.withContext(main3, downLoadManager$doDownLoad$2, downLoadManager$doDownLoad$1) == coroutine_suspended) {
return coroutine_suspended;
}
return Unit.INSTANCE;
}
if (Intrinsics.areEqual(Looper.getMainLooper().getThread(), Thread.currentThread())) {
MainCoroutineDispatcher main4 = Dispatchers.getMain();
DownLoadManager$doDownLoad$3 downLoadManager$doDownLoad$3 = new DownLoadManager$doDownLoad$3(onDownLoadListener5, str15, null);
downLoadManager$doDownLoad$1.label = 2;
if (BuildersKt.withContext(main4, downLoadManager$doDownLoad$3, downLoadManager$doDownLoad$1) == coroutine_suspended) {
return coroutine_suspended;
}
return Unit.INSTANCE;
}
File file = new File(str3 + '/' + str4);
if (file.exists()) {
obj2 = coroutine_suspended;
j5 = ShareDownLoadUtil.INSTANCE.getLong(str15, 0L);
} else {
obj2 = coroutine_suspended;
j5 = 0;
}
if (!file.exists() || j5 != 0 || z4) {
LogExtKt.logi$default(a.i("startDownLoad current ", j5), null, 1, null);
try {
downLoadPool.add(str15, coroutineScope);
downLoadPool.add(str15, str3 + '/' + str4);
downLoadPool.add(str15, onDownLoadListener5);
main2 = Dispatchers.getMain();
try {
downLoadManager$doDownLoad$4 = new DownLoadManager$doDownLoad$4(onDownLoadListener5, str15, null);
downLoadManager$doDownLoad$1.L$0 = this;
downLoadManager$doDownLoad$1.L$1 = str15;
str7 = str2;
downLoadManager$doDownLoad$1.L$2 = str7;
downLoadManager$doDownLoad$1.L$3 = str3;
downLoadManager$doDownLoad$1.L$4 = str4;
downLoadManager$doDownLoad$1.L$5 = onDownLoadListener5;
downLoadManager$doDownLoad$1.J$0 = j5;
downLoadManager$doDownLoad$1.label = 3;
obj3 = obj2;
} catch (Throwable th2) {
th = th2;
continuation2 = null;
obj = obj2;
str14 = onDownLoadListener5;
str5 = str15;
str15 = str14;
onDownLoadListener2 = str15;
th = th;
str6 = str5;
main = Dispatchers.getMain();
downLoadManager$doDownLoad$6 = new DownLoadManager$doDownLoad$6(onDownLoadListener2, str6, th, continuation2);
downLoadManager$doDownLoad$1.L$0 = str6;
downLoadManager$doDownLoad$1.L$1 = continuation2;
downLoadManager$doDownLoad$1.L$2 = continuation2;
downLoadManager$doDownLoad$1.L$3 = continuation2;
downLoadManager$doDownLoad$1.L$4 = continuation2;
downLoadManager$doDownLoad$1.L$5 = continuation2;
downLoadManager$doDownLoad$1.label = 7;
if (BuildersKt.withContext(main, downLoadManager$doDownLoad$6, downLoadManager$doDownLoad$1) == obj) {
}
DownLoadPool.INSTANCE.remove(str6);
return Unit.INSTANCE;
}
} catch (Throwable th3) {
th = th3;
obj = obj2;
str13 = onDownLoadListener5;
continuation2 = null;
str14 = str13;
str5 = str15;
str15 = str14;
onDownLoadListener2 = str15;
th = th;
str6 = str5;
main = Dispatchers.getMain();
downLoadManager$doDownLoad$6 = new DownLoadManager$doDownLoad$6(onDownLoadListener2, str6, th, continuation2);
downLoadManager$doDownLoad$1.L$0 = str6;
downLoadManager$doDownLoad$1.L$1 = continuation2;
downLoadManager$doDownLoad$1.L$2 = continuation2;
downLoadManager$doDownLoad$1.L$3 = continuation2;
downLoadManager$doDownLoad$1.L$4 = continuation2;
downLoadManager$doDownLoad$1.L$5 = continuation2;
downLoadManager$doDownLoad$1.label = 7;
if (BuildersKt.withContext(main, downLoadManager$doDownLoad$6, downLoadManager$doDownLoad$1) == obj) {
}
DownLoadPool.INSTANCE.remove(str6);
return Unit.INSTANCE;
}
if (BuildersKt.withContext(main2, downLoadManager$doDownLoad$4, downLoadManager$doDownLoad$1) == obj3) {
return obj3;
}
str8 = str3;
downLoadManager = this;
str9 = str15;
str10 = str4;
j6 = j5;
onDownLoadListener3 = onDownLoadListener5;
try {
DownLoadService downLoadService = (DownLoadService) downLoadManager.getRetrofitBuilder().create(DownLoadService.class);
String str16 = "bytes=" + j6 + '-';
downLoadManager$doDownLoad$1.L$0 = str9;
downLoadManager$doDownLoad$1.L$1 = str8;
downLoadManager$doDownLoad$1.L$2 = str10;
downLoadManager$doDownLoad$1.L$3 = onDownLoadListener3;
try {
downLoadManager$doDownLoad$1.L$4 = null;
downLoadManager$doDownLoad$1.L$5 = null;
downLoadManager$doDownLoad$1.J$0 = j6;
downLoadManager$doDownLoad$1.label = 4;
obj4 = downLoadService.downloadFile(str16, str7, downLoadManager$doDownLoad$1);
} catch (Throwable th4) {
th = th4;
continuation2 = null;
obj = obj3;
th = th;
str6 = str9;
onDownLoadListener2 = onDownLoadListener3;
main = Dispatchers.getMain();
downLoadManager$doDownLoad$6 = new DownLoadManager$doDownLoad$6(onDownLoadListener2, str6, th, continuation2);
downLoadManager$doDownLoad$1.L$0 = str6;
downLoadManager$doDownLoad$1.L$1 = continuation2;
downLoadManager$doDownLoad$1.L$2 = continuation2;
downLoadManager$doDownLoad$1.L$3 = continuation2;
downLoadManager$doDownLoad$1.L$4 = continuation2;
downLoadManager$doDownLoad$1.L$5 = continuation2;
downLoadManager$doDownLoad$1.label = 7;
if (BuildersKt.withContext(main, downLoadManager$doDownLoad$6, downLoadManager$doDownLoad$1) == obj) {
}
DownLoadPool.INSTANCE.remove(str6);
return Unit.INSTANCE;
}
} catch (Throwable th5) {
th = th5;
obj = obj3;
continuation2 = null;
}
if (obj4 != obj3) {
return obj3;
}
str11 = str10;
j7 = j6;
str15 = str9;
str12 = str8;
onDownLoadListener4 = onDownLoadListener3;
try {
responseBody = (ResponseBody) ((Response) obj4).body();
} catch (Throwable th6) {
th = th6;
obj = obj3;
str13 = onDownLoadListener4;
continuation2 = null;
str14 = str13;
str5 = str15;
str15 = str14;
onDownLoadListener2 = str15;
th = th;
str6 = str5;
main = Dispatchers.getMain();
downLoadManager$doDownLoad$6 = new DownLoadManager$doDownLoad$6(onDownLoadListener2, str6, th, continuation2);
downLoadManager$doDownLoad$1.L$0 = str6;
downLoadManager$doDownLoad$1.L$1 = continuation2;
downLoadManager$doDownLoad$1.L$2 = continuation2;
downLoadManager$doDownLoad$1.L$3 = continuation2;
downLoadManager$doDownLoad$1.L$4 = continuation2;
downLoadManager$doDownLoad$1.L$5 = continuation2;
downLoadManager$doDownLoad$1.label = 7;
if (BuildersKt.withContext(main, downLoadManager$doDownLoad$6, downLoadManager$doDownLoad$1) == obj) {
}
DownLoadPool.INSTANCE.remove(str6);
return Unit.INSTANCE;
}
if (responseBody != null) {
LogExtKt.logi$default("responseBody is null", null, 1, null);
MainCoroutineDispatcher main5 = Dispatchers.getMain();
DownLoadManager$doDownLoad$5 downLoadManager$doDownLoad$5 = new DownLoadManager$doDownLoad$5(onDownLoadListener4, str15, null);
downLoadManager$doDownLoad$1.L$0 = str15;
downLoadManager$doDownLoad$1.L$1 = onDownLoadListener4;
downLoadManager$doDownLoad$1.L$2 = null;
downLoadManager$doDownLoad$1.L$3 = null;
downLoadManager$doDownLoad$1.label = 5;
if (BuildersKt.withContext(main5, downLoadManager$doDownLoad$5, downLoadManager$doDownLoad$1) == obj3) {
return obj3;
}
DownLoadPool.INSTANCE.remove(str15);
return Unit.INSTANCE;
}
FileTool fileTool = FileTool.INSTANCE;
downLoadManager$doDownLoad$1.L$0 = str15;
downLoadManager$doDownLoad$1.L$1 = onDownLoadListener4;
continuation2 = null;
try {
downLoadManager$doDownLoad$1.L$2 = null;
downLoadManager$doDownLoad$1.L$3 = null;
downLoadManager$doDownLoad$1.label = 6;
obj = obj3;
} catch (Throwable th7) {
th = th7;
obj = obj3;
str14 = onDownLoadListener4;
str5 = str15;
str15 = str14;
onDownLoadListener2 = str15;
th = th;
str6 = str5;
main = Dispatchers.getMain();
downLoadManager$doDownLoad$6 = new DownLoadManager$doDownLoad$6(onDownLoadListener2, str6, th, continuation2);
downLoadManager$doDownLoad$1.L$0 = str6;
downLoadManager$doDownLoad$1.L$1 = continuation2;
downLoadManager$doDownLoad$1.L$2 = continuation2;
downLoadManager$doDownLoad$1.L$3 = continuation2;
downLoadManager$doDownLoad$1.L$4 = continuation2;
downLoadManager$doDownLoad$1.L$5 = continuation2;
downLoadManager$doDownLoad$1.label = 7;
if (BuildersKt.withContext(main, downLoadManager$doDownLoad$6, downLoadManager$doDownLoad$1) == obj) {
return obj;
}
DownLoadPool.INSTANCE.remove(str6);
return Unit.INSTANCE;
}
try {
if (fileTool.downToFile(str15, str12, str11, j7, responseBody, onDownLoadListener4, downLoadManager$doDownLoad$1) == obj) {
return obj;
}
} catch (Throwable th8) {
String str17 = str15;
th = th8;
str6 = str17;
onDownLoadListener2 = onDownLoadListener4;
main = Dispatchers.getMain();
downLoadManager$doDownLoad$6 = new DownLoadManager$doDownLoad$6(onDownLoadListener2, str6, th, continuation2);
downLoadManager$doDownLoad$1.L$0 = str6;
downLoadManager$doDownLoad$1.L$1 = continuation2;
downLoadManager$doDownLoad$1.L$2 = continuation2;
downLoadManager$doDownLoad$1.L$3 = continuation2;
downLoadManager$doDownLoad$1.L$4 = continuation2;
downLoadManager$doDownLoad$1.L$5 = continuation2;
downLoadManager$doDownLoad$1.label = 7;
if (BuildersKt.withContext(main, downLoadManager$doDownLoad$6, downLoadManager$doDownLoad$1) == obj) {
}
DownLoadPool.INSTANCE.remove(str6);
return Unit.INSTANCE;
}
return Unit.INSTANCE;
}
String path = file.getPath();
Intrinsics.checkNotNullExpressionValue(path, "getPath(...)");
onDownLoadListener5.onDownLoadSuccess(str15, path, file.length());
} else {
LogExtKt.logi$default("已经在队列中", null, 1, null);
}
return Unit.INSTANCE;
case 1:
ResultKt.throwOnFailure(obj4);
return Unit.INSTANCE;
case 2:
ResultKt.throwOnFailure(obj4);
return Unit.INSTANCE;
case 3:
j6 = downLoadManager$doDownLoad$1.J$0;
OnDownLoadListener onDownLoadListener6 = (OnDownLoadListener) downLoadManager$doDownLoad$1.L$5;
str10 = (String) downLoadManager$doDownLoad$1.L$4;
str8 = (String) downLoadManager$doDownLoad$1.L$3;
str7 = (String) downLoadManager$doDownLoad$1.L$2;
str9 = (String) downLoadManager$doDownLoad$1.L$1;
downLoadManager = (DownLoadManager) downLoadManager$doDownLoad$1.L$0;
try {
ResultKt.throwOnFailure(obj4);
obj3 = coroutine_suspended;
onDownLoadListener3 = onDownLoadListener6;
DownLoadService downLoadService2 = (DownLoadService) downLoadManager.getRetrofitBuilder().create(DownLoadService.class);
String str162 = "bytes=" + j6 + '-';
downLoadManager$doDownLoad$1.L$0 = str9;
downLoadManager$doDownLoad$1.L$1 = str8;
downLoadManager$doDownLoad$1.L$2 = str10;
downLoadManager$doDownLoad$1.L$3 = onDownLoadListener3;
downLoadManager$doDownLoad$1.L$4 = null;
downLoadManager$doDownLoad$1.L$5 = null;
downLoadManager$doDownLoad$1.J$0 = j6;
downLoadManager$doDownLoad$1.label = 4;
obj4 = downLoadService2.downloadFile(str162, str7, downLoadManager$doDownLoad$1);
if (obj4 != obj3) {
}
} catch (Throwable th9) {
th = th9;
str15 = onDownLoadListener6;
str5 = str9;
continuation2 = null;
obj = coroutine_suspended;
onDownLoadListener2 = str15;
th = th;
str6 = str5;
main = Dispatchers.getMain();
downLoadManager$doDownLoad$6 = new DownLoadManager$doDownLoad$6(onDownLoadListener2, str6, th, continuation2);
downLoadManager$doDownLoad$1.L$0 = str6;
downLoadManager$doDownLoad$1.L$1 = continuation2;
downLoadManager$doDownLoad$1.L$2 = continuation2;
downLoadManager$doDownLoad$1.L$3 = continuation2;
downLoadManager$doDownLoad$1.L$4 = continuation2;
downLoadManager$doDownLoad$1.L$5 = continuation2;
downLoadManager$doDownLoad$1.label = 7;
if (BuildersKt.withContext(main, downLoadManager$doDownLoad$6, downLoadManager$doDownLoad$1) == obj) {
}
DownLoadPool.INSTANCE.remove(str6);
return Unit.INSTANCE;
}
break;
case 4:
long j8 = downLoadManager$doDownLoad$1.J$0;
OnDownLoadListener onDownLoadListener7 = (OnDownLoadListener) downLoadManager$doDownLoad$1.L$3;
String str18 = (String) downLoadManager$doDownLoad$1.L$2;
String str19 = (String) downLoadManager$doDownLoad$1.L$1;
str5 = (String) downLoadManager$doDownLoad$1.L$0;
try {
ResultKt.throwOnFailure(obj4);
str11 = str18;
j7 = j8;
str12 = str19;
str15 = str5;
obj3 = coroutine_suspended;
onDownLoadListener4 = onDownLoadListener7;
responseBody = (ResponseBody) ((Response) obj4).body();
if (responseBody != null) {
}
} catch (Throwable th10) {
th = th10;
str15 = onDownLoadListener7;
continuation2 = null;
obj = coroutine_suspended;
onDownLoadListener2 = str15;
th = th;
str6 = str5;
main = Dispatchers.getMain();
downLoadManager$doDownLoad$6 = new DownLoadManager$doDownLoad$6(onDownLoadListener2, str6, th, continuation2);
downLoadManager$doDownLoad$1.L$0 = str6;
downLoadManager$doDownLoad$1.L$1 = continuation2;
downLoadManager$doDownLoad$1.L$2 = continuation2;
downLoadManager$doDownLoad$1.L$3 = continuation2;
downLoadManager$doDownLoad$1.L$4 = continuation2;
downLoadManager$doDownLoad$1.L$5 = continuation2;
downLoadManager$doDownLoad$1.label = 7;
if (BuildersKt.withContext(main, downLoadManager$doDownLoad$6, downLoadManager$doDownLoad$1) == obj) {
}
DownLoadPool.INSTANCE.remove(str6);
return Unit.INSTANCE;
}
break;
case 5:
String str20 = (String) downLoadManager$doDownLoad$1.L$0;
ResultKt.throwOnFailure(obj4);
str15 = str20;
DownLoadPool.INSTANCE.remove(str15);
return Unit.INSTANCE;
case 6:
ResultKt.throwOnFailure(obj4);
return Unit.INSTANCE;
case 7:
str6 = (String) downLoadManager$doDownLoad$1.L$0;
ResultKt.throwOnFailure(obj4);
DownLoadPool.INSTANCE.remove(str6);
return Unit.INSTANCE;
default:
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
}
}
downLoadManager$doDownLoad$1 = new DownLoadManager$doDownLoad$1(this, continuation);
Object obj42 = downLoadManager$doDownLoad$1.result;
Object coroutine_suspended2 = IntrinsicsKt.getCOROUTINE_SUSPENDED();
switch (downLoadManager$doDownLoad$1.label) {
}
}
private final Retrofit getRetrofitBuilder() {
return (Retrofit) retrofitBuilder.getValue();
}
public final void cancel(@NotNull String key) {
Intrinsics.checkNotNullParameter(key, "key");
DownLoadPool downLoadPool = DownLoadPool.INSTANCE;
String pathFromKey = downLoadPool.getPathFromKey(key);
if (pathFromKey != null) {
File file = new File(pathFromKey);
if (file.exists()) {
file.delete();
}
}
downLoadPool.remove(key);
}
public final void doDownLoadCancelAll() {
Iterator<Map.Entry<String, OnDownLoadListener>> it = DownLoadPool.INSTANCE.getListenerMap().entrySet().iterator();
while (it.hasNext()) {
INSTANCE.cancel(it.next().getKey());
}
}
public final void doDownLoadPauseAll() {
Iterator<Map.Entry<String, OnDownLoadListener>> it = DownLoadPool.INSTANCE.getListenerMap().entrySet().iterator();
while (it.hasNext()) {
INSTANCE.pause(it.next().getKey());
}
}
@Nullable
public final Object downLoad(@NotNull String str, @NotNull String str2, @NotNull String str3, @NotNull String str4, boolean z4, @NotNull OnDownLoadListener onDownLoadListener, @NotNull Continuation<? super Unit> continuation) {
Object withContext = BuildersKt.withContext(Dispatchers.getIO(), new DownLoadManager$downLoad$2(str, str2, str3, str4, z4, onDownLoadListener, null), continuation);
return withContext == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? withContext : Unit.INSTANCE;
}
public final void pause(@NotNull String key) {
Intrinsics.checkNotNullParameter(key, "key");
DownLoadPool downLoadPool = DownLoadPool.INSTANCE;
OnDownLoadListener listenerFromKey = downLoadPool.getListenerFromKey(key);
if (listenerFromKey != null) {
listenerFromKey.onDownLoadPause(key);
}
downLoadPool.pause(key);
}
}