Sfoglia il codice sorgente

fixed cache folder path, fixed image zoom view opening

Veloe 1 anno fa
parent
commit
2e9a54bd4b
21 ha cambiato i file con 133 aggiunte e 70 eliminazioni
  1. 4 2
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Android/MainActivity.cs
  2. 1 1
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Android/Services/AndroidOpenUrlService.cs
  3. 24 0
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Android/Services/AndroidStorageService.cs
  4. 3 3
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Android/VeloeAvaloniaKemonoPartyApp.Android.csproj
  5. 2 2
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Browser/VeloeAvaloniaKemonoPartyApp.Browser.csproj
  6. 3 1
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Desktop/Program.cs
  7. 34 0
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Desktop/Services/DesktopStorageService.cs
  8. 2 2
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Desktop/VeloeAvaloniaKemonoPartyApp.Desktop.csproj
  9. 2 2
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.iOS/VeloeAvaloniaKemonoPartyApp.iOS.csproj
  10. 0 1
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/App.axaml.cs
  11. 17 9
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Models/Creator.cs
  12. 5 5
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Models/Post.cs
  13. 4 6
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Services/HttpClient.cs
  14. 3 7
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Services/RegisteredServices.cs
  15. 12 13
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Services/StorageService.cs
  16. 2 2
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.csproj
  17. 2 6
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/ViewModels/CreatorPostsViewModel.cs
  18. 2 2
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/ViewModels/CreatorViewModel.cs
  19. 6 3
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/ViewModels/PostImageViewModel.cs
  20. 4 2
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/ViewModels/PostViewModel.cs
  21. 1 1
      VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Views/PostView.axaml

+ 4 - 2
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Android/MainActivity.cs

@@ -3,7 +3,8 @@ using Android.Content.PM;
 using Avalonia;
 using Avalonia.Android;
 using Avalonia.ReactiveUI;
