diff --git a/Softeq.XToolkit.Common.iOS/Extensions/NSStringExtensions.cs b/Softeq.XToolkit.Common.iOS/Extensions/NSStringExtensions.cs index 90f4fedd..ffe03ac2 100644 --- a/Softeq.XToolkit.Common.iOS/Extensions/NSStringExtensions.cs +++ b/Softeq.XToolkit.Common.iOS/Extensions/NSStringExtensions.cs @@ -66,9 +66,29 @@ public static NSMutableAttributedString BuildAttributedStringFromHtml( try { + NSAttributedString? attributedString; + + if (UIDevice.CurrentDevice.CheckSystemVersion(15, 0)) + { + if (string.IsNullOrEmpty(html)) + { + attributedString = new NSAttributedString(); + } + else + { + var markdown = new Html2Markdown.Converter().Convert(html); #pragma warning disable CS8601 // Possible null reference assignment. - var attributedString = new NSAttributedString(html, importParams, ref error); + attributedString = new NSAttributedString(markdown, default, default, out error); #pragma warning restore CS8601 // Possible null reference assignment. + } + } + else + { +#pragma warning disable CS8601 // Possible null reference assignment. + attributedString = new NSAttributedString(html, importParams, ref error); +#pragma warning restore CS8601 // Possible null reference assignment. + } + return new NSMutableAttributedString(attributedString); } catch (Exception ex) diff --git a/Softeq.XToolkit.Common.iOS/Softeq.XToolkit.Common.iOS.csproj b/Softeq.XToolkit.Common.iOS/Softeq.XToolkit.Common.iOS.csproj index 5e128ed8..d30c71b8 100644 --- a/Softeq.XToolkit.Common.iOS/Softeq.XToolkit.Common.iOS.csproj +++ b/Softeq.XToolkit.Common.iOS/Softeq.XToolkit.Common.iOS.csproj @@ -19,4 +19,8 @@ + + + + \ No newline at end of file