mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 07:38:33 +00:00
Copy image to encrypted blob and delete from device immediately.
Fixes #9097
This commit is contained in:
parent
f14a71a076
commit
adc0907906
@ -38,6 +38,7 @@ import android.net.Uri;
|
|||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.provider.Browser;
|
import android.provider.Browser;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
@ -541,9 +542,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
supportInvalidateOptionsMenu();
|
supportInvalidateOptionsMenu();
|
||||||
break;
|
break;
|
||||||
case TAKE_PHOTO:
|
case TAKE_PHOTO:
|
||||||
if (attachmentManager.getCaptureUri() != null) {
|
handleImageFromDeviceCameraApp();
|
||||||
setMedia(attachmentManager.getCaptureUri(), MediaType.IMAGE);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ADD_CONTACT:
|
case ADD_CONTACT:
|
||||||
onRecipientChanged(recipient.get());
|
onRecipientChanged(recipient.get());
|
||||||
@ -621,6 +620,26 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleImageFromDeviceCameraApp() {
|
||||||
|
if (attachmentManager.getCaptureUri() == null) {
|
||||||
|
Log.w(TAG, "No image available.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Uri mediaUri = BlobProvider.getInstance()
|
||||||
|
.forData(getContentResolver().openInputStream(attachmentManager.getCaptureUri()), 0L)
|
||||||
|
.withMimeType(MediaUtil.IMAGE_JPEG)
|
||||||
|
.createForSingleSessionOnDisk(this);
|
||||||
|
|
||||||
|
getContentResolver().delete(attachmentManager.getCaptureUri(), null, null);
|
||||||
|
|
||||||
|
setMedia(mediaUri, MediaType.IMAGE);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
Log.w(TAG, "Could not handle public image", ioe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startActivity(Intent intent) {
|
public void startActivity(Intent intent) {
|
||||||
if (intent.getStringExtra(Browser.EXTRA_APPLICATION_ID) != null) {
|
if (intent.getStringExtra(Browser.EXTRA_APPLICATION_ID) != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user