version:2.3
fix:优化上传请求 update:增加获取内置应用白名单
This commit is contained in:
@@ -13,7 +13,7 @@ public class MainSContact {
|
||||
void updateInfoFinish();
|
||||
void checkUpdateFinish();
|
||||
void checkFXYUpdateFinish();
|
||||
void getAllAppFinish();
|
||||
void getAppAndWhiteFinish();
|
||||
void setOverallApp();
|
||||
void setAppInside();
|
||||
void setForceInstall();
|
||||
@@ -33,7 +33,7 @@ public class MainSContact {
|
||||
|
||||
/*更新的*/
|
||||
//获取所有app包名
|
||||
void getAllApp();
|
||||
void getAppAndWhite();
|
||||
//检查更新
|
||||
void checkUpdate();
|
||||
//检查扶小鹰App更新
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.fuying.sn.service.main;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import com.fuying.sn.bean.AppAndWhiteBean;
|
||||
import com.fuying.sn.bean.AppStart;
|
||||
import com.fuying.sn.bean.BaseResponse;
|
||||
import com.fuying.sn.bean.MyAppUsageBean;
|
||||
@@ -16,10 +16,12 @@ import com.fuying.sn.disklrucache.CacheHelper;
|
||||
import com.fuying.sn.gson.GsonUtils;
|
||||
import com.fuying.sn.manager.ControlManager;
|
||||
import com.fuying.sn.network.NetInterfaceManager;
|
||||
import com.fuying.sn.network.UrlAddress;
|
||||
import com.fuying.sn.service.ManagerService;
|
||||
import com.fuying.sn.utils.JGYUtils;
|
||||
import com.fuying.sn.utils.SPUtils;
|
||||
import com.fuying.sn.utils.ServiceAliveUtils;
|
||||
import com.fuying.sn.utils.StringUtils;
|
||||
import com.fuying.sn.utils.Utils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
@@ -28,8 +30,10 @@ import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
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;
|
||||
@@ -73,9 +77,40 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressLint("NewApi")
|
||||
public void getAllApp() {
|
||||
mView.getAllAppFinish();
|
||||
public void getAppAndWhite() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getAppAndWhiteApiObservable()
|
||||
.subscribe(new Observer<BaseResponse<List<AppAndWhiteBean>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getAppAndWhite", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppAndWhiteBean>> baseResponse) {
|
||||
Log.e("getAppAndWhite", "onSubscribe: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
List<AppAndWhiteBean> appAndWhiteList = baseResponse.data;
|
||||
if (appAndWhiteList != null) {
|
||||
List<String> pkgList = appAndWhiteList.stream().map(AppAndWhiteBean::getApp_package).collect(Collectors.toList());
|
||||
String pkgString = StringUtils.join(",", pkgList);
|
||||
mMMKV.encode(UrlAddress.GET_APP_AND_WHITE, pkgString);
|
||||
Log.e("getAppAndWhite", "onNext: " + pkgString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getAppAndWhite", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppAndWhite", "onComplete: ");
|
||||
}
|
||||
});
|
||||
mView.getAppAndWhiteFinish();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -128,7 +128,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
public void run() {
|
||||
if ((int) SPUtils.get(MainService.this, CommonConfig.JGY_FIRST_BOOT, 0) == 0) {
|
||||
mPresenter.getSnInfo();
|
||||
mPresenter.getAllApp();
|
||||
mPresenter.getAppAndWhite();
|
||||
SPUtils.put(MainService.this, CommonConfig.JGY_FIRST_BOOT, 1);
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
public void run() {
|
||||
NTPTimeTask task = new NTPTimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
mPresenter.getAllApp();
|
||||
mPresenter.getAppAndWhite();
|
||||
}
|
||||
}, 20000);
|
||||
|
||||
@@ -547,7 +547,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
};
|
||||
|
||||
@Override
|
||||
public void getAllAppFinish() {
|
||||
public void getAppAndWhiteFinish() {
|
||||
mPresenter.checkUpdate();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user