feat(mobile): queue track reactions made offline and sync on reconnect (M5)
Likes and dislikes without a network are kept in a pending_reactions table (last reaction per track wins) and sent when the connection returns, instead of being rolled back. Downloaded track DTOs pick up the new reaction so the offline wave and Downloads reflect it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
be34ee5361
commit
756e915ff9
5 files changed
+74
-9
No files matched your search
@@ -192,6 +192,16 @@ class Downloads {
|
||||
this.pump();
|
||||
}
|
||||
|
||||
/** Реакция в сохранённом DTO: офлайн-волна и списки скачанного видят её без сети. */
|
||||
async setReaction(trackId: string, reaction: Track['reaction']) {
|
||||
const it = this.current.items.get(trackId);
|
||||
if (!it || it.track.reaction === reaction) return;
|
||||
const track = { ...it.track, reaction };
|
||||
this.setItem(trackId, { track });
|
||||
const db = await getDb();
|
||||
await db.runAsync('UPDATE downloads SET track = ? WHERE owner = ? AND track_id = ?', JSON.stringify(track), this.owner, trackId);
|
||||
}
|
||||
|
||||
/** Повторить загрузки с ошибкой. */
|
||||
async retry() {
|
||||
const db = await getDb();
|
||||
|
||||
Reference in new issue
Block a user