1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-09-30 04:17:55 +02:00

PM-3350 Added watchOS app to main project and fixed some csproj conditions for runtime identifiers on iOS.

This commit is contained in:
Federico Maccaroni 2023-11-20 10:44:56 -03:00
parent f02b3415a3
commit 3795f3aa17
No known key found for this signature in database
GPG Key ID: 5D233F8F2B034536
6 changed files with 66 additions and 46 deletions

View File

@ -30,15 +30,9 @@
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE> <!--<ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>-->
</PropertyGroup> </PropertyGroup>
<!--<PropertyGroup Condition="$(TargetFramework.Contains('-ios'))">
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>-->
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'">
<AndroidEnableMultiDex>True</AndroidEnableMultiDex> <AndroidEnableMultiDex>True</AndroidEnableMultiDex>
<UseInterpreter>False</UseInterpreter> <UseInterpreter>False</UseInterpreter>
@ -56,18 +50,18 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage> <CreatePackage>false</CreatePackage>
<RuntimeIdentifier>iossimulator-arm64</RuntimeIdentifier>
<!--<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>-->
<CodesignProvision>Automatic</CodesignProvision> <CodesignProvision>Automatic</CodesignProvision>
<CodesignKey>iPhone Developer</CodesignKey> <CodesignKey>iPhone Developer</CodesignKey>
<CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements>
<MtouchInterpreter>all</MtouchInterpreter> <MtouchInterpreter>all</MtouchInterpreter>
<MtouchLink>None</MtouchLink> <MtouchLink>None</MtouchLink>
<!--<MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>--> <!--TODO: add argon2id load when library is built with the corresponding architecture for iOS Simulator-->
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(RuntimeIdentifier)'=='Debug|net8.0-ios|ios-arm64'">
<MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage> <CreatePackage>false</CreatePackage>
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
<CodesignProvision>Automatic:AppStore</CodesignProvision> <CodesignProvision>Automatic:AppStore</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey> <CodesignKey>iPhone Distribution</CodesignKey>
<CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements>
@ -250,6 +244,24 @@
<IsWatchApp>false</IsWatchApp> <IsWatchApp>false</IsWatchApp>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net8.0-ios'">
<WatchAppBuildPath Condition=" '$(Configuration)' == 'Debug' ">$(Home)/Library/Developer/Xcode/DerivedData/bitwarden-acgkbpwvmebfiofokotvoerzkqcl/Build/Products</WatchAppBuildPath>
<WatchAppBuildPath Condition=" '$(Configuration)' != 'Debug' ">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\..'))/watchOS/bitwarden.xcarchive/Products/Applications/bitwarden.app/Watch</WatchAppBuildPath>
<WatchAppBundle>Bitwarden.app</WatchAppBundle>
<WatchAppConfiguration Condition="'$(RuntimeIdentifier)'!='ios-arm64'"> >watchsimulator</WatchAppConfiguration>
<WatchAppConfiguration Condition="'$(RuntimeIdentifier)'=='ios-arm64'"> >watchos</WatchAppConfiguration>
<WatchAppBundleFullPath Condition=" '$(Configuration)' == 'Debug' ">$(WatchAppBuildPath)/$(Configuration)-$(WatchAppConfiguration)/$(WatchAppBundle)</WatchAppBundleFullPath>
<WatchAppBundleFullPath Condition=" '$(Configuration)' != 'Debug' ">$(WatchAppBuildPath)/$(WatchAppBundle)</WatchAppBundleFullPath>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net8.0-ios' AND Exists('$(WatchAppBundleFullPath)') ">
<_ResolvedWatchAppReferences Include="$(WatchAppBundleFullPath)" />
</ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net8.0-ios' AND Exists('$(WatchAppBundleFullPath)') ">
<CreateAppBundleDependsOn>
_CopyWatchOS2AppsToBundle;
$(CreateAppBundleDependsOn);
</CreateAppBundleDependsOn>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<GoogleServicesJson Include="Platforms\Android\google-services.json" /> <GoogleServicesJson Include="Platforms\Android\google-services.json" />
<GoogleServicesJson Include="Platforms\Android\google-services.json.enc" /> <GoogleServicesJson Include="Platforms\Android\google-services.json.enc" />

View File