-using VeloeAvaloniaKemonoPartyApp.ViewModels;
+using VeloeAvaloniaKemonoPartyApp.Android.Services;
+using VeloeAvaloniaKemonoPartyApp.Services;
 
 namespace VeloeAvaloniaKemonoPartyApp.Android
 {
@@ -17,7 +18,8 @@ namespace VeloeAvaloniaKemonoPartyApp.Android
     {
         protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
         {
-            Services.RegisteredServices.OpenUrlService = new AndroidOpenUrlService();
+            RegisteredServices.OpenUrlService = new AndroidOpenUrlService();
+            RegisteredServices.StorageService = new AndroidStorageService(CacheDir.AbsolutePath);
             
             return base.CustomizeAppBuilder(builder)
                 .WithInterFont()

+ 1 - 1
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Android/AndroidOpenUrlService.cs → VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Android/Services/AndroidOpenUrlService.cs

@@ -1,7 +1,7 @@
 using VeloeAvaloniaKemonoPartyApp.Services;
 using Xamarin.Essentials;
 
-namespace VeloeAvaloniaKemonoPartyApp.Android
+namespace VeloeAvaloniaKemonoPartyApp.Android.Services
 {
     public class AndroidOpenUrlService : IOpenUrlService
     {

+ 24 - 0
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Android/Services/AndroidStorageService.cs

@@ -0,0 +1,24 @@
+using System.IO;
+using System.Threading.Tasks;
+using VeloeAvaloniaKemonoPartyApp.Services;
+
+namespace VeloeAvaloniaKemonoPartyApp.Android.Services
+{
+    internal class AndroidStorageService : IStorageService
+    {
+        private string _cacheFolder;
+
+        public AndroidStorageService(string cacheFolder)
+        {
+            _cacheFolder = cacheFolder;
+
+            if (!Directory.Exists(_cacheFolder))
+                Directory.CreateDirectory(_cacheFolder);
+        }
+
+        public async Task<string?> GetCacheFolderAsync()
+        {
+            return await Task.FromResult(_cacheFolder);
+        }
+    }
+}

+ 3 - 3
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Android/VeloeAvaloniaKemonoPartyApp.Android.csproj

@@ -6,11 +6,11 @@
     <Nullable>enable</Nullable>
     <ApplicationId>com.CompanyName.VeloeAvaloniaKemonoPartyApp</ApplicationId>
     <ApplicationVersion>1</ApplicationVersion>
-    <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
+    <ApplicationDisplayVersion>1.0.0.90</ApplicationDisplayVersion>
     <AndroidPackageFormat>apk</AndroidPackageFormat>
     <AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
-    <AssemblyVersion>1.0.0.83</AssemblyVersion>
-    <FileVersion>1.0.0.83</FileVersion>
+    <AssemblyVersion>1.0.0.90</AssemblyVersion>
+    <FileVersion>1.0.0.90</FileVersion>
   </PropertyGroup>
 
   <ItemGroup>

+ 2 - 2
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Browser/VeloeAvaloniaKemonoPartyApp.Browser.csproj

@@ -4,8 +4,8 @@
     <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
     <WasmMainJSPath>AppBundle\main.js</WasmMainJSPath>
     <OutputType>Exe</OutputType>
-    <AssemblyVersion>1.0.0.6</AssemblyVersion>
-    <FileVersion>1.0.0.6</FileVersion>
+    <AssemblyVersion>1.0.0.7</AssemblyVersion>
+    <FileVersion>1.0.0.7</FileVersion>
   </PropertyGroup>
 
   <ItemGroup>

+ 3 - 1
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Desktop/Program.cs

@@ -1,6 +1,7 @@
 using Avalonia;
 using Avalonia.ReactiveUI;
 using System;
+using VeloeAvaloniaKemonoPartyApp.Desktop.Services;
 
 namespace VeloeAvaloniaKemonoPartyApp.Desktop
 {
@@ -19,6 +20,7 @@ namespace VeloeAvaloniaKemonoPartyApp.Desktop
                 .UsePlatformDetect()
                 .WithInterFont()
                 .LogToTrace()
-                .UseReactiveUI();
+                .UseReactiveUI()
+                .InitStorageService();
     }
 }

+ 34 - 0
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Desktop/Services/DesktopStorageService.cs

@@ -0,0 +1,34 @@
+using Avalonia;
+using System.IO;
+using System.Reflection;
+using System.Threading.Tasks;
+using VeloeAvaloniaKemonoPartyApp.Services;
+
+namespace VeloeAvaloniaKemonoPartyApp.Desktop.Services
+{
+    public class DesktopStorageService : IStorageService
+    {
+        private string _cacheFolder;
+        public DesktopStorageService() 
+        {
+            _cacheFolder = Directory.GetParent(Assembly.GetEntryAssembly().Location) + "/cache/";
+
+            if (!Directory.Exists(_cacheFolder))
+                Directory.CreateDirectory(_cacheFolder);
+        }
+
+        public async Task<string?> GetCacheFolderAsync()
+        {
+            return await Task.FromResult<string?>(_cacheFolder);
+        }
+    }
+
+    public static class DesktopStorageServiceAppBuilderExtentions
+    {
+        public static AppBuilder InitStorageService(this AppBuilder appBuilder)
+        {
+            RegisteredServices.StorageService = new DesktopStorageService();
+            return appBuilder;
+        }
+    }
+}

+ 2 - 2
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.Desktop/VeloeAvaloniaKemonoPartyApp.Desktop.csproj

@@ -10,8 +10,8 @@
 
   <PropertyGroup>
     <ApplicationManifest>app.manifest</ApplicationManifest>
-    <AssemblyVersion>1.0.0.45</AssemblyVersion>
-    <FileVersion>1.0.0.45</FileVersion>
+    <AssemblyVersion>1.0.0.59</AssemblyVersion>
+    <FileVersion>1.0.0.59</FileVersion>
   </PropertyGroup>
 
   <ItemGroup>

+ 2 - 2
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.iOS/VeloeAvaloniaKemonoPartyApp.iOS.csproj

@@ -4,8 +4,8 @@
     <TargetFramework>net8.0-ios</TargetFramework>
     <SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion>
     <Nullable>enable</Nullable>
-    <AssemblyVersion>1.0.0.6</AssemblyVersion>
-    <FileVersion>1.0.0.6</FileVersion>
+    <AssemblyVersion>1.0.0.7</AssemblyVersion>
+    <FileVersion>1.0.0.7</FileVersion>
   </PropertyGroup>
 
   <ItemGroup>

+ 0 - 1
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/App.axaml.cs

@@ -6,7 +6,6 @@ using HanumanInstitute.MvvmDialogs.Avalonia;
 using HanumanInstitute.MvvmDialogs.Avalonia.MessageBox;
 using Splat;
 using VeloeAvaloniaKemonoPartyApp.ViewModels;
-using VeloeAvaloniaKemonoPartyApp.Views;
 
 namespace VeloeAvaloniaKemonoPartyApp
 {

+ 17 - 9
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Models/Creator.cs

@@ -1,6 +1,7 @@
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
+using System.Text.Json.Serialization;
 using System.Threading.Tasks;
 using VeloeKemonoPartyApp.Services;
 
@@ -8,13 +9,20 @@ namespace VeloeAvaloniaKemonoPartyApp.Models
 {
     public class Creator
     {
-        public int favorited { get; set; }
-        public string id { get; set; }
-        public double indexed { get; set; }
-        public string name { get; set; }
-        public string service { get; set; }
-        public double updated { get; set; }
-        public string Icon => $"https://kemono.su/icons/{service}/{id}";
+        [JsonPropertyName("favorited")]
+        public int Favorited { get; set; }
+        [JsonPropertyName("id")]
+        public string Id { get; set; }
+        [JsonPropertyName("indexed")]
+        public double Indexed { get; set; }
+        [JsonPropertyName("name")]
+        public string Name { get; set; }
+        [JsonPropertyName("service")]
+        public string Service { get; set; }
+        [JsonPropertyName("updated")]
+        public double Updated { get; set; }
+ 
+        public string Icon => $"https://kemono.su/icons/{Service}/{Id}";
 
         public static IList<Creator> Source = new List<Creator>(66000);
 
@@ -24,11 +32,11 @@ namespace VeloeAvaloniaKemonoPartyApp.Models
                 Source = await s_httpClient.GetCreatorsList(reloadSource);
               
 
-            return Source.Where(x=>x.name.StartsWith(searchTerm,System.StringComparison.OrdinalIgnoreCase)).Take(50);
+            return Source.Where(x=>x.Name.StartsWith(searchTerm,System.StringComparison.OrdinalIgnoreCase)).Take(50);
         }
 
         private static KemonoHttpClient s_httpClient = new();
-        private string CachePath => $"./Cache/{service} - {id}";
+        private string CachePath => $"./Cache/{Service} - {Id}";
 
         public async Task<Stream> LoadCoverBitmapAsync()
         {

+ 5 - 5
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Models/Post.cs

@@ -39,12 +39,12 @@ namespace VeloeAvaloniaKemonoPartyApp.Models
 
         public static async Task<IEnumerable<Post>> InitPostsAsync(Creator creator)
         {
-            return await s_httpClient.GetPostsList(creator.id,creator.service,0);
+            return await s_httpClient.GetPostsList(creator.Id,creator.Service,0);
         }
 
         public static async Task<IEnumerable<Post>> LoadPostsAsync(Creator creator, int start)
         {
-            return await s_httpClient.GetPostsList(creator.id, creator.service, start);
+            return await s_httpClient.GetPostsList(creator.Id, creator.Service, start);
         }
 
         private static KemonoHttpClient s_httpClient = new();
@@ -90,9 +90,9 @@ namespace VeloeAvaloniaKemonoPartyApp.Models
 
         public async Task<Stream> LoadCoverBitmapAsync()
         {
-            if (System.IO.File.Exists(System.IO.Path.Combine(await s_storage.GetDocumentsFolderAsync(),  FileName + ".bmp")))
+            if (System.IO.File.Exists(System.IO.Path.Combine(await RegisteredServices.StorageService.GetCacheFolderAsync(),  FileName + ".bmp")))
             {
-                var stream = System.IO.File.OpenRead(System.IO.Path.Combine(await s_storage.GetDocumentsFolderAsync(), FileName + ".bmp"));
+                var stream = System.IO.File.OpenRead(System.IO.Path.Combine(await RegisteredServices.StorageService.GetCacheFolderAsync(), FileName + ".bmp"));
 
                 byte[] hash = System.Security.Cryptography.SHA256.Create().ComputeHash(stream);
 
@@ -109,7 +109,7 @@ namespace VeloeAvaloniaKemonoPartyApp.Models
             {
                 var data = await s_httpClient.httpClient.GetByteArrayAsync(Link);
 
-                using (var stream = System.IO.File.OpenWrite(System.IO.Path.Combine(await s_storage.GetDocumentsFolderAsync(), FileName + ".bmp")))
+                using (var stream = System.IO.File.OpenWrite(System.IO.Path.Combine(await RegisteredServices.StorageService.GetCacheFolderAsync(), FileName + ".bmp")))
                 {
                     await stream.WriteAsync(data);
                 }

+ 4 - 6
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Services/HttpClient.cs

@@ -10,8 +10,6 @@ namespace VeloeKemonoPartyApp.Services
 {
     public class KemonoHttpClient : IDisposable
     {
-        private StorageService _storageService = new();
-
         public HttpClient httpClient;
 
         public List<Post> posts;
@@ -27,25 +25,25 @@ namespace VeloeKemonoPartyApp.Services
 
         public async Task<List<Creator>> GetCreatorsList(bool reloadSource)
         {
-            if (System.IO.File.Exists(await _storageService.GetDocumentsFolderAsync() + "/creators.json") && new System.IO.FileInfo(await _storageService.GetDocumentsFolderAsync() + "/creators.json").CreationTime > DateTime.Now.AddDays(-7) && !reloadSource)
+            if (System.IO.File.Exists(await RegisteredServices.StorageService.GetCacheFolderAsync() + "/creators.json") && new System.IO.FileInfo(await RegisteredServices.StorageService.GetCacheFolderAsync() + "/creators.json").CreationTime > DateTime.Now.AddDays(-7) && !reloadSource)
             {
                 try
                 {
-                    using (var stream = System.IO.File.OpenRead(await _storageService.GetDocumentsFolderAsync() + "/creators.json"))
+                    using (var stream = System.IO.File.OpenRead(await RegisteredServices.StorageService.GetCacheFolderAsync() + "/creators.json"))
                     {
                         return await JsonSerializer.DeserializeAsync<List<Creator>>(stream);
                     }
                 }
                 catch 
                 {
-                    System.IO.File.Delete(await _storageService.GetDocumentsFolderAsync() + "/creators.json");
+                    System.IO.File.Delete(await RegisteredServices.StorageService.GetCacheFolderAsync() + "/creators.json");
                 }
             }
 
             using (HttpResponseMessage response = await httpClient.GetAsync("https://kemono.su/api/v1/creators.txt"))
             using (HttpContent content = response.Content)
             {
-                using (var stream = System.IO.File.OpenWrite(await _storageService.GetDocumentsFolderAsync() + "/creators.json"))
+                using (var stream = System.IO.File.OpenWrite(await RegisteredServices.StorageService.GetCacheFolderAsync() + "/creators.json"))
                 {
                     stream.Write(await response.Content.ReadAsByteArrayAsync());
                 }

+ 3 - 7
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Services/RegisteredServices.cs

@@ -1,13 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace VeloeAvaloniaKemonoPartyApp.Services
+namespace VeloeAvaloniaKemonoPartyApp.Services
 {
     public static class RegisteredServices
     {
         public static IOpenUrlService? OpenUrlService { get; set; }
+
+        public static IStorageService StorageService { get; set; } = new StorageService();
     }
 }

+ 12 - 13
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Services/StorageService.cs

@@ -8,23 +8,16 @@ using Avalonia.VisualTree;
 
 namespace VeloeAvaloniaKemonoPartyApp.Services
 {
-    public class StorageService
+    public interface IStorageService
+    {
+        public Task<string?> GetCacheFolderAsync();
+    }
+
+    public class StorageService: IStorageService
     {
         protected virtual IStorageProvider Storage => _storage ??= GetTopLevel()?.StorageProvider ?? throw new NullReferenceException("No StorageProvider found.");
         private IStorageProvider? _storage;
 
-        public async Task<string?> GetDocumentsFolderAsync()
-        {
-            var result = await Storage.TryGetWellKnownFolderAsync(WellKnownFolder.Documents);
-            return result.TryGetLocalPath();
-        }
-
-        public async Task<string?> GetPicturesFolderAsync()
-        {
-            var result = await Storage.TryGetWellKnownFolderAsync(WellKnownFolder.Pictures);
-            return result.TryGetLocalPath();
-        }
-
         private TopLevel? GetTopLevel()
         {
             if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
@@ -38,5 +31,11 @@ namespace VeloeAvaloniaKemonoPartyApp.Services
             }
             return null;
         }
+
+        public async Task<string?> GetCacheFolderAsync()
+        {
+            var result = await Storage.TryGetWellKnownFolderAsync(WellKnownFolder.Documents);
+            return result.TryGetLocalPath();
+        }
     }
 }

+ 2 - 2
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp.csproj

@@ -4,8 +4,8 @@
     <Nullable>enable</Nullable>
     <LangVersion>latest</LangVersion>
     <AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
-    <AssemblyVersion>1.0.0.180</AssemblyVersion>
-    <FileVersion>1.0.0.180</FileVersion>
+    <AssemblyVersion>1.0.0.196</AssemblyVersion>
+    <FileVersion>1.0.0.196</FileVersion>
   </PropertyGroup>
 
   

+ 2 - 6
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/ViewModels/CreatorPostsViewModel.cs

@@ -1,16 +1,12 @@
 using HanumanInstitute.MvvmDialogs;
-using HanumanInstitute.MvvmDialogs.FrameworkDialogs;
 using ReactiveUI;
 using System;
-using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
 using System.Linq;
-using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
 using VeloeAvaloniaKemonoPartyApp.Models;
-using static System.Net.Mime.MediaTypeNames;
 
 namespace VeloeAvaloniaKemonoPartyApp.ViewModels
 {
@@ -63,7 +59,7 @@ namespace VeloeAvaloniaKemonoPartyApp.ViewModels
 
                 foreach (var post in posts)
                 {
-                    var vm = new PostViewModel(_dialogService,post);
+                    var vm = new PostViewModel(_dialogService,this,post);
                     Posts.Add(vm);
                 }
 
@@ -95,7 +91,7 @@ namespace VeloeAvaloniaKemonoPartyApp.ViewModels
 
                 foreach (var post in posts)
                 {
-                    var vm = new PostViewModel(_dialogService,post);
+                    var vm = new PostViewModel(_dialogService,this,post);
                     Posts.Add(vm);
                 }
 

+ 2 - 2
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/ViewModels/CreatorViewModel.cs

@@ -15,9 +15,9 @@ namespace VeloeAvaloniaKemonoPartyApp.ViewModels
             _creator = creator;
         }
 
-        public string Artist => _creator.name;
+        public string Artist => _creator.Name;
 
-        public string Title => _creator.service;
+        public string Title => _creator.Service;
 
         public Creator Creator => _creator;
 

+ 6 - 3
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/ViewModels/PostImageViewModel.cs

@@ -11,12 +11,15 @@ namespace VeloeAvaloniaKemonoPartyApp.ViewModels
 {
     public class PostImageViewModel : ViewModelBase
     {
-        private Attachment _attachment;
+        private readonly Attachment _attachment;
         private readonly IDialogService _dialogService;
-        public PostImageViewModel(IDialogService dialogService,Attachment attachment)
+        private readonly ViewModelBase _parent;
+
+        public PostImageViewModel(IDialogService dialogService,ViewModelBase parent, Attachment attachment)
         {
             _attachment = attachment;
             _dialogService = dialogService;
+            _parent = parent;
         }
 
         private Bitmap? _cover;
@@ -53,7 +56,7 @@ namespace VeloeAvaloniaKemonoPartyApp.ViewModels
         public async Task OnImageClick(object sender, RoutedEventArgs e)
         {
             var vm = new ImageZoomViewModel(_attachment);
-            _dialogService.Show((_dialogService.DialogManager as HanumanInstitute.MvvmDialogs.Avalonia.DialogManager).NavigationManager.CurrentViewModel, vm);
+            await _dialogService.ShowDialogAsync(_parent, vm);
         }
 
     }

+ 4 - 2
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/ViewModels/PostViewModel.cs

@@ -9,11 +9,13 @@ namespace VeloeAvaloniaKemonoPartyApp.ViewModels
     {
         private readonly Post _post;
         private readonly IDialogService _dialogService;
+        private readonly ViewModelBase _parent;
 
-        public PostViewModel(IDialogService dialogService, Post post)
+        public PostViewModel(IDialogService dialogService,ViewModelBase parent, Post post)
         {
             _post = post;
             _dialogService = dialogService;
+            _parent = parent;
 
             Images.Clear();
 
@@ -23,7 +25,7 @@ namespace VeloeAvaloniaKemonoPartyApp.ViewModels
 
                 if (attachment.IsImage)
                 {
-                    Images.Add(new PostImageViewModel(_dialogService,attachment));
+                    Images.Add(new PostImageViewModel(_dialogService,_parent,attachment));
                 }
 
                 Attachments.Add(new AttachmentViewModel(attachment));

+ 1 - 1
VeloeAvaloniaKemonoPartyApp/VeloeAvaloniaKemonoPartyApp/Views/PostView.axaml

@@ -18,7 +18,7 @@
 				</ItemsPanelTemplate>
 			</ItemsControl.ItemsPanel>
 		</ItemsControl>
-		<TextBlock Text="{Binding Content}" TextWrapping="Wrap"/>
+		<TextBlock Text="{Binding Content}" TextWrapping="Wrap" Margin="10 0 10 0"/>
 		<ListBox ItemsSource="{Binding Attachments}" 
 				 SelectionMode="Single"
 				 Background="Transparent">