Move SSD truth sync statuses to typed Kotlin

ober

da097a7cc897a27b53b5d70bffffc32d3428b6c9

diff --git a/templates/ssd-review.ss b/templates/ssd-review.ss
index 4a96e64..e828a88 100644
--- a/templates/ssd-review.ss
+++ b/templates/ssd-review.ss
@@ -3736,6 +3736,12 @@
                 deleteSavingStatus deleteSavedStatus
                 editDialogTitle groupCountText
                 editSavingStatus editSavedStatus
+                startupStatus truthSeedMergedStatus
+                saveTruthSavingStatus saveTruthSavedStatus
+                pullTruthStatus pulledTruthStatus
+                pushTruthStatus pushedTruthStatus
+                exportedTruthZipStatus importedTruthZipStatus
+                syncTruthFolderStatus syncedTruthFolderStatus
                 clampPageIndex shiftPageIndex displayGroupCanvasLabel
                 dropdownHeight dialogPageNumber nullableLowercaseOrEmpty
                 selectModeStatus selectionResultStatus detectStartStatus
@@ -3969,6 +3975,56 @@
             (string-append (groupDisplayLabel group) "; syncing...")))
         (def (editSavedStatus (group : SsdGroup)) : String
           (string-append "Saved " (groupDisplayLabel group)))
+        (def (startupStatus (summary : String)) : String
+          (string-append "Open an SSD PDF. " summary))
+        (def (truthSeedMergedStatus (imported : Int32) (summary : String)) : String
+          (string-append
+            "Truth seed merged "
+            (string-append
+              (int32->string imported)
+              (string-append " files. " summary))))
+        (def (saveTruthSavingStatus) : String
+          "Saving truth...")
+        (def (saveTruthSavedStatus (summary : String)) : String
+          (string-append "Saved truth; " summary))
+        (def (pullTruthStatus) : String
+          "Pulling app truth and learned model from service...")
+        (def (pulledTruthStatus (imported : Int32) (summary : String)) : String
+          (string-append
+            "Pulled app truth: imported "
+            (string-append
+              (int32->string imported)
+              (string-append " files; " summary))))
+        (def (pushTruthStatus) : String
+          "Pushing full truth dump to service...")
+        (def (pushedTruthStatus (imported : Int32) (summary : String)) : String
+          (string-append
+            "Pushed full truth: service imported "
+            (string-append
+              (int32->string imported)
+              (string-append " files; " summary))))
+        (def (exportedTruthZipStatus) : String
+          "Exported truth ZIP")
+        (def (importedTruthZipStatus (count : Int32) (summary : String)) : String
+          (string-append
+            "Imported "
+            (string-append
+              (int32->string count)
+              (string-append " files; " summary))))
+        (def (syncTruthFolderStatus) : String
+          "Syncing master truth folder...")
+        (def (syncedTruthFolderStatus (imported : Int32)
+                                      (exported : Int32)
+                                      (summary : String)) : String
+          (string-append
+            "Synced folder: imported "
+            (string-append
+              (int32->string imported)
+              (string-append
+                ", exported "
+                (string-append
+                  (int32->string exported)
+                  (string-append "; " summary))))))
         (def (dropdownHeight (screenHeight : Int32)) : Int32
           (let ((third (/ screenHeight (int32 3))))
             (if (> third (int32 620))
@@ -5046,12 +5102,12 @@
        "        logClientEvent(\"ssd-app-start\")"
        "        truthStore = TruthStore(this)"
        "        setContentView(buildUi())"
-       "        setStatus(\"Open an SSD PDF. ${truthStore.storageSummary()}\")"
+       "        setStatus(startupStatus(truthStore.storageSummary()))"
        "        restoreLastPdf()"
        "        truthStore.seedBundledTruthAsync { imported ->"
        "            if (imported > 0) {"
        "                runOnUiThread {"
-       "                    setStatus(\"Truth seed merged $imported files. ${truthStore.storageSummary()}\")"
+       "                    setStatus(truthSeedMergedStatus(imported, truthStore.storageSummary()))"
        "                    if (pdfUri != null) renderCurrentPage()"
        "                }"
        "            }"
@@ -5962,8 +6018,8 @@
        "        val session = currentSession ?: return"
        "        saveSessionAsync("
        "            session,"
-       "            \"Saving truth...\","
-       "            \"Saved truth; ${truthStore.storageSummary()}\""
+       "            saveTruthSavingStatus(),"
+       "            saveTruthSavedStatus(truthStore.storageSummary())"
        "        )"
        "    }"
        ""
@@ -6017,13 +6073,13 @@
        "    }"
        ""
        "    private fun pullTruthDump() {"
-       "        setStatus(\"Pulling app truth and learned model from service...\")"
+       "        setStatus(pullTruthStatus())"
        "        thread {"
        "            try {"
        "                val imported = truthStore.pullRemoteDump()"
        "                runOnUiThread {"
        "                    Toast.makeText(this, \"Truth pull complete\", Toast.LENGTH_SHORT).show()"
-       "                    setStatus(\"Pulled app truth: imported $imported files; ${truthStore.storageSummary()}\")"
+       "                    setStatus(pulledTruthStatus(imported, truthStore.storageSummary()))"
        "                    if (pdfUri != null) renderCurrentPage()"
        "                }"
        "            } catch (error: Exception) {"
@@ -6035,13 +6091,13 @@
        "    }"
        ""
        "    private fun pushTruthDump() {"
-       "        setStatus(\"Pushing full truth dump to service...\")"
+       "        setStatus(pushTruthStatus())"
        "        thread {"
        "            try {"
        "                val imported = truthStore.pushRemoteDump()"
        "                runOnUiThread {"
        "                    Toast.makeText(this, \"Truth push complete\", Toast.LENGTH_SHORT).show()"
-       "                    setStatus(\"Pushed full truth: service imported $imported files; ${truthStore.storageSummary()}\")"
+       "                    setStatus(pushedTruthStatus(imported, truthStore.storageSummary()))"
        "                }"
        "            } catch (error: Exception) {"
        "                runOnUiThread {"
@@ -6060,11 +6116,11 @@
        "            REQ_OPEN_SSD_PDF_TREE -> rememberAndBrowseSsdFolder(uri, data.flags)"
        "            REQ_EXPORT_ZIP -> contentResolver.openOutputStream(uri)?.use {"
        "                truthStore.exportZip(it)"
-       "                setStatus(\"Exported truth ZIP\")"
+       "                setStatus(exportedTruthZipStatus())"
        "            }"
        "            REQ_IMPORT_ZIP -> contentResolver.openInputStream(uri)?.use {"
        "                val count = truthStore.importZip(it)"
-       "                setStatus(\"Imported $count files; ${truthStore.storageSummary()}\")"
+       "                setStatus(importedTruthZipStatus(count, truthStore.storageSummary()))"
        "            }"
        "            REQ_SYNC_TREE -> syncSelectedTree(uri, data.flags)"
        "        }"
@@ -6275,13 +6331,13 @@
        "            )"
        "        } catch (_: Exception) {"
        "        }"
-       "        setStatus(\"Syncing master truth folder...\")"
+       "        setStatus(syncTruthFolderStatus())"
        "        thread {"
        "            try {"
        "                val (imported, exported) = truthStore.syncTree(uri)"
        "                runOnUiThread {"
        "                    Toast.makeText(this, \"Truth sync complete\", Toast.LENGTH_SHORT).show()"
-       "                    setStatus(\"Synced folder: imported $imported, exported $exported; ${truthStore.storageSummary()}\")"
+       "                    setStatus(syncedTruthFolderStatus(imported, exported, truthStore.storageSummary()))"
        "                }"
        "            } catch (error: Exception) {"
        "                runOnUiThread { setStatus(\"Folder sync failed: ${error.message}\") }"