getCachedFileFromUri
Retrieves or creates a cached copy of a file from the given attachment metadata.
This method handles two scenarios:
If AttachmentMetaData.file is already set, it returns the file directly
If only AttachmentMetaData.uri is available, it copies the content to a cache file
The cached file is stored in a unique timestamped folder within the app's cache directory to prevent naming conflicts. The file name is derived from the attachment's title with proper extension handling.
Return
A File object pointing to the cached file, or null
if both file and URI are null.
Parameters
The Android context used to access the content resolver and cache directory.
The attachment metadata containing either a file or URI reference.
Throws
If there's an error reading from the URI or writing to cache.