Fix TapADN show error accessibility

This commit is contained in:
2026-06-04 17:27:34 +08:00
parent 0c9d38a0b2
commit aff6890c22

View File

@@ -818,7 +818,7 @@ namespace Dirichlet.Mediation
OnClosed();
break;
case DirichletNativeEventNames.ShowError:
OnShowFailed(nativeEvent.Data);
OnShowFailed(CreateShowError(nativeEvent.Data));
break;
}
}
@@ -838,11 +838,16 @@ namespace Dirichlet.Mediation
Closed?.Invoke();
}
protected virtual void OnShowFailed(DirichletNativeEventData data)
protected virtual void OnShowFailed(DirichletError error)
{
ShowFailed?.Invoke(error ?? new DirichletError("show_error", "Ad failed to show"));
}
private static DirichletError CreateShowError(DirichletNativeEventData data)
{
var code = data != null && data.Code != 0 ? data.Code.ToString(CultureInfo.InvariantCulture) : "show_error";
var message = data?.Message;
ShowFailed?.Invoke(new DirichletError(code, string.IsNullOrEmpty(message) ? "Ad failed to show" : message));
return new DirichletError(code, string.IsNullOrEmpty(message) ? "Ad failed to show" : message);
}
}
@@ -1388,4 +1393,3 @@ namespace Dirichlet.Mediation
}
}
}