Conversation sync done properly: fork-shaped seeded import adopted by the session controller, paged transfer, replicas of remote chats for offline continuation, move/divergence ledger with queued notices delivered on reconnect, native sidebar menu item + row markers, toasts
This commit is contained in:
1 parent
0f866b1bbd
commit
2e699a061f
7 files changed
+904
-461
No files matched your search
@@ -157,35 +157,4 @@ export class Store {
|
||||
this.data.master = m
|
||||
this.save()
|
||||
}
|
||||
|
||||
// ---- session version control & offline notification queue ----------------
|
||||
sessionLineage() { return (this.data.sessionLineage ||= {}) }
|
||||
|
||||
recordLineage(sessionId, info) {
|
||||
const table = this.sessionLineage()
|
||||
table[sessionId] = { ...(table[sessionId] || {}), ...info, updatedAt: Date.now() }
|
||||
this.save()
|
||||
return table[sessionId]
|
||||
}
|
||||
|
||||
pendingMoves() { return (this.data.pendingMoves ||= {}) }
|
||||
|
||||
queueMoveNotice(notice) {
|
||||
const key = `${notice.fromDevice}:${notice.sessionId}`
|
||||
this.pendingMoves()[key] = { ...notice, queuedAt: Date.now() }
|
||||
this.save()
|
||||
}
|
||||
|
||||
popPendingMovesForDevice(deviceId) {
|
||||
const moves = this.pendingMoves()
|
||||
const matching = []
|
||||
for (const [k, v] of Object.entries(moves)) {
|
||||
if (v.fromDevice === deviceId) {
|
||||
matching.push(v)
|
||||
delete moves[k]
|
||||
}
|
||||
}
|
||||
if (matching.length > 0) this.save()
|
||||
return matching
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user