opt query share config

This commit is contained in:
tongchenfei
2020-11-09 14:12:31 +08:00
parent 3f400fd089
commit d783b303e2

View File

@@ -91,6 +91,8 @@ import static com.mogo.service.share.IMogoTanluProvider.TYPE_TRAFFIC_CHECK;
@Route(path = MogoServicePaths.PATH_SHARE)
public class ShareControl implements IMogoShareManager, Handler.Callback {
private static final String TAG = "ShareControl";
// private static final int MSG_REAL_QUERY_SHARE_CONFIG = 1001;
// private static final long QUERY_SHARE_CONFIG_DELAY = 3_000L;
private Context mContext;
// private LaucherShareDialog mShareDialog;
@@ -441,10 +443,13 @@ public class ShareControl implements IMogoShareManager, Handler.Callback {
}
private void queryShareButtonConfig() {
if (NetworkUtils.isConnected(mContext)) {
// 有网,直接请求
MogoLocation location =
ServiceApisManager.serviceApis.getMapServiceApi().getSingletonLocationClient(mContext).getLastKnowLocation();
if (handler.hasMessages(MSG_QUERY_SHARE_CONFIG_RETRY)) {
return;
}
MogoLocation location =
ServiceApisManager.serviceApis.getMapServiceApi().getSingletonLocationClient(mContext).getLastKnowLocation();
if (NetworkUtils.isConnected(mContext) && location != null && !location.getAdCode().isEmpty()) {
// 有网且有adcode直接请求
Map<String, String> params = new ArrayMap<>();
ShareConfigRequest request = new ShareConfigRequest(Utils.getSn(),
location.getAdCode());
@@ -498,6 +503,7 @@ public class ShareControl implements IMogoShareManager, Handler.Callback {
private static final int QUERY_SHARE_CONFIG_RETRY_TIME_THRESHOLD = 10;
private void retryQueryShareConfig() {
Logger.d(TAG, "retryQueryShareConfig====" + queryShareConfigRetryTime);
if (queryShareConfigRetryTime > QUERY_SHARE_CONFIG_RETRY_TIME_THRESHOLD) {
// 重试次数超过QUERY_SHARE_CONFIG_RETRY_TIME_THRESHOLD不再重试
return;