Fix tailored notification images issue.
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 459 B |
|
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 351 B |
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 279 B |
|
Before Width: | Height: | Size: 303 B After Width: | Height: | Size: 303 B |
|
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
|
Before Width: | Height: | Size: 545 B After Width: | Height: | Size: 545 B |
|
Before Width: | Height: | Size: 445 B After Width: | Height: | Size: 445 B |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 359 B |
|
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 426 B |
|
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 418 B |
|
Before Width: | Height: | Size: 669 B After Width: | Height: | Size: 669 B |
|
Before Width: | Height: | Size: 495 B After Width: | Height: | Size: 495 B |
|
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
|
Before Width: | Height: | Size: 383 B After Width: | Height: | Size: 383 B |
|
Before Width: | Height: | Size: 496 B After Width: | Height: | Size: 496 B |
|
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 458 B |
|
Before Width: | Height: | Size: 887 B After Width: | Height: | Size: 887 B |
|
Before Width: | Height: | Size: 685 B After Width: | Height: | Size: 685 B |
|
Before Width: | Height: | Size: 283 B After Width: | Height: | Size: 283 B |
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 371 B |
|
Before Width: | Height: | Size: 541 B After Width: | Height: | Size: 541 B |
|
Before Width: | Height: | Size: 595 B After Width: | Height: | Size: 595 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 521 B After Width: | Height: | Size: 521 B |
|
Before Width: | Height: | Size: 805 B After Width: | Height: | Size: 805 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 434 B After Width: | Height: | Size: 434 B |
|
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 323 B |
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 174 B |
|
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 289 B |
|
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 308 B |
|
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 507 B |
|
Before Width: | Height: | Size: 417 B After Width: | Height: | Size: 417 B |
|
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
|
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 324 B |
|
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 382 B |
|
Before Width: | Height: | Size: 615 B After Width: | Height: | Size: 615 B |
|
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 459 B |
|
Before Width: | Height: | Size: 229 B After Width: | Height: | Size: 229 B |
|
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 362 B |
|
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 465 B |
|
Before Width: | Height: | Size: 447 B After Width: | Height: | Size: 447 B |
|
Before Width: | Height: | Size: 817 B After Width: | Height: | Size: 817 B |
|
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 636 B |
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 328 B After Width: | Height: | Size: 328 B |
|
Before Width: | Height: | Size: 527 B After Width: | Height: | Size: 527 B |
|
Before Width: | Height: | Size: 574 B After Width: | Height: | Size: 574 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 509 B After Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 706 B After Width: | Height: | Size: 706 B |
|
Before Width: | Height: | Size: 989 B After Width: | Height: | Size: 989 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -5,7 +5,6 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using Microsoft.Toolkit.Uwp.Notifications;
|
using Microsoft.Toolkit.Uwp.Notifications;
|
||||||
using Microsoft.UI.Xaml;
|
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Windows.Data.Xml.Dom;
|
using Windows.Data.Xml.Dom;
|
||||||
using Windows.UI.Notifications;
|
using Windows.UI.Notifications;
|
||||||
@@ -24,28 +23,24 @@ public class NotificationBuilder : INotificationBuilder
|
|||||||
{
|
{
|
||||||
private const string MailApplicationId = "App";
|
private const string MailApplicationId = "App";
|
||||||
private const string NotificationIconRootUri = "ms-appx:///Assets/NotificationIcons/";
|
private const string NotificationIconRootUri = "ms-appx:///Assets/NotificationIcons/";
|
||||||
private static readonly int[] SupportedIconScales = [100, 125, 150, 200, 400];
|
|
||||||
|
|
||||||
private readonly IAccountService _accountService;
|
private readonly IAccountService _accountService;
|
||||||
private readonly IFolderService _folderService;
|
private readonly IFolderService _folderService;
|
||||||
private readonly IMailService _mailService;
|
private readonly IMailService _mailService;
|
||||||
private readonly IThumbnailService _thumbnailService;
|
private readonly IThumbnailService _thumbnailService;
|
||||||
private readonly IPreferencesService _preferencesService;
|
private readonly IPreferencesService _preferencesService;
|
||||||
private readonly IUnderlyingThemeService _underlyingThemeService;
|
|
||||||
|
|
||||||
public NotificationBuilder(IAccountService accountService,
|
public NotificationBuilder(IAccountService accountService,
|
||||||
IFolderService folderService,
|
IFolderService folderService,
|
||||||
IMailService mailService,
|
IMailService mailService,
|
||||||
IThumbnailService thumbnailService,
|
IThumbnailService thumbnailService,
|
||||||
IPreferencesService preferencesService,
|
IPreferencesService preferencesService)
|
||||||
IUnderlyingThemeService underlyingThemeService)
|
|
||||||
{
|
{
|
||||||
_accountService = accountService;
|
_accountService = accountService;
|
||||||
_folderService = folderService;
|
_folderService = folderService;
|
||||||
_mailService = mailService;
|
_mailService = mailService;
|
||||||
_thumbnailService = thumbnailService;
|
_thumbnailService = thumbnailService;
|
||||||
_preferencesService = preferencesService;
|
_preferencesService = preferencesService;
|
||||||
_underlyingThemeService = underlyingThemeService;
|
|
||||||
|
|
||||||
WeakReferenceMessenger.Default.Register<MailReadStatusChanged>(this, (r, msg) =>
|
WeakReferenceMessenger.Default.Register<MailReadStatusChanged>(this, (r, msg) =>
|
||||||
{
|
{
|
||||||
@@ -431,23 +426,8 @@ public class NotificationBuilder : INotificationBuilder
|
|||||||
|
|
||||||
private Uri GetNotificationIconUri(string iconName)
|
private Uri GetNotificationIconUri(string iconName)
|
||||||
{
|
{
|
||||||
var theme = _underlyingThemeService.IsUnderlyingThemeDark() ? "dark" : "light";
|
// Keep the URI unqualified so Windows resolves the best matching theme/scale asset from the package.
|
||||||
var scale = GetClosestAvailableScale();
|
return new($"{NotificationIconRootUri}{iconName}.png");
|
||||||
return new($"{NotificationIconRootUri}{iconName}.theme-{theme}.scale-{scale}.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int GetClosestAvailableScale()
|
|
||||||
{
|
|
||||||
var rasterScale = 1.0;
|
|
||||||
|
|
||||||
if (WinoApplication.MainWindow?.Content is FrameworkElement rootElement &&
|
|
||||||
rootElement.XamlRoot != null)
|
|
||||||
{
|
|
||||||
rasterScale = rootElement.XamlRoot.RasterizationScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
var requestedScale = (int)Math.Round(rasterScale * 100);
|
|
||||||
return SupportedIconScales.OrderBy(s => Math.Abs(s - requestedScale)).First();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,66 +99,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Assets\CalendarWide310x150Logo.png" />
|
<None Remove="Assets\CalendarWide310x150Logo.png" />
|
||||||
<None Remove="Assets\NotificationIcons\calendar-join.theme-dark.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-join.theme-dark.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-join.theme-dark.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-join.theme-dark.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-join.theme-dark.scale-400.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-join.theme-light.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-join.theme-light.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-join.theme-light.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-join.theme-light.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-join.theme-light.scale-400.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-snooze.theme-dark.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-snooze.theme-dark.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-snooze.theme-dark.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-snooze.theme-dark.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-snooze.theme-dark.scale-400.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-snooze.theme-light.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-snooze.theme-light.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-snooze.theme-light.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-snooze.theme-light.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\calendar-snooze.theme-light.scale-400.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\dismiss.theme-dark.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\dismiss.theme-dark.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\dismiss.theme-dark.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\dismiss.theme-dark.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\dismiss.theme-dark.scale-400.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\dismiss.theme-light.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\dismiss.theme-light.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\dismiss.theme-light.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\dismiss.theme-light.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\dismiss.theme-light.scale-400.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-archive.theme-dark.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-archive.theme-dark.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-archive.theme-dark.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-archive.theme-dark.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-archive.theme-dark.scale-400.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-archive.theme-light.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-archive.theme-light.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-archive.theme-light.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-archive.theme-light.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-archive.theme-light.scale-400.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-delete.theme-dark.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-delete.theme-dark.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-delete.theme-dark.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-delete.theme-dark.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-delete.theme-dark.scale-400.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-delete.theme-light.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-delete.theme-light.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-delete.theme-light.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-delete.theme-light.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-delete.theme-light.scale-400.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-markread.theme-dark.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-markread.theme-dark.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-markread.theme-dark.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-markread.theme-dark.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-markread.theme-dark.scale-400.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-markread.theme-light.scale-100.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-markread.theme-light.scale-125.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-markread.theme-light.scale-150.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-markread.theme-light.scale-200.png" />
|
|
||||||
<None Remove="Assets\NotificationIcons\mail-markread.theme-light.scale-400.png" />
|
|
||||||
<None Remove="Assets\UpdateNotes\Images\Calendar.svg" />
|
<None Remove="Assets\UpdateNotes\Images\Calendar.svg" />
|
||||||
<None Remove="Assets\UpdateNotes\Images\Security.svg" />
|
<None Remove="Assets\UpdateNotes\Images\Security.svg" />
|
||||||
<None Remove="Assets\UpdateNotes\Images\Thread.svg" />
|
<None Remove="Assets\UpdateNotes\Images\Thread.svg" />
|
||||||
|
|||||||