11using FluentStore . SDK . Images ;
22using FluentStore . Services ;
3- using Flurl ;
43using Garfoot . Utilities . FluentUrn ;
54using CommunityToolkit . Diagnostics ;
6- using CommunityToolkit . Mvvm . ComponentModel ;
75using CommunityToolkit . Mvvm . DependencyInjection ;
86using System ;
97using System . Collections . Generic ;
108using System . Linq ;
119using System . Threading . Tasks ;
12- using Windows . Storage ;
1310using System . IO ;
1411using CommunityToolkit . Mvvm . Messaging ;
1512using FluentStore . SDK . Messages ;
13+ using FluentStore . SDK . Models ;
14+ using FluentStore . SDK . Attributes ;
1615
1716namespace FluentStore . SDK . Packages
1817{
1918 public class UwpCommunityPackage : PackageBase < dynamic >
2019 {
21- INavigationService NavigationService = Ioc . Default . GetRequiredService < INavigationService > ( ) ;
22- PackageService PackageService = Ioc . Default . GetRequiredService < PackageService > ( ) ;
20+ readonly INavigationService NavigationService = Ioc . Default . GetRequiredService < INavigationService > ( ) ;
21+ readonly PackageService PackageService = Ioc . Default . GetRequiredService < PackageService > ( ) ;
2322
24- public UwpCommunityPackage ( dynamic project = null , IEnumerable < string > images = null , IEnumerable < dynamic > collaborators = null )
23+ public UwpCommunityPackage ( dynamic project = null , IEnumerable < string > images = null , IEnumerable < dynamic > collaborators = null , IEnumerable < string > features = null )
2524 {
2625 if ( project != null )
2726 UpdateWithProject ( project ) ;
2827 if ( images != null )
2928 UpdateWithImages ( images ) ;
3029 if ( collaborators != null )
3130 UpdateWithCollaborators ( collaborators ) ;
31+ if ( features != null )
32+ UpdateWithFeatures ( features ) ;
3233 }
3334
3435 public void UpdateWithProject ( dynamic project )
@@ -40,6 +41,8 @@ public void UpdateWithProject(dynamic project)
4041 Title = project . appName ;
4142 Description = project . description ;
4243 ReleaseDate = project . createdAt ;
44+ if ( project . externalLink != null )
45+ Website = Link . Create ( project . externalLink , ShortTitle + " website" ) ;
4346
4447 if ( project . heroImage != null )
4548 Images . Add ( new FileImage
@@ -55,13 +58,16 @@ public void UpdateWithProject(dynamic project)
5558 ImageType = ImageType . Logo ,
5659 BackgroundColor = project . accentColor ,
5760 } ) ;
58- else
59- Images . Add ( TextImage . CreateFromName ( Title ) ) ;
6061
6162 // Set UWPC properties
6263 ProjectId = ( int ) project . id ;
6364 if ( project . downloadLink != null )
6465 PackageUri = new ( project . downloadLink ) ;
66+ if ( project . githubLink != null )
67+ GithubLink = Link . Create ( project . githubLink , ShortTitle + " on GitHub" ) ;
68+ if ( project . tags != null )
69+ foreach ( dynamic tag in project . tags )
70+ Tags . Add ( tag . name ) ;
6571 }
6672
6773 public void UpdateWithImages ( IEnumerable < string > images )
@@ -87,6 +93,13 @@ public void UpdateWithCollaborators(IEnumerable<dynamic> collaborators)
8793 DeveloperName = owner . name ;
8894 }
8995
96+ public void UpdateWithFeatures ( IEnumerable < string > features )
97+ {
98+ Guard . IsNotNull ( features , nameof ( features ) ) ;
99+
100+ Features . AddRange ( features ) ;
101+ }
102+
90103 private Urn _Urn ;
91104 public override Urn Urn
92105 {
@@ -187,5 +200,29 @@ public PackageBase LinkedPackage
187200 get => _LinkedPackage ;
188201 set => SetProperty ( ref _LinkedPackage , value ) ;
189202 }
203+
204+ private Link _GithubLink ;
205+ [ DisplayAdditionalInformation ( "Source code" , "\uE943 " ) ]
206+ public Link GithubLink
207+ {
208+ get => _GithubLink ;
209+ set => SetProperty ( ref _GithubLink , value ) ;
210+ }
211+
212+ private List < string > _Tags = new ( ) ;
213+ [ DisplayAdditionalInformation ( Icon = "\uE1CB " ) ]
214+ public List < string > Tags
215+ {
216+ get => _Tags ;
217+ set => SetProperty ( ref _Tags , value ) ;
218+ }
219+
220+ private List < string > _Features = new ( ) ;
221+ [ Display ( Rank = 2 ) ]
222+ public List < string > Features
223+ {
224+ get => _Features ;
225+ set => SetProperty ( ref _Features , value ) ;
226+ }
190227 }
191228}
0 commit comments