Merge branch '1.0.0e'

This commit is contained in:
Philipp Crocoll
2016-08-30 03:40:17 +02:00
588 changed files with 22803 additions and 919 deletions

View File

@@ -254,7 +254,8 @@ namespace keepass2android.Io
//check if we need to request the external-storage-permission at runtime
if (ioc.IsLocalFile())
{
bool requiresPermission = !ioc.Path.StartsWith(activity.Activity.FilesDir.CanonicalPath);
bool requiresPermission = !(ioc.Path.StartsWith(activity.Activity.FilesDir.CanonicalPath)
|| ioc.Path.StartsWith(IoUtil.GetInternalDirectory(activity.Activity).CanonicalPath));
var extDirectory = activity.Activity.GetExternalFilesDir(null);
if ((extDirectory != null) && (ioc.Path.StartsWith(extDirectory.CanonicalPath)))

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Text;
using Android.Content;
using Android.OS;
using Java.IO;
using KeePassLib.Serialization;
@@ -53,13 +54,14 @@ namespace keepass2android.Io
try
{
File filesDir = context.FilesDir.CanonicalFile;
File noBackupDir = GetInternalDirectory(context).CanonicalFile;
File ourFile = new File(path).CanonicalFile;
//http://www.java2s.com/Tutorial/Java/0180__File/Checkswhetherthechilddirectoryisasubdirectoryofthebasedirectory.htm
File parentFile = ourFile;
while (parentFile != null)
{
if (filesDir.Equals(parentFile))
if ((filesDir.Equals(parentFile) || noBackupDir.Equals(parentFile)))
{
return true;
}
@@ -92,5 +94,13 @@ namespace keepass2android.Io
writeTransaction.CommitWrite();
}
}
public static Java.IO.File GetInternalDirectory(Context ctx)
{
if ((int)Android.OS.Build.VERSION.SdkInt >= 21)
return ctx.NoBackupFilesDir;
else
return ctx.FilesDir;
}
}
}

View File

@@ -94,7 +94,6 @@
<Compile Include="Io\IFileStorage.cs" />
<Compile Include="Io\IoUtil.cs" />
<Compile Include="Io\JavaFileStorage.cs" />
<Compile Include="Io\NetFtpFileStorage.cs" />
<Compile Include="Io\OfflineSwitchableFileStorage.cs" />
<Compile Include="Io\SftpFileStorage.cs" />
<Compile Include="Io\SkyDriveFileStorage.cs" />

View File

@@ -101,7 +101,7 @@ namespace keepass2android
}
catch (DuplicateUuidsException e)
{
Kp2aLog.LogUnexpectedError(e);
Kp2aLog.Log(e.ToString());
Finish(false, _app.GetResourceString(UiStringKey.DuplicateUuidsError) + " " + e.Message + _app.GetResourceString(UiStringKey.DuplicateUuidsErrorAdditional), Exception);
return;
}