【光环助手V5.4.0】儿童/青少年模式(客户端展示,未对接设置页面)https://git.ghzs.com/pm/halo-app-issues/-/issues/1571

This commit is contained in:
lyr
2021-10-20 17:55:41 +08:00
parent f65664b885
commit 16091f759c
22 changed files with 272 additions and 58 deletions

View File

@ -44,6 +44,7 @@ import com.gh.download.DownloadManager;
import com.gh.gamecenter.entity.AuthDialogEntity;
import com.gh.gamecenter.entity.DeviceDialogEntity;
import com.gh.gamecenter.entity.PrivacyPolicyEntity;
import com.gh.gamecenter.eventbus.EBTeenagerModelStatus;
import com.gh.gamecenter.manager.FilterManager;
import com.gh.gamecenter.retrofit.BiResponse;
import com.gh.gamecenter.retrofit.Response;
@ -52,6 +53,7 @@ import com.halo.assistant.HaloApp;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.FileUtils;
import org.greenrobot.eventbus.EventBus;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
@ -376,6 +378,7 @@ public class SplashScreenActivity extends BaseActivity {
private void prefetchData() {
AppExecutor.getIoExecutor().execute(() -> {
if (HaloApp.getInstance().isBrandNewInstall) getTeenagerModel();
Config.getGhzsSettings();
deviceDialogSetting();
getFilterDetailTags();
@ -408,6 +411,30 @@ public class SplashScreenActivity extends BaseActivity {
});
}
@SuppressLint("CheckResult")
private void getTeenagerModel() {
RetrofitManager.getInstance(HaloApp.getInstance().getApplication())
.getApi().getTeenagerModel(HaloApp.getInstance().getGid())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BiResponse<ResponseBody>() {
@Override
public void onSuccess(ResponseBody data) {
try {
boolean preStatus = SPUtils.getBoolean(Constants.SP_TEENAGER_MODEL);
JSONObject object = new JSONObject(data.string());
boolean curStatus = "open".equals(object.getString("status"));
SPUtils.setBoolean(Constants.SP_TEENAGER_MODEL, curStatus);
if (preStatus != curStatus) {
EventBus.getDefault().post(new EBTeenagerModelStatus());
}
} catch (Throwable e) {
e.printStackTrace();
}
}
});
}
@AfterPermissionGranted(REQUEST_PERMISSION_TAG)
private void checkAndRequestPermission() {
if (EasyPermissions.hasPermissions(this, mPermissions)) {