diff --git a/.editorconfig b/.editorconfig index a0942fbb..4ac26c36 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,9 +12,9 @@ csharp_style_prefer_method_group_conversion = true:silent csharp_style_prefer_top_level_statements = true: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_properties = true:warning +csharp_style_expression_bodied_indexers = true:warning +csharp_style_expression_bodied_accessors = true:warning csharp_style_expression_bodied_lambdas = true:silent csharp_style_expression_bodied_local_functions = false:silent csharp_style_throw_expression = true:suggestion @@ -45,6 +45,8 @@ csharp_style_prefer_extended_property_pattern = true:suggestion csharp_style_var_for_built_in_types = false:silent csharp_style_var_when_type_is_apparent = false:silent csharp_style_var_elsewhere = false:silent +csharp_style_prefer_primary_constructors = true:suggestion +csharp_prefer_system_threading_lock = true:suggestion [*.{cs,vb}] dotnet_style_operator_placement_when_wrapping = beginning_of_line diff --git a/.github/workflows/Automatic_release_generation.yml b/.github/workflows/Automatic_release_generation.yml index 11c343bc..bd6d1d4f 100644 --- a/.github/workflows/Automatic_release_generation.yml +++ b/.github/workflows/Automatic_release_generation.yml @@ -23,10 +23,10 @@ on: jobs: macos-latest: - name: macos-13 - runs-on: macos-13 + name: macos-15 + runs-on: macos-15 env: - ACTION_NAME: macos-13 + ACTION_NAME: macos-15 CONFIGURATION: Release steps: - uses: actions/checkout@v3 @@ -37,14 +37,6 @@ jobs: .nuke/temp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} - - # see https://github.com/actions/runner-images/issues/6771#issuecomment-1354713617 - # remove once all workflow VMs use Xcode 14.3 - - name: Set Xcode Version - shell: bash - run: | - sudo xcode-select -s "/Applications/Xcode_14.3.app" - echo "MD_APPLE_SDK_ROOT=/Applications/Xcode_14.3.app" >> $GITHUB_ENV - name: 'Run: Pack' run: ./build.cmd Pack diff --git a/.github/workflows/Desktop_test_runner.yml b/.github/workflows/Desktop_test_runner.yml index c55b6895..566b1a07 100644 --- a/.github/workflows/Desktop_test_runner.yml +++ b/.github/workflows/Desktop_test_runner.yml @@ -48,10 +48,10 @@ jobs: name: TestResults-${{env.ACTION_NAME}} path: PasswordManager.Tests/TestResults/TestResults-${{env.ACTION_NAME}}.trx macos-latest: - name: macos-13 - runs-on: macos-13 + name: macos-15 + runs-on: macos-15 env: - ACTION_NAME: macos-13 + ACTION_NAME: macos-15 steps: - uses: actions/checkout@v3 - name: 'Cache: .nuke/temp, ~/.nuget/packages' @@ -62,14 +62,6 @@ jobs: ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} - # see https://github.com/actions/runner-images/issues/6771#issuecomment-1354713617 - # remove once all workflow VMs use Xcode 14.3 - - name: Set Xcode Version - shell: bash - run: | - sudo xcode-select -s "/Applications/Xcode_14.3.app" - echo "MD_APPLE_SDK_ROOT=/Applications/Xcode_14.3.app" >> $GITHUB_ENV - - name: 'Run: UnitTest' run: ./build.cmd UnitTest - name: 'Publish: TestResults-local' diff --git a/.github/workflows/Mobile_test_runner.yml b/.github/workflows/Mobile_test_runner.yml index 5e5c96fb..c30acbab 100644 --- a/.github/workflows/Mobile_test_runner.yml +++ b/.github/workflows/Mobile_test_runner.yml @@ -27,7 +27,7 @@ on: jobs: macos-latest: name: Android (api-${{ matrix.api-level }}) - runs-on: macos-13 + runs-on: macos-15 strategy: matrix: api-level: [21, 23, 29] @@ -43,14 +43,6 @@ jobs: ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} - # see https://github.com/actions/runner-images/issues/6771#issuecomment-1354713617 - # remove once all workflow VMs use Xcode 14.3 - - name: Set Xcode Version - shell: bash - run: | - sudo xcode-select -s "/Applications/Xcode_14.3.app" - echo "MD_APPLE_SDK_ROOT=/Applications/Xcode_14.3.app" >> $GITHUB_ENV - - name: run tests uses: reactivecircus/android-emulator-runner@v2 with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 7691c385..d583b919 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -53,13 +53,13 @@ jobs: - name: Install dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: '7.0.x' + dotnet-version: '9.0.x' - name: Install MAUI run: dotnet workload install maui - name: Build app - run: dotnet build -c Debug -warnaserror -f:net7.0-windows10.0.19041.0 ${{github.workspace}}/PasswordManager/PasswordManager.csproj + run: dotnet build -c Debug -warnaserror -f:net9.0-windows10.0.19041.0 ${{github.workspace}}/PasswordManager/PasswordManager.csproj # ℹ️ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 74843cd0..2d5a4d47 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -1,22 +1,49 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "#/definitions/build", - "title": "Build Schema", "definitions": { - "build": { - "type": "object", + "Host": { + "type": "string", + "enum": [ + "AppVeyor", + "AzurePipelines", + "Bamboo", + "Bitbucket", + "Bitrise", + "GitHubActions", + "GitLab", + "Jenkins", + "Rider", + "SpaceAutomation", + "TeamCity", + "Terminal", + "TravisCI", + "VisualStudio", + "VSCode" + ] + }, + "ExecutableTarget": { + "type": "string", + "enum": [ + "Clean", + "Compile", + "Pack", + "Restore", + "UITest", + "UnitTest" + ] + }, + "Verbosity": { + "type": "string", + "description": "", + "enum": [ + "Verbose", + "Normal", + "Minimal", + "Quiet" + ] + }, + "NukeBuild": { "properties": { - "ActionName": { - "type": "string" - }, - "Configuration": { - "type": "string", - "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", - "enum": [ - "Debug", - "Release" - ] - }, "Continue": { "type": "boolean", "description": "Indicates to continue a previously failed build attempt" @@ -26,25 +53,8 @@ "description": "Shows the help text for this build assembly" }, "Host": { - "type": "string", "description": "Host for execution. Default is 'automatic'", - "enum": [ - "AppVeyor", - "AzurePipelines", - "Bamboo", - "Bitbucket", - "Bitrise", - "GitHubActions", - "GitLab", - "Jenkins", - "Rider", - "SpaceAutomation", - "TeamCity", - "Terminal", - "TravisCI", - "VisualStudio", - "VSCode" - ] + "$ref": "#/definitions/Host" }, "NoLogo": { "type": "boolean", @@ -73,47 +83,45 @@ "type": "array", "description": "List of targets to be skipped. Empty list skips all dependencies", "items": { - "type": "string", - "enum": [ - "Clean", - "Compile", - "Pack", - "Restore", - "UITest", - "UnitTest" - ] + "$ref": "#/definitions/ExecutableTarget" } }, - "Solution": { - "type": "string", - "description": "Path to a solution file that is automatically loaded" - }, "Target": { "type": "array", "description": "List of targets to be invoked. Default is '{default_target}'", "items": { - "type": "string", - "enum": [ - "Clean", - "Compile", - "Pack", - "Restore", - "UITest", - "UnitTest" - ] + "$ref": "#/definitions/ExecutableTarget" } }, "Verbosity": { - "type": "string", "description": "Logging verbosity during build execution. Default is 'Normal'", + "$ref": "#/definitions/Verbosity" + } + } + } + }, + "allOf": [ + { + "properties": { + "ActionName": { + "type": "string" + }, + "Configuration": { + "type": "string", + "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", "enum": [ - "Minimal", - "Normal", - "Quiet", - "Verbose" + "Debug", + "Release" ] + }, + "Solution": { + "type": "string", + "description": "Path to a solution file that is automatically loaded" } } + }, + { + "$ref": "#/definitions/NukeBuild" } - } + ] } diff --git a/PasswordManager.Build/Build.cs b/PasswordManager.Build/Build.cs index f908d66a..d7dfd872 100644 --- a/PasswordManager.Build/Build.cs +++ b/PasswordManager.Build/Build.cs @@ -1,5 +1,3 @@ -using System.IO; -using System.Linq; using Nuke.Common; using Nuke.Common.CI.GitHubActions; using Nuke.Common.IO; @@ -8,35 +6,37 @@ using Nuke.Common.Tools.DotNet; using Nuke.Common.Tools.PowerShell; using Nuke.Common.Utilities.Collections; -using static Nuke.Common.Tools.PowerShell.PowerShellTasks; +using System.IO; +using System.Linq; using static Nuke.Common.Tools.DotNet.DotNetTasks; +using static Nuke.Common.Tools.PowerShell.PowerShellTasks; [GitHubActions("Desktop test runner", GitHubActionsImage.WindowsLatest, GitHubActionsImage.MacOsLatest, - OnPushBranches = new[] { "main" }, - OnPullRequestBranches = new[] { "main" }, - CacheIncludePatterns = new[] - { - ".nuke/temp", + OnPushBranches = ["main"], + OnPullRequestBranches = ["main"], + CacheIncludePatterns = + [ + ".nuke/temp", "~/.nuget/packages" - }, - InvokedTargets = new[] { nameof(UnitTest) }, + ], + InvokedTargets = [nameof(UnitTest)], AutoGenerate = false)] [GitHubActions("Mobile test runner", GitHubActionsImage.MacOsLatest, - OnPushBranches = new[] { "main" }, - OnPullRequestBranches = new[] { "main" }, - InvokedTargets = new[] { nameof(UITest) }, + OnPushBranches = ["main"], + OnPullRequestBranches = ["main"], + InvokedTargets = [nameof(UITest)], AutoGenerate = false)] [GitHubActions("Automatic release generation", GitHubActionsImage.MacOsLatest, GitHubActionsImage.WindowsLatest, - OnPushBranches = new[] { "Release" }, - InvokedTargets = new[] { nameof(Pack) }, + OnPushBranches = ["Release"], + InvokedTargets = [nameof(Pack)], AutoGenerate = false)] class Build : NukeBuild { - public static int Main () => Execute(x => x.Compile); + public static int Main() => Execute(x => x.Compile); [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] public readonly Configuration Configuration = Configuration.Debug; @@ -47,7 +47,7 @@ class Build : NukeBuild public readonly Solution Solution; [LatestGitHubRelease(Build.repository_identifier)] public readonly string LatestGitHubRelease = repository_identifier; - + const string repository_identifier = @"Cootz/PasswordManager"; const string win_release_file_name = "win_x64.zip"; @@ -93,7 +93,7 @@ public Build() foreach (var project in Solution.AllProjects) { PowerShell(p => p - .SetCommand($"dotnet workload restore { Path.GetFileName(project.Path) }") + .SetCommand($"dotnet workload restore {Path.GetFileName(project.Path)}") .SetProcessWorkingDirectory(project.Directory)); } @@ -175,7 +175,7 @@ public Build() SourceDirectory / @"bin\Release\net7.0-maccatalyst\maccatalyst-arm64"; AbsolutePath macIntelPublishDirectory = SourceDirectory / @"bin\Release\net7.0-maccatalyst\maccatalyst-x64"; - AbsolutePath androidPublishDirectory = + AbsolutePath androidPublishDirectory = SourceDirectory / @"bin\Release\net7.0-android\publish\com.companyname.passwordmanager-Signed.apk"; zipHelper.ZipToPublish(winPublishDirectory, win_release_file_name); diff --git a/PasswordManager.Build/Configuration.cs b/PasswordManager.Build/Configuration.cs index 9b22a3bd..e5a9e5f6 100644 --- a/PasswordManager.Build/Configuration.cs +++ b/PasswordManager.Build/Configuration.cs @@ -1,5 +1,5 @@ -using System.ComponentModel; using Nuke.Common.Tooling; +using System.ComponentModel; [TypeConverter(typeof(TypeConverter))] public class Configuration : Enumeration diff --git a/PasswordManager.Build/PasswordManager.Build.csproj b/PasswordManager.Build/PasswordManager.Build.csproj index 20731e18..2410de38 100644 --- a/PasswordManager.Build/PasswordManager.Build.csproj +++ b/PasswordManager.Build/PasswordManager.Build.csproj @@ -1,17 +1,21 @@ - + Exe - net7.0 + net9.0 CS0649;CS0169 .. .. 1 + true - + + + + diff --git a/PasswordManager.Build/VersionHelper.cs b/PasswordManager.Build/VersionHelper.cs index 0ddf9fe8..3b07fbfb 100644 --- a/PasswordManager.Build/VersionHelper.cs +++ b/PasswordManager.Build/VersionHelper.cs @@ -1,6 +1,6 @@ +using JetBrains.Annotations; using System; using System.Linq; -using JetBrains.Annotations; class VersionHelper { @@ -18,7 +18,7 @@ public string GenerateVersion([CanBeNull] string previousVersion) if (previousVersion is null || previousVersion != fullCurrentVersion) return fullCurrentVersion; - + int subVersion = int.Parse(previousVersion.Split('.').Last()); return $"v{currentVersion}.{subVersion + 1}"; diff --git a/PasswordManager.Build/ZipHelper.cs b/PasswordManager.Build/ZipHelper.cs index 90cd9902..a2df2df0 100644 --- a/PasswordManager.Build/ZipHelper.cs +++ b/PasswordManager.Build/ZipHelper.cs @@ -1,6 +1,6 @@ +using Nuke.Common.IO; using System.IO; using System.IO.Compression; -using Nuke.Common.IO; class ZipHelper { diff --git a/PasswordManager.Tests.UI/PasswordManager.Tests.UI.csproj b/PasswordManager.Tests.UI/PasswordManager.Tests.UI.csproj index 853a3a14..6cf6e87c 100644 --- a/PasswordManager.Tests.UI/PasswordManager.Tests.UI.csproj +++ b/PasswordManager.Tests.UI/PasswordManager.Tests.UI.csproj @@ -1,7 +1,7 @@ - + - net7.0 + net9.0 enable enable true @@ -9,16 +9,27 @@ - - - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + diff --git a/PasswordManager.Tests.UI/Smoke/SmokeTest.cs b/PasswordManager.Tests.UI/Smoke/SmokeTest.cs index e215d7c9..9c32120c 100644 --- a/PasswordManager.Tests.UI/Smoke/SmokeTest.cs +++ b/PasswordManager.Tests.UI/Smoke/SmokeTest.cs @@ -1,6 +1,4 @@ using PasswordManager.View; -using Xamarin.UITest; -using Xamarin.UITest.Queries; using Platform = Xamarin.UITest.Platform; namespace PasswordManager.Tests.UI.Smoke @@ -54,7 +52,7 @@ public void TestBasePath() app.Tap("Open navigation drawer"); app.Tap("Recent"); - + waitAndAssert("ProfilesCollectionView"); app.Screenshot($"Navigated from {nameof(SettingsPage)} to {nameof(RecentPage)} via {nameof(AppShell)}"); diff --git a/PasswordManager.Tests.UI/View/RecentPageTest.cs b/PasswordManager.Tests.UI/View/RecentPageTest.cs index d31e67d5..78e3f623 100644 --- a/PasswordManager.Tests.UI/View/RecentPageTest.cs +++ b/PasswordManager.Tests.UI/View/RecentPageTest.cs @@ -55,7 +55,7 @@ private void navigateToRecentPage() app.EnterText("PasswordConfirmation", "P@ssw0rd"); app.DismissKeyboard(); - + app.Tap("RegisterButton"); app.WaitForElement("ProfilesCollectionView"); diff --git a/PasswordManager.Tests/DB/DatabaseTest.cs b/PasswordManager.Tests/DB/DatabaseTest.cs index 16009452..88d032a5 100644 --- a/PasswordManager.Tests/DB/DatabaseTest.cs +++ b/PasswordManager.Tests/DB/DatabaseTest.cs @@ -12,8 +12,13 @@ public class DatabaseTest { private static TempStorage? tempStorage; private static ISecureStorage? secureStorage; + + // This property cannot be disposed because Realm can only have one instance per application. + // Once this instance disposed Realm will throw an exception if you try to create a new instance of Realm. +#pragma warning disable NUnit1032 // An IDisposable field/property should be Disposed in a TearDown method private static RealmController? controller; private static DatabaseService? database; +#pragma warning restore NUnit1032 // An IDisposable field/property should be Disposed in a TearDown method [OneTimeSetUp] public static void Setup() diff --git a/PasswordManager.Tests/PasswordManager.Tests.csproj b/PasswordManager.Tests/PasswordManager.Tests.csproj index e0fc037b..6c750cc2 100644 --- a/PasswordManager.Tests/PasswordManager.Tests.csproj +++ b/PasswordManager.Tests/PasswordManager.Tests.csproj @@ -1,7 +1,7 @@ - + - net7.0 + net9.0 enable true enable @@ -10,22 +10,27 @@ - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/PasswordManager.Tests/ViewModel/LoginViewModelTest.cs b/PasswordManager.Tests/ViewModel/LoginViewModelTest.cs index 53dc2586..27f4dfcb 100644 --- a/PasswordManager.Tests/ViewModel/LoginViewModelTest.cs +++ b/PasswordManager.Tests/ViewModel/LoginViewModelTest.cs @@ -54,4 +54,7 @@ public async Task TestLoginWithIncorrectPassword() [TearDown] public void TearDown() => navigationService.ClearReceivedCalls(); + + [OneTimeTearDown] + public void OneTimeTearDown() => hook.Dispose(); } \ No newline at end of file diff --git a/PasswordManager.Tests/ViewModel/RecentViewModelTest.cs b/PasswordManager.Tests/ViewModel/RecentViewModelTest.cs index 7ac6e6cd..8895a488 100644 --- a/PasswordManager.Tests/ViewModel/RecentViewModelTest.cs +++ b/PasswordManager.Tests/ViewModel/RecentViewModelTest.cs @@ -1,11 +1,12 @@ -using NSubstitute; +using Newtonsoft.Json.Converters; +using NSubstitute; using PasswordManager.Model.DB.Schema; using PasswordManager.Services; using PasswordManager.Tests.DB; using PasswordManager.Tests.TestData; using PasswordManager.ViewModel; -using System.Windows.Input; using SharpHook; +using System.Windows.Input; namespace PasswordManager.Tests.ViewModel; @@ -151,6 +152,12 @@ public void CleanUp() alertService.ClearReceivedCalls(); } + [OneTimeTearDown] + public void Dispose() + { + globalHook.Dispose(); + } + private RecentViewModel setupViewModel(DatabaseService databaseService) { foreach (ServiceInfo? service in ServiceInfo.DefaultServices) diff --git a/PasswordManager.Tests/ViewModel/RegisterViewModelTest.cs b/PasswordManager.Tests/ViewModel/RegisterViewModelTest.cs index abaf9c64..8d4095c9 100644 --- a/PasswordManager.Tests/ViewModel/RegisterViewModelTest.cs +++ b/PasswordManager.Tests/ViewModel/RegisterViewModelTest.cs @@ -96,4 +96,10 @@ public void TearDown() navigationService.ClearReceivedCalls(); savedPassword = null; } + + [OneTimeTearDown] + public void OneTimeTearDown() + { + hook.Dispose(); + } } \ No newline at end of file diff --git a/PasswordManager/App.xaml.cs b/PasswordManager/App.xaml.cs index 41576104..178315a9 100644 --- a/PasswordManager/App.xaml.cs +++ b/PasswordManager/App.xaml.cs @@ -1,6 +1,4 @@ using PasswordManager.Services; -using PasswordManager.View; -using PasswordManager.ViewModel; namespace PasswordManager; @@ -14,7 +12,7 @@ public App(IServiceProvider provider) UserAppTheme = provider.GetService().CurrentTheme; InitializeComponent(); - - MainPage = new AppShell(); } + + protected override Window CreateWindow(IActivationState activationState) => new(new AppShell()); } \ No newline at end of file diff --git a/PasswordManager/FodyWeavers.xsd b/PasswordManager/FodyWeavers.xsd index 224a0a4a..f526bddb 100644 --- a/PasswordManager/FodyWeavers.xsd +++ b/PasswordManager/FodyWeavers.xsd @@ -5,51 +5,7 @@ - - - - THIS IS DEPRECATED - USE `AnalyticsCollection` INSTEAD. Disables anonymized - usage information from being sent on build. Read more about what data is being collected and - why here: https://github.com/realm/realm-dotnet/blob/main/Realm/Realm.Weaver/Analytics.cs - - - - - Controls what anonymized usage information is being sent on build. Read more - about what data is being collected and why here: - https://github.com/realm/realm-dotnet/blob/main/Realm/Realm.Weaver/Analytics/Analytics.cs - - - - - - Analytics collection will run normally. This is the default behavior - and we hope you don't change it as the anonymized data collected is critical for - making the right decisions about the future of the Realm SDK. - - - - - Analytics collection will run but will not send it to the server. This - is useful in combination with `AnalyticsLogPath` if you want to review the data being - sent. - - - - - Analytics collection is disabled. No data will be sent on build. - - - - - - - - Controls where the payload for the anonymized metrics collection will be - stored. This can be useful if you want to review the data being collected by Realm. - - - + diff --git a/PasswordManager/MauiProgram.cs b/PasswordManager/MauiProgram.cs index 1ba6057e..3391081f 100644 --- a/PasswordManager/MauiProgram.cs +++ b/PasswordManager/MauiProgram.cs @@ -23,7 +23,7 @@ public static class MauiProgram public static MauiApp CreateMauiApp() { - OptimizedTaskPoolGlobalHook globalHook = new(new TaskPoolGlobalHookOptions(4, true)); + OptimizedTaskPoolGlobalHook globalHook = new(4, true); MauiAppBuilder builder = MauiApp.CreateBuilder(); builder @@ -37,14 +37,14 @@ public static MauiApp CreateMauiApp() .ConfigureLifecycleEvents(events => { #if WINDOWS - events.AddWindows(windows => + events.AddWindows(windows => + { + windows.OnActivated((window, args) => { - windows.OnActivated((window, args) => - { - OptimizationHelper.IsAppActive = args.WindowActivationState != - Microsoft.UI.Xaml.WindowActivationState.Deactivated; - }); + OptimizationHelper.IsAppActive = args.WindowActivationState != + Microsoft.UI.Xaml.WindowActivationState.Deactivated; }); + }); #elif MACCATALYST events.AddiOS(ios => { diff --git a/PasswordManager/Model/DB/Schema/ServiceInfo.cs b/PasswordManager/Model/DB/Schema/ServiceInfo.cs index 9cf1c2ee..438f613e 100644 --- a/PasswordManager/Model/DB/Schema/ServiceInfo.cs +++ b/PasswordManager/Model/DB/Schema/ServiceInfo.cs @@ -41,7 +41,7 @@ public bool Equals([AllowNull] ServiceInfo other) if (other is null) return false; if (!IsValid || !other.IsValid) return false; - + bool[] equals = { ID == other.ID, Name == other.Name }; return equals[0] & equals[1]; diff --git a/PasswordManager/Model/OptimizedTaskPoolGlobalHook.cs b/PasswordManager/Model/OptimizedTaskPoolGlobalHook.cs index 54506039..cbda007a 100644 --- a/PasswordManager/Model/OptimizedTaskPoolGlobalHook.cs +++ b/PasswordManager/Model/OptimizedTaskPoolGlobalHook.cs @@ -11,22 +11,17 @@ public sealed class OptimizedTaskPoolGlobalHook : GlobalHookBase /// /// Initializes a new instance of . /// - /// - /// Calling this constructor is the same as passing to the - /// other constructor. - /// public OptimizedTaskPoolGlobalHook() - : this(TaskPoolGlobalHookOptions.Sequential) + : this(1, true) { } /// /// Initializes a new instance of . /// - /// The options of the hook which include its parallelism level. - public OptimizedTaskPoolGlobalHook(TaskPoolGlobalHookOptions options) - : base(options.RunAsyncOnBackgroundThread) => - taskQueue = new SemaphoreQueue(options.ParallelismLevel); + public OptimizedTaskPoolGlobalHook(int levelOfParallelism, bool runAsyncOnBackgroundThread) + : base(runAsyncOnBackgroundThread) => + taskQueue = new SemaphoreQueue(levelOfParallelism); /// /// Handles the hook event. diff --git a/PasswordManager/PasswordManager.csproj b/PasswordManager/PasswordManager.csproj index 5d5fbf9d..96dfa725 100644 --- a/PasswordManager/PasswordManager.csproj +++ b/PasswordManager/PasswordManager.csproj @@ -1,11 +1,11 @@ - net7.0;net7.0-android;net7.0-maccatalyst - $(TargetFrameworks);net7.0-windows10.0.19041.0 + net9.0;net9.0-android;net9.0-maccatalyst + $(TargetFrameworks);net9.0-windows10.0.19041.0 - - Exe + + Exe PasswordManager true true @@ -22,13 +22,13 @@ 1 2 - True - True + True + True None 11.0 - 13.1 + 15.0 21.0 10.0.17763.0 10.0.17763.0 @@ -65,12 +65,14 @@ - - - - - - + + + + + + + + diff --git a/PasswordManager/PasswordManager.csproj.user b/PasswordManager/PasswordManager.csproj.user index 4256acf8..69ebe673 100644 --- a/PasswordManager/PasswordManager.csproj.user +++ b/PasswordManager/PasswordManager.csproj.user @@ -2,7 +2,7 @@ False - net7.0-windows10.0.19041.0 + net9.0-windows10.0.19041.0 Project Name (Package) Emulator pixel_5_-_api_21 @@ -24,6 +24,12 @@ ProjectDebugger + + ProjectDebugger + + + ProjectDebugger + Designer diff --git a/PasswordManager/Properties/launchSettings.json b/PasswordManager/Properties/launchSettings.json index e33d8208..9fd7b22d 100644 --- a/PasswordManager/Properties/launchSettings.json +++ b/PasswordManager/Properties/launchSettings.json @@ -4,7 +4,8 @@ "commandName": "MsixPackage" }, "Project Name (Unpackaged)": { - "commandName": "Project" + "commandName": "Project", + "nativeDebugging": false } } } \ No newline at end of file diff --git a/PasswordManager/Services/AlertService.cs b/PasswordManager/Services/AlertService.cs index fde5fdae..ef3a9286 100644 --- a/PasswordManager/Services/AlertService.cs +++ b/PasswordManager/Services/AlertService.cs @@ -1,18 +1,16 @@ -using System.Threading.Channels; - -namespace PasswordManager.Services; +namespace PasswordManager.Services; public sealed class AlertService : IAlertService { public Task ShowConfirmationAsync(string title, string message, string accept, string cancel) => - Application.Current.MainPage.DisplayAlert(title, message, accept, cancel); + Application.Current.Windows[0].Page.DisplayAlert(title, message, accept, cancel); - public Task ShowConfirmationAsync(string title, string message) => - Application.Current.MainPage.DisplayAlert(title, message, "Yes", "No"); + public Task ShowConfirmationAsync(string title, string message) => + Application.Current.Windows[0].Page.DisplayAlert(title, message, "Yes", "No"); public Task ShowPromptAsync(string title, string message, string accept, string cancel) => - Application.Current.MainPage.DisplayPromptAsync(title, message, accept, cancel); + Application.Current.Windows[0].Page.DisplayPromptAsync(title, message, accept, cancel); public Task ShowPromptAsync(string title, string message) => - Application.Current.MainPage.DisplayPromptAsync(title, message); + Application.Current.Windows[0].Page.DisplayPromptAsync(title, message); } \ No newline at end of file diff --git a/PasswordManager/Services/DatabaseService.cs b/PasswordManager/Services/DatabaseService.cs index 76071963..56c1214b 100644 --- a/PasswordManager/Services/DatabaseService.cs +++ b/PasswordManager/Services/DatabaseService.cs @@ -10,7 +10,7 @@ namespace PasswordManager.Services; public sealed class DatabaseService : IDisposable { private readonly IController db; - + public DatabaseService(IController db) => this.db = db; /// diff --git a/PasswordManager/Services/IAlertService.cs b/PasswordManager/Services/IAlertService.cs index 2f0cc1d3..e7e66859 100644 --- a/PasswordManager/Services/IAlertService.cs +++ b/PasswordManager/Services/IAlertService.cs @@ -19,7 +19,7 @@ public interface IAlertService /// /// User's response Task ShowConfirmationAsync(string title, string message, string accept, string cancel); - + /// /// Show confirmation alert /// diff --git a/PasswordManager/Services/ISettingsService.cs b/PasswordManager/Services/ISettingsService.cs index 2912e165..d3fae598 100644 --- a/PasswordManager/Services/ISettingsService.cs +++ b/PasswordManager/Services/ISettingsService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using PasswordManager.Model.DB.Schema; +using PasswordManager.Model.DB.Schema; namespace PasswordManager.Services { diff --git a/PasswordManager/Services/SettingsService.cs b/PasswordManager/Services/SettingsService.cs index 9f70e247..1a1f3e15 100644 --- a/PasswordManager/Services/SettingsService.cs +++ b/PasswordManager/Services/SettingsService.cs @@ -6,10 +6,7 @@ public class SettingsService : ISettingsService { private readonly DatabaseService databaseService; - public IQueryable ServiceInfos - { - get => databaseService.Select(); - } + public IQueryable ServiceInfos => databaseService.Select(); public AppTheme CurrentTheme { diff --git a/Passwords.sln b/Passwords.sln index 392af29e..446faf0f 100644 --- a/Passwords.sln +++ b/Passwords.sln @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PasswordManager.Tests.UI", "PasswordManager.Tests.UI\PasswordManager.Tests.UI.csproj", "{D1175425-761E-4B16-BD46-455801319E7C}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PasswordManager.Build", "PasswordManager.Build\PasswordManager.Build.csproj", "{5F7E688C-A6C5-4A16-8F31-CC83098A2BEF}" EndProject Global @@ -21,8 +22,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5F7E688C-A6C5-4A16-8F31-CC83098A2BEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5F7E688C-A6C5-4A16-8F31-CC83098A2BEF}.Release|Any CPU.ActiveCfg = Release|Any CPU {981CC1C1-C79D-431C-BA80-A45D9C97020D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {981CC1C1-C79D-431C-BA80-A45D9C97020D}.Debug|Any CPU.Build.0 = Debug|Any CPU {981CC1C1-C79D-431C-BA80-A45D9C97020D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU @@ -37,6 +36,8 @@ Global {D1175425-761E-4B16-BD46-455801319E7C}.Debug|Any CPU.Build.0 = Debug|Any CPU {D1175425-761E-4B16-BD46-455801319E7C}.Release|Any CPU.ActiveCfg = Release|Any CPU {D1175425-761E-4B16-BD46-455801319E7C}.Release|Any CPU.Build.0 = Release|Any CPU + {5F7E688C-A6C5-4A16-8F31-CC83098A2BEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F7E688C-A6C5-4A16-8F31-CC83098A2BEF}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE