Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

private static readonly string[] _assemblyCandidates =
{
"Microsoft.Windows.AppNotifications",
"Microsoft.WindowsAppSDK",
"Microsoft.Windows.AppNotifications.Projection",
"Microsoft.Windows.AppNotifications.Builder.Projection",
};

public static bool ShowProgress(AbstractOperation operation)
Expand Down Expand Up @@ -375,7 +375,7 @@
return _isRegistered;
}

_managerDefault = managerType.GetProperty("Default", BindingFlags.Public | BindingFlags.Static)

Check warning on line 378 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / test-codebase

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String, BindingFlags)'. The return value of method 'UniGetUI.Avalonia.Infrastructure.WindowsAppNotificationBridge.ResolveType(params String[])' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

Check warning on line 378 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / Linux (Avalonia)

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String, BindingFlags)'. The return value of method 'UniGetUI.Avalonia.Infrastructure.WindowsAppNotificationBridge.ResolveType(params String[])' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
?.GetValue(null);

if (_managerDefault is null)
Expand All @@ -384,20 +384,17 @@
return _isRegistered;
}

managerType.GetMethod("Register", BindingFlags.Public | BindingFlags.Instance)
?.Invoke(_managerDefault, null);

_removeByTagAsyncMethod = managerType.GetMethod(

Check warning on line 387 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / Linux (Avalonia)

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])'. The return value of method 'UniGetUI.Avalonia.Infrastructure.WindowsAppNotificationBridge.ResolveType(params String[])' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
"RemoveByTagAsync",
BindingFlags.Public | BindingFlags.Instance,
binder: null,
types: [typeof(string)],
modifiers: null);

_showMethod = managerType.GetMethod("Show", BindingFlags.Public | BindingFlags.Instance);

Check warning on line 394 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / Linux (Avalonia)

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags)'. The return value of method 'UniGetUI.Avalonia.Infrastructure.WindowsAppNotificationBridge.ResolveType(params String[])' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

// ── B2: subscribe to NotificationInvoked via Expression lambda ──────
var notifEventInfo = managerType.GetEvent("NotificationInvoked");

Check warning on line 397 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / Linux (Avalonia)

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicEvents' in call to 'System.Type.GetEvent(String)'. The return value of method 'UniGetUI.Avalonia.Infrastructure.WindowsAppNotificationBridge.ResolveType(params String[])' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
if (notifEventInfo is not null)
{
var handlerType = notifEventInfo.EventHandlerType!;
Expand All @@ -416,6 +413,14 @@
notifEventInfo.AddEventHandler(_managerDefault, lambda.Compile());
}

managerType.GetMethod(

Check warning on line 416 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / Linux (Avalonia)

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])'. The return value of method 'UniGetUI.Avalonia.Infrastructure.WindowsAppNotificationBridge.ResolveType(params String[])' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
"Register",
BindingFlags.Public | BindingFlags.Instance,
binder: null,
types: Type.EmptyTypes,
modifiers: null)
?.Invoke(_managerDefault, null);

_isRegistered = _showMethod is not null;
}
catch (Exception ex)
Expand Down Expand Up @@ -443,7 +448,7 @@

_removeByTagAsyncMethod?.Invoke(_managerDefault, [tag]);

object builder = Activator.CreateInstance(_builderType)

Check warning on line 451 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / test-codebase

'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in call to 'System.Activator.CreateInstance(Type)'. The field 'UniGetUI.Avalonia.Infrastructure.WindowsAppNotificationBridge._builderType' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

Check warning on line 451 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / Linux (Avalonia)

'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in call to 'System.Activator.CreateInstance(Type)'. The field 'UniGetUI.Avalonia.Infrastructure.WindowsAppNotificationBridge._builderType' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
?? throw new InvalidOperationException("Could not construct AppNotificationBuilder via reflection.");

object? scenarioValue = Enum.Parse(_scenarioType, scenario, ignoreCase: true);
Expand All @@ -463,10 +468,10 @@
{
try
{
object? btn = Activator.CreateInstance(_buttonType, label);

Check warning on line 471 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / test-codebase

'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'System.Activator.CreateInstance(Type, params Object[])'. The field 'UniGetUI.Avalonia.Infrastructure.WindowsAppNotificationBridge._buttonType' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

Check warning on line 471 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / Linux (Avalonia)

'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'System.Activator.CreateInstance(Type, params Object[])'. The field 'UniGetUI.Avalonia.Infrastructure.WindowsAppNotificationBridge._buttonType' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
if (btn is null) continue;
// btn.AddArgument("action", action) returns AppNotificationButton
btn = _buttonType

Check warning on line 474 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / test-codebase

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])'. The field 'UniGetUI.Avalonia.Infrastructure.WindowsAppNotificationBridge._buttonType' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
.GetMethod("AddArgument", BindingFlags.Public | BindingFlags.Instance,
null, [typeof(string), typeof(string)], null)
?.Invoke(btn, ["action", action]) ?? btn;
Expand All @@ -479,7 +484,7 @@
}
}

object? notification = builder

Check warning on line 487 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / test-codebase

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
.GetType()
.GetMethod("BuildNotification", BindingFlags.Public | BindingFlags.Instance)
?.Invoke(builder, null);
Expand All @@ -495,14 +500,24 @@

private static object InvokeFluent(object instance, string methodName, params object?[] args)
{
return instance.GetType().GetMethod(methodName, BindingFlags.Public | BindingFlags.Instance)
?.Invoke(instance, args)
?? instance;
Type type = instance.GetType();
Type[] argTypes = args.Select(a => a?.GetType() ?? typeof(object)).ToArray();

MethodInfo? method = type.GetMethod(

Check warning on line 506 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / test-codebase

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
methodName,
BindingFlags.Public | BindingFlags.Instance,
binder: null,
types: argTypes,
modifiers: null)
?? type.GetMethods(BindingFlags.Public | BindingFlags.Instance)

Check warning on line 512 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / test-codebase

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to 'System.Type.GetMethods(BindingFlags)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
.FirstOrDefault(m => m.Name == methodName && m.GetParameters().Length == args.Length);

return method?.Invoke(instance, args) ?? instance;
}

private static void SetPropertyIfPresent(object instance, string propertyName, object value)
{
instance.GetType().GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance)

Check warning on line 520 in src/UniGetUI.Avalonia/Infrastructure/WindowsAppNotificationBridge.cs

View workflow job for this annotation

GitHub Actions / test-codebase

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String, BindingFlags)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
?.SetValue(instance, value);
}

Expand Down
16 changes: 16 additions & 0 deletions src/UniGetUI.Avalonia/UniGetUI.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@
<AppxGeneratePrisForPortableLibrariesEnabled>false</AppxGeneratePrisForPortableLibrariesEnabled>
</PropertyGroup>

<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<WindowsPackageType>None</WindowsPackageType>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<EnableCoreMrtTooling>false</EnableCoreMrtTooling>
<NoWarn>$(NoWarn);MVVMTK0045</NoWarn>
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == '' and '$(Platform)' == 'arm64'">win-arm64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == '' and ('$(Platform)' == 'x64' or '$(Platform)' == 'x86')">win-$(Platform)</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">win-x64</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250606001" />
</ItemGroup>

<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<PingetCliRuntimeIdentifier Condition="'$(RuntimeIdentifier)' != ''">$(RuntimeIdentifier)</PingetCliRuntimeIdentifier>
<PingetCliRuntimeIdentifier Condition="'$(PingetCliRuntimeIdentifier)' == '' and '$(Platform)' == 'arm64'">win-arm64</PingetCliRuntimeIdentifier>
Expand Down
Loading