1. 优化网络请求、更改活动和默认配置显示超时

This commit is contained in:
wangcongtao
2020-08-28 10:41:03 +08:00
parent 7078fd3e6b
commit c25782dc84

View File

@@ -21,6 +21,7 @@ import com.mogo.module.service.network.RefreshModel;
import com.mogo.module.service.network.ZhidaoRefreshModel;
import com.mogo.module.service.network.bean.LauncherCardAdvertisementData;
import com.mogo.utils.AppUtils;
import com.mogo.utils.NetworkUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.RequestOptions;
import com.mogo.utils.storage.SharedPrefsMgr;
@@ -161,9 +162,13 @@ class LauncherCardRefresher {
Logger.d( TAG, "start" );
mLaunchTTSText = mContext.getString( R.string.module_service_open_app_tip );
startExplorerWayStrategy();
// 延时一分钟加载数据已保证accOn之后网络恢复正常
mHandler.sendEmptyMessageDelayed( MSG_START_REFRESH_ADVERTISEMENT, ONE_MINUTE );
mDefaultConfigCounter = 0;
// 延时加载数据已保证accOn之后网络恢复正常
long delay = ONE_MINUTE;
if ( NetworkUtils.isConnected( mContext ) ) {
delay = 0L;
}
mHandler.sendEmptyMessageDelayed( MSG_START_REFRESH_ADVERTISEMENT, delay );
}
/**
@@ -301,6 +306,7 @@ class LauncherCardRefresher {
intent.putExtra( "v2x_card_button_name", mDefaultLauncherCardConfig.buttonContent );
intent.putExtra( "v2x_card_startTime", mDefaultLauncherCardConfig.startTime );
intent.putExtra( "v2x_card_endTime", mDefaultLauncherCardConfig.endTime );
intent.putExtra( "v2x_card_is_default", true );
mContext.sendBroadcast( intent );
Logger.d( TAG, "发送默认配置广播到桌面卡片." );
if ( !TextUtils.isEmpty( mDefaultLauncherCardConfig.content ) ) {
@@ -465,6 +471,8 @@ class LauncherCardRefresher {
intent.putExtra( "v2x_card_button_name", advertisement.buttonContent );
intent.putExtra( "v2x_card_startTime", advertisement.startTime );
intent.putExtra( "v2x_card_endTime", advertisement.endTime );
intent.putExtra( "v2x_card_timeout", 20 * 1000 );
intent.putExtra( "v2x_card_is_default", false );
mContext.sendBroadcast( intent );
if ( !AppUtils.isAppForeground( mContext ) ) {
speakTTS( advertisement.content, true );