mirror of
https://github.com/moparisthebest/keepass2android
synced 2025-02-16 15:00:12 -05:00
Bug fixes
This commit is contained in:
parent
a2dc7449d4
commit
00332523e6
@ -385,7 +385,7 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
|
|
||||||
Intent showNotIntent = new Intent(this, typeof(CopyToClipboardService));
|
Intent showNotIntent = new Intent(this, typeof(CopyToClipboardService));
|
||||||
Intent.SetAction(Intents.ShowNotification);
|
showNotIntent.SetAction(Intents.ShowNotification);
|
||||||
showNotIntent.PutExtra(KeyEntry, Entry.Uuid.ToHexString());
|
showNotIntent.PutExtra(KeyEntry, Entry.Uuid.ToHexString());
|
||||||
bool closeAfterCreate = _appTask.CloseEntryActivityAfterCreate;
|
bool closeAfterCreate = _appTask.CloseEntryActivityAfterCreate;
|
||||||
showNotIntent.PutExtra(KeyCloseAfterCreate, closeAfterCreate);
|
showNotIntent.PutExtra(KeyCloseAfterCreate, closeAfterCreate);
|
||||||
|
@ -45,7 +45,7 @@ namespace keepass2android
|
|||||||
protected LockCloseActivity(IntPtr javaReference, JniHandleOwnership transfer)
|
protected LockCloseActivity(IntPtr javaReference, JniHandleOwnership transfer)
|
||||||
: base(javaReference, transfer)
|
: base(javaReference, transfer)
|
||||||
{
|
{
|
||||||
|
_design = new ActivityDesign(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnCreate(Bundle savedInstanceState)
|
protected override void OnCreate(Bundle savedInstanceState)
|
||||||
|
@ -16,7 +16,6 @@ namespace keepass2android
|
|||||||
private const string _accessToken = "accessToken";
|
private const string _accessToken = "accessToken";
|
||||||
private const string _scopes = "scopes";
|
private const string _scopes = "scopes";
|
||||||
private const string _requesttoken = "requestToken";
|
private const string _requesttoken = "requestToken";
|
||||||
private const string _pluginlist = "pluginList";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -34,14 +33,7 @@ namespace keepass2android
|
|||||||
editor.PutString(_requesttoken, Guid.NewGuid().ToString());
|
editor.PutString(_requesttoken, Guid.NewGuid().ToString());
|
||||||
editor.Commit();
|
editor.Commit();
|
||||||
}
|
}
|
||||||
var hostPrefs = GetHostPrefs();
|
|
||||||
var plugins = hostPrefs.GetStringSet(_pluginlist, new List<string>());
|
|
||||||
if (!plugins.Contains(packageName))
|
|
||||||
{
|
|
||||||
plugins.Add(packageName);
|
|
||||||
hostPrefs.Edit().PutStringSet(_pluginlist, plugins).Commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
return prefs;
|
return prefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,8 +54,7 @@ namespace keepass2android
|
|||||||
|
|
||||||
public IEnumerable<String> GetAllPluginPackages()
|
public IEnumerable<String> GetAllPluginPackages()
|
||||||
{
|
{
|
||||||
var hostPrefs = GetHostPrefs();
|
return PluginHost.GetAllPlugins(_ctx);
|
||||||
return hostPrefs.GetStringSet(_pluginlist, new List<string>()).Where(IsPackageInstalled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsPackageInstalled(string targetPackage)
|
public bool IsPackageInstalled(string targetPackage)
|
||||||
@ -95,11 +86,6 @@ namespace keepass2android
|
|||||||
.Commit();
|
.Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISharedPreferences GetHostPrefs()
|
|
||||||
{
|
|
||||||
return _ctx.GetSharedPreferences("plugins", FileCreationMode.Private);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetEnabled(string pluginPackage, bool enabled)
|
public void SetEnabled(string pluginPackage, bool enabled)
|
||||||
{
|
{
|
||||||
if (enabled)
|
if (enabled)
|
||||||
@ -166,7 +152,6 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
GetPreferencesForPlugin(plugin).Edit().Clear().Commit();
|
GetPreferencesForPlugin(plugin).Edit().Clear().Commit();
|
||||||
}
|
}
|
||||||
GetHostPrefs().Edit().Clear().Commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,23 +24,25 @@ namespace keepass2android
|
|||||||
|
|
||||||
private static readonly string[] _validScopes = { Strings.ScopeDatabaseActions, Strings.ScopeCurrentEntry };
|
private static readonly string[] _validScopes = { Strings.ScopeDatabaseActions, Strings.ScopeCurrentEntry };
|
||||||
|
|
||||||
/// <summary>
|
public static IEnumerable<string> GetAllPlugins(Context ctx)
|
||||||
/// Sends a broadcast to all potential plugins prompting them to request access to our app.
|
|
||||||
/// </summary>
|
|
||||||
public static void TriggerRequests(Context ctx)
|
|
||||||
{
|
{
|
||||||
Intent accessIntent = new Intent(Strings.ActionTriggerRequestAccess);
|
Intent accessIntent = new Intent(Strings.ActionTriggerRequestAccess);
|
||||||
PackageManager packageManager = ctx.PackageManager;
|
PackageManager packageManager = ctx.PackageManager;
|
||||||
IList<ResolveInfo> dictPacks = packageManager.QueryBroadcastReceivers(
|
IList<ResolveInfo> dictPacks = packageManager.QueryBroadcastReceivers(
|
||||||
accessIntent, PackageInfoFlags.Receivers);
|
accessIntent, PackageInfoFlags.Receivers);
|
||||||
PluginDatabase pluginDatabase = new PluginDatabase(ctx);
|
|
||||||
foreach (ResolveInfo ri in dictPacks)
|
return dictPacks.Select(ri => ri.ActivityInfo.ApplicationInfo).Select(appInfo => appInfo.PackageName);
|
||||||
{
|
|
||||||
ApplicationInfo appInfo = ri.ActivityInfo.ApplicationInfo;
|
}
|
||||||
String pkgName = appInfo.PackageName;
|
|
||||||
|
|
||||||
TriggerRequest(ctx, pkgName, pluginDatabase);
|
/// <summary>
|
||||||
}
|
/// Sends a broadcast to all potential plugins prompting them to request access to our app.
|
||||||
|
/// </summary>
|
||||||
|
public static void TriggerRequests(Context ctx)
|
||||||
|
{
|
||||||
|
PluginDatabase pluginDatabase = new PluginDatabase(ctx);
|
||||||
|
foreach (string pkg in GetAllPlugins(ctx))
|
||||||
|
TriggerRequest(ctx, pkg, pluginDatabase);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user