<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFrameworks>net8.0-android;net8.0-ios</TargetFrameworks>

    <!-- Uncomment to also build for Windows platform.-->
    <!--<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>-->

    <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
    <!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

		<OutputType>Exe</OutputType>
		<RootNamespace>Bit.App</RootNamespace>
		<UseMaui>true</UseMaui>
		<SingleProject>true</SingleProject>
		<ImplicitUsings>enable</ImplicitUsings>

		<!-- Display name -->
		<ApplicationTitle>Bitwarden</ApplicationTitle>

		<!-- App Identifier -->
		<ApplicationId Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">com.8bit.bitwarden</ApplicationId>
		<ApplicationId Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">com.x8bit.bitwarden</ApplicationId>
		<ApplicationIdGuid>ccf4766c-a36c-4647-900c-0ea7d323ccc6</ApplicationIdGuid>

		<!-- Versions -->
		<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
		<ApplicationVersion>1</ApplicationVersion>

		<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
		<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>

		<ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
	</PropertyGroup>
	<PropertyGroup>
    <DefineConstants Condition=" '$(CustomConstants)' != '' ">$(DefineConstants);$(CustomConstants)</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'">
    <AndroidEnableMultiDex>True</AndroidEnableMultiDex>
    <UseInterpreter>False</UseInterpreter>
    <DebugSymbols>True</DebugSymbols>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
    <AndroidEnableMultiDex>True</AndroidEnableMultiDex>
    <UseInterpreter>False</UseInterpreter>
    <DebugSymbols>False</DebugSymbols>
    <RunAOTCompilation>False</RunAOTCompilation>
    <AndroidSupportedAbis>armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
    <JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
    <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
    <AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
  </PropertyGroup>
	<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
	  <CreatePackage>false</CreatePackage>
	  <CodesignProvision>Automatic</CodesignProvision>
	  <CodesignKey>iPhone Developer</CodesignKey>
	  <CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements>
	  <UseInterpreter>true</UseInterpreter>
	</PropertyGroup>
	<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(RuntimeIdentifier)'=='Debug|net8.0-ios|iossimulator-x64'">
		<MtouchExtraArgs>$(Argon2IdLoadMtouchExtraArgs)</MtouchExtraArgs>
	</PropertyGroup>
	<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(RuntimeIdentifier)'=='Debug|net8.0-ios|ios-arm64'">
		<MtouchExtraArgs>$(Argon2IdLoadMtouchExtraArgs)</MtouchExtraArgs>
	</PropertyGroup>
	<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
	  <CreatePackage>false</CreatePackage>
      <CodesignProvision>$(ReleaseCodesignProvision)</CodesignProvision>
      <CodesignKey>$(ReleaseCodesignKey)</CodesignKey>
	  <CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements>
	  <UseInterpreter>true</UseInterpreter>
	  <MtouchExtraArgs>$(Argon2IdLoadMtouchExtraArgs)</MtouchExtraArgs>
	</PropertyGroup>
	<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
		<!--This is needed for PCLCrypto to work correctly-->
		<TrimmerRootAssembly Include="System.Security.Cryptography" />
	</ItemGroup>
	<ItemGroup>
	  <AndroidNativeLibrary Include="Platforms\Android\lib\arm64-v8a\libargon2.so" />
	  <AndroidNativeLibrary Include="Platforms\Android\lib\armeabi-v7a\libargon2.so" />
	  <AndroidNativeLibrary Include="Platforms\Android\lib\x86\libargon2.so" />
	  <AndroidNativeLibrary Include="Platforms\Android\lib\x86_64\libargon2.so" />
	</ItemGroup>
	<ItemGroup>
		<PackageReference Include="Camera.MAUI" Version="1.4.4" />
		<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
		<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
		<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
		<PackageReference Include="CsvHelper" Version="30.0.1" />
		<PackageReference Include="LiteDB" Version="5.0.17" />
		<PackageReference Include="MessagePack" Version="2.5.124" />
		<PackageReference Include="MessagePack.MSBuild.Tasks" Version="2.5.124">
		  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
		  <PrivateAssets>all</PrivateAssets>
		</PackageReference>
		<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
		<PackageReference Include="zxcvbn-core" Version="7.0.92" />
		<PackageReference Include="CommunityToolkit.Maui" Version="5.2.0" />
		<PackageReference Include="Plugin.Fingerprint" Version="3.0.0-beta.1" />
		<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="2.88.4-preview.84" />
		<PackageReference Include="SkiaSharp.Views.Maui.Controls.Compatibility" Version="2.88.4-preview.84" />
		<PackageReference Include="FFImageLoadingCompat.Maui" Version="0.1.1" />
		<PackageReference Include="AsyncAwaitBestPractices.MVVM" Version="6.0.6" />
		<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
		<PackageReference Include="PCLCrypto" Version="2.1.40-alpha" />
		<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
	</ItemGroup>
	<ItemGroup>
	  <Folder Include="Effects\" />
	  <Folder Include="Resources\" />
	  <Folder Include="Resources\AppIcon\" />
	  <Folder Include="Resources\Splash\" />
	  <Folder Include="Platforms\Android\Accessibility\" />
	  <Folder Include="Platforms\Android\Autofill\" />
	  <Folder Include="Platforms\Android\Push\" />
	  <Folder Include="Platforms\Android\Receivers\" />
	  <Folder Include="Platforms\Android\Services\" />
	  <Folder Include="Platforms\Android\Tiles\" />
	  <Folder Include="Platforms\Android\Utilities\" />
	</ItemGroup>
	<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
	  <PackageReference Include="Xamarin.AndroidX.AutoFill" Version="1.1.0.18" />
	  <PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.7.2.1" />
	</ItemGroup>
	<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android' AND !$(DefineConstants.Contains(FDROID))">
	  <PackageReference Include="Xamarin.GooglePlayServices.SafetyNet" Version="118.0.1.5" />
	  <PackageReference Include="Xamarin.Firebase.Messaging" Version="123.1.2.2" />
	</ItemGroup>
	<ItemGroup Condition="!$(DefineConstants.Contains(FDROID))">
		<PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.3" />
	</ItemGroup>
	<ItemGroup>
	  <BundleResource Include="Platforms\Android\Resources\mipmap-mdpi\ic_launcher.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-mdpi\ic_launcher_round.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-xxhdpi\ic_launcher.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-xxhdpi\ic_launcher_round.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-xxxhdpi\ic_launcher.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-xxxhdpi\ic_launcher_round.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-hdpi\ic_launcher.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-hdpi\ic_launcher_round.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-mdpi\ic_launcher.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-mdpi\ic_launcher_round.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-hdpi\ic_launcher.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-hdpi\ic_launcher_round.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-xxxhdpi\ic_launcher.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-xxxhdpi\ic_launcher_round.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-xxhdpi\ic_launcher.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-xxhdpi\ic_launcher_round.png" />
	  <BundleResource Include="Platforms\Android\Resources\drawable-xhdpi\logo_legacy.png" />
	  <BundleResource Include="Platforms\Android\Resources\drawable-xhdpi\yubikey.png" />
	  <BundleResource Include="Platforms\Android\Resources\drawable-xhdpi\logo_white_legacy.png" />
	  <BundleResource Include="Platforms\Android\Resources\drawable-xxhdpi\logo_legacy.png" />
	  <BundleResource Include="Platforms\Android\Resources\drawable-xxhdpi\yubikey.png" />
	  <BundleResource Include="Platforms\Android\Resources\drawable-xxhdpi\logo_white_legacy.png" />
	  <BundleResource Include="Platforms\Android\Resources\drawable-hdpi\logo_legacy.png" />
	  <BundleResource Include="Platforms\Android\Resources\drawable-hdpi\yubikey.png" />
	  <BundleResource Include="Platforms\Android\Resources\drawable-hdpi\logo_white_legacy.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-xhdpi\ic_launcher.png" />
	  <BundleResource Include="Platforms\Android\Resources\mipmap-xhdpi\ic_launcher_round.png" />
	  <BundleResource Include="Platforms\iOS\Resources\logo.png" />
	  <BundleResource Include="Platforms\iOS\Resources\logo_white%402x.png" />
	  <BundleResource Include="Platforms\iOS\Resources\more_vert%402x.png" />
	  <BundleResource Include="Platforms\iOS\Resources\logo_white%403x.png" />
	  <BundleResource Include="Platforms\iOS\Resources\logo%403x.png" />
	  <BundleResource Include="Platforms\iOS\Resources\more_vert%403x.png" />
	  <BundleResource Include="Platforms\iOS\Resources\more_vert.png" />
	  <BundleResource Include="Platforms\iOS\Resources\logo_white.png" />
	  <BundleResource Include="Platforms\iOS\Resources\logo%402x.png" />
	</ItemGroup>
	<ItemGroup>
	  <ProjectReference Include="..\iOS.Core\iOS.Core.csproj" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'" />
	  <ProjectReference Include="..\Core\Core.csproj" />
	</ItemGroup>
	<ItemGroup>
				<!-- App Icon -->
		<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
	</ItemGroup>
	<ItemGroup>
	  <MauiImage Include="Resources\cog_settings.svg">
	    <BaseSize>24,24</BaseSize>
	  </MauiImage>
	  <MauiImage Include="Resources\ext_act.png" />
	  <MauiImage Include="Resources\ext_more.png" />
	  <MauiImage Include="Resources\ext_use.png" />
	  <MauiImage Include="Resources\generate.svg">
	    <BaseSize>24,24</BaseSize>
	  </MauiImage>
	  <MauiImage Include="Resources\info.svg">
	    <BaseSize>24,24</BaseSize>
	  </MauiImage>
	  <MauiImage Include="Resources\lock.svg">
	    <BaseSize>24,24</BaseSize>
	  </MauiImage>
	  <MauiImage Include="Resources\login.svg">
	    <BaseSize>24,24</BaseSize>
	  </MauiImage>
	  <MauiImage Include="Resources\logo_white.png" />
	  <MauiImage Include="Resources\logo.png" />
	  <MauiImage Include="Resources\more_vert.svg">
	    <BaseSize>24,24</BaseSize>
	  </MauiImage>
	  <MauiImage Include="Resources\more.svg">
	    <BaseSize>24,24</BaseSize>
	  </MauiImage>
	  <MauiImage Include="Resources\plus.svg" TintColor="#FFFFFFFF">
	    <BaseSize>24,24</BaseSize>
	  </MauiImage>
	  <MauiImage Include="Resources\send.svg">
	    <BaseSize>24,24</BaseSize>
	  </MauiImage>
	  <MauiImage Include="Resources\yubikey.png" />
	</ItemGroup>
	<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' AND '$(IncludeBitwardeniOSExtensions)' == 'True'">
		<ProjectReference Include="..\iOS.Autofill\iOS.Autofill.csproj">
			<IsAppExtension>true</IsAppExtension>
			<IsWatchApp>false</IsWatchApp>
		</ProjectReference>
		<ProjectReference Include="..\iOS.Extension\iOS.Extension.csproj">
			<IsAppExtension>true</IsAppExtension>
			<IsWatchApp>false</IsWatchApp>
		</ProjectReference>
		<ProjectReference Include="..\iOS.ShareExtension\iOS.ShareExtension.csproj">
			<IsAppExtension>true</IsAppExtension>
			<IsWatchApp>false</IsWatchApp>
		</ProjectReference>
	</ItemGroup>
	<PropertyGroup Condition="'$(TargetFramework)'=='net8.0-ios' AND '$(IncludeBitwardenWatchOSApp)' == 'True'">
		<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>
	  <GoogleServicesJson Include="Platforms\Android\google-services.json" />
	  <GoogleServicesJson Include="Platforms\Android\google-services.json.enc" />
	</ItemGroup>
	<ItemGroup>
	  <None Remove="Platforms\iOS\Resources\logo.png" />
	  <None Remove="Platforms\iOS\Resources\logo_white%402x.png" />
	  <None Remove="Platforms\iOS\Resources\more_vert%402x.png" />
	  <None Remove="Platforms\iOS\Resources\logo_white%403x.png" />
	  <None Remove="Platforms\iOS\Resources\logo%403x.png" />
	  <None Remove="Platforms\iOS\Resources\more_vert%403x.png" />
	  <None Remove="Platforms\iOS\Resources\more_vert.png" />
	  <None Remove="Platforms\iOS\Resources\logo_white.png" />
	  <None Remove="Platforms\iOS\Resources\logo%402x.png" />
	</ItemGroup>
</Project>
