From 16b298ce5e617e4e036fb16e58a331fefd0a8721 Mon Sep 17 00:00:00 2001 From: "CORE-FOLDCC\\Core" <1813547935@qq.com> Date: Thu, 4 Jun 2026 17:27:34 +0800 Subject: [PATCH] Fix TapADN show error accessibility --- .../DirichletMediation/Runtime/DirichletAdTypes.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Assets/DirichletMediation/Runtime/DirichletAdTypes.cs b/Assets/DirichletMediation/Runtime/DirichletAdTypes.cs index 96a2462..e7e18c9 100644 --- a/Assets/DirichletMediation/Runtime/DirichletAdTypes.cs +++ b/Assets/DirichletMediation/Runtime/DirichletAdTypes.cs @@ -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 } } } -