Merge pull request #511 from Inhishonor/attachment-name

Change attachments to be saved with `QUIK_format_date`
This commit is contained in:
octoshrimpy
2025-08-29 11:14:50 -04:00
committed by GitHub
@@ -171,9 +171,10 @@ open class MessageRepositoryImpl @Inject constructor(
val extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(part.type) val extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(part.type)
?: return null ?: return null
val date = part.messages?.first()?.date // fileDateAndTime is divided by 1000 in order to remove the extra 0's after date and time
val fileName = part.name?.takeIf { name -> name.endsWith(extension) } // This way the file name isn't so long.
?: "${part.type.split("/").last()}_$date.$extension" val fileDateAndTime = (part.messages?.first()?.date)?.div(1000)
val fileName = "QUIK_${part.type.split("/").last()}_$fileDateAndTime.$extension"
val values = contentValuesOf( val values = contentValuesOf(
MediaStore.MediaColumns.DISPLAY_NAME to fileName, MediaStore.MediaColumns.DISPLAY_NAME to fileName,