Skip to content

Commit

Permalink
Merge branch 'V2/2.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
dinc5150 committed Jun 7, 2024
2 parents 3fa026c + 8540145 commit f8f99f8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
10 changes: 9 additions & 1 deletion MetaMomentum.Core/MetaMomentum.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net5.0;net472</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;net472</TargetFrameworks>
<Version>2.2.1</Version>
<Description>Core MetaMomentum DLL for reference in class projects</Description>
<Company>Digital Momentum</Company>
Expand Down Expand Up @@ -47,6 +47,14 @@
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Umbraco.Cms.Web.Common" Version="10.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Umbraco.Cms.Web.Common" Version="11.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Umbraco.Cms.Web.Common" Version="13.0.0" />
</ItemGroup>


<ItemGroup>
Expand Down
28 changes: 25 additions & 3 deletions MetaMomentum.Core/ValueConverters/MetaMomentumValueConverter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
using MetaMomentum.Models;
using MetaMomentum.Config;
using System;








#if NET5_0_OR_GREATER
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Models.PublishedContent;
Expand All @@ -9,6 +17,9 @@
using Umbraco.Cms.Core.Services;
using Microsoft.Extensions.Logging;
using System.Text.Json;
using Umbraco.Cms.Core.Models;
using Umbraco.Extensions;

#else
using Newtonsoft.Json;
using Umbraco.Core;
Expand All @@ -33,7 +44,7 @@ public class MetaMomentumValueConverter : IPropertyValueConverter {

public MetaMomentumValueConverter(
IPublishedSnapshotAccessor publishedSnapshotAccessor,
ILogger<MetaMomentumValueConverter> logger,
ILogger<MetaMomentumValueConverter> logger,
MetaMomentumConfig metaMomentumConfig) {
_publishedSnapshotAccessor = publishedSnapshotAccessor ?? throw new ArgumentNullException(nameof(publishedSnapshotAccessor));
_metaMomentumConfig = metaMomentumConfig;
Expand Down Expand Up @@ -188,11 +199,22 @@ private class MetaValuesIntermediateModel {

public string ShareTitle { get; set; }
public string ShareDescription { get; set; }
public string ShareImage { get; set; }
public dynamic ShareImage { get; set; }
public string ShareImageUrl { get; set; }

public GuidUdi GetShareImageUdi() {
#if NET5_0_OR_GREATER
#if NET6_0_OR_GREATER

string imgAsString = ShareImage as string;
if (imgAsString == null) return null;

if (UdiParser.TryParse(imgAsString, out Udi udi)) {
return udi as GuidUdi;
}

#elif NET5_0_OR_GREATER
if(ShareImage == null) return null;

if (UdiParser.TryParse(ShareImage, out Udi udi)) {
return udi as GuidUdi;
}
Expand Down
2 changes: 1 addition & 1 deletion MetaMomentum/MetaMomentum.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net5.0;net472</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;net472</TargetFrameworks>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<ContentTargetFolders>.</ContentTargetFolders>
<IncludeBuildOutput>false</IncludeBuildOutput>
Expand Down

0 comments on commit f8f99f8

Please sign in to comment.