remove "singleTask" launch mode on Android 11+ (#1673)
* remove "singleTask" launch mode on Android 12+ * remove commented and unneccesary code * fix formatting and change from Android 12 to Android 11
This commit is contained in:
parent
ea1ee2c3d3
commit
05bcc10277
|
@ -206,6 +206,8 @@
|
||||||
<AndroidResource Include="Resources\values-night\styles.xml" />
|
<AndroidResource Include="Resources\values-night\styles.xml" />
|
||||||
<AndroidResource Include="Resources\values\styles.xml" />
|
<AndroidResource Include="Resources\values\styles.xml" />
|
||||||
<AndroidResource Include="Resources\values\colors.xml" />
|
<AndroidResource Include="Resources\values\colors.xml" />
|
||||||
|
<AndroidResource Include="Resources\values\manifest.xml" />
|
||||||
|
<AndroidResource Include="Resources\values-v30\manifest.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable\splash_screen.xml" />
|
<AndroidResource Include="Resources\drawable\splash_screen.xml" />
|
||||||
|
@ -271,5 +273,8 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</AndroidResource>
|
</AndroidResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Resources\values-v30\" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
|
@ -22,25 +22,10 @@ using ZXing.Net.Mobile.Android;
|
||||||
|
|
||||||
namespace Bit.Droid
|
namespace Bit.Droid
|
||||||
{
|
{
|
||||||
[Activity(
|
// Activity and IntentFilter declarations have been moved to Properties/AndroidManifest.xml
|
||||||
Label = "Bitwarden",
|
// They have been hardcoded so we can use the default LaunchMode on Android 11+
|
||||||
Icon = "@mipmap/ic_launcher",
|
// LaunchMode defined in values/manifest.xml for Android 10- and values-v30/manifest.xml for Android 11+
|
||||||
Theme = "@style/LaunchTheme",
|
// See https://github.com/bitwarden/mobile/pull/1673 for details
|
||||||
MainLauncher = true,
|
|
||||||
LaunchMode = LaunchMode.SingleTask,
|
|
||||||
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation |
|
|
||||||
ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden |
|
|
||||||
ConfigChanges.Navigation | ConfigChanges.UiMode)]
|
|
||||||
[IntentFilter(
|
|
||||||
new[] { Intent.ActionSend },
|
|
||||||
Categories = new[] { Intent.CategoryDefault },
|
|
||||||
DataMimeTypes = new[]
|
|
||||||
{
|
|
||||||
@"application/*",
|
|
||||||
@"image/*",
|
|
||||||
@"video/*",
|
|
||||||
@"text/*"
|
|
||||||
})]
|
|
||||||
[Register("com.x8bit.bitwarden.MainActivity")]
|
[Register("com.x8bit.bitwarden.MainActivity")]
|
||||||
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||||
{
|
{
|
||||||
|
@ -159,7 +144,15 @@ namespace Bit.Droid
|
||||||
base.OnNewIntent(intent);
|
base.OnNewIntent(intent);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (intent.GetBooleanExtra("generatorTile", false))
|
if (intent?.GetStringExtra("uri") is string uri)
|
||||||
|
{
|
||||||
|
_messagingService.Send("popAllAndGoToAutofillCiphers");
|
||||||
|
if (_appOptions != null)
|
||||||
|
{
|
||||||
|
_appOptions.Uri = uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (intent.GetBooleanExtra("generatorTile", false))
|
||||||
{
|
{
|
||||||
_messagingService.Send("popAllAndGoToTabGenerator");
|
_messagingService.Send("popAllAndGoToTabGenerator");
|
||||||
if (_appOptions != null)
|
if (_appOptions != null)
|
||||||
|
|
|
@ -49,13 +49,35 @@
|
||||||
|
|
||||||
<!-- Support for LG "Dual Window" mode (for Android < 7.0 users) -->
|
<!-- Support for LG "Dual Window" mode (for Android < 7.0 users) -->
|
||||||
<meta-data android:name="com.lge.support.SPLIT_WINDOW" android:value="true" />
|
<meta-data android:name="com.lge.support.SPLIT_WINDOW" android:value="true" />
|
||||||
|
<!-- Declare MainActivity manually so we can set LaunchMode using API dependant resource -->
|
||||||
|
<activity
|
||||||
|
android:name="com.x8bit.bitwarden.MainActivity"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|uiMode"
|
||||||
|
android:exported="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="Bitwarden"
|
||||||
|
android:launchMode="@integer/launchModeAPIlevel"
|
||||||
|
android:theme="@style/LaunchTheme">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEND" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="application/*" />
|
||||||
|
<data android:mimeType="image/*" />
|
||||||
|
<data android:mimeType="video/*" />
|
||||||
|
<data android:mimeType="text/*" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<!-- Package visibility (for Android 11+) -->
|
<!-- Package visibility (for Android 11+) -->
|
||||||
<queries>
|
<queries>
|
||||||
<intent>
|
<intent>
|
||||||
<action android:name="*"/>
|
<action android:name="*"/>
|
||||||
</intent>
|
</intent>
|
||||||
</queries>
|
</queries>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<resources>
|
||||||
|
<integer name="launchModeAPIlevel">0</integer>
|
||||||
|
</resources>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<resources>
|
||||||
|
<integer name="launchModeAPIlevel">2</integer>
|
||||||
|
</resources>
|
|
@ -113,7 +113,8 @@ namespace Bit.App
|
||||||
}
|
}
|
||||||
else if (message.Command == "popAllAndGoToTabGenerator" ||
|
else if (message.Command == "popAllAndGoToTabGenerator" ||
|
||||||
message.Command == "popAllAndGoToTabMyVault" ||
|
message.Command == "popAllAndGoToTabMyVault" ||
|
||||||
message.Command == "popAllAndGoToTabSend")
|
message.Command == "popAllAndGoToTabSend" ||
|
||||||
|
message.Command == "popAllAndGoToAutofillCiphers")
|
||||||
{
|
{
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
Device.BeginInvokeOnMainThread(async () =>
|
||||||
{
|
{
|
||||||
|
@ -123,7 +124,11 @@ namespace Bit.App
|
||||||
{
|
{
|
||||||
await tabsPage.Navigation.PopModalAsync(false);
|
await tabsPage.Navigation.PopModalAsync(false);
|
||||||
}
|
}
|
||||||
if (message.Command == "popAllAndGoToTabMyVault")
|
if (message.Command == "popAllAndGoToAutofillCiphers")
|
||||||
|
{
|
||||||
|
Current.MainPage = new NavigationPage(new AutofillCiphersPage(Options));
|
||||||
|
}
|
||||||
|
else if (message.Command == "popAllAndGoToTabMyVault")
|
||||||
{
|
{
|
||||||
Options.MyVaultTile = false;
|
Options.MyVaultTile = false;
|
||||||
tabsPage.ResetToVaultPage();
|
tabsPage.ResetToVaultPage();
|
||||||
|
|
Loading…
Reference in New Issue