Skip to content

Commit

Permalink
Add support for net8.0-ios (#98)
Browse files Browse the repository at this point in the history
* Add support for net8.0-ios

* Update workflows for iOS workload

* Generate artifact attestations on master only

---------

Co-authored-by: Dan Ardelean <[email protected]>
Co-authored-by: David Sungaila <[email protected]>
  • Loading branch information
3 people authored Oct 18, 2024
1 parent d8f9c66 commit 44115ff
Show file tree
Hide file tree
Showing 19 changed files with 378 additions and 23,737 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ jobs:
8.x
- name: Setup .NET workload maui-android
run: dotnet workload install maui-android
- name: Setup .NET workload maui-ios
run: dotnet workload install maui-ios
- name: Setup .NET workload maui-windows
run: dotnet workload install maui-windows
- name: Setup .NET workload wasm-tools
Expand All @@ -85,6 +87,7 @@ jobs:
- name: Pack
run: dotnet pack src/PDFtoImage/PDFtoImage.csproj -c ${{ github.event_name != 'workflow_dispatch' && 'Debug' || inputs.build_configuration }} -p:VersionSuffix=ci --no-restore
- name: Generate artifact attestation
if: github.repository == 'sungaila/PDFtoImage' && github.ref == 'refs/heads/master'
uses: actions/attest-build-provenance@main
with:
subject-path: src/PDFtoImage/bin/${{ github.event_name != 'workflow_dispatch' && 'Debug' || inputs.build_configuration }}/*.nupkg
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/githubpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@main
Expand All @@ -23,6 +23,8 @@ jobs:
dotnet-version: 8.x
- name: Setup .NET workload maui-android
run: dotnet workload install maui-android
- name: Setup .NET workload maui-ios
run: dotnet workload install maui-ios
- name: Setup .NET workload wasm-tools
run: dotnet workload install wasm-tools
- name: Update relative paths
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/githubpages_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@main
Expand All @@ -24,6 +24,8 @@ jobs:
dotnet-version: 8.x
- name: Setup .NET workload maui-android
run: dotnet workload install maui-android
- name: Setup .NET workload maui-ios
run: dotnet workload install maui-ios
- name: Setup .NET workload wasm-tools
run: dotnet workload install wasm-tools
- name: Update relative paths
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ using Conversion = PDFtoImage.Compatibility.Conversion;
* [ASP.NET](https://learn.microsoft.com/en-us/aspnet/overview)
* [ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/introduction-to-aspnet-core)
* [Blazor WebAssembly](https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly)
* [.NET Multi-platform App UI (.NET MAUI)](https://learn.microsoft.com/en-us/dotnet/maui/what-is-maui) (excluding **macOS** and **iOS**)
* [.NET Multi-platform App UI (.NET MAUI)](https://learn.microsoft.com/en-us/dotnet/maui/what-is-maui) (excluding **macOS**)
* [Unity](https://docs.unity3d.com/Manual/Mono.html)
* [Universal Windows Platform (UWP)](https://learn.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide)
* [Windows UI Library 3 (WinUI 3)](https://learn.microsoft.com/en-us/windows/apps/winui/winui3/)
Expand Down
9 changes: 4 additions & 5 deletions src/FrameworkTests/MauiApp/App.xaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Application
x:Class="PDFtoImage.FrameworkTests.MauiApp.App"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiApp">
<Application x:Class="PDFtoImage.FrameworkTests.MauiApp.App"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:PDFtoImage.FrameworkTests.MauiApp">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down
19 changes: 9 additions & 10 deletions src/FrameworkTests/MauiApp/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="PDFtoImage.FrameworkTests.MauiApp.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:PDFtoImage.FrameworkTests.MauiApp"
Shell.FlyoutBehavior="Disabled">
<Shell x:Class="PDFtoImage.FrameworkTests.MauiApp.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:PDFtoImage.FrameworkTests.MauiApp"
Title="PDFtoImage.FrameworkTests.MauiApp"
Shell.FlyoutBehavior="Disabled">

<ShellContent
Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />
<ShellContent Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />

</Shell>
7 changes: 4 additions & 3 deletions src/FrameworkTests/MauiApp/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
Spacing="25"
VerticalOptions="Center">

<Image HeightRequest="200"
<Image x:Name="imgTest"
HeightRequest="200"
HorizontalOptions="Center"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
Source="dotnet_bot.png" />
Expand All @@ -23,7 +24,7 @@
HorizontalOptions="Center"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
SemanticProperties.HeadingLevel="Level2"
Text="Tab the button below to test PDFtoImage." />
Text="Tap the button below to test PDFtoImage." />

<Button x:Name="CounterBtn"
Clicked="OnCounterClicked"
Expand All @@ -34,4 +35,4 @@
</VerticalStackLayout>
</ScrollView>

</ContentPage>
</ContentPage>
10 changes: 9 additions & 1 deletion src/FrameworkTests/MauiApp/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace PDFtoImage.FrameworkTests.MauiApp
using SkiaSharp;

namespace PDFtoImage.FrameworkTests.MauiApp
{
public partial class MainPage : ContentPage
{
Expand All @@ -16,8 +18,14 @@ private async void OnCounterClicked(object sender, EventArgs e)
input.CopyTo(ms);

using var bitmap = PDFtoImage.Conversion.ToImage(ms, 0);
using var encodedImage = new MemoryStream();

OutputLabel.Text = $"SocialPreview.pdf size: {bitmap.Width}x{bitmap.Height}";
bitmap.Encode(encodedImage, SKEncodedImageFormat.Png, 100);

var byteArray = encodedImage.ToArray();

imgTest.Source = ImageSource.FromStream(() => new MemoryStream(byteArray));
}
catch (Exception ex)
{
Expand Down
17 changes: 12 additions & 5 deletions src/FrameworkTests/MauiApp/MauiApp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0-android</TargetFrameworks>
<TargetFrameworks>net8.0-android;net8.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
Expand All @@ -22,14 +22,21 @@
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">13.6</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">33.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net8.0-ios'">
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
Expand All @@ -49,9 +56,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.90" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.90" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.92" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.92" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 44115ff

Please sign in to comment.