Skip to content

Commit

Permalink
Fix: GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaibatsu89 committed Jun 8, 2024
1 parent 9d1cd6a commit fd48ca5
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build
run: dotnet build samples\Plugin.Maui.Feature.Sample.sln -c Release
run: dotnet build samples\Plugin.Maui.Rotatable.Sample.sln -c Release
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build
run: dotnet build src\Plugin.Maui.Feature.sln -c Release
run: dotnet build src\Plugin.Maui.Rotatable.sln -c Release
4 changes: 2 additions & 2 deletions .github/workflows/release-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
$version="${{github.ref_name}}".TrimStart("v")
"version-without-v=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Pack
run: dotnet pack src\Plugin.Maui.Feature.sln -c Release -p:PackageVersion=${{ steps.get_version.outputs.version-without-v }}
run: dotnet pack src\Plugin.Maui.Rotatable.sln -c Release -p:PackageVersion=${{ steps.get_version.outputs.version-without-v }}
- name: Push
run: dotnet nuget push src\Plugin.Maui.Feature\bin\Release\Plugin.Maui.Feature.${{ steps.get_version.outputs.version-without-v }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push src\Plugin.Maui.Rotatable\bin\Release\Plugin.Maui.Rotatable.${{ steps.get_version.outputs.version-without-v }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.NUGET_API_KEY }}
2 changes: 1 addition & 1 deletion README_Feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Install with the dotnet CLI: `dotnet add package Plugin.Maui.Rotatable`, or thro

## API Usage

`Plugin.Maui.Feature` provides the `RotatableImplementation` class that has a single property `IsPortrait` that you can get.
`Plugin.Maui.Rotatable` provides the `RotatableImplementation` class that has a single property `IsPortrait` that you can get.

You can use it as a base class, e.g.: `{Binding IsPortrait}`

Expand Down
33 changes: 22 additions & 11 deletions src/Plugin.Maui.Rotatable/Plugin.Maui.Rotatable.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0</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> -->
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand All @@ -17,24 +16,29 @@
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>

<!-- NuGet -->
<Authors>author</Authors>
<Copyright>Copyright © author and contributors</Copyright>
<Authors>Zaibatsu89</Authors>
<Copyright>Copyright © Zaibatsu89 and contributors</Copyright>
<IsPackable>True</IsPackable>
<PackageProjectUrl>https://github.com/jfversluis/Plugin.Maui.Feature</PackageProjectUrl>
<RepositoryUrl>https://github.com/jfversluis/Plugin.Maui.Feature</RepositoryUrl>
<PackageProjectUrl>https://github.com/Zaibatsu89/Plugin.Maui.Rotatable</PackageProjectUrl>
<RepositoryUrl>https://github.com/Zaibatsu89/Plugin.Maui.Rotatable.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>dotnet-maui;maui;plugin;</PackageTags>
<PackageTags>dotnet-maui;maui;plugin;orientation;</PackageTags>
<IncludeSymbols>True</IncludeSymbols>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Title>.NET MAUI Feature Plugin</Title>
<Description>Plugin.Maui.Feature provides the ability to do this amazing thing in your .NET MAUI application.</Description>
<Title>.NET MAUI Rotatable Plugin</Title>
<Description>Plugin.Maui.Rotatable provides the ability to customize your presentation when the orientation changes inside a .NET MAUI application.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<DebugType>portable</DebugType>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageId>Plugin.Maui.Rotatable</PackageId>
<Company>Zaibatsu89</Company>
<RootNamespace>Plugin.Maui.Rotatable</RootNamespace>
<Version>1.0.0</Version>
</PropertyGroup>

<!-- iOS & MacCatalyst -->
Expand Down Expand Up @@ -62,6 +66,13 @@
<Compile Remove="**\windows\**\*.cs" />
<None Include="**\windows\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<!-- Tizen -->
<ItemGroup Condition="$(TargetFramework.StartsWith('net')) == true AND $(TargetFramework.Contains('-tizen')) != true">
<Compile Remove="**\*.samsung.cs" />
<None Include="**\*.samsung.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\samsung\**\*.cs" />
<None Include="**\samsung\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<!-- .NET (generic) -->
<ItemGroup Condition="!($(TargetFramework.StartsWith('net')) == true AND $(TargetFramework.EndsWith('.0')) == true AND $(TargetFramework.Contains('-')) != true)">
<!-- e.g net6.0 or net8.0 (and higher) -->
Expand All @@ -81,4 +92,4 @@
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
</ItemGroup>

</Project>
</Project>
43 changes: 43 additions & 0 deletions src/Plugin.Maui.Rotatable/Rotatable.samsung.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System.ComponentModel;

namespace Plugin.Maui.Rotatable;

public partial class RotatableImplementation : IRotatable, INotifyPropertyChanged
{
private bool _isPortrait = false;
/// <inheritdoc cref="IRotatable.IsPortrait" />
public bool IsPortrait
{
get
{
return _isPortrait;
}
private set
{
if (_isPortrait != value)
{
_isPortrait = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsPortrait)));
}
}
}

public RotatableImplementation()
{
if (DeviceInfo.Idiom == DeviceIdiom.Desktop) return; // TODO: support desktop form factor
DeviceDisplay.MainDisplayInfoChanged += OnWindowInfoChanged;
IsPortrait = DeviceDisplay.MainDisplayInfo.Orientation == DisplayOrientation.Portrait;
}

~RotatableImplementation()
{
DeviceDisplay.MainDisplayInfoChanged -= OnWindowInfoChanged;
}

private void OnWindowInfoChanged(object? sender, DisplayInfoChangedEventArgs e)
{
IsPortrait = e.DisplayInfo.Orientation == DisplayOrientation.Portrait;
}

public event PropertyChangedEventHandler? PropertyChanged;
}

0 comments on commit fd48ca5

Please sign in to comment.