diff --git a/src/Umbraco.Core/Manifest/ContentAppDefinitionConverter.cs b/src/Umbraco.Core/Manifest/ContentAppDefinitionConverter.cs deleted file mode 100644 index dd167e06df..0000000000 --- a/src/Umbraco.Core/Manifest/ContentAppDefinitionConverter.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using Newtonsoft.Json.Linq; -using Umbraco.Core.Models.ContentEditing; -using Umbraco.Core.Serialization; - -namespace Umbraco.Core.Manifest -{ - /// - /// Implements a json read converter for . - /// - internal class ContentAppDefinitionConverter : JsonReadConverter - { - protected override ManifestContentAppDefinition Create(Type objectType, string path, JObject jObject) - => new ManifestContentAppDefinition(); - } -} diff --git a/src/Umbraco.Core/Manifest/ManifestContentAppFactory.cs b/src/Umbraco.Core/Manifest/ManifestContentAppFactory.cs index b44d31f0a5..1c50a4b895 100644 --- a/src/Umbraco.Core/Manifest/ManifestContentAppFactory.cs +++ b/src/Umbraco.Core/Manifest/ManifestContentAppFactory.cs @@ -26,13 +26,12 @@ namespace Umbraco.Core.Manifest // ] /// - /// Represents a content app definition, parsed from a manifest. + /// Represents a content app factory, for content apps parsed from the manifest. /// public class ManifestContentAppFactory : IContentAppFactory { private readonly ManifestContentAppDefinition _definition; - public ManifestContentAppFactory(ManifestContentAppDefinition definition) { _definition = definition; diff --git a/src/Umbraco.Core/Manifest/ManifestParser.cs b/src/Umbraco.Core/Manifest/ManifestParser.cs index 2d6ec93e14..59753df66a 100644 --- a/src/Umbraco.Core/Manifest/ManifestParser.cs +++ b/src/Umbraco.Core/Manifest/ManifestParser.cs @@ -153,7 +153,6 @@ namespace Umbraco.Core.Manifest var manifest = JsonConvert.DeserializeObject(text, new DataEditorConverter(_logger), new ValueValidatorConverter(_validators), - new ContentAppDefinitionConverter(), new DashboardAccessRuleConverter()); // scripts and stylesheets are raw string, must process here diff --git a/src/Umbraco.Core/Models/ContentEditing/IContentAppFactory.cs b/src/Umbraco.Core/Models/ContentEditing/IContentAppFactory.cs index 144f1c4f84..6b8d90d418 100644 --- a/src/Umbraco.Core/Models/ContentEditing/IContentAppFactory.cs +++ b/src/Umbraco.Core/Models/ContentEditing/IContentAppFactory.cs @@ -1,13 +1,10 @@ using System.Collections.Generic; -using Umbraco.Core.Manifest; using Umbraco.Core.Models.Membership; namespace Umbraco.Core.Models.ContentEditing { - - /// - /// Represents a content app definition. + /// Represents a content app factory. /// public interface IContentAppFactory { diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 6acda13392..a8361a237a 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -334,7 +334,6 @@ - diff --git a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs index d80802b1cf..1eb222cd6a 100644 --- a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs +++ b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs @@ -213,7 +213,7 @@ namespace Umbraco.Tests.Testing Container.RegisterSingleton(); // register empty content apps collection - Container.RegisterCollectionBuilder(); + Container.RegisterCollectionBuilder(); } protected virtual void ComposeCacheHelper() diff --git a/src/Umbraco.Web/CompositionExtensions.cs b/src/Umbraco.Web/CompositionExtensions.cs index fe2ea4b8a7..3031410f19 100644 --- a/src/Umbraco.Web/CompositionExtensions.cs +++ b/src/Umbraco.Web/CompositionExtensions.cs @@ -40,8 +40,8 @@ namespace Umbraco.Core.Components /// /// The composition. /// - public static ContentAppDefinitionCollectionBuilder ContentApps(this Composition composition) - => composition.Container.GetInstance(); + public static ContentAppFactoryCollectionBuilder ContentApps(this Composition composition) + => composition.Container.GetInstance(); /// /// Gets the content finders collection builder. diff --git a/src/Umbraco.Web/ContentApps/ContentAppDefinitionCollection.cs b/src/Umbraco.Web/ContentApps/ContentAppFactoryCollection.cs similarity index 77% rename from src/Umbraco.Web/ContentApps/ContentAppDefinitionCollection.cs rename to src/Umbraco.Web/ContentApps/ContentAppFactoryCollection.cs index 484e8641a9..07987aea3e 100644 --- a/src/Umbraco.Web/ContentApps/ContentAppDefinitionCollection.cs +++ b/src/Umbraco.Web/ContentApps/ContentAppFactoryCollection.cs @@ -1,21 +1,18 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Umbraco.Core; using Umbraco.Core.Composing; using Umbraco.Core.Models.ContentEditing; using Umbraco.Core.Logging; -using Umbraco.Core.Manifest; using Umbraco.Core.Models.Membership; namespace Umbraco.Web.ContentApps { - public class ContentAppDefinitionCollection : BuilderCollectionBase + public class ContentAppFactoryCollection : BuilderCollectionBase { private readonly ILogger _logger; - private readonly IContentAppFactory _factory; - public ContentAppDefinitionCollection(IEnumerable items, ILogger logger) + public ContentAppFactoryCollection(IEnumerable items, ILogger logger) : base(items) { _logger = logger; @@ -35,10 +32,8 @@ namespace Umbraco.Web.ContentApps { var roles = GetCurrentUserGroups(); - var apps = this.Select(x => x.GetContentAppFor(o, roles)).WhereNotNull().OrderBy(x => x.Weight).ToList(); - var aliases = new HashSet(); List dups = null; @@ -55,7 +50,7 @@ namespace Umbraco.Web.ContentApps // dying is not user-friendly, so let's write to log instead, and wish people read logs... //throw new InvalidOperationException($"Duplicate content app aliases found: {string.Join(",", dups)}"); - _logger.Warn("Duplicate content app aliases found: {DuplicateAliases}", string.Join(",", dups)); + _logger.Warn("Duplicate content app aliases found: {DuplicateAliases}", string.Join(",", dups)); } return apps; diff --git a/src/Umbraco.Web/ContentApps/ContentAppDefinitionCollectionBuilder.cs b/src/Umbraco.Web/ContentApps/ContentAppFactoryCollectionBuilder.cs similarity index 63% rename from src/Umbraco.Web/ContentApps/ContentAppDefinitionCollectionBuilder.cs rename to src/Umbraco.Web/ContentApps/ContentAppFactoryCollectionBuilder.cs index 744785bacd..8dd3b6bc98 100644 --- a/src/Umbraco.Web/ContentApps/ContentAppDefinitionCollectionBuilder.cs +++ b/src/Umbraco.Web/ContentApps/ContentAppFactoryCollectionBuilder.cs @@ -5,26 +5,24 @@ using Umbraco.Core.Composing; using Umbraco.Core.Logging; using Umbraco.Core.Manifest; using Umbraco.Core.Models.ContentEditing; -using Umbraco.Core.Services; namespace Umbraco.Web.ContentApps { - public class ContentAppDefinitionCollectionBuilder : OrderedCollectionBuilderBase + public class ContentAppFactoryCollectionBuilder : OrderedCollectionBuilderBase { - public ContentAppDefinitionCollectionBuilder(IServiceContainer container) + public ContentAppFactoryCollectionBuilder(IServiceContainer container) : base(container) - { - } + { } - protected override ContentAppDefinitionCollectionBuilder This => this; + protected override ContentAppFactoryCollectionBuilder This => this; // need to inject dependencies in the collection, so override creation - public override ContentAppDefinitionCollection CreateCollection() + public override ContentAppFactoryCollection CreateCollection() { // get the logger just-in-time - see note below for manifest parser var logger = Container.GetInstance(); - return new ContentAppDefinitionCollection(CreateItems(), logger); + return new ContentAppFactoryCollection(CreateItems(), logger); } protected override IEnumerable CreateItems(params object[] args) @@ -34,7 +32,7 @@ namespace Umbraco.Web.ContentApps // its dependencies too, and that can create cycles or other oddities var manifestParser = Container.GetInstance(); - return base.CreateItems(args).Concat(manifestParser.Manifest.ContentApps.Select(x=>new ManifestContentAppFactory(x))); + return base.CreateItems(args).Concat(manifestParser.Manifest.ContentApps.Select(x => new ManifestContentAppFactory(x))); } } } diff --git a/src/Umbraco.Web/Models/Mapping/ContentAppResolver.cs b/src/Umbraco.Web/Models/Mapping/ContentAppResolver.cs index a199c7e60e..ee3e991f89 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentAppResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentAppResolver.cs @@ -11,9 +11,9 @@ namespace Umbraco.Web.Models.Mapping // maps ContentApps when mapping IContent to ContentItemDisplay internal class ContentAppResolver : IValueResolver> { - private readonly ContentAppDefinitionCollection _contentAppDefinitions; + private readonly ContentAppFactoryCollection _contentAppDefinitions; - public ContentAppResolver(ContentAppDefinitionCollection contentAppDefinitions) + public ContentAppResolver(ContentAppFactoryCollection contentAppDefinitions) { _contentAppDefinitions = contentAppDefinitions; } diff --git a/src/Umbraco.Web/Models/Mapping/MediaAppResolver.cs b/src/Umbraco.Web/Models/Mapping/MediaAppResolver.cs index caaaacc5f2..2e3afac549 100644 --- a/src/Umbraco.Web/Models/Mapping/MediaAppResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/MediaAppResolver.cs @@ -11,9 +11,9 @@ namespace Umbraco.Web.Models.Mapping // maps ContentApps when mapping IMedia to MediaItemDisplay internal class MediaAppResolver : IValueResolver> { - private readonly ContentAppDefinitionCollection _contentAppDefinitions; + private readonly ContentAppFactoryCollection _contentAppDefinitions; - public MediaAppResolver(ContentAppDefinitionCollection contentAppDefinitions) + public MediaAppResolver(ContentAppFactoryCollection contentAppDefinitions) { _contentAppDefinitions = contentAppDefinitions; } diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs index f6d6d98050..2e1c934bc0 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs @@ -208,7 +208,7 @@ namespace Umbraco.Web.Runtime composition.Container.RegisterSingleton(); // register known content apps - composition.Container.RegisterCollectionBuilder() + composition.Container.RegisterCollectionBuilder() .Append() .Append() .Append(); diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 67e34e313c..a00a8c69a6 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -156,8 +156,8 @@ - - + +