* feat: Enhanced sender avatars with gravatar and favicons integration * chore: Remove unused known companies thumbnails * feat(thumbnail): add IThumbnailService and refactor usage - Introduced a new interface `IThumbnailService` for handling thumbnail-related functionalities. - Registered `IThumbnailService` with its implementation `ThumbnailService` in the service container. - Updated `NotificationBuilder` to use an instance of `IThumbnailService` instead of static methods. - Refactored `ThumbnailService` from a static class to a regular class with instance methods and variables. - Modified `ImagePreviewControl` to utilize the new `IThumbnailService` instance. - Completed integration of `IThumbnailService` in the application by registering it in `App.xaml.cs`. * style: Show favicons as squares - Changed `hintCrop` in `NotificationBuilder` to `None` for app logo display. - Added `FaviconSquircle`, `FaviconImage`, and `isFavicon` to `ImagePreviewControl` for favicon handling. - Updated `UpdateInformation` method to manage favicon visibility. - Introduced `GetBitmapImageAsync` for converting Base64 to Bitmap images. - Enhanced XAML to include `FaviconSquircle` for improved UI appearance. * refactor thumbnail service * Removed old code and added clear method * added prefetch function * Change key from host to email * Remove redundant code * Test event * Fixed an issue with the thumbnail updated event. * Fix cutted favicons * exclude some domain from favicons * add yandex.ru * fix buttons in settings * remove prefetch method * Added thumbnails propagation to mailRenderingPage * Revert MailItemViewModel to object * Remove redundant code * spaces * await load parameter added * fix spaces * fix case sensativity for mail list thumbnails * change duckdns to google * Some cleanup. --------- Co-authored-by: Aleh Khantsevich <aleh.khantsevich@gmail.com> Co-authored-by: Burak Kaan Köse <bkaankose@outlook.com>
108 lines
2.9 KiB
C#
108 lines
2.9 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Windows.ApplicationModel;
|
|
using Windows.Foundation.Metadata;
|
|
using Windows.Storage;
|
|
using Windows.System;
|
|
using Windows.UI.Shell;
|
|
using Wino.Core.Domain.Interfaces;
|
|
|
|
|
|
|
|
#if WINDOWS_UWP
|
|
using Windows.UI.Xaml;
|
|
using Windows.UI.Xaml.Controls;
|
|
#endif
|
|
|
|
namespace Wino.Services;
|
|
|
|
public class NativeAppService : INativeAppService
|
|
{
|
|
private string _mimeMessagesFolder;
|
|
private string _editorBundlePath;
|
|
|
|
public Func<IntPtr> GetCoreWindowHwnd { get; set; }
|
|
|
|
public string GetWebAuthenticationBrokerUri()
|
|
{
|
|
#if WINDOWS_UWP
|
|
return WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri;
|
|
#endif
|
|
|
|
return string.Empty;
|
|
}
|
|
|
|
public async Task<string> GetMimeMessageStoragePath()
|
|
{
|
|
if (!string.IsNullOrEmpty(_mimeMessagesFolder))
|
|
return _mimeMessagesFolder;
|
|
|
|
var localFolder = ApplicationData.Current.LocalFolder;
|
|
var mimeFolder = await localFolder.CreateFolderAsync("Mime", CreationCollisionOption.OpenIfExists);
|
|
|
|
_mimeMessagesFolder = mimeFolder.Path;
|
|
|
|
return _mimeMessagesFolder;
|
|
}
|
|
|
|
public async Task<string> GetEditorBundlePathAsync()
|
|
{
|
|
if (string.IsNullOrEmpty(_editorBundlePath))
|
|
{
|
|
var editorFileFromBundle = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///JS/editor.html"))
|
|
.AsTask()
|
|
.ConfigureAwait(false);
|
|
|
|
_editorBundlePath = editorFileFromBundle.Path;
|
|
}
|
|
|
|
return _editorBundlePath;
|
|
}
|
|
|
|
[Obsolete("This should be removed. There should be no functionality.")]
|
|
public bool IsAppRunning()
|
|
{
|
|
#if WINDOWS_UWP
|
|
return (Window.Current?.Content as Frame)?.Content != null;
|
|
#endif
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
public async Task LaunchFileAsync(string filePath)
|
|
{
|
|
var file = await StorageFile.GetFileFromPathAsync(filePath);
|
|
|
|
await Launcher.LaunchFileAsync(file);
|
|
}
|
|
|
|
public Task<bool> LaunchUriAsync(Uri uri) => Launcher.LaunchUriAsync(uri).AsTask();
|
|
|
|
public string GetFullAppVersion()
|
|
{
|
|
Package package = Package.Current;
|
|
PackageId packageId = package.Id;
|
|
PackageVersion version = packageId.Version;
|
|
|
|
return string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
|
|
}
|
|
|
|
public async Task PinAppToTaskbarAsync()
|
|
{
|
|
// If Start screen manager API's aren't present
|
|
if (!ApiInformation.IsTypePresent("Windows.UI.Shell.TaskbarManager")) return;
|
|
|
|
// Get the taskbar manager
|
|
var taskbarManager = TaskbarManager.GetDefault();
|
|
|
|
// If Taskbar doesn't allow pinning, don't show the tip
|
|
if (!taskbarManager.IsPinningAllowed) return;
|
|
|
|
// If already pinned, don't show the tip
|
|
if (await taskbarManager.IsCurrentAppPinnedAsync()) return;
|
|
|
|
await taskbarManager.RequestPinCurrentAppAsync();
|
|
}
|
|
}
|