From 3795f3aa171d5522a9495e1bebbad556d315fe91 Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Mon, 20 Nov 2023 10:44:56 -0300 Subject: [PATCH] PM-3350 Added watchOS app to main project and fixed some csproj conditions for runtime identifiers on iOS. --- src/App/App.csproj | 34 +++++++++----- .../Settings/OtherSettingsPageViewModel.cs | 1 + .../GroupingsPage/GroupingsPageViewModel.cs | 46 ++++++++++--------- src/iOS.Autofill/iOS.Autofill.csproj | 9 ++-- src/iOS.Extension/iOS.Extension.csproj | 13 ++---- .../iOS.ShareExtension.csproj | 9 ++-- 6 files changed, 66 insertions(+), 46 deletions(-) diff --git a/src/App/App.csproj b/src/App/App.csproj index bd1f60623..7cdef448b 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -30,15 +30,9 @@ 11.0 21.0 - true + - - True False @@ -56,18 +50,18 @@ false - iossimulator-arm64 - Automatic iPhone Developer Platforms\iOS\Entitlements.plist all None - + + + + -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" false - ios-arm64 Automatic:AppStore iPhone Distribution Platforms\iOS\Entitlements.plist @@ -250,6 +244,24 @@ false + + $(Home)/Library/Developer/Xcode/DerivedData/bitwarden-acgkbpwvmebfiofokotvoerzkqcl/Build/Products + $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\..'))/watchOS/bitwarden.xcarchive/Products/Applications/bitwarden.app/Watch + Bitwarden.app + >watchsimulator + >watchos + $(WatchAppBuildPath)/$(Configuration)-$(WatchAppConfiguration)/$(WatchAppBundle) + $(WatchAppBuildPath)/$(WatchAppBundle) + + + <_ResolvedWatchAppReferences Include="$(WatchAppBundleFullPath)" /> + + + + _CopyWatchOS2AppsToBundle; + $(CreateAppBundleDependsOn); + + diff --git a/src/Core/Pages/Settings/OtherSettingsPageViewModel.cs b/src/Core/Pages/Settings/OtherSettingsPageViewModel.cs index f11a0ddde..2be3b31b0 100644 --- a/src/Core/Pages/Settings/OtherSettingsPageViewModel.cs +++ b/src/Core/Pages/Settings/OtherSettingsPageViewModel.cs @@ -11,6 +11,7 @@ using Microsoft.Maui.ApplicationModel; using Microsoft.Maui.Controls; using Microsoft.Maui; using Bit.App.Utilities; +using CommunityToolkit.Mvvm.Input; namespace Bit.App.Pages { diff --git a/src/Core/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs b/src/Core/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs index bf0e3304a..c33a74a6a 100644 --- a/src/Core/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs +++ b/src/Core/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs @@ -216,8 +216,12 @@ namespace Bit.App.Pages NestedFolders = NestedFolders.GetRange(0, NestedFolders.Count - 1); } - // TODO Xamarin.Forms.Device.RuntimePlatform is no longer supported. Use Microsoft.Maui.Devices.DeviceInfo.Platform instead. For more details see https://learn.microsoft.com/en-us/dotnet/maui/migration/forms-projects#device-changes - var uppercaseGroupNames = Device.RuntimePlatform == Device.iOS; +#if IOS + var uppercaseGroupNames = true; +#else + var uppercaseGroupNames = false; +#endif + var hasFavorites = FavoriteCiphers?.Any() ?? false; if (hasFavorites) { @@ -296,8 +300,7 @@ namespace Bit.App.Pages } // TODO: refactor this - // TODO Xamarin.Forms.Device.RuntimePlatform is no longer supported. Use Microsoft.Maui.Devices.DeviceInfo.Platform instead. For more details see https://learn.microsoft.com/en-us/dotnet/maui/migration/forms-projects#device-changes - if (Device.RuntimePlatform == Device.Android + if (DeviceInfo.Platform == DevicePlatform.Android || GroupedItems.Any()) { @@ -308,14 +311,13 @@ namespace Bit.App.Pages items.AddRange(itemGroup); } - Device.BeginInvokeOnMainThread(() => + await MainThread.InvokeOnMainThreadAsync(() => { - if (Device.RuntimePlatform == Device.iOS) - { - // HACK: [PS-536] Fix to avoid blank list after back navigation on unlocking with previous page info - // because of update to XF v5.0.0.2401 - GroupedItems.Clear(); - } +#if IOS + // HACK: [PS-536] Fix to avoid blank list after back navigation on unlocking with previous page info + // because of update to XF v5.0.0.2401 + GroupedItems.Clear(); +#endif GroupedItems.ReplaceRange(items); }); } @@ -337,16 +339,15 @@ namespace Bit.App.Pages items.AddRange(itemGroup); } - Device.BeginInvokeOnMainThread(() => + await MainThread.InvokeOnMainThreadAsync(() => { if (groupedItems.Any()) { - if (Device.RuntimePlatform == Device.iOS) - { - // HACK: [PS-536] Fix to avoid blank list after back navigation on unlocking with previous page info - // because of update to XF v5.0.0.2401 - GroupedItems.Clear(); - } +#if IOS + // HACK: [PS-536] Fix to avoid blank list after back navigation on unlocking with previous page info + // because of update to XF v5.0.0.2401 + GroupedItems.Clear(); +#endif GroupedItems.ReplaceRange(new List { new GroupingsPageHeaderListItem(groupedItems[0].Name, groupedItems[0].ItemCount) }); GroupedItems.AddRange(items); } @@ -362,7 +363,7 @@ namespace Bit.App.Pages _doingLoad = false; Loaded = true; Loading = false; - Device.BeginInvokeOnMainThread(() => + await MainThread.InvokeOnMainThreadAsync(() => { ShowNoData = (MainPage && !HasCiphers) || !groupedItems.Any(); ShowList = !ShowNoData; @@ -390,8 +391,11 @@ namespace Bit.App.Pages private void CreateCipherGroupedItems(List groupedItems) { - // TODO Xamarin.Forms.Device.RuntimePlatform is no longer supported. Use Microsoft.Maui.Devices.DeviceInfo.Platform instead. For more details see https://learn.microsoft.com/en-us/dotnet/maui/migration/forms-projects#device-changes - var uppercaseGroupNames = Device.RuntimePlatform == Device.iOS; +#if IOS + var uppercaseGroupNames = true; +#else + var uppercaseGroupNames = false; +#endif _totpTickCts?.Cancel(); if (ShowTotp) { diff --git a/src/iOS.Autofill/iOS.Autofill.csproj b/src/iOS.Autofill/iOS.Autofill.csproj index bd24d4603..47b72eded 100644 --- a/src/iOS.Autofill/iOS.Autofill.csproj +++ b/src/iOS.Autofill/iOS.Autofill.csproj @@ -20,8 +20,6 @@ false - iossimulator-arm64 - Automatic iPhone Developer Entitlements.plist @@ -30,7 +28,12 @@ - + + + + + -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" + false --linkskip=LiteDB -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" diff --git a/src/iOS.Extension/iOS.Extension.csproj b/src/iOS.Extension/iOS.Extension.csproj index 4fa82679e..69d29352e 100644 --- a/src/iOS.Extension/iOS.Extension.csproj +++ b/src/iOS.Extension/iOS.Extension.csproj @@ -26,14 +26,11 @@ Entitlements.plist all None - - - iossimulator-arm64 - - - - - + + + + -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" + false --linkskip=LiteDB -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" diff --git a/src/iOS.ShareExtension/iOS.ShareExtension.csproj b/src/iOS.ShareExtension/iOS.ShareExtension.csproj index 9d697ee1d..6acd7e412 100644 --- a/src/iOS.ShareExtension/iOS.ShareExtension.csproj +++ b/src/iOS.ShareExtension/iOS.ShareExtension.csproj @@ -21,15 +21,18 @@ false - iossimulator-arm64 - Automatic iPhone Developer Entitlements.plist all None - + + + + + -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" + false --linkskip=LiteDB -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"