Skip to content

Commit

Permalink
Merge pull request #1 from egvijayanand/working
Browse files Browse the repository at this point in the history
Sample project to simulate the issue dotnet/maui#24705
  • Loading branch information
egvijayanand authored Sep 11, 2024
2 parents 0261303 + 408dd61 commit 1663e7d
Show file tree
Hide file tree
Showing 43 changed files with 1,415 additions and 0 deletions.
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"rollForward": "latestMinor",
"version": "9.0.100-rc.1.24452.12"
}
}
54 changes: 54 additions & 0 deletions src/HwvApp/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Application
x:Class="HwvApp.App"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:HwvApp"
mc:Ignorable="d">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Additional Styles -->
<x:Double x:Key="ItemSpacing">10</x:Double>

<Style ApplyToDerivedTypes="True" TargetType="StackBase">
<Setter Property="Spacing"
Value="{StaticResource ItemSpacing}" />
</Style>

<Style x:Key="MauiLabel" TargetType="Label">
<Setter Property="TextColor"
Value="{AppThemeBinding Dark={StaticResource White}, Light={StaticResource Primary}}" />
</Style>

<Style x:Key="Action" TargetType="Button">
<Setter Property="BackgroundColor"
Value="{AppThemeBinding Dark={StaticResource BackgroundDark}, Light={StaticResource BackgroundLight}}" />
<Setter Property="TextColor"
Value="{AppThemeBinding Dark={StaticResource TextDark}, Light={StaticResource TextLight}}" />
<Setter Property="FontFamily"
Value="{StaticResource AppFont}" />
<Setter Property="FontSize"
Value="{StaticResource AppFontSize}" />
<Setter Property="Padding"
Value="14,10" />
</Style>

<Style x:Key="PrimaryAction"
TargetType="Button"
BasedOn="{StaticResource Action}">
<Setter Property="BackgroundColor"
Value="{StaticResource Primary}" />
<Setter Property="FontAttributes"
Value="Bold" />
<Setter Property="TextColor"
Value="{StaticResource White}" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
16 changes: 16 additions & 0 deletions src/HwvApp/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace HwvApp
{
public partial class App : Application
{
public App()
{
InitializeComponent();
UserAppTheme = PlatformAppTheme;
}

protected override Window CreateWindow(IActivationState? activationState)
{
return new MainWindow();
}
}
}
74 changes: 74 additions & 0 deletions src/HwvApp/HwvApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net9.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('osx'))">$(TargetFrameworks);net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-ios;net9.0-maccatalyst;net9.0-windows10.0.19041.0</TargetFrameworks>
<!-- <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-tizen</TargetFrameworks> -->
<TargetFrameworks>$(TargetFrameworks);net9.0</TargetFrameworks>
<OutputType Condition="'$(TargetFramework)' != 'net9.0'">Exe</OutputType>

<!-- .NET MAUI -->
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>

<!-- Project Options -->
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>HwvApp</RootNamespace>
<WindowsPackageType>None</WindowsPackageType>

<!-- Display name -->
<ApplicationTitle>HwvApp</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.hwvapp</ApplicationId>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<!-- Target Platform Options -->
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>

<!-- Minimum Target OS Version for Windows Platform -->
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\appiconfg.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<None Remove="HwvApp.code-workspace" />
<None Remove="HwvApp.slnx" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.*-*" Condition="'$(Configuration)' == 'Debug'" />
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
<BundleResource Include="Platforms\MacCatalyst\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
</ItemGroup>
</Project>
24 changes: 24 additions & 0 deletions src/HwvApp/HwvApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HwvApp", "HwvApp.csproj", "{1080AA5C-2542-4737-978C-F4870F703B6A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1080AA5C-2542-4737-978C-F4870F703B6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1080AA5C-2542-4737-978C-F4870F703B6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1080AA5C-2542-4737-978C-F4870F703B6A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{1080AA5C-2542-4737-978C-F4870F703B6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1080AA5C-2542-4737-978C-F4870F703B6A}.Release|Any CPU.Build.0 = Release|Any CPU
{1080AA5C-2542-4737-978C-F4870F703B6A}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
EndGlobal
5 changes: 5 additions & 0 deletions src/HwvApp/Imports.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
global using HwvApp;
global using HwvApp.Views;

// Static
global using static Microsoft.Maui.Graphics.Colors;
14 changes: 14 additions & 0 deletions src/HwvApp/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Window
x:Class="HwvApp.MainWindow"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vw="clr-namespace:HwvApp.Views"
Title="HwvApp"
mc:Ignorable="d">
<Window.Page>
<vw:MainPage />
</Window.Page>
</Window>
15 changes: 15 additions & 0 deletions src/HwvApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace HwvApp
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

public MainWindow(Page page) : base(page)
{
InitializeComponent();
}
}
}
24 changes: 24 additions & 0 deletions src/HwvApp/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.Extensions.Logging;

namespace HwvApp
{
public static partial class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-SemiBold.ttf", "OpenSansSemiBold");
});

#if DEBUG
builder.Logging.AddDebug();
#endif

return builder.Build();
}
}
}
6 changes: 6 additions & 0 deletions src/HwvApp/Platforms/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="35" />
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
12 changes: 12 additions & 0 deletions src/HwvApp/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Android.App;
using Android.Content.PM;
using Android.OS;

namespace HwvApp
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
public class MainActivity : MauiAppCompatActivity
{

}
}
16 changes: 16 additions & 0 deletions src/HwvApp/Platforms/Android/MainApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Android.App;
using Android.Runtime;

namespace HwvApp
{
[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
6 changes: 6 additions & 0 deletions src/HwvApp/Platforms/Android/Resources/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
</resources>
10 changes: 10 additions & 0 deletions src/HwvApp/Platforms/MacCatalyst/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Foundation;

namespace HwvApp
{
[Register(nameof(AppDelegate))]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
30 changes: 30 additions & 0 deletions src/HwvApp/Platforms/MacCatalyst/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
</dict>
</plist>
43 changes: 43 additions & 0 deletions src/HwvApp/Platforms/MacCatalyst/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>E174.1</string>
</array>
</dict>
<!--
The entry below is only needed when you're using the Preferences API in your app.
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict> -->
</array>
</dict>
</plist>
16 changes: 16 additions & 0 deletions src/HwvApp/Platforms/MacCatalyst/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using ObjCRuntime;
using UIKit;

namespace HwvApp
{
public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
}
Loading

0 comments on commit 1663e7d

Please sign in to comment.