v1.0.63: live sync progress counters, pause/resume, .gitignore fix
Build & Release APK / build (push) Has been cancelled
Build & Release APK / build (push) Has been cancelled
- SyncEngine: accepts onProgress callback — emits uploaded/downloaded/ deleted/bytes counts atomically as each file completes - SyncWorker: streams progress to WorkManager data so the UI can poll it live; reports per-run counters in the completion notification; adds pause/resume support - HomeViewModel/PairDetailViewModel: subscribe to live WorkManager progress and surface it via SyncProgress state - SyncPairEntity/SyncPairDao/SyncDatabase: persist last-run counters (uploaded, downloaded, deleted, bytesTransferred) in the DB with a Room migration (v3→v4) - AppModule: provides WorkManager as an injectable singleton - .gitignore: add .kotlin/ to exclude compiler session files Security: no new issues — all logging via Timber (debug-only), DB queries use Room parameterized API, file sharing via FileProvider. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -47,7 +47,14 @@ class SyncWorker @AssistedInject constructor(
|
||||
return try {
|
||||
val domainPair = pair.toDomain()
|
||||
val provider = providerFactory.create(account)
|
||||
val result = syncEngine.sync(domainPair, provider)
|
||||
val result = syncEngine.sync(domainPair, provider) { up, down, del, bytes ->
|
||||
setProgress(workDataOf(
|
||||
KEY_PROGRESS_UPLOADED to up,
|
||||
KEY_PROGRESS_DOWNLOADED to down,
|
||||
KEY_PROGRESS_DELETED to del,
|
||||
KEY_PROGRESS_BYTES to bytes,
|
||||
))
|
||||
}
|
||||
|
||||
val lines = buildList {
|
||||
if (result.uploaded > 0) add("↑${result.uploaded}")
|
||||
@@ -158,6 +165,10 @@ class SyncWorker @AssistedInject constructor(
|
||||
const val KEY_PAIR_ID = "pair_id"
|
||||
const val KEY_SILENT = "silent"
|
||||
const val KEY_RESULT_SUMMARY = "result_summary"
|
||||
const val KEY_PROGRESS_UPLOADED = "prog_up"
|
||||
const val KEY_PROGRESS_DOWNLOADED = "prog_down"
|
||||
const val KEY_PROGRESS_DELETED = "prog_del"
|
||||
const val KEY_PROGRESS_BYTES = "prog_bytes"
|
||||
private const val NOTIFICATION_ID = 1001
|
||||
private const val RESULT_ID_OFFSET = 2000
|
||||
private const val CHANNEL_PROGRESS = "sync_progress"
|
||||
|
||||
Reference in New Issue
Block a user