fix: 修复 AdStatus 的显示 BUG

Signed-off-by: huyufei <yufei.hu@castbox.fm>
main
胡宇飞 2024-06-27 18:47:36 +08:00
parent 1a9481b094
commit 81f37625c1
1 changed files with 12 additions and 11 deletions

View File

@ -99,22 +99,22 @@ namespace Guru
UpdateView(); // 刷新视图
}
// 字段缓冲
private StringBuilder _infoBuff;
private string CreateMonitorInfo()
{
string msg = "";
bool loaded = false;
StringBuilder sb = new StringBuilder();
if (!ADService.Instance.IsInitialized)
{
msg = ColoredText("AdService not initialized...", Consts.ColorRed);
return msg;
}
if (_infoBuff == null) _infoBuff = new StringBuilder();
_infoBuff.Clear();
if (_curBadsInfo == null)
{
msg = $"BADS: {ColoredText("not ready", Consts.ColorRed)}\n";
@ -137,7 +137,7 @@ namespace Guru
msg = $"BADS: {ColoredText("loading...", Consts.ColorYellow)}\n\tformat: {_curBadsInfo.format}\n";
break;
case AdStatusType.Paid:
msg = $"BADS: {ColoredText("display", Consts.ColorGreen)}\n\tnetwork: {_curIadsInfo.network}\n\trevenue: {_curBadsInfo.revenue}\n";
msg = $"BADS: {ColoredText("display", Consts.ColorGreen)}\n\tnetwork: {_curBadsInfo.network}\n\trevenue: {_curBadsInfo.revenue}\n";
break;
case AdStatusType.NotReady:
msg = $"BADS: {ColoredText("not ready", Consts.ColorGray)}\n\t{ColoredText("---", Consts.ColorGray)}\n";
@ -147,7 +147,7 @@ namespace Guru
break;
}
}
sb.Append(msg);
_infoBuff.Append(msg);
if (_curIadsInfo == null)
@ -159,7 +159,7 @@ namespace Guru
switch (_curIadsInfo.status)
{
case AdStatusType.Loaded:
msg = $"IADS: {ColoredText("loaded", Consts.ColorGreen)}\n\tnetwork: {_curIadsInfo.network}\n\twaterfall: {_curBadsInfo.waterfall}\n";
msg = $"IADS: {ColoredText("loaded", Consts.ColorGreen)}\n\tnetwork: {_curIadsInfo.network}\n\twaterfall: {_curIadsInfo.waterfall}\n";
break;
case AdStatusType.LoadFailed:
msg = $"IADS: {ColoredText("loading failed", Consts.ColorRed)}\n\tmessage: {_curIadsInfo.info}\n";
@ -181,7 +181,7 @@ namespace Guru
break;
}
}
sb.Append(msg);
_infoBuff.Append(msg);
if (_curRadsInfo == null)
@ -215,10 +215,11 @@ namespace Guru
break;
}
}
sb.Append(msg);
_infoBuff.Append(msg);
return sb.ToString();
return _infoBuff.ToString();
}