From 3252d773fe79323115130342e137bf1df0510bf3 Mon Sep 17 00:00:00 2001 From: Joseph Date: Wed, 13 Mar 2024 00:08:37 +0100 Subject: [PATCH] MAUI Controls --- Firebase.Auth.sln | 55 +++ build/build-libs.ps1 | 3 +- build/build-samples.ps1 | 3 +- build/run-pack.ps1 | 2 + samples/MAUI/App.xaml | 14 + samples/MAUI/App.xaml.cs | 47 ++ samples/MAUI/AppNavigation.xaml | 6 + samples/MAUI/AppNavigation.xaml.cs | 39 ++ samples/MAUI/AppShell.xaml | 14 + samples/MAUI/AppShell.xaml.cs | 39 ++ samples/MAUI/Auth.MAUI.Sample.csproj | 77 ++++ samples/MAUI/LoginPage.xaml | 28 ++ samples/MAUI/LoginPage.xaml.cs | 9 + samples/MAUI/MainPage.xaml | 35 ++ samples/MAUI/MainPage.xaml.cs | 40 ++ samples/MAUI/MauiProgram.cs | 59 +++ .../Platforms/Android/AndroidManifest.xml | 6 + .../MAUI/Platforms/Android/MainActivity.cs | 11 + .../MAUI/Platforms/Android/MainApplication.cs | 16 + .../Android/Resources/values/colors.xml | 6 + .../MAUI/Platforms/MacCatalyst/AppDelegate.cs | 10 + .../Platforms/MacCatalyst/Entitlements.plist | 14 + samples/MAUI/Platforms/MacCatalyst/Info.plist | 38 ++ samples/MAUI/Platforms/MacCatalyst/Program.cs | 16 + samples/MAUI/Platforms/Tizen/Main.cs | 17 + .../MAUI/Platforms/Tizen/tizen-manifest.xml | 15 + samples/MAUI/Platforms/Windows/App.xaml | 8 + samples/MAUI/Platforms/Windows/App.xaml.cs | 25 + .../Platforms/Windows/Package.appxmanifest | 46 ++ samples/MAUI/Platforms/Windows/app.manifest | 15 + samples/MAUI/Platforms/iOS/AppDelegate.cs | 10 + samples/MAUI/Platforms/iOS/Info.plist | 32 ++ samples/MAUI/Platforms/iOS/Program.cs | 16 + samples/MAUI/Properties/launchSettings.json | 8 + samples/MAUI/Resources/AppIcon/appicon.svg | 4 + samples/MAUI/Resources/AppIcon/appiconfg.svg | 8 + .../MAUI/Resources/Fonts/OpenSans-Regular.ttf | Bin 0 -> 107168 bytes .../Resources/Fonts/OpenSans-Semibold.ttf | Bin 0 -> 111056 bytes samples/MAUI/Resources/Images/dotnet_bot.png | Bin 0 -> 69811 bytes samples/MAUI/Resources/Raw/AboutAssets.txt | 15 + samples/MAUI/Resources/Splash/splash.svg | 8 + samples/MAUI/Resources/Styles/Colors.xaml | 45 ++ samples/MAUI/Resources/Styles/Styles.xaml | 426 ++++++++++++++++++ src/Auth.UI.MAUI/Assets/anonymous.png | Bin 0 -> 551 bytes src/Auth.UI.MAUI/Assets/apple.png | Bin 0 -> 5743 bytes src/Auth.UI.MAUI/Assets/facebook.png | Bin 0 -> 918 bytes src/Auth.UI.MAUI/Assets/firebase.png | Bin 0 -> 11776 bytes src/Auth.UI.MAUI/Assets/github.png | Bin 0 -> 3248 bytes src/Auth.UI.MAUI/Assets/google.png | Bin 0 -> 3114 bytes src/Auth.UI.MAUI/Assets/mail.png | Bin 0 -> 1215 bytes src/Auth.UI.MAUI/Assets/microsoft.png | Bin 0 -> 2920 bytes src/Auth.UI.MAUI/Assets/twitter.png | Bin 0 -> 2164 bytes src/Auth.UI.MAUI/Auth.UI.MAUI.csproj | 82 ++++ src/Auth.UI.MAUI/Components/ContentPage.cs | 10 + src/Auth.UI.MAUI/Components/HyperlinkSpan.cs | 77 ++++ src/Auth.UI.MAUI/Components/LinksFooter.xaml | 14 + .../Components/LinksFooter.xaml.cs | 15 + src/Auth.UI.MAUI/Converters/AssetConverter.cs | 25 + .../Converters/BackgroundConverter.cs | 34 ++ .../Converters/ForegroundConverter.cs | 19 + src/Auth.UI.MAUI/Converters/TitleConverter.cs | 19 + src/Auth.UI.MAUI/FirebaseMainPage.xaml | 8 + src/Auth.UI.MAUI/FirebaseMainPage.xaml.cs | 9 + src/Auth.UI.MAUI/FirebaseUIControl.xaml | 23 + src/Auth.UI.MAUI/FirebaseUIControl.xaml.cs | 58 +++ src/Auth.UI.MAUI/Launcher.cs | 22 + src/Auth.UI.MAUI/LoginRouter.cs | 59 +++ src/Auth.UI.MAUI/Pages/EmailPage.xaml | 52 +++ src/Auth.UI.MAUI/Pages/EmailPage.xaml.cs | 85 ++++ src/Auth.UI.MAUI/Pages/ProvidersPage.xaml | 92 ++++ src/Auth.UI.MAUI/Pages/ProvidersPage.xaml.cs | 99 ++++ .../Pages/RecoverPasswordPage.xaml | 58 +++ .../Pages/RecoverPasswordPage.xaml.cs | 71 +++ src/Auth.UI.MAUI/Pages/SignInPage.xaml | 71 +++ src/Auth.UI.MAUI/Pages/SignInPage.xaml.cs | 88 ++++ src/Auth.UI.MAUI/Pages/SignUpPage.xaml | 73 +++ src/Auth.UI.MAUI/Pages/SignUpPage.xaml.cs | 104 +++++ .../Platforms/Android/PlatformClass1.cs | 7 + .../Platforms/MacCatalyst/PlatformClass1.cs | 7 + .../Platforms/Tizen/PlatformClass1.cs | 9 + .../Platforms/Windows/PlatformClass1.cs | 7 + .../Platforms/iOS/PlatformClass1.cs | 7 + src/Auth.UI.MAUI/Themes/Generic.xaml | 41 ++ src/Auth.UI.MAUI/Themes/Generic.xaml.cs | 9 + src/Auth.UI.MAUI/UIFLow.cs | 203 +++++++++ src/Auth.UI.MAUI/WebAuthenticationBroker.cs | 54 +++ .../WebAuthenticationBrokerWindow.cs | 17 + .../tools/VisualStudioToolsManifest.xml | 7 + src/Auth.UI/EmailValidator.cs | 10 +- 89 files changed, 2927 insertions(+), 3 deletions(-) create mode 100644 samples/MAUI/App.xaml create mode 100644 samples/MAUI/App.xaml.cs create mode 100644 samples/MAUI/AppNavigation.xaml create mode 100644 samples/MAUI/AppNavigation.xaml.cs create mode 100644 samples/MAUI/AppShell.xaml create mode 100644 samples/MAUI/AppShell.xaml.cs create mode 100644 samples/MAUI/Auth.MAUI.Sample.csproj create mode 100644 samples/MAUI/LoginPage.xaml create mode 100644 samples/MAUI/LoginPage.xaml.cs create mode 100644 samples/MAUI/MainPage.xaml create mode 100644 samples/MAUI/MainPage.xaml.cs create mode 100644 samples/MAUI/MauiProgram.cs create mode 100644 samples/MAUI/Platforms/Android/AndroidManifest.xml create mode 100644 samples/MAUI/Platforms/Android/MainActivity.cs create mode 100644 samples/MAUI/Platforms/Android/MainApplication.cs create mode 100644 samples/MAUI/Platforms/Android/Resources/values/colors.xml create mode 100644 samples/MAUI/Platforms/MacCatalyst/AppDelegate.cs create mode 100644 samples/MAUI/Platforms/MacCatalyst/Entitlements.plist create mode 100644 samples/MAUI/Platforms/MacCatalyst/Info.plist create mode 100644 samples/MAUI/Platforms/MacCatalyst/Program.cs create mode 100644 samples/MAUI/Platforms/Tizen/Main.cs create mode 100644 samples/MAUI/Platforms/Tizen/tizen-manifest.xml create mode 100644 samples/MAUI/Platforms/Windows/App.xaml create mode 100644 samples/MAUI/Platforms/Windows/App.xaml.cs create mode 100644 samples/MAUI/Platforms/Windows/Package.appxmanifest create mode 100644 samples/MAUI/Platforms/Windows/app.manifest create mode 100644 samples/MAUI/Platforms/iOS/AppDelegate.cs create mode 100644 samples/MAUI/Platforms/iOS/Info.plist create mode 100644 samples/MAUI/Platforms/iOS/Program.cs create mode 100644 samples/MAUI/Properties/launchSettings.json create mode 100644 samples/MAUI/Resources/AppIcon/appicon.svg create mode 100644 samples/MAUI/Resources/AppIcon/appiconfg.svg create mode 100644 samples/MAUI/Resources/Fonts/OpenSans-Regular.ttf create mode 100644 samples/MAUI/Resources/Fonts/OpenSans-Semibold.ttf create mode 100644 samples/MAUI/Resources/Images/dotnet_bot.png create mode 100644 samples/MAUI/Resources/Raw/AboutAssets.txt create mode 100644 samples/MAUI/Resources/Splash/splash.svg create mode 100644 samples/MAUI/Resources/Styles/Colors.xaml create mode 100644 samples/MAUI/Resources/Styles/Styles.xaml create mode 100644 src/Auth.UI.MAUI/Assets/anonymous.png create mode 100644 src/Auth.UI.MAUI/Assets/apple.png create mode 100644 src/Auth.UI.MAUI/Assets/facebook.png create mode 100644 src/Auth.UI.MAUI/Assets/firebase.png create mode 100644 src/Auth.UI.MAUI/Assets/github.png create mode 100644 src/Auth.UI.MAUI/Assets/google.png create mode 100644 src/Auth.UI.MAUI/Assets/mail.png create mode 100644 src/Auth.UI.MAUI/Assets/microsoft.png create mode 100644 src/Auth.UI.MAUI/Assets/twitter.png create mode 100644 src/Auth.UI.MAUI/Auth.UI.MAUI.csproj create mode 100644 src/Auth.UI.MAUI/Components/ContentPage.cs create mode 100644 src/Auth.UI.MAUI/Components/HyperlinkSpan.cs create mode 100644 src/Auth.UI.MAUI/Components/LinksFooter.xaml create mode 100644 src/Auth.UI.MAUI/Components/LinksFooter.xaml.cs create mode 100644 src/Auth.UI.MAUI/Converters/AssetConverter.cs create mode 100644 src/Auth.UI.MAUI/Converters/BackgroundConverter.cs create mode 100644 src/Auth.UI.MAUI/Converters/ForegroundConverter.cs create mode 100644 src/Auth.UI.MAUI/Converters/TitleConverter.cs create mode 100644 src/Auth.UI.MAUI/FirebaseMainPage.xaml create mode 100644 src/Auth.UI.MAUI/FirebaseMainPage.xaml.cs create mode 100644 src/Auth.UI.MAUI/FirebaseUIControl.xaml create mode 100644 src/Auth.UI.MAUI/FirebaseUIControl.xaml.cs create mode 100644 src/Auth.UI.MAUI/Launcher.cs create mode 100644 src/Auth.UI.MAUI/LoginRouter.cs create mode 100644 src/Auth.UI.MAUI/Pages/EmailPage.xaml create mode 100644 src/Auth.UI.MAUI/Pages/EmailPage.xaml.cs create mode 100644 src/Auth.UI.MAUI/Pages/ProvidersPage.xaml create mode 100644 src/Auth.UI.MAUI/Pages/ProvidersPage.xaml.cs create mode 100644 src/Auth.UI.MAUI/Pages/RecoverPasswordPage.xaml create mode 100644 src/Auth.UI.MAUI/Pages/RecoverPasswordPage.xaml.cs create mode 100644 src/Auth.UI.MAUI/Pages/SignInPage.xaml create mode 100644 src/Auth.UI.MAUI/Pages/SignInPage.xaml.cs create mode 100644 src/Auth.UI.MAUI/Pages/SignUpPage.xaml create mode 100644 src/Auth.UI.MAUI/Pages/SignUpPage.xaml.cs create mode 100644 src/Auth.UI.MAUI/Platforms/Android/PlatformClass1.cs create mode 100644 src/Auth.UI.MAUI/Platforms/MacCatalyst/PlatformClass1.cs create mode 100644 src/Auth.UI.MAUI/Platforms/Tizen/PlatformClass1.cs create mode 100644 src/Auth.UI.MAUI/Platforms/Windows/PlatformClass1.cs create mode 100644 src/Auth.UI.MAUI/Platforms/iOS/PlatformClass1.cs create mode 100644 src/Auth.UI.MAUI/Themes/Generic.xaml create mode 100644 src/Auth.UI.MAUI/Themes/Generic.xaml.cs create mode 100644 src/Auth.UI.MAUI/UIFLow.cs create mode 100644 src/Auth.UI.MAUI/WebAuthenticationBroker.cs create mode 100644 src/Auth.UI.MAUI/WebAuthenticationBrokerWindow.cs create mode 100644 src/Auth.UI.MAUI/tools/VisualStudioToolsManifest.xml diff --git a/Firebase.Auth.sln b/Firebase.Auth.sln index 742b844..5828da2 100644 --- a/Firebase.Auth.sln +++ b/Firebase.Auth.sln @@ -47,6 +47,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Auth.UI.WinUI3", "src\Auth. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Auth.WinUI3.Sample", "samples\WinUI3\Auth.WinUI3.Sample.csproj", "{4D7E8D5F-9DB9-46B3-99F3-2D768BBAA92D}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Auth.UI.MAUI", "src\Auth.UI.MAUI\Auth.UI.MAUI.csproj", "{08B76970-ACB8-4823-AEEA-4E2F32CADD47}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Auth.MAUI.Sample", "samples\MAUI\Auth.MAUI.Sample.csproj", "{249C7854-09D3-4137-BFF1-D32FE972488A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -299,6 +303,56 @@ Global {4D7E8D5F-9DB9-46B3-99F3-2D768BBAA92D}.Release|x86.ActiveCfg = Release|x86 {4D7E8D5F-9DB9-46B3-99F3-2D768BBAA92D}.Release|x86.Build.0 = Release|x86 {4D7E8D5F-9DB9-46B3-99F3-2D768BBAA92D}.Release|x86.Deploy.0 = Release|x86 + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Debug|ARM.ActiveCfg = Debug|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Debug|ARM.Build.0 = Debug|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Debug|ARM64.Build.0 = Debug|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Debug|x64.ActiveCfg = Debug|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Debug|x64.Build.0 = Debug|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Debug|x86.ActiveCfg = Debug|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Debug|x86.Build.0 = Debug|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Release|Any CPU.Build.0 = Release|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Release|ARM.ActiveCfg = Release|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Release|ARM.Build.0 = Release|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Release|ARM64.ActiveCfg = Release|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Release|ARM64.Build.0 = Release|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Release|x64.ActiveCfg = Release|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Release|x64.Build.0 = Release|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Release|x86.ActiveCfg = Release|Any CPU + {08B76970-ACB8-4823-AEEA-4E2F32CADD47}.Release|x86.Build.0 = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|ARM.ActiveCfg = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|ARM.Build.0 = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|ARM.Deploy.0 = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|ARM64.Build.0 = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|ARM64.Deploy.0 = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|x64.ActiveCfg = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|x64.Build.0 = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|x64.Deploy.0 = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|x86.ActiveCfg = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|x86.Build.0 = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Debug|x86.Deploy.0 = Debug|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|Any CPU.Build.0 = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|Any CPU.Deploy.0 = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|ARM.ActiveCfg = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|ARM.Build.0 = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|ARM.Deploy.0 = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|ARM64.ActiveCfg = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|ARM64.Build.0 = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|ARM64.Deploy.0 = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|x64.ActiveCfg = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|x64.Build.0 = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|x64.Deploy.0 = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|x86.ActiveCfg = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|x86.Build.0 = Release|Any CPU + {249C7854-09D3-4137-BFF1-D32FE972488A}.Release|x86.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -310,6 +364,7 @@ Global {31FAEF42-D294-4269-94B8-D5AE76CDF964} = {5528D6EA-402F-4FD9-9A01-0B799AFFC14B} {69BFF1A9-8384-4DD8-BD23-31E384D57499} = {5528D6EA-402F-4FD9-9A01-0B799AFFC14B} {4D7E8D5F-9DB9-46B3-99F3-2D768BBAA92D} = {CF8B7ECC-0E53-4B26-ABB3-0D74BDBB642F} + {249C7854-09D3-4137-BFF1-D32FE972488A} = {CF8B7ECC-0E53-4B26-ABB3-0D74BDBB642F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EBE8EC40-A988-4401-8C7E-61E1165C7D46} diff --git a/build/build-libs.ps1 b/build/build-libs.ps1 index 3720dd2..176f299 100644 --- a/build/build-libs.ps1 +++ b/build/build-libs.ps1 @@ -2,4 +2,5 @@ dotnet build --configuration release .\src\Auth.UI\Auth.UI.csproj dotnet build --configuration release .\src\Auth.UI.WPF\Auth.UI.WPF.csproj dotnet build --configuration release .\src\Auth.UI.WinUI3\Auth.UI.WinUI3.csproj -msbuild /restore /p:Configuration=Release .\src\Auth.UI.UWP\Auth.UI.UWP.csproj \ No newline at end of file +msbuild /restore /p:Configuration=Release .\src\Auth.UI.UWP\Auth.UI.UWP.csproj +dotnet build --configuration release .\src\Auth.UI.MAUI\Auth.UI.MAUI.csproj \ No newline at end of file diff --git a/build/build-samples.ps1 b/build/build-samples.ps1 index adb0509..774b282 100644 --- a/build/build-samples.ps1 +++ b/build/build-samples.ps1 @@ -1,4 +1,5 @@ dotnet build --configuration release .\samples\Console\Auth.Console.Sample.csproj dotnet build --configuration release .\samples\WPF\Auth.WPF.Sample.csproj dotnet build --configuration release .\samples\WinUI3\Auth.WinUI3.Sample.csproj -msbuild /restore /p:Configuration=Debug .\samples\UWP\Auth.UWP.Sample.csproj \ No newline at end of file +msbuild /restore /p:Configuration=Debug .\samples\UWP\Auth.UWP.Sample.csproj +dotnet build --configuration release .\samples\MAUI\Auth.MAUI.Sample.csproj \ No newline at end of file diff --git a/build/run-pack.ps1 b/build/run-pack.ps1 index f5d89ef..62a4b50 100644 --- a/build/run-pack.ps1 +++ b/build/run-pack.ps1 @@ -9,6 +9,7 @@ if ($preview) { dotnet pack --configuration release --output $output --version-suffix=$suffix .\src\Auth.UI.WPF\Auth.UI.WPF.csproj dotnet pack --configuration release --output $output --version-suffix=$suffix .\src\Auth.UI.WinUI3\Auth.UI.WinUI3.csproj msbuild /t:restore,pack /p:Configuration=Release /p:PackageOutputPath=$output /p:VersionSuffix=$suffix .\src\Auth.UI.UWP\Auth.UI.UWP.csproj + dotnet pack --configuration release --output $output --version-suffix=$suffix .\src\Auth.UI.MAUI\Auth.UI.MAUI.csproj } else { $version = $(git describe --tags --abbrev=0).substring(1) write "Creating packages with tag version $version" @@ -16,4 +17,5 @@ if ($preview) { dotnet pack --configuration release --output $output -p:version=$version .\src\Auth.UI.WPF\Auth.UI.WPF.csproj dotnet pack --configuration release --output $output -p:version=$version .\src\Auth.UI.WinUI3\Auth.UI.WinUI3.csproj msbuild /t:restore,pack /p:Configuration=Release /p:PackageOutputPath=$output /p:Version=$version .\src\Auth.UI.UWP\Auth.UI.UWP.csproj + dotnet pack --configuration release --output $output -p:version=$version .\src\Auth.UI.MAUI\Auth.UI.MAUI.csproj } \ No newline at end of file diff --git a/samples/MAUI/App.xaml b/samples/MAUI/App.xaml new file mode 100644 index 0000000..4a49538 --- /dev/null +++ b/samples/MAUI/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/samples/MAUI/App.xaml.cs b/samples/MAUI/App.xaml.cs new file mode 100644 index 0000000..fef1016 --- /dev/null +++ b/samples/MAUI/App.xaml.cs @@ -0,0 +1,47 @@ +using Firebase.Auth; +using Firebase.Auth.UI; +using Firebase.Auth.UI.MAUI; + +namespace Auth.MAUI.Sample +{ + public partial class App : Application + { + public App() + { + InitializeComponent(); + // Use Direct Navigation + UseDirectNavigation(); + // Use APP Shell + //MainPage = new AppShell(); + // Use Navigation Page + //MainPage = new AppNavigation(); + } + + private void UseDirectNavigation() + { + Router.RegisterMainType(Router.NavigationModeEnum.Direct); + MainPage = new LoginPage(); + FirebaseUI.Instance.Client.AuthStateChanged += this.AuthStateChanged; + } + private void AuthStateChanged(object sender, UserEventArgs e) + { + Application.Current.Dispatcher.DispatchAsync(async () => + { + if (e.User == null) + { + if (this.MainPage?.GetType() != Router.MainType) + await Router.NavigateToMain(); + } + else if (e.User.IsAnonymous) + { + if (this.MainPage?.GetType() != typeof(MainPage)) + MainPage = new MainPage(); + } + else if (this.MainPage?.GetType() != typeof(MainPage)) + { + MainPage = new MainPage(); + } + }); + } + } +} diff --git a/samples/MAUI/AppNavigation.xaml b/samples/MAUI/AppNavigation.xaml new file mode 100644 index 0000000..3874c6e --- /dev/null +++ b/samples/MAUI/AppNavigation.xaml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/samples/MAUI/AppNavigation.xaml.cs b/samples/MAUI/AppNavigation.xaml.cs new file mode 100644 index 0000000..684d5da --- /dev/null +++ b/samples/MAUI/AppNavigation.xaml.cs @@ -0,0 +1,39 @@ +using Firebase.Auth; +using Firebase.Auth.UI; +using Firebase.Auth.UI.MAUI; + +namespace Auth.MAUI.Sample; + +public partial class AppNavigation : NavigationPage +{ + public AppNavigation() + { + Router.RegisterMainType(Router.NavigationModeEnum.Stack); + InitializeComponent(); + + FirebaseUI.Instance.Client.AuthStateChanged += this.AuthStateChanged; + } + + private void AuthStateChanged(object sender, UserEventArgs e) + { + Application.Current.Dispatcher.DispatchAsync(async () => + { + Shell.SetBackButtonBehavior(this, new BackButtonBehavior() { IsVisible = false }); + + if (e.User == null) + { + if (this.Navigation.NavigationStack.LastOrDefault()?.GetType() != Router.MainType) + await Router.NavigateToMain(); + } + else if (e.User.IsAnonymous) + { + if (this.Navigation.NavigationStack.LastOrDefault()?.GetType() != typeof(MainPage)) + await Router.NavigateToMain(); + } + else if (this.Navigation.NavigationStack.LastOrDefault()?.GetType() != typeof(MainPage)) + { + await this.Navigation.PushAsync(new MainPage()); + } + }); + } +} \ No newline at end of file diff --git a/samples/MAUI/AppShell.xaml b/samples/MAUI/AppShell.xaml new file mode 100644 index 0000000..fd8efbe --- /dev/null +++ b/samples/MAUI/AppShell.xaml @@ -0,0 +1,14 @@ + + + + + diff --git a/samples/MAUI/AppShell.xaml.cs b/samples/MAUI/AppShell.xaml.cs new file mode 100644 index 0000000..a53e44b --- /dev/null +++ b/samples/MAUI/AppShell.xaml.cs @@ -0,0 +1,39 @@ +using Firebase.Auth.UI; +using Firebase.Auth; +using Firebase.Auth.UI.MAUI; + +namespace Auth.MAUI.Sample +{ + public partial class AppShell : Shell + { + public AppShell() + { + Router.RegisterShellRoutes(); + Router.RegisterMainType(Router.NavigationModeEnum.StackModal); + InitializeComponent(); + + FirebaseUI.Instance.Client.AuthStateChanged += this.AuthStateChanged; + } + + private void AuthStateChanged(object sender, UserEventArgs e) + { + Application.Current.Dispatcher.DispatchAsync(async () => + { + if (e.User == null) + { + if (this.CurrentPage.GetType() != Router.MainType) + await Router.NavigateToMain(); + } + else if (e.User.IsAnonymous) + { + if (this.CurrentPage.GetType() != typeof(MainPage)) + await GoToAsync(nameof(MainPage)); + } + else if (this.CurrentPage.GetType() != typeof(MainPage)) + { + await GoToAsync(nameof(MainPage)); + } + }); + } + } +} diff --git a/samples/MAUI/Auth.MAUI.Sample.csproj b/samples/MAUI/Auth.MAUI.Sample.csproj new file mode 100644 index 0000000..4353afd --- /dev/null +++ b/samples/MAUI/Auth.MAUI.Sample.csproj @@ -0,0 +1,77 @@ + + + + net8.0-android;net8.0-ios;net8.0-maccatalyst + $(TargetFrameworks);net8.0-windows10.0.19041.0 + + + + + + + Exe + Auth.MAUI.Sample + true + true + enable + + + Auth.MAUI.Sample + + + com.companyname.auth.maui.sample + + + 1.0 + 1 + + 11.0 + 13.1 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MSBuild:Compile + + + MSBuild:Compile + + + + diff --git a/samples/MAUI/LoginPage.xaml b/samples/MAUI/LoginPage.xaml new file mode 100644 index 0000000..13b02a9 --- /dev/null +++ b/samples/MAUI/LoginPage.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/MAUI/LoginPage.xaml.cs b/samples/MAUI/LoginPage.xaml.cs new file mode 100644 index 0000000..2af5580 --- /dev/null +++ b/samples/MAUI/LoginPage.xaml.cs @@ -0,0 +1,9 @@ +namespace Auth.MAUI.Sample; + +public partial class LoginPage : ContentPage +{ + public LoginPage() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/samples/MAUI/MainPage.xaml b/samples/MAUI/MainPage.xaml new file mode 100644 index 0000000..ae81c58 --- /dev/null +++ b/samples/MAUI/MainPage.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + +