Generate SSD tree sync from typed Jerboa
ober
32a7cc06c92497b206267657aef5971b650c792d
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -4829,6 +4829,7 @@ mainActivityPushTruthDumpAsync mainActivityMergeRemoteTruthAsync mainActivityRenderCurrentPageAsync + mainActivitySyncSelectedTreeAsync mainActivityInstallApproveAreaDialogButton mainActivityInstallAppendDialogButton mainActivityInstallEditDialogButtons @@ -7005,6 +7006,35 @@ activity (renderFailedStatus (exceptionMessageRaw error))) (begin))))))))) + (def (mainActivitySyncSelectedTreeAsync + (activity : MainActivity) + (store : TruthStore) + (uri : Uri)) : Unit + (begin + (mainActivitySetStatusRaw activity (syncTruthFolderStatus)) + (runBackground + (lambda () + (try + (let ((counts (truthStoreSyncTreeCounts store uri))) + (mainActivityRunOnUiThreadRaw + activity + (lambda () + (begin + (showShortToast activity "Truth sync complete") + (mainActivitySetStatusRaw + activity + (syncedTruthFolderStatus + (pair-first counts) + (pair-second counts) + (truthStoreStorageSummary store))))))) + (catch (error : Exception) + (mainActivityRunOnUiThreadRaw + activity + (lambda () + (mainActivitySetStatusRaw + activity + (folderSyncFailedStatus + (exceptionMessageRaw error))))))))))) (def (mainActivityInstallApproveAreaDialogButton (activity : MainActivity) (dialog : AlertDialog) @@ -9560,18 +9590,7 @@ " )" " } catch (_: Exception) {" " }" - " setStatus(syncTruthFolderStatus())" - " thread {" - " try {" - " val (imported, exported) = truthStoreSyncTreeCounts(truthStore, uri)" - " runOnUiThread {" - " Toast.makeText(this, \"Truth sync complete\", Toast.LENGTH_SHORT).show()" - " setStatus(syncedTruthFolderStatus(imported, exported, truthStoreStorageSummary(truthStore)))" - " }" - " } catch (error: Exception) {" - " runOnUiThread { setStatus(folderSyncFailedStatus(error.message)) }" - " }" - " }" + " mainActivitySyncSelectedTreeAsync(this, truthStore, uri)" " }" "" " internal fun loadPdf(uri: Uri, flags: Int, initialPageIndex: Int = 0, restoring: Boolean = false) {"