From a1ba7afb19fabb18b04ddbee25e1d110e41a8c4e Mon Sep 17 00:00:00 2001 From: OmnipotentOwl <1769881+OmnipotentOwl@users.noreply.github.com> Date: Sat, 9 Dec 2023 16:05:13 -0500 Subject: [PATCH] Feature: Add MAUI support (#691) --- .github/workflows/build-samples.yml | 44 +- .github/workflows/ci-build.yml | 134 +-- .github/workflows/release.yml | 25 + .../Properties/AndroidManifest.xml | 4 +- .../Resources/values/styles.xml | 4 +- .../SextantSample.Android.csproj | 33 +- .../SextantSample.ViewModels.csproj | 3 +- Sample/SextantSample.Maui/App.xaml | 11 + Sample/SextantSample.Maui/App.xaml.cs | 20 + Sample/SextantSample.Maui/GlobalUsings.cs | 17 + Sample/SextantSample.Maui/MauiProgram.cs | 40 + .../Platforms/Android/AndroidManifest.xml | 6 + .../Platforms/Android/MainActivity.cs | 24 + .../Platforms/Android/MainApplication.cs | 18 + .../Android/Resources/values/colors.xml | 6 + .../Platforms/MacCatalyst/AppDelegate.cs | 11 + .../Platforms/MacCatalyst/Info.plist | 30 + .../Platforms/MacCatalyst/Program.cs | 15 + .../Platforms/Windows/App.xaml | 8 + .../Platforms/Windows/App.xaml.cs | 26 + .../Platforms/Windows/Package.appxmanifest | 56 ++ .../Platforms/Windows/app.manifest | 15 + .../Platforms/iOS/AppDelegate.cs | 11 + .../Platforms/iOS/Info.plist | 34 + .../Platforms/iOS/Program.cs | 15 + .../Platforms/iOS/Resources/LaunchScreen.xib | 43 + .../Properties/launchSettings.json | 8 + .../Resources/AppIcon/appicon.svg | 4 + .../Resources/AppIcon/appiconfg.svg | 8 + .../Resources/Fonts/OpenSans-Regular.ttf | 3 + .../Resources/Fonts/OpenSans-Semibold.ttf | 3 + .../Resources/Images/dotnet_bot.svg | 93 ++ .../Resources/Raw/AboutAssets.txt | 15 + .../Resources/Splash/splash.svg | 8 + .../Resources/Styles/Colors.xaml | 44 + .../Resources/Styles/Styles.xaml | 405 +++++++++ .../SextantSample.Maui.csproj | 112 +++ .../Views/BlueNavigationView.cs | 16 + .../Views/FirstModalView.xaml | 15 + .../Views/FirstModalView.xaml.cs | 30 + .../SextantSample.Maui/Views/GreenView.xaml | 15 + .../Views/GreenView.xaml.cs | 13 + Sample/SextantSample.Maui/Views/HomeView.xaml | 16 + .../SextantSample.Maui/Views/HomeView.xaml.cs | 27 + Sample/SextantSample.Maui/Views/RedView.xaml | 17 + .../SextantSample.Maui/Views/RedView.xaml.cs | 22 + .../Views/SecondModalView.xaml | 15 + .../Views/SecondModalView.xaml.cs | 20 + .../SextantSample.iOS.csproj | 44 +- Sample/SextantSample.sln | 180 +++- Sample/SextantSample/SextantSample.csproj | 3 +- Sample/global.json | 5 + src/Directory.build.props | 45 +- src/Directory.build.targets | 62 +- src/Sextant.Avalonia/Sextant.Avalonia.csproj | 2 +- src/Sextant.Maui/Behaviors/BehaviorBase.cs | 66 ++ .../NavigationPageSystemPopBehavior.cs | 70 ++ src/Sextant.Maui/GlobalUsings.cs | 9 + .../Mixins/DependencyResolverMixins.cs | 105 +++ src/Sextant.Maui/Mixins/SextantExtensions.cs | 32 + src/Sextant.Maui/NavigationSource.cs | 23 + src/Sextant.Maui/NavigationView.cs | 225 +++++ src/Sextant.Maui/Sextant.Maui.csproj | 32 + src/Sextant.Mocks/Sextant.Mocks.csproj | 4 +- ...antPluginsPopup.netcoreapp3.1.approved.txt | 67 -- .../API/ApiApprovalTests.cs | 87 -- src/Sextant.Plugins.Popup.Tests/PopupMock.cs | 14 - .../PopupNavigationMock.cs | 79 -- .../PopupViewStackServiceFixture.cs | 53 -- .../PopupViewStackServiceTests.cs | 854 ------------------ .../Sextant.Plugins.Popup.Tests.csproj | 28 - ...rovalTests.Sextant.DotNet6_0.verified.txt} | 9 +- ...rovalTests.Sextant.DotNet7_0.verified.txt} | 9 +- ...provalTests.Sextant.DotNet8_0.verified.txt | 196 ++++ src/Sextant.Tests/API/ApiApprovalTests.cs | 71 +- src/Sextant.Tests/API/ApiExtensions.cs | 45 + src/Sextant.Tests/Sextant.Tests.csproj | 10 +- ...lTests.SextantXamForms.net6.0.approved.txt | 51 ++ .../Sextant.XamForms.Tests.csproj | 9 +- src/Sextant.XamForms/Sextant.XamForms.csproj | 6 +- .../Sextant.iOS.Runner.csproj | 8 +- src/Sextant.sln | 16 +- .../{net5 => android}/SextantExtensions.cs | 0 .../Platforms/mac/SextantExtensions.cs | 33 + .../Platforms/net/SextantExtensions.cs | 29 + .../uikit-common/NavigationViewController.cs | 2 + src/Sextant/Sextant.csproj | 55 +- src/Sextant/Sextant.csproj.DotSettings | 1 + .../ViewModelFactoryNotFoundException.cs | 3 + src/global.json | 5 + 90 files changed, 2740 insertions(+), 1469 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 Sample/SextantSample.Maui/App.xaml create mode 100644 Sample/SextantSample.Maui/App.xaml.cs create mode 100644 Sample/SextantSample.Maui/GlobalUsings.cs create mode 100644 Sample/SextantSample.Maui/MauiProgram.cs create mode 100644 Sample/SextantSample.Maui/Platforms/Android/AndroidManifest.xml create mode 100644 Sample/SextantSample.Maui/Platforms/Android/MainActivity.cs create mode 100644 Sample/SextantSample.Maui/Platforms/Android/MainApplication.cs create mode 100644 Sample/SextantSample.Maui/Platforms/Android/Resources/values/colors.xml create mode 100644 Sample/SextantSample.Maui/Platforms/MacCatalyst/AppDelegate.cs create mode 100644 Sample/SextantSample.Maui/Platforms/MacCatalyst/Info.plist create mode 100644 Sample/SextantSample.Maui/Platforms/MacCatalyst/Program.cs create mode 100644 Sample/SextantSample.Maui/Platforms/Windows/App.xaml create mode 100644 Sample/SextantSample.Maui/Platforms/Windows/App.xaml.cs create mode 100644 Sample/SextantSample.Maui/Platforms/Windows/Package.appxmanifest create mode 100644 Sample/SextantSample.Maui/Platforms/Windows/app.manifest create mode 100644 Sample/SextantSample.Maui/Platforms/iOS/AppDelegate.cs create mode 100644 Sample/SextantSample.Maui/Platforms/iOS/Info.plist create mode 100644 Sample/SextantSample.Maui/Platforms/iOS/Program.cs create mode 100644 Sample/SextantSample.Maui/Platforms/iOS/Resources/LaunchScreen.xib create mode 100644 Sample/SextantSample.Maui/Properties/launchSettings.json create mode 100644 Sample/SextantSample.Maui/Resources/AppIcon/appicon.svg create mode 100644 Sample/SextantSample.Maui/Resources/AppIcon/appiconfg.svg create mode 100644 Sample/SextantSample.Maui/Resources/Fonts/OpenSans-Regular.ttf create mode 100644 Sample/SextantSample.Maui/Resources/Fonts/OpenSans-Semibold.ttf create mode 100644 Sample/SextantSample.Maui/Resources/Images/dotnet_bot.svg create mode 100644 Sample/SextantSample.Maui/Resources/Raw/AboutAssets.txt create mode 100644 Sample/SextantSample.Maui/Resources/Splash/splash.svg create mode 100644 Sample/SextantSample.Maui/Resources/Styles/Colors.xaml create mode 100644 Sample/SextantSample.Maui/Resources/Styles/Styles.xaml create mode 100644 Sample/SextantSample.Maui/SextantSample.Maui.csproj create mode 100644 Sample/SextantSample.Maui/Views/BlueNavigationView.cs create mode 100644 Sample/SextantSample.Maui/Views/FirstModalView.xaml create mode 100644 Sample/SextantSample.Maui/Views/FirstModalView.xaml.cs create mode 100644 Sample/SextantSample.Maui/Views/GreenView.xaml create mode 100644 Sample/SextantSample.Maui/Views/GreenView.xaml.cs create mode 100644 Sample/SextantSample.Maui/Views/HomeView.xaml create mode 100644 Sample/SextantSample.Maui/Views/HomeView.xaml.cs create mode 100644 Sample/SextantSample.Maui/Views/RedView.xaml create mode 100644 Sample/SextantSample.Maui/Views/RedView.xaml.cs create mode 100644 Sample/SextantSample.Maui/Views/SecondModalView.xaml create mode 100644 Sample/SextantSample.Maui/Views/SecondModalView.xaml.cs create mode 100644 Sample/global.json create mode 100644 src/Sextant.Maui/Behaviors/BehaviorBase.cs create mode 100644 src/Sextant.Maui/Behaviors/NavigationPageSystemPopBehavior.cs create mode 100644 src/Sextant.Maui/GlobalUsings.cs create mode 100644 src/Sextant.Maui/Mixins/DependencyResolverMixins.cs create mode 100644 src/Sextant.Maui/Mixins/SextantExtensions.cs create mode 100644 src/Sextant.Maui/NavigationSource.cs create mode 100644 src/Sextant.Maui/NavigationView.cs create mode 100644 src/Sextant.Maui/Sextant.Maui.csproj delete mode 100644 src/Sextant.Plugins.Popup.Tests/API/ApiApprovalTests.SextantPluginsPopup.netcoreapp3.1.approved.txt delete mode 100644 src/Sextant.Plugins.Popup.Tests/API/ApiApprovalTests.cs delete mode 100644 src/Sextant.Plugins.Popup.Tests/PopupMock.cs delete mode 100644 src/Sextant.Plugins.Popup.Tests/PopupNavigationMock.cs delete mode 100644 src/Sextant.Plugins.Popup.Tests/PopupViewStackServiceFixture.cs delete mode 100644 src/Sextant.Plugins.Popup.Tests/PopupViewStackServiceTests.cs delete mode 100644 src/Sextant.Plugins.Popup.Tests/Sextant.Plugins.Popup.Tests.csproj rename src/Sextant.Tests/API/{ApiApprovalTests.Sextant.net5.0.approved.txt => ApiApprovalTests.Sextant.DotNet6_0.verified.txt} (97%) rename src/Sextant.Tests/API/{ApiApprovalTests.Sextant.netcoreapp3.1.approved.txt => ApiApprovalTests.Sextant.DotNet7_0.verified.txt} (97%) create mode 100644 src/Sextant.Tests/API/ApiApprovalTests.Sextant.DotNet8_0.verified.txt create mode 100644 src/Sextant.Tests/API/ApiExtensions.cs create mode 100644 src/Sextant.XamForms.Tests/API/ApiApprovalTests.SextantXamForms.net6.0.approved.txt rename src/Sextant/Platforms/{net5 => android}/SextantExtensions.cs (100%) create mode 100644 src/Sextant/Platforms/mac/SextantExtensions.cs create mode 100644 src/Sextant/Platforms/net/SextantExtensions.cs diff --git a/.github/workflows/build-samples.yml b/.github/workflows/build-samples.yml index 30c596a7..8c6befea 100644 --- a/.github/workflows/build-samples.yml +++ b/.github/workflows/build-samples.yml @@ -5,6 +5,7 @@ on: branches: [ main ] pull_request: branches: [ main ] + workflow_dispatch: jobs: build-samples: @@ -12,25 +13,50 @@ jobs: matrix: configuration: [Debug, Release] - runs-on: windows-latest + runs-on: windows-2022 steps: + - name: Install Windows SDK 10.0.16299 + shell: pwsh + run: | + Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/p/?linkid=864422 -OutFile winsdk.exe + $startInfo = New-Object System.Diagnostics.ProcessStartInfo + $startInfo.FileName = "winsdk.exe" + $startInfo.Arguments = "/norestart /quiet" + $process = New-Object System.Diagnostics.Process + $process.StartInfo = $startInfo + $process.Start() + $process.WaitForExit() + + - name: Setup Java JDK + uses: actions/setup-java@v4.0.0 + with: + distribution: 'microsoft' + java-version: '11' + - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 lfs: true - # Install the .NET Core workload - - name: Install .NET Core 3.1.x - uses: actions/setup-dotnet@v1 + # Install the .NET workload + - name: Setup .NET 6/7/8 + uses: actions/setup-dotnet@v3 with: - dotnet-version: 3.1.x + dotnet-version: | + 6.0.x + 7.0.x + 8.0.x - - name: Install .NET 5.0.x - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.0.x + - name: Install DotNet workloads + shell: bash + run: | + dotnet workload install android + dotnet workload install ios + dotnet workload install tvos + dotnet workload install macos + dotnet workload install maui # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild - name: Setup MSBuild.exe diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 984c4177..75b9451d 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -4,130 +4,22 @@ on: push: branches: [ main ] pull_request: - types: [opened, synchronize, reopened, closed] branches: [ main ] - + env: - configuration: Release productNamespacePrefix: "Sextant" +permissions: + contents: read + jobs: build: - runs-on: windows-latest - outputs: - nbgv: ${{ steps.nbgv.outputs.SemVer2 }} - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - lfs: true - - - name: Install .NET Core 3.1.x - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 3.1.x - - - name: Install .NET 5.0.x - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.0.x - - - name: Add MSBuild to PATH - uses: glennawatson/setup-msbuild@v1.0.3 - - # - name: Update VS2019 - # shell: powershell - # run: Start-Process -Wait -PassThru -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "update --passive --norestart --installpath ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise""" - - - name: NBGV - id: nbgv - uses: dotnet/nbgv@master - with: - setAllVars: true - - - name: NuGet Restore - run: dotnet restore - working-directory: src - - - name: Build - run: msbuild /t:build,pack /p:NoPackageAnalysis=true /verbosity:minimal /p:Configuration=${{ env.configuration }} - working-directory: src - - - name: Run Unit Tests and Generate Coverage - uses: glennawatson/coverlet-msbuild@v1 - with: - project-files: '**/*Tests*.csproj' - no-build: true - exclude-filter: '[${{env.productNamespacePrefix}}.*.Tests.*]*' - include-filter: '[${{env.productNamespacePrefix}}*]*' - output-format: cobertura - output: '../../artifacts/' - configuration: ${{ env.configuration }} - - - name: Upload Code Coverage - shell: bash - run: | - echo $PWD - bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -t ${{ env.CODECOV_TOKEN }} -s '$PWD/artifacts' -f '*.xml' - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - - name: Create NuGet Artifacts - uses: actions/upload-artifact@master - with: - name: nuget - path: '**/*.nupkg' - - release: - runs-on: ubuntu-latest - needs: build - if: contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download NuGet Packages - uses: actions/download-artifact@v2 - with: - name: nuget - - - name: Save SignClient Configuration - run: 'echo "$SIGN_CLIENT_CONFIG" > SignPackages.json' - shell: bash - env: - SIGN_CLIENT_CONFIG: ${{secrets.SIGN_CLIENT_CONFIG}} - - - name: Sign NuGet Packages - uses: glennawatson/signclient@v1 - with: - input-files: '**/*.nupkg' - sign-client-secret: ${{ secrets.SIGN_CLIENT_SECRET }} - sign-client-user: ${{ secrets.SIGN_CLIENT_USER_ID }} - project-name: reactiveui - description: reactiveui - config-file: SignPackages.json - - - name: Changelog - uses: glennawatson/ChangeLog@v1 - id: changelog - - - name: Create Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ needs.build.outputs.nbgv }} - release_name: ${{ needs.build.outputs.nbgv }} - body: | - ${{ steps.changelog.outputs.commitLog }} - - - name: NuGet Push - env: - NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }} - SOURCE_URL: https://api.nuget.org/v3/index.json - run: | - dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg - + permissions: + contents: none + uses: reactiveui/actions-common/.github/workflows/workflow-common-setup-and-build.yml@main + with: + configuration: Release + productNamespacePrefix: "Sextant" + useVisualStudioPreview: false + useMauiCheckDotNetTool: false + solutionFile: "Sextant.sln" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..f42547f5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release + +on: + push: + branches: + - main + - patches/* + +env: + productNamespacePrefix: "Sextant" + +jobs: + release: + uses: reactiveui/actions-common/.github/workflows/workflow-common-release.yml@main + with: + configuration: Release + productNamespacePrefix: "Sextant" + useVisualStudioPreview: true + useMauiCheckDotNetTool: false + solutionFile: "Sextant.sln" + secrets: + SIGN_CLIENT_USER_ID: ${{ secrets.SIGN_CLIENT_USER_ID }} + SIGN_CLIENT_SECRET: ${{ secrets.SIGN_CLIENT_SECRET }} + SIGN_CLIENT_CONFIG: ${{ secrets.SIGN_CLIENT_CONFIG }} + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} \ No newline at end of file diff --git a/Sample/SextantSample.Android/Properties/AndroidManifest.xml b/Sample/SextantSample.Android/Properties/AndroidManifest.xml index 868b6601..da365097 100644 --- a/Sample/SextantSample.Android/Properties/AndroidManifest.xml +++ b/Sample/SextantSample.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + - + \ No newline at end of file diff --git a/Sample/SextantSample.Android/Resources/values/styles.xml b/Sample/SextantSample.Android/Resources/values/styles.xml index b6308586..48d15fe3 100644 --- a/Sample/SextantSample.Android/Resources/values/styles.xml +++ b/Sample/SextantSample.Android/Resources/values/styles.xml @@ -4,7 +4,7 @@ - - diff --git a/Sample/SextantSample.Android/SextantSample.Android.csproj b/Sample/SextantSample.Android/SextantSample.Android.csproj index b9181802..b9f25840 100644 --- a/Sample/SextantSample.Android/SextantSample.Android.csproj +++ b/Sample/SextantSample.Android/SextantSample.Android.csproj @@ -15,7 +15,7 @@ Properties\AndroidManifest.xml Resources Assets - v10.0 + v13.0 @@ -58,6 +58,36 @@ true armeabi-v7a + + true + bin\x64\Debug\ + DEBUG;LOGGING + portable + x64 + Off + 8.0 + prompt + + + true + bin\x64\Release\ + true + portable + x64 + Off + 8.0 + prompt + + + true + bin\x64\Sample Release\ + true + portable + x64 + Off + 8.0 + prompt + @@ -66,6 +96,7 @@ + diff --git a/Sample/SextantSample.Core/SextantSample.ViewModels.csproj b/Sample/SextantSample.Core/SextantSample.ViewModels.csproj index 97d13568..8ca4e604 100644 --- a/Sample/SextantSample.Core/SextantSample.ViewModels.csproj +++ b/Sample/SextantSample.Core/SextantSample.ViewModels.csproj @@ -1,7 +1,8 @@ - netstandard2.0 + netstandard2.0;net6.0;net7.0;net8.0 + AnyCPU;x64 diff --git a/Sample/SextantSample.Maui/App.xaml b/Sample/SextantSample.Maui/App.xaml new file mode 100644 index 00000000..28a858fc --- /dev/null +++ b/Sample/SextantSample.Maui/App.xaml @@ -0,0 +1,11 @@ + + + + + + diff --git a/Sample/SextantSample.Maui/App.xaml.cs b/Sample/SextantSample.Maui/App.xaml.cs new file mode 100644 index 00000000..feed922c --- /dev/null +++ b/Sample/SextantSample.Maui/App.xaml.cs @@ -0,0 +1,20 @@ +[assembly: XamlCompilation(XamlCompilationOptions.Compile)] + +namespace SextantSample.Maui +{ + public partial class App : Application + { + public App() + { + InitializeComponent(); + + Locator + .Current + .GetService() + .PushPage(new HomeViewModel(), null, true, false) + .Subscribe(); + + MainPage = Locator.Current.GetNavigationView(); + } + } +} diff --git a/Sample/SextantSample.Maui/GlobalUsings.cs b/Sample/SextantSample.Maui/GlobalUsings.cs new file mode 100644 index 00000000..0de7e8af --- /dev/null +++ b/Sample/SextantSample.Maui/GlobalUsings.cs @@ -0,0 +1,17 @@ +global using Microsoft.Maui; +global using Microsoft.Maui.Controls; +global using Microsoft.Maui.Controls.Hosting; +global using Microsoft.Maui.Hosting; +global using Microsoft.Maui.LifecycleEvents; +global using System; +global using System.Diagnostics; +global using System.Threading.Tasks; +global using Microsoft.Extensions.Logging; +global using ReactiveUI; +global using ReactiveUI.Maui; +global using Sextant; +global using Sextant.Maui; +global using SextantSample.Maui.Views; +global using SextantSample.ViewModels; +global using Splat; +global using Application = Microsoft.Maui.Controls.Application; diff --git a/Sample/SextantSample.Maui/MauiProgram.cs b/Sample/SextantSample.Maui/MauiProgram.cs new file mode 100644 index 00000000..decc2c93 --- /dev/null +++ b/Sample/SextantSample.Maui/MauiProgram.cs @@ -0,0 +1,40 @@ +using static Sextant.Sextant; + +namespace SextantSample.Maui +{ + public static class MauiProgram + { + public static MauiApp CreateMauiApp() + { + MauiAppBuilder builder = MauiApp.CreateBuilder(); + builder + .UseMauiApp() + .ConfigureFonts(fonts => + { + fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); + fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); + }); + + RxApp.DefaultExceptionHandler = new SextantDefaultExceptionHandler(); + IMutableDependencyResolver resolver = Locator.CurrentMutable; + resolver.InitializeSplat(); + resolver.InitializeReactiveUI(); + Instance.InitializeMaui(); + Locator + .CurrentMutable + .RegisterView() + .RegisterView() + .RegisterView() + .RegisterView() + .RegisterView() + .RegisterNavigationView(() => new BlueNavigationView()) + .RegisterViewModel(() => new GreenViewModel(Locator.Current.GetService())); + +#if DEBUG + builder.Logging.AddDebug(); +#endif + + return builder.Build(); + } + } +} diff --git a/Sample/SextantSample.Maui/Platforms/Android/AndroidManifest.xml b/Sample/SextantSample.Maui/Platforms/Android/AndroidManifest.xml new file mode 100644 index 00000000..7570ff62 --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/Android/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Platforms/Android/MainActivity.cs b/Sample/SextantSample.Maui/Platforms/Android/MainActivity.cs new file mode 100644 index 00000000..622f4ba7 --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/Android/MainActivity.cs @@ -0,0 +1,24 @@ +using Android.App; +using Android.Content.PM; +using Android.OS; +using Microsoft.Maui; + +namespace SextantSample.Maui +{ + [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)] + public class MainActivity : MauiAppCompatActivity + { + protected override void OnCreate(Bundle savedInstanceState) + { + base.OnCreate(savedInstanceState); + Platform.Init(this, savedInstanceState); + } + + public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults) + { + Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); + + base.OnRequestPermissionsResult(requestCode, permissions, grantResults); + } + } +} diff --git a/Sample/SextantSample.Maui/Platforms/Android/MainApplication.cs b/Sample/SextantSample.Maui/Platforms/Android/MainApplication.cs new file mode 100644 index 00000000..1f58769b --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/Android/MainApplication.cs @@ -0,0 +1,18 @@ +using Android.App; +using Android.Runtime; +using Microsoft.Maui; +using System; + +namespace SextantSample.Maui +{ + [Application] + public class MainApplication : MauiApplication + { + public MainApplication(IntPtr handle, JniHandleOwnership ownership) + : base(handle, ownership) + { + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Platforms/Android/Resources/values/colors.xml b/Sample/SextantSample.Maui/Platforms/Android/Resources/values/colors.xml new file mode 100644 index 00000000..c04d7492 --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/Android/Resources/values/colors.xml @@ -0,0 +1,6 @@ + + + #512BD4 + #2B0B98 + #2B0B98 + \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Platforms/MacCatalyst/AppDelegate.cs b/Sample/SextantSample.Maui/Platforms/MacCatalyst/AppDelegate.cs new file mode 100644 index 00000000..b61f86f8 --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/MacCatalyst/AppDelegate.cs @@ -0,0 +1,11 @@ +using Foundation; +using Microsoft.Maui; + +namespace SextantSample.Maui +{ + [Register("AppDelegate")] + public class AppDelegate : MauiUIApplicationDelegate + { + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Platforms/MacCatalyst/Info.plist b/Sample/SextantSample.Maui/Platforms/MacCatalyst/Info.plist new file mode 100644 index 00000000..c96dd0a2 --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/MacCatalyst/Info.plist @@ -0,0 +1,30 @@ + + + + + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/Sample/SextantSample.Maui/Platforms/MacCatalyst/Program.cs b/Sample/SextantSample.Maui/Platforms/MacCatalyst/Program.cs new file mode 100644 index 00000000..ee3165bb --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/MacCatalyst/Program.cs @@ -0,0 +1,15 @@ +using UIKit; + +namespace SextantSample.Maui +{ + 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)); + } + } +} \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Platforms/Windows/App.xaml b/Sample/SextantSample.Maui/Platforms/Windows/App.xaml new file mode 100644 index 00000000..19d4aee7 --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/Windows/App.xaml @@ -0,0 +1,8 @@ + + + diff --git a/Sample/SextantSample.Maui/Platforms/Windows/App.xaml.cs b/Sample/SextantSample.Maui/Platforms/Windows/App.xaml.cs new file mode 100644 index 00000000..82163cd6 --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/Windows/App.xaml.cs @@ -0,0 +1,26 @@ +using Microsoft.Maui; +using Microsoft.UI.Xaml; +using Windows.ApplicationModel; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace SextantSample.Maui.WinUI +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + public partial class App : MauiWinUIApplication + { + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} diff --git a/Sample/SextantSample.Maui/Platforms/Windows/Package.appxmanifest b/Sample/SextantSample.Maui/Platforms/Windows/Package.appxmanifest new file mode 100644 index 00000000..a04e3629 --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/Windows/Package.appxmanifest @@ -0,0 +1,56 @@ + + + + + + + + + + $placeholder$ + User Name + $placeholder$.png + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sample/SextantSample.Maui/Platforms/Windows/app.manifest b/Sample/SextantSample.Maui/Platforms/Windows/app.manifest new file mode 100644 index 00000000..380448ab --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/Windows/app.manifest @@ -0,0 +1,15 @@ + + + + + + + + true/PM + PerMonitorV2, PerMonitor + + + diff --git a/Sample/SextantSample.Maui/Platforms/iOS/AppDelegate.cs b/Sample/SextantSample.Maui/Platforms/iOS/AppDelegate.cs new file mode 100644 index 00000000..b61f86f8 --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/iOS/AppDelegate.cs @@ -0,0 +1,11 @@ +using Foundation; +using Microsoft.Maui; + +namespace SextantSample.Maui +{ + [Register("AppDelegate")] + public class AppDelegate : MauiUIApplicationDelegate + { + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Platforms/iOS/Info.plist b/Sample/SextantSample.Maui/Platforms/iOS/Info.plist new file mode 100644 index 00000000..ed2ffb61 --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/iOS/Info.plist @@ -0,0 +1,34 @@ + + + + + LSRequiresIPhoneOS + + MinimumOSVersion + 10.3.4 + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/Sample/SextantSample.Maui/Platforms/iOS/Program.cs b/Sample/SextantSample.Maui/Platforms/iOS/Program.cs new file mode 100644 index 00000000..ee3165bb --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/iOS/Program.cs @@ -0,0 +1,15 @@ +using UIKit; + +namespace SextantSample.Maui +{ + 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)); + } + } +} \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Platforms/iOS/Resources/LaunchScreen.xib b/Sample/SextantSample.Maui/Platforms/iOS/Resources/LaunchScreen.xib new file mode 100644 index 00000000..3e5075f7 --- /dev/null +++ b/Sample/SextantSample.Maui/Platforms/iOS/Resources/LaunchScreen.xib @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sample/SextantSample.Maui/Properties/launchSettings.json b/Sample/SextantSample.Maui/Properties/launchSettings.json new file mode 100644 index 00000000..edf8aadc --- /dev/null +++ b/Sample/SextantSample.Maui/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Windows Machine": { + "commandName": "MsixPackage", + "nativeDebugging": false + } + } +} \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Resources/AppIcon/appicon.svg b/Sample/SextantSample.Maui/Resources/AppIcon/appicon.svg new file mode 100644 index 00000000..9d63b651 --- /dev/null +++ b/Sample/SextantSample.Maui/Resources/AppIcon/appicon.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Resources/AppIcon/appiconfg.svg b/Sample/SextantSample.Maui/Resources/AppIcon/appiconfg.svg new file mode 100644 index 00000000..21dfb25f --- /dev/null +++ b/Sample/SextantSample.Maui/Resources/AppIcon/appiconfg.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Resources/Fonts/OpenSans-Regular.ttf b/Sample/SextantSample.Maui/Resources/Fonts/OpenSans-Regular.ttf new file mode 100644 index 00000000..1beddae5 --- /dev/null +++ b/Sample/SextantSample.Maui/Resources/Fonts/OpenSans-Regular.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:037236ed4bf58a85f67074c165d308260fd6be01c86d7df4e79ea16eb273f8c5 +size 96932 diff --git a/Sample/SextantSample.Maui/Resources/Fonts/OpenSans-Semibold.ttf b/Sample/SextantSample.Maui/Resources/Fonts/OpenSans-Semibold.ttf new file mode 100644 index 00000000..d81c625f --- /dev/null +++ b/Sample/SextantSample.Maui/Resources/Fonts/OpenSans-Semibold.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e8d9e1a89083cd1b0849993fe2f3acc9aa33b7f439f7e8616872f6897f30684 +size 100820 diff --git a/Sample/SextantSample.Maui/Resources/Images/dotnet_bot.svg b/Sample/SextantSample.Maui/Resources/Images/dotnet_bot.svg new file mode 100644 index 00000000..abfaff26 --- /dev/null +++ b/Sample/SextantSample.Maui/Resources/Images/dotnet_bot.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sample/SextantSample.Maui/Resources/Raw/AboutAssets.txt b/Sample/SextantSample.Maui/Resources/Raw/AboutAssets.txt new file mode 100644 index 00000000..15d62448 --- /dev/null +++ b/Sample/SextantSample.Maui/Resources/Raw/AboutAssets.txt @@ -0,0 +1,15 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories). Deployment of the asset to your application +is automatically handled by the following `MauiAsset` Build Action within your `.csproj`. + + + +These files will be deployed with you package and will be accessible using Essentials: + + async Task LoadMauiAsset() + { + using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); + using var reader = new StreamReader(stream); + + var contents = reader.ReadToEnd(); + } diff --git a/Sample/SextantSample.Maui/Resources/Splash/splash.svg b/Sample/SextantSample.Maui/Resources/Splash/splash.svg new file mode 100644 index 00000000..21dfb25f --- /dev/null +++ b/Sample/SextantSample.Maui/Resources/Splash/splash.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Resources/Styles/Colors.xaml b/Sample/SextantSample.Maui/Resources/Styles/Colors.xaml new file mode 100644 index 00000000..245758ba --- /dev/null +++ b/Sample/SextantSample.Maui/Resources/Styles/Colors.xaml @@ -0,0 +1,44 @@ + + + + + #512BD4 + #DFD8F7 + #2B0B98 + White + Black + #E1E1E1 + #C8C8C8 + #ACACAC + #919191 + #6E6E6E + #404040 + #212121 + #141414 + + + + + + + + + + + + + + + #F7B548 + #FFD590 + #FFE5B9 + #28C2D1 + #7BDDEF + #C3F2F4 + #3E8EED + #72ACF1 + #A7CBF6 + + \ No newline at end of file diff --git a/Sample/SextantSample.Maui/Resources/Styles/Styles.xaml b/Sample/SextantSample.Maui/Resources/Styles/Styles.xaml new file mode 100644 index 00000000..dc4a0347 --- /dev/null +++ b/Sample/SextantSample.Maui/Resources/Styles/Styles.xaml @@ -0,0 +1,405 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sample/SextantSample.Maui/SextantSample.Maui.csproj b/Sample/SextantSample.Maui/SextantSample.Maui.csproj new file mode 100644 index 00000000..e328bf52 --- /dev/null +++ b/Sample/SextantSample.Maui/SextantSample.Maui.csproj @@ -0,0 +1,112 @@ + + + + net8.0-ios;net8.0-android;net8.0-maccatalyst + $(TargetFrameworks);net8.0-windows10.0.19041.0 + Exe + SextantSample.Maui + true + true + enable + true + + + SextantSample.Maui + + + com.companyname.SextantSample.Maui + 919dc1f9-17a9-48b3-81f8-0b8016bdfbf7 + + + 1.0 + 1 + + + True + + 14.2 + 14.0 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %(Filename) + + + + + + Designer + + + + + WinExe + win10-x64 + MSIX + + + + + + + diff --git a/Sample/SextantSample.Maui/Views/BlueNavigationView.cs b/Sample/SextantSample.Maui/Views/BlueNavigationView.cs new file mode 100644 index 00000000..5a00c440 --- /dev/null +++ b/Sample/SextantSample.Maui/Views/BlueNavigationView.cs @@ -0,0 +1,16 @@ +namespace SextantSample.Maui.Views +{ + public class BlueNavigationView : NavigationView, IViewFor + { + public BlueNavigationView() + : base(RxApp.MainThreadScheduler, RxApp.TaskpoolScheduler, ViewLocator.Current) + { + BarBackgroundColor = Colors.Blue; + BarTextColor = Colors.White; + } + +#pragma warning disable CA1065 // Do not raise exceptions in unexpected locations + public object ViewModel { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } +#pragma warning restore CA1065 // Do not raise exceptions in unexpected locations + } +} diff --git a/Sample/SextantSample.Maui/Views/FirstModalView.xaml b/Sample/SextantSample.Maui/Views/FirstModalView.xaml new file mode 100644 index 00000000..e37b83ee --- /dev/null +++ b/Sample/SextantSample.Maui/Views/FirstModalView.xaml @@ -0,0 +1,15 @@ + + + + +