@ -11,6 +11,7 @@ using Microsoft.Maui.ApplicationModel;
using Microsoft.Maui.Controls; using Microsoft.Maui.Controls;
using Microsoft.Maui; using Microsoft.Maui;
using Bit.App.Utilities; using Bit.App.Utilities;
using CommunityToolkit.Mvvm.Input;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {

View File

@ -216,8 +216,12 @@ namespace Bit.App.Pages
NestedFolders = NestedFolders.GetRange(0, NestedFolders.Count - 1); 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 #if IOS
var uppercaseGroupNames = Device.RuntimePlatform == Device.iOS; var uppercaseGroupNames = true;
#else
var uppercaseGroupNames = false;
#endif
var hasFavorites = FavoriteCiphers?.Any() ?? false; var hasFavorites = FavoriteCiphers?.Any() ?? false;
if (hasFavorites) if (hasFavorites)
{ {
@ -296,8 +300,7 @@ namespace Bit.App.Pages
} }
// TODO: refactor this // 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 (DeviceInfo.Platform == DevicePlatform.Android
if (Device.RuntimePlatform == Device.Android
|| ||
GroupedItems.Any()) GroupedItems.Any())
{ {
@ -308,14 +311,13 @@ namespace Bit.App.Pages
items.AddRange(itemGroup); items.AddRange(itemGroup);
} }
Device.BeginInvokeOnMainThread(() => await MainThread.InvokeOnMainThreadAsync(() =>
{ {
if (Device.RuntimePlatform == Device.iOS) #if IOS
{ // HACK: [PS-536] Fix to avoid blank list after back navigation on unlocking with previous page info
// 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
// because of update to XF v5.0.0.2401 GroupedItems.Clear();
GroupedItems.Clear(); #endif
}
GroupedItems.ReplaceRange(items); GroupedItems.ReplaceRange(items);
}); });
} }
@ -337,16 +339,15 @@ namespace Bit.App.Pages
items.AddRange(itemGroup); items.AddRange(itemGroup);
} }
Device.BeginInvokeOnMainThread(() => await MainThread.InvokeOnMainThreadAsync(() =>
{ {
if (groupedItems.Any()) if (groupedItems.Any())
{ {
if (Device.RuntimePlatform == Device.iOS) #if IOS
{ // HACK: [PS-536] Fix to avoid blank list after back navigation on unlocking with previous page info
// 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
// because of update to XF v5.0.0.2401 GroupedItems.Clear();
GroupedItems.Clear(); #endif
}
GroupedItems.ReplaceRange(new List<IGroupingsPageListItem> { new GroupingsPageHeaderListItem(groupedItems[0].Name, groupedItems[0].ItemCount) }); GroupedItems.ReplaceRange(new List<IGroupingsPageListItem> { new GroupingsPageHeaderListItem(groupedItems[0].Name, groupedItems[0].ItemCount) });
GroupedItems.AddRange(items); GroupedItems.AddRange(items);
} }
@ -362,7 +363,7 @@ namespace Bit.App.Pages
_doingLoad = false; _doingLoad = false;
Loaded = true; Loaded = true;
Loading = false; Loading = false;
Device.BeginInvokeOnMainThread(() => await MainThread.InvokeOnMainThreadAsync(() =>
{ {
ShowNoData = (MainPage && !HasCiphers) || !groupedItems.Any(); ShowNoData = (MainPage && !HasCiphers) || !groupedItems.Any();
ShowList = !ShowNoData; ShowList = !ShowNoData;
@ -390,8 +391,11 @@ namespace Bit.App.Pages
private void CreateCipherGroupedItems(List<GroupingsPageListGroup> groupedItems) private void CreateCipherGroupedItems(List<GroupingsPageListGroup> 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 #if IOS
var uppercaseGroupNames = Device.RuntimePlatform == Device.iOS; var uppercaseGroupNames = true;
#else
var uppercaseGroupNames = false;
#endif
_totpTickCts?.Cancel(); _totpTickCts?.Cancel();
if (ShowTotp) if (ShowTotp)
{ {

View File

@ -20,8 +20,6 @@
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage> <CreatePackage>false</CreatePackage>
<RuntimeIdentifier>iossimulator-arm64</RuntimeIdentifier>
<!--<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>-->
<CodesignProvision>Automatic</CodesignProvision> <CodesignProvision>Automatic</CodesignProvision>
<CodesignKey>iPhone Developer</CodesignKey> <CodesignKey>iPhone Developer</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
@ -30,7 +28,12 @@
<!-- <!--
Note: The linkskip needs 2 dashes in front but if we put it in the comment then the project can't load so leaving it with 1 for now Note: The linkskip needs 2 dashes in front but if we put it in the comment then the project can't load so leaving it with 1 for now
<MtouchExtraArgs>-linkskip=LiteDB -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>--> <MtouchExtraArgs>-linkskip=LiteDB -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>-->
</PropertyGroup>
<!--TODO: add argon2id load when library is built with the corresponding architecture for iOS Simulator-->
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(RuntimeIdentifier)'=='Debug|net8.0-ios|ios-arm64'">
<MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage> <CreatePackage>false</CreatePackage>
<MtouchExtraArgs>--linkskip=LiteDB -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs> <MtouchExtraArgs>--linkskip=LiteDB -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>

View File

@ -26,14 +26,11 @@
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchInterpreter>all</MtouchInterpreter> <MtouchInterpreter>all</MtouchInterpreter>
<MtouchLink>None</MtouchLink> <MtouchLink>None</MtouchLink>
</PropertyGroup> <!--TODO: add argon2id load when library is built with the corresponding architecture for iOS Simulator-->
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'"> </PropertyGroup>
<RuntimeIdentifier>iossimulator-arm64</RuntimeIdentifier> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(RuntimeIdentifier)'=='Debug|net8.0-ios|ios-arm64'">
</PropertyGroup> <MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'"> </PropertyGroup>
<!--<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>-->
<!--<MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>-->
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage> <CreatePackage>false</CreatePackage>
<MtouchExtraArgs>--linkskip=LiteDB -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs> <MtouchExtraArgs>--linkskip=LiteDB -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>

View File

@ -21,15 +21,18 @@
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage> <CreatePackage>false</CreatePackage>
<RuntimeIdentifier>iossimulator-arm64</RuntimeIdentifier>
<!--<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>-->
<CodesignProvision>Automatic</CodesignProvision> <CodesignProvision>Automatic</CodesignProvision>
<CodesignKey>iPhone Developer</CodesignKey> <CodesignKey>iPhone Developer</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchInterpreter>all</MtouchInterpreter> <MtouchInterpreter>all</MtouchInterpreter>
<MtouchLink>None</MtouchLink> <MtouchLink>None</MtouchLink>
<!--<MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>--> <!--<MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>-->
</PropertyGroup>
<!--TODO: add argon2id load when library is built with the corresponding architecture for iOS Simulator-->
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(RuntimeIdentifier)'=='Debug|net8.0-ios|ios-arm64'">
<MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage> <CreatePackage>false</CreatePackage>
<MtouchExtraArgs>--linkskip=LiteDB -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs> <MtouchExtraArgs>--linkskip=LiteDB -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>