mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 08:47:46 +00:00
parent
23a1c1c8fa
commit
d1dd50e31c
@ -411,7 +411,7 @@ public class ConversationFragment extends SherlockListFragment
|
|||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
File mediaFile = constructOutputFile(slide);
|
File mediaFile = constructOutputFile(slide, messageRecord[0].getDateReceived());
|
||||||
InputStream inputStream = slide.getPartDataInputStream();
|
InputStream inputStream = slide.getPartDataInputStream();
|
||||||
OutputStream outputStream = new FileOutputStream(mediaFile);
|
OutputStream outputStream = new FileOutputStream(mediaFile);
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ public class ConversationFragment extends SherlockListFragment
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private File constructOutputFile(Slide slide) throws IOException {
|
private File constructOutputFile(Slide slide, long timestamp) throws IOException {
|
||||||
File sdCard = Environment.getExternalStorageDirectory();
|
File sdCard = Environment.getExternalStorageDirectory();
|
||||||
File outputDirectory;
|
File outputDirectory;
|
||||||
|
|
||||||
@ -484,13 +484,14 @@ public class ConversationFragment extends SherlockListFragment
|
|||||||
|
|
||||||
outputDirectory.mkdirs();
|
outputDirectory.mkdirs();
|
||||||
|
|
||||||
MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
|
MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
|
||||||
String extension = mimeTypeMap.getExtensionFromMimeType(slide.getContentType());
|
String extension = mimeTypeMap.getExtensionFromMimeType(slide.getContentType());
|
||||||
|
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
if (extension == null)
|
if (extension == null)
|
||||||
extension = "attach";
|
extension = "attach";
|
||||||
|
|
||||||
return File.createTempFile("textsecure", "." + extension, outputDirectory);
|
return File.createTempFile("textsecure-" + dateFormatter.format(timestamp), "." + extension, outputDirectory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user