feature: Implement Download Caching for Chat Attachments
I maintainer di solito rispondono entro 1 giorno
@JASIM0021 ci sta già lavorando.
Dal 19/11/2025.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- react-native, typescript
- Ambito
- mobile
Direzione di ricerca
Individua il punto di ingresso fileDownload e leggi le implementazioni esistenti di getMediaCache e downloadMediaFile, quindi traccia il modo in cui gli allegati della chat invocano i download. Il lavoro è completato quando un allegato scaricato in precedenza viene servito dalla cache locale agli accessi successivi, mentre gli allegati non memorizzati nella cache continuano a essere scaricati normalmente; verifica il comportamento tramite il flusso esistente degli allegati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Feature Description
- Implement a caching system for chat attachment downloads that stores files locally after first download, allowing subsequent access to use cached versions instead of re-downloading. This will significantly improve user experience by reducing download times, saving data usage, and eliminating redundant downloads for the same file.
poc:-
https://github.com/user-attachments/assets/4e5d2f2e-fc7c-404a-96ac-92db54558df4
Motivation and Use Case
Current Problem:
- Users must wait for full download every time they access an attachment (PDF, images, documents, etc.)
- Multiple downloads occur for the same file if accessed multiple times
- Unnecessary data usage and battery drain
- Poor user experience with slow file access in chat
Use Cases:
- Frequent Reference: Users accessing the same important documents multiple times during a work session
- Offline Access: Users wanting to quickly access previously viewed files without internet
- Data Conservation: Users on limited data plans wanting to avoid repeated downloads
- Quick Review: Users rapidly switching between different attachments in a conversation
Implementation Ideas
Based on the current implementation provided:
export const fileDownload = async ( url: string, attachment?: IAttachment, fileName?: string ): Promise<string> => { let path = ${FileSystem.documentDirectory}; if (fileName) { path = ${path}${sanitizeFileName(fileName)}; } if (attachment?.title) { path = ${path}${sanitizeFileName(attachment.title)}`;
}
// Check if file exists in cache first using existing cache system
const cache = await getMediaCache({
type: 'other' as const,
mimeType: attachment?.format,
urlToCache: url
});
if (cache?.exists) {
return cache.uri; // Return cached file URI if exists
}
// Create download options for media file
const option = {
messageId: url,
type: 'other' as const,
downloadUrl: url
};
// Download file if not cached
const uri = await downloadMediaFile(option);
return uri;
};`
profile
Qwen3-Coder
12:47 am
Feature Request: Implement Download Caching for Chat Attachments
Feature Description
Implement a caching system for chat attachment downloads that stores files locally after first download, allowing subsequent access to use cached versions instead of re-downloading. This will significantly improve user experience by reducing download times, saving data usage, and eliminating redundant downloads for the same file.
Motivation and Use Case
Current Problem:
Users must wait for full download every time they access an attachment (PDF, images, documents, etc.)
Multiple downloads occur for the same file if accessed multiple times
Unnecessary data usage and battery drain
Poor user experience with slow file access in chat
Use Cases:
Frequent Reference: Users accessing the same important documents multiple times during a work session
Offline Access: Users wanting to quickly access previously viewed files without internet
Data Conservation: Users on limited data plans wanting to avoid repeated downloads
Quick Review: Users rapidly switching between different attachments in a conversation
Implementation Ideas
Based on the current implementation provided:
export const fileDownload = async (
url: string,
attachment?: IAttachment,
fileName?: string
): Promise<string> => {
let path = `${FileSystem.documentDirectory}`;
if (fileName) {
path = `${path}${sanitizeFileName(fileName)}`;
}
if (attachment?.title) {
path = `${path}${sanitizeFileName(attachment.title)}`;
}
// Check if file exists in cache first using existing cache system
const cache = await getMediaCache({
type: 'other' as const,
mimeType: attachment?.format,
urlToCache: url
});
if (cache?.exists) {
return cache.uri; // Return cached file URI if exists
}
// Create download options for media file
const option = {
messageId: url,
type: 'other' as const,
downloadUrl: url
};
// Download file if not cached
const uri = await downloadMediaFile(option);
return uri;
};
Key Implementation Benefits:
- Leverages existing cache system: Uses the existing getMediaCache function for consistency
- Simple cache check: Checks if file exists before initiating download
- Integrates with existing download logic: Uses downloadMediaFile for actual download
- Maintains backward compatibility: Works with existing attachment handling
- Efficient: Only downloads when necessary, returns cached version otherwise
Is this feature available in the API or web version?
Available in API
Rocket.Chat Server Version
NA
Rocket.Chat App Version
4.66.0
Device Name
POCO M2 Pro
OS Version
Android
Additional Context
This feature will particularly benefit users who:
- Work with document-heavy conversations
- Have limited internet connectivity
- Need quick access to frequently referenced files
- Want to conserve mobile data usage
- Lingua principale
- TypeScript
- Stelle
- 2.4k
- Fork
- 1.5k
- Merge medio
- 1g 15h
- PR unite (30g)
- 29
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di RocketChat/Rocket.Chat.ReactNative
-
[IMPROVEMENT] Remove redundant `await` on synchronous `userPreferences.getBool` in `getUsersPresence`Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertatype: feature
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
RocketChat/Rocket.Chat.ReactNative#7737 ·
I maintainer di solito rispondono entro 1 giorno
-
UIKit modal: a viewSubmit response with no `type` field fails to close the modal on mobile (regression from #7057)Forse già presa @erikurt9 l’ha presa 106 giorni fa. Apertatype: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
RocketChat/Rocket.Chat.ReactNative#7503 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
type: bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
RocketChat/Rocket.Chat.ReactNative#7437 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
✅ tests 👷 ci type: feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
RocketChat/Rocket.Chat.ReactNative#7247 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug: goRoom navigates to broken RoomView after failed DM creation from searchForse già presa @deepak0x l’ha presa 216 giorni fa. Apertatype: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
RocketChat/Rocket.Chat.ReactNative#7098 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di RocketChat/Rocket.Chat.ReactNative
Issue simili
-
Bug: Broken RTL / BiDi text rendering when mixing Persian (Farsi) with English or numbersForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 2/5 Mezza giornata Idoneità per principianti 68/100
amosblomqvist/learnharness#758 ·
I maintainer di solito rispondono entro 2 giorni
-
Change WorkspacesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
bitfocus/companion-module-renewedvision-propresenter-api#134 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
rcpch/digital-growth-charts-react-component-library#304 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dsh-market/dsh-market#1210 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
trustjonathan/STUDY-HUB#13 ·