refactor: Make ShouldHideRevision private

This commit is contained in:
2025-02-14 18:20:09 +08:00
parent 844aea5594
commit fd1e92f810
2 changed files with 3 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ namespace Cryville.EEW.Unity.UI {
}
public virtual void SetViewModel(ReportViewModel viewModel, bool hideRevision = false) {
_viewModel = viewModel;
if (hideRevision) hideRevision = ShouldHideRevision(viewModel.RevisionKey);
if (m_titleView != null) {
var title = viewModel.Title ?? "";
@@ -56,7 +57,7 @@ namespace Cryville.EEW.Unity.UI {
);
}
protected static bool ShouldHideRevision(IReportRevisionKey key) {
static bool ShouldHideRevision(IReportRevisionKey key) {
return key == null || (key.Serial == null && !key.IsCancellation && !key.IsFinalRevision);
}
}

View File

@@ -18,7 +18,7 @@ namespace Cryville.EEW.Unity.UI {
public void Set(ReportUnit unit) {
lock (unit) {
SetViewModel(unit.LatestReport, ShouldHideRevision(unit.LatestReport.RevisionKey) && unit.Count <= 1);
SetViewModel(unit.LatestReport, unit.Count <= 1);
m_listView.Set(unit);
}
m_listView.gameObject.SetActive(false);