Skip to content

Commit

Permalink
chore: merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
rajamatt committed Dec 3, 2024
2 parents f632a3e + 7b28795 commit 27f03f3
Show file tree
Hide file tree
Showing 212 changed files with 4,949 additions and 583 deletions.
39 changes: 32 additions & 7 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
matrix:
include:
- language: csharp
build-mode: none
build-mode: manual
- language: java-kotlin
build-mode: none # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too.
- language: javascript-typescript
Expand All @@ -61,6 +61,35 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Free Disk Space (Ubuntu)
if: runner.os == 'Linux'
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be #v1.3.1
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Pin .NET Version
run: |
cp build/ci/net9/global.json global.json
- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3
with:
global-json-file: global.json
env:
DOTNET_INSTALL_DIR: ${{ runner.temp }}/.dotnet
DOTNET_ROOT: ${{ runner.temp }}/.dotnet

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand All @@ -83,12 +112,8 @@ jobs:
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
cd src/SamplesApp/SamplesApp.Skia.Generic
dotnet build SamplesApp.Skia.Generic.csproj -f net9.0 -c Release -p:UnoTargetFrameworkOverride=net9.0 /bl:ios-netcoremobile-sampleapp.binlog
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand Down
2 changes: 1 addition & 1 deletion build/ci/.azure-devops-wasm-uitests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- task: CopyFiles@2
displayName: 'Publish Wasm Site (net9.0)'
inputs:
SourceFolder: $(build.sourcesdirectory)/src/SamplesApp/SamplesApp.Wasm/bin/Release/net9.0/browser-wasm/publish/wwwroot
SourceFolder: $(build.sourcesdirectory)/src/SamplesApp/SamplesApp.Wasm/bin/Release/net9.0/publish/wwwroot
Contents: '**/*.*'
TargetFolder: $(build.artifactstagingdirectory)/site-net9.0-$(XAML_FLAVOR_BUILD)
CleanTargetFolder: false
Expand Down
14 changes: 13 additions & 1 deletion build/test-scripts/run-net7-template-linux.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ $projects =
@(3, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", @(), @()),

# 5.3 lib
@(3, "5.3/uno53net9Lib/uno53net9Lib.csproj", @(), @())
@(3, "5.3/uno53net9Lib/uno53net9Lib.csproj", @(), @()),

# 5.3 Uno App with Library reference
@(3, "5.3/uno53AppWithLib/uno53AppWithLib/uno53AppWithLib.csproj", @(), @()),

# 5.3 blank publish testing
# Disabled for LXD setup issues
Expand All @@ -91,10 +94,19 @@ $projects =
##
## When adding new template versions, create them in a separate version named folder
## using all the specific features that can be impacted by the use of the Uno.SDK

# Empty marker to allow new tests lines to end with a comma
@()
);

for($i = 0; $i -lt $projects.Length; $i++)
{
# Skip the end marker to help for new tests authoring
if ($projects[$i].Length -eq 0)
{
continue
}

$projectTestGroup=$projects[$i][0];
$projectPath=$projects[$i][1];
$projectParameters=$projects[$i][2];
Expand Down
17 changes: 17 additions & 0 deletions build/test-scripts/run-netcore-mobile-template-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,31 @@ $projects =
# Ensure that build can happen even if a RID is specified
@(4, "5.3/uno53net9blank/uno53net9blank/uno53net9blank.csproj", @("-f", "net9.0-android", "-r", "android-arm64"), @("macOS", "NetCore"))

# Ensure that build can happen even if a RID is specified
@(4, "5.3/uno53AppWithLib/uno53AppWithLib/uno53AppWithLib.csproj", @("-f", "net9.0"), @("macOS", "NetCore")),
@(4, "5.3/uno53AppWithLib/uno53AppWithLib/uno53AppWithLib.csproj", @("-f", "net9.0-browserwasm"), @("macOS", "NetCore")),
@(4, "5.3/uno53AppWithLib/uno53AppWithLib/uno53AppWithLib.csproj", @("-f", "net9.0-ios"), @("macOS", "NetCore")),
@(4, "5.3/uno53AppWithLib/uno53AppWithLib/uno53AppWithLib.csproj", @("-f", "net9.0-android"), @("macOS", "NetCore")),
@(4, "5.3/uno53AppWithLib/uno53AppWithLib/uno53AppWithLib.csproj", @("-f", "net9.0-maccatalyst"), @("macOS", "NetCore")),
@(4, "5.3/uno53AppWithLib/uno53AppWithLib/uno53AppWithLib.csproj", @("-f", "net9.0-desktop"), @("macOS", "NetCore")),

## Note for contributors
##
## When adding new template versions, create them in a separate version named folder
## using all the specific features that can be impacted by the use of the Uno.SDK

# Empty marker to allow new tests lines to end with a comma
@()
);

