feat: 神策数据埋点第二期(2)—客户端 https://jira.shanqu.cc/browse/GHZS-3181
This commit is contained in:
@ -121,7 +121,7 @@ public class DialogUtils {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public static void checkDownload(Context context, String size, String gameId, String gameName, CheckDownloadCallBack callBack) {
|
||||
public static void checkDownload(Context context, String size, String gameId, String gameName, String gameCategoryChinese, CheckDownloadCallBack callBack) {
|
||||
if (!NetworkUtils.isNetworkConnected(context)) {
|
||||
showNoConnectionDownloadDialog(context, () -> {
|
||||
},
|
||||
@ -138,7 +138,8 @@ public class DialogUtils {
|
||||
() -> callBack.onResponse(false),
|
||||
() -> callBack.onResponse(true),
|
||||
gameId,
|
||||
gameName);
|
||||
gameName,
|
||||
gameCategoryChinese);
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +168,9 @@ public class DialogUtils {
|
||||
DialogHelper.showDialog(context, "下载提示", "网络异常,请检查手机网络状态", "知道了", "WiFi自动下载", listener::onConfirm, cancelListener::onCancel, false, "", "");
|
||||
}
|
||||
|
||||
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener, String gameId, String gameName) {
|
||||
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener, String gameId, String gameName, String gameCategoryChinese) {
|
||||
SensorsBridge.trackDownloadMobileDataDialogShow(gameId, gameName, gameCategoryChinese);
|
||||
|
||||
context = checkDialogContext(context);
|
||||
|
||||
NewFlatLogUtils.logDownloadMobileDataDialogShow(gameId, gameName);
|
||||
@ -182,6 +185,7 @@ public class DialogUtils {
|
||||
Context finalContext = context;
|
||||
allowOnce.setOnClickListener(v -> {
|
||||
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "允许一次");
|
||||
SensorsBridge.trackDownloadMobileDataDialogClick("允许一次", gameId, gameName, gameCategoryChinese);
|
||||
AppExecutor.getUiExecutor().executeWithDelay(() -> {
|
||||
Utils.toast(finalContext, "已使用移动网络下载,请注意流量消耗");
|
||||
}, 500);
|
||||
@ -191,12 +195,14 @@ public class DialogUtils {
|
||||
});
|
||||
wifiAuto.setOnClickListener(v -> {
|
||||
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "WiFi自动下载");
|
||||
SensorsBridge.trackDownloadMobileDataDialogClick("WiFi自动下载", gameId, gameName, gameCategoryChinese);
|
||||
cancelListener.onCancel();
|
||||
dialog.dismiss();
|
||||
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "连上WiFi后自动下载");
|
||||
});
|
||||
allowAlways.setOnClickListener(v -> {
|
||||
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "总是允许");
|
||||
SensorsBridge.trackDownloadMobileDataDialogClick("总是允许", gameId, gameName, gameCategoryChinese);
|
||||
SPUtils.setBoolean(getTrafficDownloadHintKey(), false);
|
||||
AppExecutor.getUiExecutor().executeWithDelay(() -> {
|
||||
// 显示了弹窗以后,即便下面这个 toast 放在 listener.onConfirm 后调用也是显示 listener.onConfirm 里的 toast
|
||||
@ -208,7 +214,10 @@ public class DialogUtils {
|
||||
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "总是允许");
|
||||
});
|
||||
|
||||
dialog.setOnCancelListener(downloadDialog -> NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "关闭弹窗"));
|
||||
dialog.setOnCancelListener(downloadDialog -> {
|
||||
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "关闭弹窗");
|
||||
SensorsBridge.trackDownloadMobileDataDialogClick("关闭弹窗", gameId, gameName, gameCategoryChinese);
|
||||
});
|
||||
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(contentView);
|
||||
@ -730,6 +739,12 @@ public class DialogUtils {
|
||||
|
||||
// 海外下载地址弹窗
|
||||
public static void showOverseaDownloadDialog(Context context, GameEntity gameEntity, @NonNull ConfirmListener listener) {
|
||||
SensorsBridge.trackOverseasAddressDialogShow(
|
||||
gameEntity.getId(),
|
||||
gameEntity.getName() != null ? gameEntity.getName() : "",
|
||||
gameEntity.getCategoryChinese()
|
||||
);
|
||||
|
||||
context = checkDialogContext(context);
|
||||
|
||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
||||
@ -739,8 +754,15 @@ public class DialogUtils {
|
||||
View contentView = binding.getRoot();
|
||||
|
||||
binding.gameIcon.displayGameIcon(gameEntity);
|
||||
binding.gameNameTv.setText(context.getString(R.string.dialog_oversea_hint, gameEntity.getName()));
|
||||
binding.closeIv.setOnClickListener(v -> dialog.dismiss());
|
||||
binding.closeIv.setOnClickListener(v -> {
|
||||
SensorsBridge.trackOverseasAddressDialogClick(
|
||||
"关闭弹窗",
|
||||
gameEntity.getId(),
|
||||
gameEntity.getName() != null ? gameEntity.getName() : "",
|
||||
gameEntity.getCategoryChinese()
|
||||
);
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
if ("show&download".equals(gameEntity.getOverseasAddressDialog().getStatus())) {
|
||||
gameEntity.getApk().get(0).setUrl(gameEntity.getOverseasAddressDialog().getLink());
|
||||
@ -748,6 +770,12 @@ public class DialogUtils {
|
||||
binding.urlTv.setText(gameEntity.getOverseasAddressDialog().getLink());
|
||||
binding.downloadBtn.setText("下载(" + gameEntity.getApk().get(0).getSize() + ")");
|
||||
binding.downloadBtn.setOnClickListener(v -> {
|
||||
SensorsBridge.trackOverseasAddressDialogClick(
|
||||
"下载",
|
||||
gameEntity.getId(),
|
||||
gameEntity.getName() != null ? gameEntity.getName() : "",
|
||||
gameEntity.getCategoryChinese()
|
||||
);
|
||||
listener.onConfirm();
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user