diff --git a/FrontendPlaformUno/.editorconfig b/FrontendPlaformUno/.editorconfig new file mode 100644 index 0000000..b947be6 --- /dev/null +++ b/FrontendPlaformUno/.editorconfig @@ -0,0 +1,167 @@ +; This file is for unifying the coding style for different editors and IDEs. +; More information at http://editorconfig.org + +# This file is the top-most EditorConfig file +root = true + +########################################## +# Common Settings +########################################## + +[*] +indent_style = space +end_of_line = crlf +trim_trailing_whitespace = true +insert_final_newline = true +charset = utf-8 + +########################################## +# File Extension Settings +########################################## + +[*.{yml,yaml}] +indent_size = 2 + +[.vsconfig] +indent_size = 2 +end_of_line = lf + +[*.sln] +indent_style = tab +indent_size = 2 + +[*.{csproj,proj,projitems,shproj}] +indent_size = 2 + +[*.{json,slnf}] +indent_size = 2 +end_of_line = lf + +[*.{props,targets}] +indent_size = 2 + +[*.xaml] +indent_size = 2 +charset = utf-8-bom + +[*.xml] +indent_size = 2 +end_of_line = lf + +[*.plist] +indent_size = 2 +indent_style = tab +end_of_line = lf + +[*.manifest] +indent_size = 2 + +[*.appxmanifest] +indent_size = 2 + +[*.{json,css,webmanifest}] +indent_size = 2 +end_of_line = lf + +[web.config] +indent_size = 2 +end_of_line = lf + +[*.sh] +indent_size = 2 +end_of_line = lf + +[*.cs] +# EOL should be normalized by Git. See https://github.com/dotnet/format/issues/1099 +end_of_line = unset + +# See https://github.com/dotnet/roslyn/issues/20356#issuecomment-310143926 +trim_trailing_whitespace = false + +tab_width = 4 +indent_size = 4 + +# Sort using and Import directives with System.* appearing first +dotnet_sort_system_directives_first = true + +# Avoid "this." and "Me." if not necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +#### Naming styles #### + +# Naming rules + +dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i + +dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.types_should_be_pascal_case.symbols = types +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case + +# Symbol specifications + +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.required_modifiers = + +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +# Naming styles + +dotnet_naming_style.begins_with_i.required_prefix = I +dotnet_naming_style.begins_with_i.required_suffix = +dotnet_naming_style.begins_with_i.word_separator = +dotnet_naming_style.begins_with_i.capitalization = pascal_case + +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case + +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion + +csharp_indent_labels = one_less_than_current +csharp_using_directive_placement = outside_namespace:silent +csharp_prefer_simple_using_statement = true:suggestion +csharp_prefer_braces = true:silent +csharp_style_namespace_declarations = file_scoped:warning +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_top_level_statements = true:silent +csharp_style_prefer_primary_constructors = true:suggestion +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent diff --git a/FrontendPlaformUno/.gitignore b/FrontendPlaformUno/.gitignore new file mode 100644 index 0000000..ef88c20 --- /dev/null +++ b/FrontendPlaformUno/.gitignore @@ -0,0 +1,403 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +# Single Target Config +solution-config.props +# Publish Profiles +!**/Properties/PublishProfiles/*.pubxml \ No newline at end of file diff --git a/FrontendPlaformUno/.run/FrontendPlaformUno.run.xml b/FrontendPlaformUno/.run/FrontendPlaformUno.run.xml new file mode 100644 index 0000000..6ba9ad4 --- /dev/null +++ b/FrontendPlaformUno/.run/FrontendPlaformUno.run.xml @@ -0,0 +1,62 @@ + + + + + + + + + + diff --git a/FrontendPlaformUno/.run/Readme.md b/FrontendPlaformUno/.run/Readme.md new file mode 100644 index 0000000..6e72638 --- /dev/null +++ b/FrontendPlaformUno/.run/Readme.md @@ -0,0 +1,3 @@ +# About the `.run` folder + +This folder is present to add support for the [Rider IDE](https://aka.platform.uno/rider-getstarted). You can remove this folder safely if you're not using Rider. diff --git a/FrontendPlatformUno/.vsconfig b/FrontendPlaformUno/.vsconfig similarity index 72% rename from FrontendPlatformUno/.vsconfig rename to FrontendPlaformUno/.vsconfig index 1c9c228..0439670 100644 --- a/FrontendPlatformUno/.vsconfig +++ b/FrontendPlaformUno/.vsconfig @@ -5,34 +5,30 @@ "Microsoft.VisualStudio.Workload.CoreEditor", "Microsoft.NetCore.Component.SDK", "Microsoft.NetCore.Component.DevelopmentTools", - "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions", - "Microsoft.NetCore.Component.Web", "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites", "Microsoft.VisualStudio.Component.TextTemplating", + "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions", + "Microsoft.NetCore.Component.Web", "Microsoft.VisualStudio.Component.IISExpress", "Component.Microsoft.Web.LibraryManager", "Microsoft.VisualStudio.ComponentGroup.Web", "Microsoft.VisualStudio.Component.Web", "Microsoft.VisualStudio.ComponentGroup.Web.Client", "Microsoft.VisualStudio.Workload.NetWeb", - "Microsoft.VisualStudio.ComponentGroup.Azure.Prerequisites", - "Microsoft.VisualStudio.Workload.Azure", - "Microsoft.VisualStudio.Component.Windows10SDK.19041", + "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.TemplateEngine", + "Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging", "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites", "Microsoft.VisualStudio.Component.Debugger.JustInTime", - "Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging", "Microsoft.VisualStudio.Workload.ManagedDesktop", - "Microsoft.Component.NetFX.Native", - "Microsoft.VisualStudio.Component.Graphics", - "Component.OpenJDK", - "Microsoft.VisualStudio.Component.MonoDebugger", - "Microsoft.VisualStudio.Component.Merq", "Component.Xamarin.RemotedSimulator", - "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.TemplateEngine", - "Component.Xamarin", - "Component.Android.SDK32", + "Microsoft.VisualStudio.Component.MonoDebugger", + "Microsoft.VisualStudio.ComponentGroup.Maui.All", + "Component.Android.SDK34", + "Component.OpenJDK", "Microsoft.VisualStudio.Workload.NetCrossPlat", - "Microsoft.VisualStudio.Workload.NetCoreTools", - "Microsoft.VisualStudio.ComponentGroup.Maui.All" + "Microsoft.VisualStudio.Workload.NetCoreTools" + ], + "extensions": [ + "https://marketplace.visualstudio.com/items?itemName=unoplatform.uno-platform-addin-2022" ] } diff --git a/FrontendPlaformUno/Directory.Build.props b/FrontendPlaformUno/Directory.Build.props new file mode 100644 index 0000000..8daf569 --- /dev/null +++ b/FrontendPlaformUno/Directory.Build.props @@ -0,0 +1,15 @@ + + + enable + enable + true + + + $(NoWarn);NU1507;NETSDK1201;PRI257 + + diff --git a/FrontendPlaformUno/Directory.Build.targets b/FrontendPlaformUno/Directory.Build.targets new file mode 100644 index 0000000..f75adf7 --- /dev/null +++ b/FrontendPlaformUno/Directory.Build.targets @@ -0,0 +1,2 @@ + + diff --git a/FrontendPlaformUno/Directory.Packages.props b/FrontendPlaformUno/Directory.Packages.props new file mode 100644 index 0000000..43f897b --- /dev/null +++ b/FrontendPlaformUno/Directory.Packages.props @@ -0,0 +1,18 @@ + + + + + + + + + + + + + diff --git a/FrontendPlaformUno/FrontendPlaformUno.Tests/AppInfoTests.cs b/FrontendPlaformUno/FrontendPlaformUno.Tests/AppInfoTests.cs new file mode 100644 index 0000000..ab3c02f --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno.Tests/AppInfoTests.cs @@ -0,0 +1,18 @@ +namespace FrontendPlaformUno.Tests; + +public class AppInfoTests +{ + [SetUp] + public void Setup() + { + } + + [Test] + public void AppInfoCreation() + { + var appInfo = new AppConfig { Environment = "Test" }; + + appInfo.Should().NotBeNull(); + appInfo.Environment.Should().Be("Test"); + } +} diff --git a/FrontendPlaformUno/FrontendPlaformUno.Tests/FrontendPlaformUno.Tests.csproj b/FrontendPlaformUno/FrontendPlaformUno.Tests/FrontendPlaformUno.Tests.csproj new file mode 100644 index 0000000..db44850 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno.Tests/FrontendPlaformUno.Tests.csproj @@ -0,0 +1,20 @@ + + + + net8.0 + false + true + + + + + + + + + + + + + + diff --git a/FrontendPlaformUno/FrontendPlaformUno.Tests/GlobalUsings.cs b/FrontendPlaformUno/FrontendPlaformUno.Tests/GlobalUsings.cs new file mode 100644 index 0000000..34486ef --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno.Tests/GlobalUsings.cs @@ -0,0 +1,3 @@ +global using FluentAssertions; +global using FrontendPlaformUno.Models; +global using NUnit.Framework; diff --git a/FrontendPlaformUno/FrontendPlaformUno.UITests/Constants.cs b/FrontendPlaformUno/FrontendPlaformUno.UITests/Constants.cs new file mode 100644 index 0000000..19abac8 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno.UITests/Constants.cs @@ -0,0 +1,12 @@ +namespace FrontendPlaformUno.UITests; + +public class Constants +{ + public readonly static string WebAssemblyDefaultUri = "http://localhost:5000/"; + public readonly static string iOSAppName = "es.brentj.FrontendPlaformUno"; + public readonly static string AndroidAppName = "es.brentj.FrontendPlaformUno"; + public readonly static string iOSDeviceNameOrId = "iPad Pro (12.9-inch) (3rd generation)"; + + public readonly static Platform CurrentPlatform = Platform.Browser; + public readonly static Browser WebAssemblyBrowser = Browser.Chrome; +} diff --git a/FrontendPlaformUno/FrontendPlaformUno.UITests/FrontendPlaformUno.UITests.csproj b/FrontendPlaformUno/FrontendPlaformUno.UITests/FrontendPlaformUno.UITests.csproj new file mode 100644 index 0000000..ef4fb63 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno.UITests/FrontendPlaformUno.UITests.csproj @@ -0,0 +1,17 @@ + + + + net8.0 + true + + + + + + + + + + + + diff --git a/FrontendPlaformUno/FrontendPlaformUno.UITests/Given_MainPage.cs b/FrontendPlaformUno/FrontendPlaformUno.UITests/Given_MainPage.cs new file mode 100644 index 0000000..f056c7b --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno.UITests/Given_MainPage.cs @@ -0,0 +1,25 @@ +namespace FrontendPlaformUno.UITests; + +public class Given_MainPage : TestBase +{ + [Test] + public async Task When_SmokeTest() + { + // NOTICE + // To run UITests, Run the WASM target without debugger. Note + // the port that is being used and update the Constants.cs file + // in the UITests project with the correct port number. + + // Add delay to allow for the splash screen to disappear + await Task.Delay(5000); + + + // Query for the SecondPageButton and then tap it + Query xamlButton = q => q.All().Marked("SecondPageButton"); + App.WaitForElement(xamlButton); + App.Tap(xamlButton); + + // Take a screenshot and add it to the test results + TakeScreenshot("After tapped"); + } +} diff --git a/FrontendPlatformUno/FrontendPlatformUno.UITests/GlobalUsings.cs b/FrontendPlaformUno/FrontendPlaformUno.UITests/GlobalUsings.cs similarity index 97% rename from FrontendPlatformUno/FrontendPlatformUno.UITests/GlobalUsings.cs rename to FrontendPlaformUno/FrontendPlaformUno.UITests/GlobalUsings.cs index be400b2..eb3b6c8 100644 --- a/FrontendPlatformUno/FrontendPlatformUno.UITests/GlobalUsings.cs +++ b/FrontendPlaformUno/FrontendPlaformUno.UITests/GlobalUsings.cs @@ -1,7 +1,5 @@ - global using NUnit.Framework; global using Uno.UITest; global using Uno.UITest.Helpers.Queries; global using Uno.UITests.Helpers; global using Query = System.Func; - diff --git a/FrontendPlaformUno/FrontendPlaformUno.UITests/TestBase.cs b/FrontendPlaformUno/FrontendPlaformUno.UITests/TestBase.cs new file mode 100644 index 0000000..ab50e10 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno.UITests/TestBase.cs @@ -0,0 +1,82 @@ + +namespace FrontendPlaformUno.UITests; + +public class TestBase +{ + private IApp? _app; + + static TestBase() + { + AppInitializer.TestEnvironment.AndroidAppName = Constants.AndroidAppName; + AppInitializer.TestEnvironment.WebAssemblyDefaultUri = Constants.WebAssemblyDefaultUri; + AppInitializer.TestEnvironment.iOSAppName = Constants.iOSAppName; + AppInitializer.TestEnvironment.AndroidAppName = Constants.AndroidAppName; + AppInitializer.TestEnvironment.iOSDeviceNameOrId = Constants.iOSDeviceNameOrId; + AppInitializer.TestEnvironment.CurrentPlatform = Constants.CurrentPlatform; + AppInitializer.TestEnvironment.WebAssemblyBrowser = Constants.WebAssemblyBrowser; + +#if DEBUG + AppInitializer.TestEnvironment.WebAssemblyHeadless = false; +#endif + + // Start the app only once, so the tests runs don't restart it + // and gain some time for the tests. + AppInitializer.ColdStartApp(); + } + + protected IApp App + { + get => _app!; + private set + { + _app = value; + Uno.UITest.Helpers.Queries.Helpers.App = value; + } + } + + [SetUp] + public void SetUpTest() + { + App = AppInitializer.AttachToApp(); + } + + [TearDown] + public void TearDownTest() + { + TakeScreenshot("teardown"); + } + + public FileInfo TakeScreenshot(string stepName) + { + var title = $"{TestContext.CurrentContext.Test.Name}_{stepName}" + .Replace(" ", "_") + .Replace(".", "_"); + + var fileInfo = App.Screenshot(title); + + var fileNameWithoutExt = Path.GetFileNameWithoutExtension(fileInfo.Name); + if (fileNameWithoutExt != title && fileInfo.DirectoryName != null) + { + var destFileName = Path + .Combine(fileInfo.DirectoryName, title + Path.GetExtension(fileInfo.Name)); + + if (File.Exists(destFileName)) + { + File.Delete(destFileName); + } + + File.Move(fileInfo.FullName, destFileName); + + TestContext.AddTestAttachment(destFileName, stepName); + + fileInfo = new FileInfo(destFileName); + } + else + { + TestContext.AddTestAttachment(fileInfo.FullName, stepName); + } + + return fileInfo; + } + +} diff --git a/FrontendPlaformUno/FrontendPlaformUno.sln b/FrontendPlaformUno/FrontendPlaformUno.sln new file mode 100644 index 0000000..3789a8d --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno.sln @@ -0,0 +1,58 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35312.102 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FrontendPlaformUno", "FrontendPlaformUno\FrontendPlaformUno.csproj", "{5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{E17EEAED-92DF-4399-A1AD-E90914D44955}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontendPlaformUno.UITests", "FrontendPlaformUno.UITests\FrontendPlaformUno.UITests.csproj", "{07B45AB6-6827-444D-918A-C5C3E42A173D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontendPlaformUno.Tests", "FrontendPlaformUno.Tests\FrontendPlaformUno.Tests.csproj", "{77538902-6BAD-4164-AF66-5DE8317661F4}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8A8F1605-47C4-4E3E-8D6D-768654BD3DE7}" + ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore + Directory.Build.props = Directory.Build.props + Directory.Build.targets = Directory.Build.targets + Directory.Packages.props = Directory.Packages.props + global.json = global.json + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Release|Any CPU.Build.0 = Release|Any CPU + {5EA00281-83BD-4B28-8D2A-7FBF5FA5C951}.Release|Any CPU.Deploy.0 = Release|Any CPU + {07B45AB6-6827-444D-918A-C5C3E42A173D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07B45AB6-6827-444D-918A-C5C3E42A173D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07B45AB6-6827-444D-918A-C5C3E42A173D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {07B45AB6-6827-444D-918A-C5C3E42A173D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07B45AB6-6827-444D-918A-C5C3E42A173D}.Release|Any CPU.Build.0 = Release|Any CPU + {07B45AB6-6827-444D-918A-C5C3E42A173D}.Release|Any CPU.Deploy.0 = Release|Any CPU + {77538902-6BAD-4164-AF66-5DE8317661F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77538902-6BAD-4164-AF66-5DE8317661F4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77538902-6BAD-4164-AF66-5DE8317661F4}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {77538902-6BAD-4164-AF66-5DE8317661F4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77538902-6BAD-4164-AF66-5DE8317661F4}.Release|Any CPU.Build.0 = Release|Any CPU + {77538902-6BAD-4164-AF66-5DE8317661F4}.Release|Any CPU.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {07B45AB6-6827-444D-918A-C5C3E42A173D} = {E17EEAED-92DF-4399-A1AD-E90914D44955} + {77538902-6BAD-4164-AF66-5DE8317661F4} = {E17EEAED-92DF-4399-A1AD-E90914D44955} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C100779A-C536-48D0-8B2B-2D39626AE74C} + EndGlobalSection +EndGlobal diff --git a/FrontendPlaformUno/FrontendPlaformUno/App.xaml b/FrontendPlaformUno/FrontendPlaformUno/App.xaml new file mode 100644 index 0000000..3085481 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno/App.xaml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + diff --git a/FrontendPlaformUno/FrontendPlaformUno/App.xaml.cs b/FrontendPlaformUno/FrontendPlaformUno/App.xaml.cs new file mode 100644 index 0000000..6f0b717 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno/App.xaml.cs @@ -0,0 +1,199 @@ +using FrontendPlaformUno.Services.Endpoints.Gamenight; +using FrontendPlaformUno.Services.Endpoints.Gamenight.Login; +using Uno.Resizetizer; + +namespace FrontendPlaformUno; + +public class GamenightEndpointOptions : EndpointOptions +{ + public string? ApiKey { get; init; } +} + +public partial class App : Application +{ + /// + /// 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 Window? MainWindow { get; private set; } + protected IHost? Host { get; private set; } + + protected async override void OnLaunched(LaunchActivatedEventArgs args) + { + var builder = this.CreateBuilder(args) + // Add navigation support for toolkit controls such as TabBar and NavigationView + .UseToolkitNavigation() + .Configure(host => host +#if DEBUG + // Switch to Development environment when running in DEBUG + .UseEnvironment(Environments.Development) +#endif + .UseLogging(configure: (context, logBuilder) => + { + // Configure log levels for different categories of logging + logBuilder + .SetMinimumLevel( + context.HostingEnvironment.IsDevelopment() ? + LogLevel.Information : + LogLevel.Warning) + + // Default filters for core Uno Platform namespaces + .CoreLogLevel(LogLevel.Warning); + + // Uno Platform namespace filter groups + // Uncomment individual methods to see more detailed logging + //// Generic Xaml events + //logBuilder.XamlLogLevel(LogLevel.Debug); + //// Layout specific messages + //logBuilder.XamlLayoutLogLevel(LogLevel.Debug); + //// Storage messages + //logBuilder.StorageLogLevel(LogLevel.Debug); + //// Binding related messages + //logBuilder.XamlBindingLogLevel(LogLevel.Debug); + //// Binder memory references tracking + //logBuilder.BinderMemoryReferenceLogLevel(LogLevel.Debug); + //// DevServer and HotReload related + //logBuilder.HotReloadCoreLogLevel(LogLevel.Information); + //// Debug JS interop + //logBuilder.WebAssemblyLogLevel(LogLevel.Debug); + + }, enableUnoLogging: true) + .UseConfiguration(configure: configBuilder => + configBuilder + .EmbeddedSource() + .Section() + ) + // Enable localization (see appsettings.json for supported languages) + .UseLocalization() + // Register Json serializers (ISerializer and ISerializer) + .UseSerialization((context, services) => services + .AddContentSerializer(context) + .AddJsonTypeInfo(WeatherForecastContext.Default.IImmutableListWeatherForecast)) + .UseHttp((context, services) => services + // Register HttpClient +#if DEBUG + // DelegatingHandler will be automatically injected into Refit Client + .AddTransient() +#endif + .AddSingleton() + .AddRefitClient(context) + .AddRefitClientWithEndpoint( + context, + configure: (builder, options) => builder + .ConfigureHttpClient(HttpClient => + { + HttpClient.BaseAddress = new Uri("http://localhost:8080/"); + } + ) + )) + .UseAuthentication(auth => + auth.AddCustom(custom => + custom + .Login(async (sp, dispatcher, credentials, cancellationToken) => + { + // TODO: Write code to process credentials that are passed into the LoginAsync method + var gamenightApi = sp.GetRequiredService(); + + string? username = ""; + string? password = ""; + + var hasUsername = credentials?.TryGetValue(nameof(LoginModel.Username), out username) ?? false; + var hasPassword = credentials?.TryGetValue(nameof(LoginModel.Password), out password) ?? false; + + if (!hasUsername || !hasPassword) + { + return credentials; + } + + var apiResponse = await gamenightApi.Login(new LoginRequest { Username = username!, Password = password! }, cancellationToken); + + + if (apiResponse.IsSuccessStatusCode && apiResponse.Content is LoginResponse loginResponse) + { + // Return IDictionary containing any tokens used by service calls or in the app + credentials ??= new Dictionary(); + credentials[TokenCacheExtensions.AccessTokenKey] = "SampleToken"; + credentials[TokenCacheExtensions.RefreshTokenKey] = "RefreshToken"; + credentials["Expiry"] = DateTime.Now.AddMinutes(5).ToString("g"); + return credentials; + } + + // Return null/default to fail the LoginAsync method + return default; + }) + .Refresh((sp, tokenDictionary, cancellationToken) => + { + // TODO: Write code to refresh tokens using the currently stored tokens + if ((tokenDictionary?.TryGetValue(TokenCacheExtensions.RefreshTokenKey, out var refreshToken) ?? false) && + !refreshToken.IsNullOrEmpty() && + (tokenDictionary?.TryGetValue("Expiry", out var expiry) ?? false) && + DateTime.TryParse(expiry, out var tokenExpiry) && + tokenExpiry > DateTime.Now) + { + // Return IDictionary containing any tokens used by service calls or in the app + tokenDictionary ??= new Dictionary(); + tokenDictionary[TokenCacheExtensions.AccessTokenKey] = "NewSampleToken"; + tokenDictionary["Expiry"] = DateTime.Now.AddMinutes(5).ToString("g"); + return ValueTask.FromResult?>(tokenDictionary); + } + + // Return null/default to fail the Refresh method + return ValueTask.FromResult?>(default); + }), name: "CustomAuth") + ) + .ConfigureServices((context, services) => + { + // TODO: Register your services + //services.AddSingleton(); + }) + .UseNavigation(ReactiveViewModelMappings.ViewModelMappings, RegisterRoutes) + ); + MainWindow = builder.Window; + +#if DEBUG + MainWindow.EnableHotReload(); +#endif + MainWindow.SetWindowIcon(); + + Host = await builder.NavigateAsync + (initialNavigate: async (services, navigator) => + { + var auth = services.GetRequiredService(); + var authenticated = await auth.RefreshAsync(); + if (authenticated) + { + await navigator.NavigateViewModelAsync(this, qualifier: Qualifiers.Nested); + } + else + { + await navigator.NavigateViewModelAsync(this, qualifier: Qualifiers.Nested); + } + }); + } + + private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes) + { + views.Register( + new ViewMap(ViewModel: typeof(ShellModel)), + new ViewMap(), + new ViewMap(), + new DataViewMap() + ); + + routes.Register( + new RouteMap("", View: views.FindByViewModel(), + Nested: + [ + new ("Login", View: views.FindByViewModel()), + new ("Main", View: views.FindByViewModel(), IsDefault:true), + new ("Second", View: views.FindByViewModel()), + ] + ) + ); + } +} diff --git a/FrontendPlatformUno/FrontendPlatformUno.Base/Icons/iconapp.svg b/FrontendPlaformUno/FrontendPlaformUno/Assets/Icons/icon.svg similarity index 96% rename from FrontendPlatformUno/FrontendPlatformUno.Base/Icons/iconapp.svg rename to FrontendPlaformUno/FrontendPlaformUno/Assets/Icons/icon.svg index f621ea5..a15af53 100644 --- a/FrontendPlatformUno/FrontendPlatformUno.Base/Icons/iconapp.svg +++ b/FrontendPlaformUno/FrontendPlaformUno/Assets/Icons/icon.svg @@ -5,7 +5,7 @@ viewBox="0 0 456 456" version="1.1" id="svg453" - sodipodi:docname="iconapp.old.svg" + sodipodi:docname="icon.svg" inkscape:version="1.2 (dc2aedaf03, 2022-05-15)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" diff --git a/FrontendPlatformUno/FrontendPlatformUno.Base/Icons/appconfig.svg b/FrontendPlaformUno/FrontendPlaformUno/Assets/Icons/icon_foreground.svg similarity index 99% rename from FrontendPlatformUno/FrontendPlatformUno.Base/Icons/appconfig.svg rename to FrontendPlaformUno/FrontendPlaformUno/Assets/Icons/icon_foreground.svg index 3106b1a..8ffc41a 100644 --- a/FrontendPlatformUno/FrontendPlatformUno.Base/Icons/appconfig.svg +++ b/FrontendPlaformUno/FrontendPlaformUno/Assets/Icons/icon_foreground.svg @@ -5,7 +5,7 @@ viewBox="0 0 50.369617 49.826836" version="1.1" id="svg151" - sodipodi:docname="appconfig.svg" + sodipodi:docname="icon_foreground.svg" inkscape:version="1.2 (dc2aedaf03, 2022-05-15)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" diff --git a/FrontendPlatformUno/FrontendPlatformUno/Assets/Icons/back.svg b/FrontendPlaformUno/FrontendPlaformUno/Assets/Images/back.svg similarity index 100% rename from FrontendPlatformUno/FrontendPlatformUno/Assets/Icons/back.svg rename to FrontendPlaformUno/FrontendPlaformUno/Assets/Images/back.svg diff --git a/FrontendPlaformUno/FrontendPlaformUno/Assets/SharedAssets.md b/FrontendPlaformUno/FrontendPlaformUno/Assets/SharedAssets.md new file mode 100644 index 0000000..1b84a74 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno/Assets/SharedAssets.md @@ -0,0 +1,32 @@ +# Shared Assets + +See documentation about assets here: https://github.com/unoplatform/uno/blob/master/doc/articles/features/working-with-assets.md + +## Here is a cheat sheet + +1. Add the image file to the `Assets` directory of a shared project. +2. Set the build action to `Content`. +3. (Recommended) Provide an asset for various scales/dpi + +### Examples + +```text +\Assets\Images\logo.scale-100.png +\Assets\Images\logo.scale-200.png +\Assets\Images\logo.scale-400.png + +\Assets\Images\scale-100\logo.png +\Assets\Images\scale-200\logo.png +\Assets\Images\scale-400\logo.png +``` + +### Table of scales + +| Scale | WinUI | iOS/MacCatalyst | Android | +|-------|:-----------:|:---------------:|:-------:| +| `100` | scale-100 | @1x | mdpi | +| `125` | scale-125 | N/A | N/A | +| `150` | scale-150 | N/A | hdpi | +| `200` | scale-200 | @2x | xhdpi | +| `300` | scale-300 | @3x | xxhdpi | +| `400` | scale-400 | N/A | xxxhdpi | diff --git a/FrontendPlatformUno/FrontendPlatformUno.Base/Splash/splash_screen.svg b/FrontendPlaformUno/FrontendPlaformUno/Assets/Splash/splash_screen.svg similarity index 99% rename from FrontendPlatformUno/FrontendPlatformUno.Base/Splash/splash_screen.svg rename to FrontendPlaformUno/FrontendPlaformUno/Assets/Splash/splash_screen.svg index 3106b1a..8ffc41a 100644 --- a/FrontendPlatformUno/FrontendPlatformUno.Base/Splash/splash_screen.svg +++ b/FrontendPlaformUno/FrontendPlaformUno/Assets/Splash/splash_screen.svg @@ -5,7 +5,7 @@ viewBox="0 0 50.369617 49.826836" version="1.1" id="svg151" - sodipodi:docname="appconfig.svg" + sodipodi:docname="icon_foreground.svg" inkscape:version="1.2 (dc2aedaf03, 2022-05-15)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" diff --git a/FrontendPlaformUno/FrontendPlaformUno/FrontendPlaformUno.csproj b/FrontendPlaformUno/FrontendPlaformUno/FrontendPlaformUno.csproj new file mode 100644 index 0000000..a7c6049 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno/FrontendPlaformUno.csproj @@ -0,0 +1,57 @@ + + + net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0-windows10.0.19041;net8.0-browserwasm;net8.0-desktop;net8.0 + + Exe + true + + + FrontendPlaformUno + + es.brentj.FrontendPlaformUno + + 1.0 + 1 + + dbren + + FrontendPlaformUno powered by Uno Platform. + + + + + + Material; + Dsp; + Hosting; + Toolkit; + Logging; + MVUX; + Configuration; + Http; + Serialization; + Localization; + Authentication; + Navigation; + ThemeService; + + + + + True + $(DefineConstants);USE_UITESTS + + + diff --git a/FrontendPlaformUno/FrontendPlaformUno/GlobalUsings.cs b/FrontendPlaformUno/FrontendPlaformUno/GlobalUsings.cs new file mode 100644 index 0000000..f67143e --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno/GlobalUsings.cs @@ -0,0 +1,13 @@ +global using System.Collections.Immutable; +global using FrontendPlaformUno.DataContracts; +global using FrontendPlaformUno.DataContracts.Serialization; +global using FrontendPlaformUno.Models; +global using FrontendPlaformUno.Presentation; +global using FrontendPlaformUno.Services.Caching; +global using FrontendPlaformUno.Services.Endpoints; +global using Microsoft.Extensions.DependencyInjection; +global using Microsoft.Extensions.Hosting; +global using Microsoft.Extensions.Localization; +global using Microsoft.Extensions.Logging; +global using Microsoft.Extensions.Options; +global using ApplicationExecutionState = Windows.ApplicationModel.Activation.ApplicationExecutionState; diff --git a/FrontendPlaformUno/FrontendPlaformUno/IGameNightOptions.cs b/FrontendPlaformUno/FrontendPlaformUno/IGameNightOptions.cs new file mode 100644 index 0000000..ea986c3 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno/IGameNightOptions.cs @@ -0,0 +1,5 @@ +namespace FrontendPlaformUno; + +internal interface IGameNightOptions +{ +} \ No newline at end of file diff --git a/FrontendPlaformUno/FrontendPlaformUno/Models/AppConfig.cs b/FrontendPlaformUno/FrontendPlaformUno/Models/AppConfig.cs new file mode 100644 index 0000000..2d4f656 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno/Models/AppConfig.cs @@ -0,0 +1,6 @@ +namespace FrontendPlaformUno.Models; + +public record AppConfig +{ + public string? Environment { get; init; } +} diff --git a/FrontendPlaformUno/FrontendPlaformUno/Models/Entity.cs b/FrontendPlaformUno/FrontendPlaformUno/Models/Entity.cs new file mode 100644 index 0000000..27ae99b --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno/Models/Entity.cs @@ -0,0 +1,3 @@ +namespace FrontendPlaformUno.Models; + +public record Entity(string Name); diff --git a/FrontendPlaformUno/FrontendPlaformUno/Models/WeatherForecast.cs b/FrontendPlaformUno/FrontendPlaformUno/Models/WeatherForecast.cs new file mode 100644 index 0000000..5838077 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno/Models/WeatherForecast.cs @@ -0,0 +1,15 @@ +namespace FrontendPlaformUno.DataContracts; + +/// +/// A Weather Forecast for a specific date +/// +/// Gets the Date of the Forecast. +/// Gets the Forecast Temperature in Celsius. +/// Get a description of how the weather will feel. +public record WeatherForecast(DateOnly Date, double TemperatureC, string? Summary) +{ + /// + /// Gets the Forecast Temperature in Fahrenheit + /// + public double TemperatureF => 32 + (TemperatureC * 9 / 5); +} diff --git a/FrontendPlatformUno/FrontendPlatformUno.Skia.Gtk/Package.appxmanifest b/FrontendPlaformUno/FrontendPlaformUno/Package.appxmanifest similarity index 63% rename from FrontendPlatformUno/FrontendPlatformUno.Skia.Gtk/Package.appxmanifest rename to FrontendPlaformUno/FrontendPlaformUno/Package.appxmanifest index 03ed548..9ef3814 100644 --- a/FrontendPlatformUno/FrontendPlatformUno.Skia.Gtk/Package.appxmanifest +++ b/FrontendPlaformUno/FrontendPlaformUno/Package.appxmanifest @@ -1,20 +1,12 @@ - - + - - - - FrontendPlatformUno - FrontendPlatformUno - + + @@ -29,11 +21,7 @@ - - - + diff --git a/FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/AndroidManifest.xml b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/AndroidManifest.xml similarity index 100% rename from FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/AndroidManifest.xml rename to FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/AndroidManifest.xml diff --git a/FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/Assets/AboutAssets.txt b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Assets/AboutAssets.txt similarity index 88% rename from FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/Assets/AboutAssets.txt rename to FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Assets/AboutAssets.txt index 210a93b..89ab409 100644 --- a/FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/Assets/AboutAssets.txt +++ b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Assets/AboutAssets.txt @@ -4,7 +4,7 @@ in the shared project instead. Assets in this folder are Android-only assets. Any raw assets you want to be deployed with your application can be placed in this directory (and child directories) and given a Build Action of "AndroidAsset". -These files will be deployed with you package and will be accessible using Android's +These files will be deployed with your package and will be accessible using Android's AssetManager, like this: public class ReadAsset : Activity diff --git a/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Main.Android.cs b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Main.Android.cs new file mode 100644 index 0000000..7f52b86 --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Main.Android.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Android.App; +using Android.Content; +using Android.OS; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Com.Nostra13.Universalimageloader.Core; +using Microsoft.UI.Xaml.Media; + +namespace FrontendPlaformUno.Droid; +[global::Android.App.ApplicationAttribute( + Label = "@string/ApplicationName", + Icon = "@mipmap/icon", + LargeHeap = true, + HardwareAccelerated = true, + Theme = "@style/AppTheme" +)] +public class Application : Microsoft.UI.Xaml.NativeApplication +{ + + public Application(IntPtr javaReference, JniHandleOwnership transfer) + : base(() => new App(), javaReference, transfer) + { + ConfigureUniversalImageLoader(); + } + + private static void ConfigureUniversalImageLoader() + { + // Create global configuration and initialize ImageLoader with this config + ImageLoaderConfiguration config = new ImageLoaderConfiguration + .Builder(Context) + .Build(); + + ImageLoader.Instance.Init(config); + + ImageSource.DefaultImageLoader = ImageLoader.Instance.LoadImageAsync; + } +} + diff --git a/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/MainActivity.Android.cs b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/MainActivity.Android.cs new file mode 100644 index 0000000..c49e3ad --- /dev/null +++ b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/MainActivity.Android.cs @@ -0,0 +1,15 @@ +using Android.App; +using Android.Content.PM; +using Android.OS; +using Android.Views; +using Android.Widget; + +namespace FrontendPlaformUno.Droid; +[Activity( + MainLauncher = true, + ConfigurationChanges = global::Uno.UI.ActivityHelper.AllConfigChanges, + WindowSoftInputMode = SoftInput.AdjustNothing | SoftInput.StateHidden +)] +public class MainActivity : Microsoft.UI.Xaml.ApplicationActivity +{ +} diff --git a/FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/Resources/AboutResources.txt b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Resources/AboutResources.txt similarity index 100% rename from FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/Resources/AboutResources.txt rename to FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Resources/AboutResources.txt diff --git a/FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/Resources/values/Strings.xml b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Resources/values/Strings.xml similarity index 65% rename from FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/Resources/values/Strings.xml rename to FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Resources/values/Strings.xml index 27299d4..f4f8292 100644 --- a/FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/Resources/values/Strings.xml +++ b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Resources/values/Strings.xml @@ -1,5 +1,5 @@ Hello World, Click Me! - FrontendPlatformUno + FrontendPlaformUno diff --git a/FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/Resources/values/Styles.xml b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Resources/values/Styles.xml similarity index 64% rename from FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/Resources/values/Styles.xml rename to FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Resources/values/Styles.xml index fd16cd7..c02bd06 100644 --- a/FrontendPlatformUno/FrontendPlatformUno.Mobile/Android/Resources/values/Styles.xml +++ b/FrontendPlaformUno/FrontendPlaformUno/Platforms/Android/Resources/values/Styles.xml @@ -1,6 +1,6 @@ - - - - - diff --git a/FrontendPlatformUno/FrontendPlatformUno/Styles/MaterialFontsOverride.xaml b/FrontendPlatformUno/FrontendPlatformUno/Styles/MaterialFontsOverride.xaml deleted file mode 100644 index 385d659..0000000 --- a/FrontendPlatformUno/FrontendPlatformUno/Styles/MaterialFontsOverride.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Light.ttf#Roboto - ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Medium.ttf#Roboto - ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Regular.ttf#Roboto - - diff --git a/FrontendPlatformUno/FrontendPlatformUno/ViewModels/GamenightsViewModel.cs b/FrontendPlatformUno/FrontendPlatformUno/ViewModels/GamenightsViewModel.cs deleted file mode 100644 index 8237cfb..0000000 --- a/FrontendPlatformUno/FrontendPlatformUno/ViewModels/GamenightsViewModel.cs +++ /dev/null @@ -1,31 +0,0 @@ -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Input; -using System.Xml.Linq; - -namespace FrontendPlatformUno.ViewModels -{ - public class GamenightsViewModel : ObservableObject - { - private INavigator Navigator { get; } - public string? Title { get; } - public ICommand GoToLogin { get; } - - public GamenightsViewModel(INavigator navigator, IStringLocalizer stringLocalizer) - { - Navigator = navigator; - Title = $"{stringLocalizer["ApplicationName"]}"; - GoToLogin = new AsyncRelayCommand(GoToLoginView); - } - - private async Task GoToLoginView() - { - await Navigator.NavigateViewModelAsync(this); - } - } -} diff --git a/FrontendPlatformUno/FrontendPlatformUno/ViewModels/LoginViewModel.cs b/FrontendPlatformUno/FrontendPlatformUno/ViewModels/LoginViewModel.cs deleted file mode 100644 index b152720..0000000 --- a/FrontendPlatformUno/FrontendPlatformUno/ViewModels/LoginViewModel.cs +++ /dev/null @@ -1,59 +0,0 @@ -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; -using FrontendPlatformUno.Services.Api; -using FrontendPlatformUno.Services.Client; -using FrontendPlatformUno.Services.Model; -using FrontendPlatformUno.Views; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Input; - -namespace FrontendPlatformUno.ViewModels -{ - public class LoginViewModel : ObservableObject - { - private INavigator Navigator { get; } - public string? Title { get; } - public ICommand GoToLogin { get; } - - public string? Username { get; set; } - - public string? Password { get; set; } - public ICommand LoginCommand { get; internal set; } - - private IDefaultApi GamenightApi { get; } - - public LoginViewModel(INavigator navigator, IStringLocalizer stringLocalizer, IDefaultApi gamenightApi) - { - Navigator = navigator; - GamenightApi = gamenightApi; - Title = $"{stringLocalizer["ApplicationName"]} - Login"; - GoToLogin = new AsyncRelayCommand(GoToLoginView); - LoginCommand = new AsyncRelayCommand(Login); - } - - private async Task GoToLoginView() - { - await Navigator.NavigateViewModelAsync(this); - } - - private async Task Login() - { - var req = new GetTokenRequest(Username, Password); - GetToken200Response tokenResponse; - try - { - tokenResponse = await GamenightApi.GetTokenAsync(req); - } - catch (Exception ex) - { - Console.WriteLine(ex.ToString()); - return; - } - ((Configuration)GamenightApi.Configuration).AccessToken = tokenResponse.JwtToken; - } - } -} diff --git a/FrontendPlatformUno/FrontendPlatformUno/ViewModels/ShellViewModel.cs b/FrontendPlatformUno/FrontendPlatformUno/ViewModels/ShellViewModel.cs deleted file mode 100644 index 3f758df..0000000 --- a/FrontendPlatformUno/FrontendPlatformUno/ViewModels/ShellViewModel.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace FrontendPlatformUno.ViewModels -{ - public class ShellViewModel - { - private INavigator Navigator { get; } - - public ShellViewModel(INavigator navigator) - { - Navigator = navigator; - - _ = Start(); - } - - public async Task Start() - { - await Navigator.NavigateViewModelAsync(this); - } - } -} \ No newline at end of file diff --git a/FrontendPlatformUno/FrontendPlatformUno/Views/GamenightsPage.xaml b/FrontendPlatformUno/FrontendPlatformUno/Views/GamenightsPage.xaml deleted file mode 100644 index 76f42d1..0000000 --- a/FrontendPlatformUno/FrontendPlatformUno/Views/GamenightsPage.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - diff --git a/FrontendPlatformUno/FrontendPlatformUno/Views/GamenightsPage.xaml.cs b/FrontendPlatformUno/FrontendPlatformUno/Views/GamenightsPage.xaml.cs deleted file mode 100644 index 5f62773..0000000 --- a/FrontendPlatformUno/FrontendPlatformUno/Views/GamenightsPage.xaml.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; -using Microsoft.UI.Xaml.Data; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; -using Microsoft.UI.Xaml.Navigation; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; - -// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 - -namespace FrontendPlatformUno.Views -{ - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class GamenightsPage : Page - { - public GamenightsPage() - { - this.InitializeComponent(); - } - } -} diff --git a/FrontendPlatformUno/FrontendPlatformUno/Views/LoginPage.xaml b/FrontendPlatformUno/FrontendPlatformUno/Views/LoginPage.xaml deleted file mode 100644 index 1ee6a83..0000000 --- a/FrontendPlatformUno/FrontendPlatformUno/Views/LoginPage.xaml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -