Fix TapADN show error accessibility

This commit is contained in:
2026-06-04 17:27:34 +08:00
parent 02cb90c1c0
commit 16b298ce5e

View File

@@ -818,7 +818,7 @@ namespace Dirichlet.Mediation
OnClosed(); OnClosed();
break; break;
case DirichletNativeEventNames.ShowError: case DirichletNativeEventNames.ShowError:
OnShowFailed(nativeEvent.Data); OnShowFailed(CreateShowError(nativeEvent.Data));
break; break;
} }
} }
@@ -838,11 +838,16 @@ namespace Dirichlet.Mediation
Closed?.Invoke(); 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 code = data != null && data.Code != 0 ? data.Code.ToString(CultureInfo.InvariantCulture) : "show_error";
var message = data?.Message; 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
} }
} }
} }