version:2.3
fix: add:优化上传app信息失败
This commit is contained in:
@@ -63,6 +63,7 @@ import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
@@ -72,6 +73,7 @@ import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
import io.reactivex.rxjava3.core.ObservableSource;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.functions.Consumer;
|
||||
import io.reactivex.rxjava3.functions.Function;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
@@ -812,6 +814,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
synchronized private void sendStartTime(Context context, String jsonString) {
|
||||
NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
NetInterfaceManager.getInstance().sendRunningApp();
|
||||
NetInterfaceManager.getInstance().SendAppInstallInfo();
|
||||
if (JGYUtils.getInstance().isScreenOn()) {
|
||||
NetInterfaceManager.getInstance().screenshot();
|
||||
}
|
||||
@@ -983,13 +986,34 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
}
|
||||
}
|
||||
|
||||
private Disposable subscribe;
|
||||
private long cutdownTime = 30;
|
||||
private CustomDialog dialog;
|
||||
|
||||
synchronized void bindService(final Context context, String jsonString) {
|
||||
ToastUtil.debugShow("收到绑定设备请求");
|
||||
JSONObject object = JSON.parseObject(jsonString);
|
||||
String userName = object.getString("member_name");
|
||||
final String id = object.getString("id");
|
||||
String phoneNum = object.getString("member_phone");
|
||||
final CustomDialog dialog = new CustomDialog(context);
|
||||
dialog = new CustomDialog(context);
|
||||
subscribe = Observable.interval(1, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<Long>() {
|
||||
@Override
|
||||
public void accept(Long aLong) throws Exception {
|
||||
// Log.e("TAG", "倒计时:" + aLong);
|
||||
if (aLong < cutdownTime && !subscribe.isDisposed()) {
|
||||
dialog.setNegtiveText("拒绝" + "(" + (cutdownTime - aLong) + ")");
|
||||
} else {
|
||||
bind(context, id, 0);
|
||||
dialog.dismiss();
|
||||
subscribe.dispose();
|
||||
subscribe = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
dialog.setMessage(phoneNum + "的用户请求绑定你的平板")
|
||||
.setTitle("绑定请求")
|
||||
.setPositive("允许")
|
||||
@@ -1000,6 +1024,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
public void onPositiveClick() {
|
||||
bind(context, id, 1);
|
||||
dialog.dismiss();
|
||||
subscribe.dispose();
|
||||
subscribe = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1007,6 +1033,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
bind(context, id, 0);
|
||||
ToastUtil.show("设备取消绑定");
|
||||
dialog.dismiss();
|
||||
subscribe.dispose();
|
||||
subscribe = null;
|
||||
}
|
||||
});
|
||||
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
||||
@@ -1015,20 +1043,19 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
|
||||
new CountDownTimer(30000, 1000) {
|
||||
|
||||
@Override
|
||||
public void onTick(long l) {
|
||||
String value = String.valueOf((int) (l / 1000));
|
||||
dialog.setNegtiveText("拒绝" + "(" + value + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
bind(context, id, 0);
|
||||
dialog.dismiss();
|
||||
}
|
||||
}.start();
|
||||
// new CountDownTimer(30000, 1000) {
|
||||
// @Override
|
||||
// public void onTick(long l) {
|
||||
// String value = String.valueOf((int) (l / 1000));
|
||||
// dialog.setNegtiveText("拒绝" + "(" + value + ")");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFinish() {
|
||||
// bind(context, id, 0);
|
||||
// dialog.dismiss();
|
||||
// }
|
||||
// }.start();
|
||||
}
|
||||
|
||||
synchronized private void bind(final Context context, String id, int type) {
|
||||
@@ -1059,11 +1086,13 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("bind", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("bind", "onComplete: ");
|
||||
MainService.getPresenter().getSnInfo();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user