171 lines
6.6 KiB
Java
171 lines
6.6 KiB
Java
package com.ubt.jimu.update;
|
|
|
|
import android.app.Activity;
|
|
import android.app.Dialog;
|
|
import android.content.Context;
|
|
import android.content.DialogInterface;
|
|
import com.safelib.TryCatchAspect;
|
|
import com.ubt.jimu.base.dialog.JimuSimpleDialog;
|
|
import com.ubt.jimu.base.entities.UpdateApkEntities;
|
|
import com.ubt.jimu.base.http.ApiObserver;
|
|
import com.ubt.jimu.base.http.manager.CommunityManager;
|
|
import com.ubtech.handler.HandlerHub;
|
|
import io.reactivex.disposables.CompositeDisposable;
|
|
import io.reactivex.disposables.Disposable;
|
|
import java.util.Iterator;
|
|
import org.aspectj.lang.JoinPoint;
|
|
import org.aspectj.runtime.internal.AroundClosure;
|
|
import org.aspectj.runtime.reflect.Factory;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class UpdateManager {
|
|
private static UpdateManager d;
|
|
private static final /* synthetic */ JoinPoint.StaticPart e = null;
|
|
CompositeDisposable a;
|
|
private String b = "http://10.10.1.12:8081/version/appVersion/Jimu/jimu-fir_test-2.2.6.11.apk";
|
|
private boolean c = false;
|
|
|
|
public class AjcClosure3 extends AroundClosure {
|
|
public AjcClosure3(Object[] objArr) {
|
|
super(objArr);
|
|
}
|
|
|
|
@Override // org.aspectj.runtime.internal.AroundClosure
|
|
public Object run(Object[] objArr) {
|
|
Object[] objArr2 = this.state;
|
|
UpdateManager.a((UpdateManager) objArr2[0], (Context) objArr2[1], (JoinPoint) objArr2[2]);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public interface UpdateCallback {
|
|
void a(UpdateApkEntities updateApkEntities);
|
|
}
|
|
|
|
static {
|
|
b();
|
|
}
|
|
|
|
private UpdateManager() {
|
|
}
|
|
|
|
static /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
|
}
|
|
|
|
private static /* synthetic */ void b() {
|
|
Factory factory = new Factory("UpdateManager.java", UpdateManager.class);
|
|
factory.a("method-execution", factory.a("1", "checkUpdate", "com.ubt.jimu.update.UpdateManager", "android.app.Activity", "activity", "", "void"), 49);
|
|
e = factory.a("method-execution", factory.a("1", "startDownLoad", "com.ubt.jimu.update.UpdateManager", "android.content.Context", "context", "", "void"), 113);
|
|
}
|
|
|
|
public static synchronized UpdateManager c() {
|
|
UpdateManager updateManager;
|
|
synchronized (UpdateManager.class) {
|
|
if (d == null) {
|
|
d = new UpdateManager();
|
|
}
|
|
updateManager = d;
|
|
}
|
|
return updateManager;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void b(final UpdateApkEntities updateApkEntities, final Activity activity) {
|
|
HandlerHub.a().post(new Runnable() { // from class: com.ubt.jimu.update.d
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
UpdateManager.this.a(updateApkEntities, activity);
|
|
}
|
|
});
|
|
}
|
|
|
|
public void a(final Activity activity, final UpdateCallback updateCallback, final boolean z) {
|
|
if (this.a == null) {
|
|
this.a = new CompositeDisposable();
|
|
}
|
|
CommunityManager.create().updateApp(new ApiObserver<UpdateApkEntities>(null) { // from class: com.ubt.jimu.update.UpdateManager.1
|
|
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(UpdateApkEntities updateApkEntities) {
|
|
UpdateCallback updateCallback2 = updateCallback;
|
|
if (updateCallback2 != null) {
|
|
updateCallback2.a(updateApkEntities);
|
|
}
|
|
if (!z || updateApkEntities.getModels() == null) {
|
|
return;
|
|
}
|
|
UpdateManager.this.b(updateApkEntities, activity);
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.ApiObserver, io.reactivex.Observer
|
|
public void onSubscribe(Disposable disposable) {
|
|
super.onSubscribe(disposable);
|
|
UpdateManager.this.a.b(disposable);
|
|
}
|
|
});
|
|
}
|
|
|
|
private void b(Context context) {
|
|
DownLoadDialog downLoadDialog = new DownLoadDialog(context, this.c, this.b);
|
|
downLoadDialog.show();
|
|
downLoadDialog.a();
|
|
}
|
|
|
|
public /* synthetic */ void a(UpdateApkEntities updateApkEntities, Activity activity) {
|
|
if (updateApkEntities.getModels().isIsNeed()) {
|
|
this.c = updateApkEntities.getModels().isIsForce();
|
|
this.b = updateApkEntities.getModels().getPath();
|
|
StringBuilder sb = new StringBuilder();
|
|
Iterator<String> it = updateApkEntities.getModels().getContent().iterator();
|
|
while (it.hasNext()) {
|
|
sb.append(it.next());
|
|
sb.append("\n");
|
|
}
|
|
if (activity == null) {
|
|
return;
|
|
}
|
|
Dialog versionUpdateDialog = JimuSimpleDialog.versionUpdateDialog(activity, updateApkEntities.getModels().isIsForce(), sb.toString());
|
|
if (activity.isFinishing() || activity.isDestroyed() || versionUpdateDialog.isShowing()) {
|
|
return;
|
|
}
|
|
versionUpdateDialog.show();
|
|
}
|
|
}
|
|
|
|
public void a(Context context) {
|
|
TryCatchAspect.b().a(new AjcClosure3(new Object[]{this, context, Factory.a(e, this, this, context)}).linkClosureAndJoinPoint(69648));
|
|
}
|
|
|
|
static final /* synthetic */ void a(final UpdateManager updateManager, final Context context, JoinPoint joinPoint) {
|
|
if (!updateManager.c) {
|
|
JimuSimpleDialog.showWifiOnlyDialog(context, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.update.e
|
|
@Override // android.content.DialogInterface.OnClickListener
|
|
public final void onClick(DialogInterface dialogInterface, int i) {
|
|
UpdateManager.a(dialogInterface, i);
|
|
}
|
|
}, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.update.f
|
|
@Override // android.content.DialogInterface.OnClickListener
|
|
public final void onClick(DialogInterface dialogInterface, int i) {
|
|
UpdateManager.this.a(context, dialogInterface, i);
|
|
}
|
|
}, false);
|
|
} else {
|
|
updateManager.b(context);
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ void a(Context context, DialogInterface dialogInterface, int i) {
|
|
b(context);
|
|
}
|
|
|
|
public void a() {
|
|
CompositeDisposable compositeDisposable = this.a;
|
|
if (compositeDisposable == null) {
|
|
return;
|
|
}
|
|
compositeDisposable.dispose();
|
|
this.a.a();
|
|
this.a = null;
|
|
}
|
|
}
|