Skip to content

Commit 6e70eac

Browse files
authored
Merge pull request #242 from umbraco/feature/v15/shopify-cache-level
Update Shopify property editor cache level
2 parents f5c0492 + 827b562 commit 6e70eac

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/Umbraco.Cms.Integrations.Commerce.Shopify/Configuration/ShopifySettings.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Configuration
1+
using Umbraco.Cms.Core.PropertyEditors;
2+
3+
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Configuration
24
{
35
public class ShopifySettings
46
{
@@ -9,5 +11,7 @@ public class ShopifySettings
911
public string AccessToken { get; set; } = string.Empty;
1012

1113
public bool UseUmbracoAuthorization { get; set; } = true;
14+
15+
public PropertyCacheLevel PropertyCacheLevel { get; set; } = PropertyCacheLevel.Snapshot;
1216
}
1317
}

src/Umbraco.Cms.Integrations.Commerce.Shopify/Editors/ShopifyProductPickerValueConverter.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
using System.Text.Json;
1+
using Microsoft.Extensions.Options;
22
using Umbraco.Cms.Core.Models.PublishedContent;
33
using Umbraco.Cms.Core.PropertyEditors;
4+
using Umbraco.Cms.Integrations.Commerce.Shopify.Configuration;
45
using Umbraco.Cms.Integrations.Commerce.Shopify.Models.ViewModels;
56
using Umbraco.Cms.Integrations.Commerce.Shopify.Services;
67

78
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Editors
89
{
910
public class ShopifyProductPickerValueConverter : PropertyValueConverterBase
1011
{
12+
private readonly ShopifySettings _settings;
1113
private readonly IShopifyService _apiService;
1214

13-
public ShopifyProductPickerValueConverter(IShopifyService apiService)
15+
public ShopifyProductPickerValueConverter(IOptions<ShopifySettings> options, IShopifyService apiService)
1416
{
17+
_settings = options.Value;
1518
_apiService = apiService;
1619
}
1720

@@ -21,7 +24,7 @@ public override bool IsConverter(IPublishedPropertyType propertyType) =>
2124
public override Type GetPropertyValueType(IPublishedPropertyType propertyType) => typeof(List<ProductViewModel>);
2225

2326
public override PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType) =>
24-
PropertyCacheLevel.Snapshot;
27+
_settings.PropertyCacheLevel;
2528

2629
public override object ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object source,
2730
bool preview)

src/Umbraco.Cms.Integrations.Commerce.Shopify/Umbraco.Cms.Integrations.Commerce.Shopify.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<PackageIconUrl></PackageIconUrl>
1717
<PackageProjectUrl>https://github.com/umbraco/Umbraco.Cms.Integrations/tree/main-v14/src/Umbraco.Cms.Integrations.Commerce.Shopify</PackageProjectUrl>
1818
<RepositoryUrl>https://github.com/umbraco/Umbraco.Cms.Integrations</RepositoryUrl>
19-
<Version>3.0.0</Version>
19+
<Version>3.1.0</Version>
2020
<Authors>Umbraco HQ</Authors>
2121
<Company>Umbraco</Company>
2222
<PackageIcon>shopify.png</PackageIcon>

0 commit comments

Comments
 (0)