mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
transform google photos nonsense URI scheme to something usable when necessary
Fixes #3307 Closes #3375 // FREEBIE
This commit is contained in:
parent
0f7f458ce0
commit
cb3cf7789f
@ -31,6 +31,8 @@ import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import ws.com.google.android.mms.ContentType;
|
||||
|
||||
/**
|
||||
@ -115,10 +117,23 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private Uri getStreamExtra() {
|
||||
Uri streamUri = getIntent().getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
if (streamUri.getAuthority().equals("com.google.android.apps.photos.contentprovider") &&
|
||||
streamUri.toString().endsWith("/ACTUAL"))
|
||||
{
|
||||
String[] parts = streamUri.toString().split("/");
|
||||
if (parts.length > 3) {
|
||||
return Uri.parse(URLDecoder.decode(parts[parts.length - 2]));
|
||||
}
|
||||
}
|
||||
return streamUri;
|
||||
}
|
||||
|
||||
private Intent getBaseShareIntent(final Class<?> target) {
|
||||
final Intent intent = new Intent(this, target);
|
||||
final String textExtra = getIntent().getStringExtra(Intent.EXTRA_TEXT);
|
||||
final Uri streamExtra = getIntent().getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
final Uri streamExtra = getStreamExtra();
|
||||
final String type = streamExtra != null ? getMimeType(streamExtra) : getIntent().getType();
|
||||
|
||||
if (ContentType.isImageType(type)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user