for($i = 0; $i -lt $projects.Length; $i++)
{
# Skip the end marker to help for new tests authoring
if ($projects[$i].Length -eq 0)
{
continue
}

$projectTestGroup=$projects[$i][0];
$projectPath=$projects[$i][1];
$projectOptions=$projects[$i][2];
Expand Down
14 changes: 13 additions & 1 deletion doc/articles/controls/Frame.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,16 @@ uid: Uno.Controls.Frame

## Using Frame with Uno

To improve performance during navigation, `Frame` on Android, iOS, and WebAssembly targets operates in different way than in WinUI. Whereas WinUI follows `NavigationCacheMode` property on individual `Page` instances, on iOS and Android we keep the individual page instances in the back stack in memory by default. This way the can be quickly surfaced back to the user during back navigation. This behavior can be controlled using the `FeatureConfiguration.Frame.UseWinUIBehavior` property. This defaults to `true` on Skia targets and to `false` on Android, iOS and WebAssembly.
To improve performance during navigation, `Frame` on Android, iOS, and WebAssembly targets operates in different way than in WinUI. Whereas WinUI follows `NavigationCacheMode` property on individual `Page` instances, on iOS and Android we keep the individual page instances in the back stack in memory by default. This way they can be quickly surfaced back to the user during back navigation. This behavior can be controlled using the `FeatureConfiguration.Frame.UseWinUIBehavior` property. This defaults to `true` on Skia targets and to `false` on Android, iOS and WebAssembly.

If you set `UseWinUIBehavior` to `true` on Android and iOS, you also need to override the default style for the control. You can do this by explicitly setting the `Style` to `XamlDefaultFrame`:

```xml
<Frame Style="{StaticResource XamlDefaultFrame}" />
```

Or by creating an implicit style based on `XamlDefaultFrame`:

```xml
<Style TargetType="Frame" BasedOn="XamlDefaultFrame" />
```
14 changes: 14 additions & 0 deletions doc/articles/features/using-the-uno-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,20 @@ By Default when using the Uno.Sdk you get the added benefit of default includes

As discussed above setting `EnableDefaultUnoItems` to false will disable these includes.

> [!TIP]
> When you need to exclude specific files from a particular target framework (such as WebAssembly), you can use a custom MSBuild target:
>
> ```xml
> <Target Name="AdjustAppItemGroups" BeforeTargets="ResolveAssemblyReferences">
> <ItemGroup Condition="'$(TargetFramework)' == 'net9.0-browserwasm'">
> <None Remove="Page.xaml"/>
> <Page Remove="Page.xaml"/>
> </ItemGroup>
> </Target>
> ```
>
> This approach allows you to selectively remove pages from specific target frameworks while maintaining them in others.
## Apple Privacy Manifest Support
Starting May 1st, 2024, Apple requires the inclusion of a new file, the [Privacy Manifest file](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files) (named `PrivacyInfo.xcprivacy`), in app bundles. This file is crucial for complying with updated privacy regulations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ For Android, there is one permission you must configure before using this API in
- The `Cancel` method is not supported.
- The parameter of the `Vibrate(TimeSpan)` method is not taken into account - iOS supports only a default vibration duration.

#### WinUI

- The `Windows.Phone.Devices.Notification` namespace is no longer supported in WinUI.
- Developers should use the [Windows.Devices.Haptics](xref:Uno.Features.WDHaptics) namespace for vibration functionality.

#### UWP

- The `VibrationDevice` class is only available in the UWP-head if the `Windows.Mobile.Extensions for the UWP` is added to the project.
7 changes: 6 additions & 1 deletion doc/articles/guides/profiling-applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Run the following commands

- `dotnet tool update -g dotnet-dsrouter`
- `dotnet tool update -g dotnet-trace`
- `dotnet tool update -g dotnet-gcdump`

## Profiling .NET iOS applications

Expand Down Expand Up @@ -164,7 +165,11 @@ The `suspend` directive means that the application will wait for `dotnet-trace`

- Open a browser at `https://speedscope.app` and drop the `*.speedscope.json` file in it

See complete [documentation](https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/tracing.md) for more details.
### Getting GC memory dumps

To take a GC memory dump of a running android app, follow the same steps above, but instead of `dotnet-trace collect -p <port>`, use `dotnet-gcdump collect -p <port>`. It will create a `.gcdump` file that can be viewed in Visual Studio and Perfview on Windows and [heapview](https://github.com/1hub/dotnet-heapview) on non-Windows platforms.

See complete [documentation](https://github.com/dotnet/android/blob/main/Documentation/guides/tracing.md) for more details.

### Analyzing the trace data

Expand Down
33 changes: 21 additions & 12 deletions doc/articles/uno-development/Internal-WeakEventHelper.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The WeakEventHelper class is an internal method that is designed to provide a
memory-friendly environment for registering to events internally in Uno.

This class is not exposed to the end-user because its patterns do not fit with the
original UWP event-based designs of the API.
original WinUI event-based designs of the API.

## The RegisterEvent method

Expand All @@ -17,35 +17,44 @@ that both the source and the target are weak. The source must be kept alive by
another longer-lived reference, and the target is kept alive by the
return disposable.

If the returned disposable is collected, the handler will also be
collected. Conversely, if the provided list is collected
raising the event will produce nothing.
If the provided handler is collected, the registration will
be collected as well. The returned disposable is not tracked, which means that it will
not remove the registration when collected, unless the provided handler is a lambda. In
this case, the lambda's lifetime is tied to the returned disposable.

The WeakEventCollection automatically manages its internal registration list using GC events.

Here's a usage example:

private List<WeakEventHelper.GenericEventHandler> _sizeChangedHandlers = new List<WeakEventHelper.GenericEventHandler>();
```csharp
private WeakEventHelper.WeakEventCollection? _sizeChangedHandlers;

internal IDisposable RegisterSizeChangedEvent(WindowSizeChangedEventHandler handler)
{
return WeakEventHelper.RegisterEvent(
_sizeChangedHandlers,
_sizeChangedHandlers ??= new(),
handler,
(h, s, e) => (h as WindowSizeChangedEventHandler)?.Invoke(s, (WindowSizeChangedEventArgs)e)
);
}

internal void RaiseEvent()
{
_sizeChangedHandlers?.Invoke(this, new WindowSizeChangedEventArgs());
}
```

The RegisterEvent method is intentionally non-generic to avoid the cost related to AOT performance. The
performance cost is shifted to downcast and upcast checks in the `EventRaiseHandler` handlers.

The returned disposable must be used as follows :

private SerialDisposable _sizeChangedSubscription = new SerialDisposable();
```csharp
private IDisposable? _sizeChangedSubscription;

...

_sizeChangedSubscription.Disposable = null;
_sizeChangedSubscription?.Dispose();

if (Owner != null)
{
_sizeChangedSubscription.Disposable = Window.Current.RegisterSizeChangedEvent(OnCurrentWindowSizeChanged);
}
_sizeChangedSubscription = Window.Current.RegisterSizeChangedEvent(OnCurrentWindowSizeChanged);
```
2 changes: 2 additions & 0 deletions doc/articles/uno-development/uno-internals-hotreload.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ Pausing and resuming UI Update is done by calling

Note that pausing UI Updates doesn't stop the Hot Reload process. It only prevents the UI Update from running until UI Updates are resumed.

<!---
## Waiting for Hot Reload to be applied
// TODO: Give an example of how to await UI Updates (eg https://github.com/unoplatform/uno/blob/0340cc1394994cdbd525d61de611a0531c38bcc7/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Given_Frame.cs#L9-L37)
-->
9 changes: 4 additions & 5 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@
<PackageReference Update="Uno.Core.Extensions.Disposables" Version="4.0.1" />
<PackageReference Update="Uno.Core.Extensions.Compatibility" Version="4.0.1" />
<PackageReference Update="Uno.Diagnostics.Eventing" Version="2.0.1" />
<PackageReference Update="Uno.Wasm.Bootstrap" Version="9.0.0-dev.301" />
<PackageReference Update="Uno.Wasm.Bootstrap.DevServer" Version="9.0.0-dev.301" />
<PackageReference Update="MSTest" Version="3.3.1" />
<PackageReference Update="MSTest.TestFramework" Version="3.3.1" />
<PackageReference Update="MSTest.TestAdapter" Version="3.3.1" />
<PackageReference Update="Uno.Wasm.Bootstrap" Version="9.0.8" />
<PackageReference Update="MSTest" Version="3.6.3" />
<PackageReference Update="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Update="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Update="MSTest.Analyzers" Version="3.3.1" />
<PackageReference Update="Uno.MonoAnalyzers" Version="1.0.0" PrivateAssets="all" />
<PackageReference Update="Uno.Wasm.WebSockets" Version="1.1.0" />
Expand Down
8 changes: 3 additions & 5 deletions src/SamplesApp/SamplesApp.Shared/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,8 @@ override void OnLaunched(LaunchActivatedEventArgs e)
}

var sw = Stopwatch.StartNew();
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
// this.DebugSettings.EnableFrameRateCounter = true;
}
#if WINAPPSDK && DEBUG
// this.DebugSettings.EnableFrameRateCounter = true;
#endif
AssertInitialWindowSize();

Expand Down Expand Up @@ -549,6 +546,7 @@ static void ConfigureFeatureFlags()
#if HAS_UNO
Uno.UI.FeatureConfiguration.TextBox.UseOverlayOnSkia = false;
Uno.UI.FeatureConfiguration.ToolTip.UseToolTips = true;
Uno.UI.FeatureConfiguration.DependencyProperty.ValidatePropertyOwnerOnReadWrite = true;

Uno.UI.FeatureConfiguration.Font.DefaultTextFontFamily = "ms-appx:///Uno.Fonts.OpenSans/Fonts/OpenSans.ttf";
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ await TestServices.WindowHelper.RootElementDispatcher.RunAsync(() =>
}
else if (test.ExpectedException is null || !test.ExpectedException.IsInstanceOfType(e))
{
if (_currentRun.CurrentRepeatCount < config.Attempts - 1 && !Debugger.IsAttached)
if (_currentRun.CurrentRepeatCount < config.Attempts - 1)
{
_currentRun.CurrentRepeatCount++;
canRetry = true;
Expand Down
1 change: 1 addition & 0 deletions src/SamplesApp/SamplesApp.Wasm/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static void Main(string[] args)
#endif

Microsoft.UI.Xaml.Application.Start(_ => _app = new App());

}
}
}
4 changes: 3 additions & 1 deletion src/SamplesApp/SamplesApp.Wasm/SamplesApp.Wasm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<WasmShellIncludeWindowsCompatibility>false</WasmShellIncludeWindowsCompatibility>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<!-- Required for net9 workloads -->
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>

