make loading of databases through third party app possible again (Android < 7) or hide third party app (Android >= 7)
This commit is contained in:
@@ -74,7 +74,7 @@ namespace keepass2android
|
||||
}
|
||||
|
||||
|
||||
if (context.Intent.GetBooleanExtra(AllowThirdPartyAppGet, false))
|
||||
if ((context.Intent.GetBooleanExtra(AllowThirdPartyAppGet, false)) && (Util.ActionGetContentAvailable))
|
||||
_displayedProtocolIds.Add("androidget");
|
||||
if (context.Intent.GetBooleanExtra(AllowThirdPartyAppSend, false))
|
||||
_displayedProtocolIds.Add("androidsend");
|
||||
|
||||
@@ -200,8 +200,10 @@ namespace keepass2android
|
||||
/// is more for one-time access, but therefore allows possibly more available sources.</param>
|
||||
public static void ShowBrowseDialog(Activity activity, int requestCodeBrowse, bool forSaving, bool tryGetPermanentAccess)
|
||||
{
|
||||
var loadAction = IsKitKatOrLater ?
|
||||
Intent.ActionOpenDocument : Intent.ActionGetContent;
|
||||
var loadAction = (tryGetPermanentAccess && IsKitKatOrLater) || !ActionGetContentAvailable
|
||||
? Intent.ActionOpenDocument
|
||||
: Intent.ActionGetContent;
|
||||
|
||||
if ((!forSaving) && (IsIntentAvailable(activity, loadAction, "*/*", new List<string> { Intent.CategoryOpenable})))
|
||||
{
|
||||
Intent i = new Intent(loadAction);
|
||||
@@ -230,6 +232,12 @@ namespace keepass2android
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ActionGetContentAvailable
|
||||
{
|
||||
//https://commonsware.com/Android/previews/appendix-b-android-70
|
||||
get { return ((int) Build.VERSION.SdkInt < 24); }
|
||||
}
|
||||
|
||||
public static bool IsKitKatOrLater
|
||||
{
|
||||
get { return (int)Build.VERSION.SdkInt >= 19; }
|
||||
|
||||
Reference in New Issue
Block a user