add report switch
This commit is contained in:
@@ -12,11 +12,13 @@ public class CommonConfig {
|
||||
public Active active;//活动配置
|
||||
public Auth auth; //授权配置
|
||||
public Speech speech; //语音播报次数
|
||||
public ReportStrategy reportStrategy; //被动上报策略开关
|
||||
|
||||
public CommonConfig(Active active, Auth auth, Speech speech) {
|
||||
public CommonConfig(Active active, Auth auth, Speech speech, ReportStrategy reportStrategy) {
|
||||
this.active = active;
|
||||
this.auth = auth;
|
||||
this.speech = speech;
|
||||
this.reportStrategy = reportStrategy;
|
||||
}
|
||||
|
||||
public class Active{
|
||||
@@ -47,4 +49,11 @@ public class CommonConfig {
|
||||
this.isNeedAuth = isNeedAuth;
|
||||
}
|
||||
}
|
||||
|
||||
public class ReportStrategy {
|
||||
public boolean open;
|
||||
ReportStrategy(boolean open) {
|
||||
this.open = open;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,6 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
|
||||
public void getCommonConfig() {
|
||||
Map<String, Object> params = new ArrayMap<>();
|
||||
params.put("sn", Utils.getSn());
|
||||
|
||||
mNetWork.create(GetConfigApiServices.class, UserInfoConstant.getUserInfoBaseUrl())
|
||||
.getConfig(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -145,12 +144,20 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
|
||||
Logger.d(TAG, "getCommonConfig onSuccess -----> ");
|
||||
if (config != null && config.result != null) {
|
||||
CommonConfig.Speech speech = config.result.speech;
|
||||
CommonConfig.ReportStrategy strategy = config.result.reportStrategy;
|
||||
if (speech != null) {
|
||||
Logger.d(TAG, "getCommonConfig onSuccess speech.count = " + speech.count);
|
||||
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SERVER_SHOW_DAY_COUNT, speech.count);
|
||||
} else {
|
||||
Logger.e(TAG, "getCommonConfig onSuccess speech == null ");
|
||||
}
|
||||
|
||||
if (strategy != null) {
|
||||
Logger.d(TAG, "getCommonConfig onSuccess strategy.open = " + strategy.open);
|
||||
SharedPrefsMgr.getInstance(getContext()).putBoolean("KEY_SERVER_REPORTSTRATEGY_SWITCH", strategy.open);
|
||||
} else {
|
||||
Logger.e(TAG, "getCommonConfig onSuccess strategy == null ");
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "getCommonConfig onSuccess config == null");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user