version:3.7beta
fix:移除HTTPInterface,所有请求在NetInterfaceManager进行 update:
This commit is contained in:
@@ -249,7 +249,6 @@ public class GuardService extends Service {
|
||||
}
|
||||
break;
|
||||
case Intent.ACTION_SCREEN_OFF: {
|
||||
// HTTPInterface.getAppLimit(GuardService.this);
|
||||
long time = System.currentTimeMillis();
|
||||
getLockState("1", String.valueOf(time));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
|
||||
@@ -32,9 +32,10 @@ public class MainSContact {
|
||||
/*分支4 获取应用*/
|
||||
/*获取设备信息更新*/
|
||||
void checkAoleyunUpdate();
|
||||
|
||||
/*获取测试应用更新*/
|
||||
void checkTestUpdate();
|
||||
/*获取可被写入的安装包名*/
|
||||
void getAppLimit();
|
||||
/*获取强制下载apk*/
|
||||
void getForceDownload();
|
||||
/*获取桌面*/
|
||||
@@ -47,8 +48,8 @@ public class MainSContact {
|
||||
void getDeveloper();
|
||||
/*获取设备后台设置*/
|
||||
void getSystemSettingBegin();
|
||||
/*获取可被写入的安装包名*/
|
||||
void getAppLimit();
|
||||
/*获取所有app详细信息*/
|
||||
void getAllAppList();
|
||||
/*获取自定义内置app*/
|
||||
void getROMApp();
|
||||
/*获取浏览器书签设置管控*/
|
||||
@@ -75,10 +76,10 @@ public class MainSContact {
|
||||
void getSnTimeControl();
|
||||
/*获取电子书包激活码*/
|
||||
void getEBagCode();
|
||||
/*获取wifi密码*/
|
||||
void getWiFiPasswd();
|
||||
/*获取屏幕锁状态*/
|
||||
void getScreenLockState();
|
||||
/*获取wifi密码*/
|
||||
void getWiFiPasswd();
|
||||
}
|
||||
|
||||
public interface MainView extends BaseView {
|
||||
@@ -105,9 +106,10 @@ public class MainSContact {
|
||||
|
||||
/*获取设备信息更新*/
|
||||
void checkAoleyunUpdateFinish();
|
||||
|
||||
/*获取测试应用更新*/
|
||||
void checkTestUpdateFinish();
|
||||
/*获取可被写入的安装包名结束*/
|
||||
void getAppLimitFinish();
|
||||
/*获取强制下载apk结束*/
|
||||
void getForceDownloadFinish();
|
||||
/*获取桌面结束*/
|
||||
@@ -119,8 +121,8 @@ public class MainSContact {
|
||||
void getDeveloperFinish();
|
||||
/*设置设备后台设置*/
|
||||
void setSystemSetting();
|
||||
/*获取可被写入的安装包名结束*/
|
||||
void getAppLimitFinish();
|
||||
/*获取所有app详细信息*/
|
||||
void getAllAppListFinish();
|
||||
/*获取自定义内置app*/
|
||||
void getROMAppFinish();
|
||||
/*获取浏览器书签设置管控结束*/
|
||||
@@ -147,9 +149,9 @@ public class MainSContact {
|
||||
void getSnTimeControlFinish();
|
||||
/*获取电子书包激活码*/
|
||||
void getEBagCodeFinish();
|
||||
/*获取wifi密码结束*/
|
||||
void setWiFiPasswd();
|
||||
/*设置屏幕锁状态结束*/
|
||||
void setScreenLockStateFinish(boolean locked, String tips);
|
||||
/*获取wifi密码结束*/
|
||||
void setWiFiPasswd();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,54 +2,25 @@ package com.aoleyun.sn.service.main;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.bean.BaseResponse;
|
||||
import com.aoleyun.sn.bean.DefaultApp;
|
||||
import com.aoleyun.sn.bean.LogoImg;
|
||||
import com.aoleyun.sn.bean.NetAndLaunchBean;
|
||||
import com.aoleyun.sn.bean.StudentsInfo;
|
||||
import com.aoleyun.sn.bean.WiFiAlias;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.disklrucache.CacheHelper;
|
||||
import com.aoleyun.sn.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.utils.ApkUtils;
|
||||
import com.aoleyun.sn.utils.JGYUtils;
|
||||
import com.aoleyun.sn.utils.SPUtils;
|
||||
import com.aoleyun.sn.utils.TimeUtils;
|
||||
import com.aoleyun.sn.utils.ToastUtil;
|
||||
import com.aoleyun.sn.utils.URLUtils;
|
||||
import com.aoleyun.sn.utils.Utils;
|
||||
import com.aoleyun.sn.utils.WiFiUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
import static com.google.gson.JsonParser.parseString;
|
||||
|
||||
/**
|
||||
* MainService 的 Presenter
|
||||
@@ -64,9 +35,6 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
private MMKV mMMKV = MMKV.defaultMMKV();
|
||||
private CacheHelper cacheHelper;
|
||||
|
||||
private final String DEFAULT_INFO = "暂无信息";
|
||||
private final int OK = 200;
|
||||
|
||||
private BehaviorSubject<ActivityEvent> lifecycle;
|
||||
|
||||
public void setLifecycle(BehaviorSubject<ActivityEvent> lifecycle) {
|
||||
@@ -237,6 +205,17 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppLimit() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getAppLimit(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getAppLimitFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getForceDownload() {
|
||||
NetInterfaceManager.getInstance()
|
||||
@@ -258,7 +237,6 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
.getDefaultDesktop(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
NetInterfaceManager.getInstance().getAllAppList();
|
||||
mView.getDefaultDesktopFinish();
|
||||
}
|
||||
});
|
||||
@@ -303,50 +281,12 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppLimit() {
|
||||
public void getAllAppList() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getAppLimitObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAppLimit", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
|
||||
Log.e("getAppLimit", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == OK) {
|
||||
Log.e("getAppLimit", "onNext: " + baseResponse.data.toString());
|
||||
JsonObject jsonObject = parseString(new Gson().toJson(baseResponse.data)).getAsJsonObject();
|
||||
String data = jsonObject.get("result").getAsString();
|
||||
//开机图标
|
||||
boolean write = Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST, data);
|
||||
Log.e(TAG, "onNext: only_jgy_shortcut_list: " + write);
|
||||
JGYUtils.getInstance().writeAppPackageList(mContext, data);
|
||||
mView.getAppLimitFinish();
|
||||
} else {
|
||||
boolean write = Settings.System.putString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST, " ");
|
||||
JGYUtils.getInstance().writeAppPackageList(mContext, "");
|
||||
Log.e(TAG, "onNext: only_jgy_shortcut_list: " + write);
|
||||
Log.e("getAppLimit", "onNext: " + baseResponse);
|
||||
mView.getAppLimitFinish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAppLimit", "onError: " + e.getMessage());
|
||||
String oldListString = Settings.System.getString(mContext.getContentResolver(), JGYActions.ACTION_JGY_SHORTCUTLIST);
|
||||
Log.e("getAppLimit", "oldListString: " + oldListString);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
.getAllAppList(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppLimit", "onComplete: ");
|
||||
mView.getAppLimitFinish();
|
||||
mView.getAllAppListFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -355,40 +295,10 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
public void getROMApp() {
|
||||
String customVersion = Utils.getCustomVersion();
|
||||
Log.e(TAG, "getROMApp: " + customVersion);
|
||||
NetInterfaceManager.getInstance().getCustomROMAppApi()
|
||||
.getROMApp(NetInterfaceManager.HTTP_KEY, customVersion)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getROMApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
|
||||
Log.e("getROMApp", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == OK) {
|
||||
JsonObject jsonObject = parseString(new Gson().toJson(baseResponse.data)).getAsJsonObject();
|
||||
String packageName = jsonObject.get("package_name").getAsString();
|
||||
Settings.System.putString(mContext.getContentResolver(), "jgy_customromapp", packageName);
|
||||
} else {
|
||||
Log.e("getROMApp", "onNext: " + baseResponse.msg);
|
||||
Settings.System.putString(mContext.getContentResolver(), "jgy_customromapp", " ");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getROMApp", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
NetInterfaceManager.getInstance()
|
||||
.getCustomROMApp(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getROMApp", "onComplete: ");
|
||||
mView.getROMAppFinish();
|
||||
}
|
||||
});
|
||||
@@ -396,29 +306,11 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getBrowserBookmarks() {
|
||||
NetInterfaceManager.getInstance().getHomePageBookmarks(new NetInterfaceManager.BookmarksCallback() {
|
||||
@Override
|
||||
public void onSubscribe() {
|
||||
Log.e("getBrowserBookmarks", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext() {
|
||||
|
||||
Log.e("getBrowserBookmarks", "onNext: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getBrowserBookmarks", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
NetInterfaceManager.getInstance()
|
||||
.getBookMarkBlackWhiteList(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getBrowserBookmarks", "onComplete: ");
|
||||
if (mView != null) {
|
||||
mView.getBrowserBookmarksFinish();
|
||||
}
|
||||
mView.getBrowserBookmarksFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -432,60 +324,9 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
@Override
|
||||
public void getDesktopIcon() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getDesktopIconObservable()
|
||||
.observeOn(Schedulers.io())
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getDesktopIcon", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
|
||||
Log.e("getDesktopIcon", "onNext: ");
|
||||
ApkUtils.showAllAPP(mContext);
|
||||
if (response.code == OK) {
|
||||
String data = response.data.toString();
|
||||
Log.e("getDesktopIcon", "data: " + data);
|
||||
if (!TextUtils.isEmpty(data)) {
|
||||
List<String> newList = Arrays.asList(data.split(","));//新的list
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
for (String pack : newList) {
|
||||
try {
|
||||
// TODO: 2021/5/24 需要后端替换包名,暂时解决方案
|
||||
try {
|
||||
if ("com.mediatek.camera".equals(pack)) {
|
||||
pm.setApplicationEnabledSetting("com.android.camera2", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
}
|
||||
if ("com.android.mms".equals(pack)) {
|
||||
pm.setApplicationEnabledSetting("com.android.messaging", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Log.e("getDesktopIcon", "Exception: ex: " + ex.getMessage());
|
||||
}
|
||||
pm.setApplicationEnabledSetting(pack, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
Log.e("getDesktopIcon", pack);
|
||||
} catch (Exception e) {
|
||||
Log.e("getDesktopIcon", "Exception: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.e("getDesktopIcon", "onNext: " + response.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getDesktopIcon", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
.getDesktopIcon(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getDesktopIcon", "onComplete: ");
|
||||
JGYUtils.getInstance().hideSystemAPP();
|
||||
mView.getDesktopIconFinish();
|
||||
}
|
||||
@@ -495,36 +336,9 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
@Override
|
||||
public void getAppAutoStartUpdateAndNet() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getAppAutoStartUpdateAndNetObservable()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<NetAndLaunchBean>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAppAutoStart", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull NetAndLaunchBean netAndLaunchBean) {
|
||||
|
||||
Log.e("getAppAutoStart", "onNext: " + netAndLaunchBean.toString());
|
||||
if (netAndLaunchBean.getCode() == OK) {
|
||||
JGYUtils.getInstance().setNetAndlaunch(netAndLaunchBean);
|
||||
} else {
|
||||
Log.e("getAppAutoStart", "onNext: " + netAndLaunchBean.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAppAutoStart", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
.getAppAutoStartUpdateAndNet(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppAutoStart", "onComplete: ");
|
||||
mView.getAppAutoStartUpdateAndNetFinish();
|
||||
}
|
||||
});
|
||||
@@ -533,52 +347,9 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
@Override
|
||||
public void getAppIDControl() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getAppIDControlObservable()
|
||||
.observeOn(Schedulers.io())
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAppIDControl", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull ResponseBody responseBody) {
|
||||
|
||||
Log.e("getAppIDControl", "onNext: ");
|
||||
try {
|
||||
String bodyString = responseBody.string();
|
||||
Log.e("getAppIDControl", "bodyString: " + bodyString);
|
||||
JsonObject jsonObject = parseString(bodyString).getAsJsonObject();
|
||||
int code = jsonObject.get("code").getAsInt();
|
||||
if (code == OK) {
|
||||
JsonObject data = jsonObject.getAsJsonObject("data");
|
||||
JsonElement ids = data.get("ids");
|
||||
JsonElement packages = data.get("package");
|
||||
if (null == ids || null == packages) {
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem("", "");
|
||||
} else {
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem(ids.getAsString(), packages.getAsString());
|
||||
}
|
||||
} else {
|
||||
JGYUtils.getInstance().writeDeselectIDtoSystem("", "");
|
||||
Log.e("getAppIDControl", "onNext: " + bodyString);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("getAppIDControl", "onNext: IOException: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAppIDControl", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
.getAppIDControl(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppIDControl", "onComplete: ");
|
||||
mView.getAppIDControlFinish();
|
||||
}
|
||||
});
|
||||
@@ -601,98 +372,20 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
@Override
|
||||
public void setSystemSetting() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSystemSettingObservable()
|
||||
.observeOn(Schedulers.io())
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<ResponseBody>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("setSystemSetting", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull ResponseBody responseBody) {
|
||||
|
||||
SPUtils.put(mContext, CommonConfig.JGY_FIRST_CONNECT, 1);
|
||||
try {
|
||||
String bodyString = responseBody.string();
|
||||
Log.e("setSystemSetting", "onNext: " + bodyString);
|
||||
JsonObject jsonObject = parseString(bodyString).getAsJsonObject();
|
||||
int code = jsonObject.get("code").getAsInt();
|
||||
if (code == OK) {
|
||||
String data = jsonObject.getAsJsonObject("data").toString();
|
||||
//结果保存到本地
|
||||
JGYUtils.getInstance().SettingSysData(data);
|
||||
} else {
|
||||
//没有数据全部关闭
|
||||
// SysSettingUtils.setDisableSetting(mContext);
|
||||
// SPUtils.put(mContext, "SystemSettingData", "");
|
||||
JGYUtils.getInstance().SettingSysData("");
|
||||
//获取系统管控先不要关闭开发人员选项
|
||||
if (!BuildConfig.DEBUG) {
|
||||
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", 1);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("setSystemSetting", "onNext: IOException: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("setSystemSetting", "onError: " + e.getMessage());
|
||||
String oldData = (String) SPUtils.get(mContext, "SystemSettingData", "");
|
||||
Log.e("setSystemSetting", "oldData: " + oldData);
|
||||
JGYUtils.getInstance().SettingSysData(oldData);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
.setSystemSetting(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("setSystemSetting", "onComplete: ");
|
||||
mView.setSystemSettingFinish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDefaultApp() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getDefaultAppApi()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<DefaultApp>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getDefaultApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<DefaultApp> defaultAppBaseResponse) {
|
||||
|
||||
Log.e("getDefaultApp", "onNext: " + JSONObject.toJSONString(defaultAppBaseResponse.data));
|
||||
int code = defaultAppBaseResponse.code;
|
||||
if (code == OK) {
|
||||
DefaultApp defaultApp = defaultAppBaseResponse.data;
|
||||
JGYUtils.getInstance().setDefaultDesktop(defaultApp.getDefault_launcher());
|
||||
if (defaultApp.getDefault_launcher() != null) {
|
||||
SPUtils.put(mContext, "default_launcher", defaultApp.getDefault_launcher());
|
||||
}
|
||||
} else {
|
||||
Log.e("getDefaultApp", "onNext: " + defaultAppBaseResponse.msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getDefaultApp", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
.getDefaultApp(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getDefaultApp", "onComplete: ");
|
||||
mView.setDefaultAppFinish();
|
||||
}
|
||||
});
|
||||
@@ -728,132 +421,28 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
public void getSnTimeControl() {
|
||||
if (JGYUtils.isOfficialVersion()) {
|
||||
mView.getSnTimeControlFinish();
|
||||
return;
|
||||
}
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSnTimeObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSnTimeControl", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse response) {
|
||||
|
||||
Log.e("getSnTimeControl", "onNext: ");
|
||||
int code = response.code;
|
||||
if (code == OK) {
|
||||
JsonObject jsonObject = JsonParser.parseString(new Gson().toJson(response.data)).getAsJsonObject();
|
||||
String start_time = jsonObject.get("start_time").getAsString();
|
||||
String end_time = jsonObject.get("end_time").getAsString();
|
||||
TimeUtils.ContralTime c = TimeUtils.String2ContralTime(mContext, start_time + "-" + end_time);
|
||||
if (null != c) {
|
||||
Log.e("getTimeControl", "OK:" + c.toString());
|
||||
}
|
||||
} else {
|
||||
TimeUtils.setEmpty(mContext);
|
||||
TimeUtils.ContralTime c = TimeUtils.getDefaltContralTime(mContext);
|
||||
if (null != c) {
|
||||
Log.e("getTimeControl", c.toString());
|
||||
}
|
||||
} else {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSnTimeControl(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.getSnTimeControlFinish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSnTimeControl", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSnTimeControl", "onComplete: ");
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(MainService.TimeChangedReceiver.ACTION_UPDATE);
|
||||
mContext.sendBroadcast(intent);
|
||||
mView.getSnTimeControlFinish();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getEBagCode() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getEBagCodeControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getEBagCode", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
|
||||
Log.e("getEBagCode", "onNext: " + baseResponse);
|
||||
int code = baseResponse.code;
|
||||
if (code == OK) {
|
||||
JsonObject jsonObject = parseString(new Gson().toJson(baseResponse.data)).getAsJsonObject();
|
||||
String ebagCode = jsonObject.get("ebagCode").getAsString();
|
||||
SPUtils.put(mContext, "ebagCode", ebagCode);
|
||||
} else {
|
||||
Log.e("getEBagCode", "onNext: " + baseResponse.data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getEBagCode", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
.getEBagCode(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getEBagCode", "onComplete: ");
|
||||
mView.getEBagCodeFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWiFiPasswd() {
|
||||
NetInterfaceManager.getInstance().getWiFiControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<WiFiAlias>>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getWiFiPasswd", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<WiFiAlias>> listBaseResponse) {
|
||||
Log.e("getWiFiPasswd", "onNext: ");
|
||||
if (listBaseResponse.code == OK) {
|
||||
WiFiUtils.saveWiFiPasswd(listBaseResponse.data);
|
||||
mMMKV.encode("WiFiPassword", parseString(new Gson().toJson(listBaseResponse.data)).toString());
|
||||
} else {
|
||||
Log.e("getWiFiPasswd", "onNext: msg = " + listBaseResponse.msg);
|
||||
WiFiUtils.saveWiFiPasswd(listBaseResponse.data);
|
||||
mMMKV.encode("WiFiPassword", "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getWiFiPasswd", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getWiFiPasswd", "onComplete: ");
|
||||
mView.setWiFiPasswd();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getScreenLockState() {
|
||||
@@ -864,4 +453,15 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWiFiPasswd() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getWiFiPasswd(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.setWiFiPasswd();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Debug.waitForDebugger();
|
||||
// Debug.waitForDebugger();
|
||||
ToastUtil.betaShow("网络已连接");
|
||||
String WiFiAlias = Utils.getWifiAlias(this);
|
||||
Log.e("OnNetworkStatusChanged", "onConnected: " + WiFiAlias);
|
||||
@@ -886,6 +886,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void checkTestUpdateFinish() {
|
||||
mPresenter.getAppLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppLimitFinish() {
|
||||
mPresenter.getForceDownload();
|
||||
}
|
||||
|
||||
@@ -911,11 +916,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void setSystemSetting() {
|
||||
mPresenter.getAppLimit();
|
||||
mPresenter.getAllAppList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppLimitFinish() {
|
||||
public void getAllAppListFinish() {
|
||||
mPresenter.getROMApp();
|
||||
}
|
||||
|
||||
@@ -981,11 +986,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
|
||||
@Override
|
||||
public void getEBagCodeFinish() {
|
||||
mPresenter.getWiFiPasswd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWiFiPasswd() {
|
||||
mPresenter.getScreenLockState();
|
||||
}
|
||||
|
||||
@@ -1006,5 +1006,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
SPUtils.put(this, "is_screen_lock", false);
|
||||
SPUtils.put(this, "screen_tips", "");
|
||||
}
|
||||
mPresenter.getWiFiPasswd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWiFiPasswd() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user