Move SSD remote truth calls to typed Kotlin

ober

b796431c0291fc61ad62a285f674baefb826a5b3

diff --git a/templates/ssd-review.ss b/templates/ssd-review.ss
index 3106ed3..744af9b 100644
--- a/templates/ssd-review.ss
+++ b/templates/ssd-review.ss
@@ -4705,6 +4705,8 @@
                 truthStoreExportZipArchive
                 truthStoreImportZipArchive
                 truthStoreSyncTreeCounts
+                truthStorePullRemoteTruthCount
+                truthStoreLoadTruthForSession
                 ssdBrowserResumeReady focusChangeShouldShowDropdown
                 dialogReadyToShowDropdown focusedDialogReadyToShowDropdown
                 permissionResultGranted downloadAccessBeforeRuntimePermissions
@@ -4803,6 +4805,10 @@
         (extern (truthStoreApplyLearnedGuesses (store : TruthStore)
                                                (session : SsdSession)) : Int32
           (kotlin-member-call applyLearnedGuesses))
+        (extern (truthStorePullRemoteTruthRaw
+                  (store : TruthStore)
+                  (session : SsdSession)) : Int32
+          (kotlin-member-call pullRemoteTruth))
         (extern (truthStoreApplyTruth (store : TruthStore)
                                       (session : SsdSession)) : Unit
           (kotlin-member-call applyTruth))
@@ -5817,6 +5823,14 @@
                (store : TruthStore)
                (treeUri : Uri)) : (Pair Int32 Int32)
           (truthStoreSyncTreeRaw store treeUri))
+        (def (truthStorePullRemoteTruthCount
+               (store : TruthStore)
+               (session : SsdSession)) : Int32
+          (truthStorePullRemoteTruthRaw store session))
+        (def (truthStoreLoadTruthForSession
+               (store : TruthStore)
+               (session : SsdSession)) : (Nullable JSONObject)
+          (truthStoreLoadTruth store session))
         (def (shouldCaptureViewport (includeViewport : Bool)) : Bool
           includeViewport)
         (def (viewportForSave (view : SsdReviewView)
@@ -7814,7 +7828,7 @@
 	       "                        setStatus(sessionCountsStatus(session, \", replayed cached truth\"))"
 	       "                        logDetectResult(\"cached-truth\", session, \"local-truth\")"
        "                    }"
-       "                    truthStore.pullRemoteTruth(session)"
+       "                    truthStorePullRemoteTruthCount(truthStore, session)"
        "                    return@thread"
        "                }"
        ""
@@ -7884,9 +7898,9 @@
        ""
        "    private fun mergeRemoteTruthAsync(session: SsdSession, generation: Int, uri: Uri, page: Int) {"
        "        thread {"
-       "            val matches = truthStore.pullRemoteTruth(session)"
+       "            val matches = truthStorePullRemoteTruthCount(truthStore, session)"
        "            if (nonPositiveCount(matches)) return@thread"
-       "            val truth = truthStore.loadTruth(session)"
+       "            val truth = truthStoreLoadTruthForSession(truthStore, session)"
        "            if (!truthPresent(truth)) return@thread"
        "            val loadedTruth = truthJsonObjectOrEmpty(truth)"
        "            val merged = makeRemoteTruthMergeSession(session)"