mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 18:38:27 +03:00
externalsFileDir w/ FileProvider for temp store
This commit is contained in:
parent
8e04945d4e
commit
e33b49e78c
3 changed files with 7 additions and 6 deletions
|
@ -17,6 +17,7 @@ using Bit.Core.Enums;
|
||||||
using Android.Nfc;
|
using Android.Nfc;
|
||||||
using Bit.App.Utilities;
|
using Bit.App.Utilities;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Android.Support.V4.Content;
|
||||||
|
|
||||||
namespace Bit.Droid
|
namespace Bit.Droid
|
||||||
{
|
{
|
||||||
|
@ -202,9 +203,8 @@ namespace Bit.Droid
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// camera
|
// camera
|
||||||
var root = new Java.IO.File(Android.OS.Environment.ExternalStorageDirectory, "bitwarden");
|
var file = new Java.IO.File(GetExternalFilesDir("temp"), "camera_photo.jpg");
|
||||||
var file = new Java.IO.File(root, "temp_camera_photo.jpg");
|
uri = FileProvider.GetUriForFile(this, "com.x8bit.bitwarden.fileprovider", file);
|
||||||
uri = Android.Net.Uri.FromFile(file);
|
|
||||||
fileName = $"photo_{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}.jpg";
|
fileName = $"photo_{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}.jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<cache-path name="cache" path="." />
|
<cache-path name="cache" path="." />
|
||||||
|
<external-path name="temp" path="Android/data/com.x8bit.bitwarden/files/temp" />
|
||||||
</paths>
|
</paths>
|
||||||
|
|
|
@ -201,14 +201,14 @@ namespace Bit.Droid.Services
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var root = new Java.IO.File(Android.OS.Environment.ExternalStorageDirectory, "bitwarden");
|
var file = new Java.IO.File(activity.GetExternalFilesDir("temp"), "camera_photo.jpg");
|
||||||
var file = new Java.IO.File(root, "temp_camera_photo.jpg");
|
|
||||||
if(!file.Exists())
|
if(!file.Exists())
|
||||||
{
|
{
|
||||||
file.ParentFile.Mkdirs();
|
file.ParentFile.Mkdirs();
|
||||||
file.CreateNewFile();
|
file.CreateNewFile();
|
||||||
}
|
}
|
||||||
var outputFileUri = Android.Net.Uri.FromFile(file);
|
var outputFileUri = FileProvider.GetUriForFile(activity,
|
||||||
|
"com.x8bit.bitwarden.fileprovider", file);
|
||||||
additionalIntents.AddRange(GetCameraIntents(outputFileUri));
|
additionalIntents.AddRange(GetCameraIntents(outputFileUri));
|
||||||
}
|
}
|
||||||
catch(Java.IO.IOException) { }
|
catch(Java.IO.IOException) { }
|
||||||
|
|
Loading…
Reference in a new issue