<!-- To build with AOT, uncomment these two lines -->
<!--<WasmShellEnableEmccProfiling>true</WasmShellEnableEmccProfiling>
<WasmShellMonoRuntimeExecutionMode>InterpreterAndAOT</WasmShellMonoRuntimeExecutionMode>-->
Expand Down Expand Up @@ -94,7 +97,6 @@
<PackageReference Include="Uno.BenchmarkDotNet.Annotations" Version="0.11.7-develop" />
<PackageReference Include="Uno.Wasm.WebSockets" />
<PackageReference Include="Uno.Wasm.Bootstrap" />
<PackageReference Include="Uno.Wasm.Bootstrap.DevServer" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="9.0.0" />
<PackageReference Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.0-dev.7" />
<PackageReference Include="Uno.Fonts.Fluent" />
Expand Down
7 changes: 7 additions & 0 deletions src/SamplesApp/UITests.Shared/UITests.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml\DragAndDrop\DragDrop_Wasm_Selection.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml\FocusManager\FocusManagerTest.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -6353,6 +6357,9 @@
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml\DragAndDrop\DragDrop_TestPage.xaml.cs">
<DependentUpon>DragDrop_TestPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml\DragAndDrop\DragDrop_Wasm_Selection.xaml.cs">
<DependentUpon>DragDrop_Wasm_Selection.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml\FocusManager\FocusManagerTest.xaml.cs">
<DependentUpon>FocusManagerTest.xaml</DependentUpon>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<UserControl x:Class="UITests.Windows_UI_Xaml.DragAndDrop.DragDrop_Wasm_Selection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<StackPanel Spacing="16">
<TextBlock Text="selectable text: // 1. select from HERE" IsTextSelectionEnabled="True" />

<!-- some controls that typically use drag gestures -->
<Slider />
<ScrollBar Orientation="Horizontal" IndicatorMode="MouseIndicator" />

<TextBlock Text="selectable text: // 2. to THERE" IsTextSelectionEnabled="True" />
</StackPanel>
</UserControl>
Loading

0 comments on commit 27f03f3

Please sign in to comment.