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