fix for new server backfill

This commit is contained in:
Trevor
2025-08-01 10:13:06 -05:00
parent eb8e9270e0
commit 545ece59ad
3 changed files with 15 additions and 24 deletions
@@ -49,7 +49,6 @@ class PolycentricProfileActivity : AppCompatActivity() {
private lateinit var _buttonHelp: ImageButton;
private lateinit var _editName: EditText;
private lateinit var _buttonExport: BigButton;
private lateinit var _buttonOpenHarborProfile: BigButton;
private lateinit var _buttonModeration: BigButton;
private lateinit var _buttonLogout: BigButton;
private lateinit var _buttonDelete: BigButton;
@@ -72,7 +71,6 @@ class PolycentricProfileActivity : AppCompatActivity() {
_imagePolycentric = findViewById(R.id.image_polycentric);
_editName = findViewById(R.id.edit_profile_name);
_buttonExport = findViewById(R.id.button_export);
_buttonOpenHarborProfile = findViewById(R.id.button_open_harbor_profile);
_buttonModeration = findViewById(R.id.button_moderation);
_buttonLogout = findViewById(R.id.button_logout);
_buttonDelete = findViewById(R.id.button_delete);
@@ -101,16 +99,6 @@ class PolycentricProfileActivity : AppCompatActivity() {
startActivity(Intent(this, PolycentricBackupActivity::class.java));
};
_buttonOpenHarborProfile.onClick.subscribe {
val processHandle = StatePolycentric.instance.processHandle!!;
processHandle?.let {
val systemState = SystemState.fromStorageTypeSystemState(Store.instance.getSystemState(it.system));
val url = it.system.systemToURLInfoSystemLinkUrl(systemState.servers.asIterable());
val navUrl = "https://harbor.social/" + url.substring("polycentric://".length)
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(navUrl)))
}
}
_buttonModeration.onClick.subscribe {
startActivity(Intent(this, PolycentricModerationActivity::class.java));
};
@@ -55,6 +55,9 @@ import java.time.Instant
import java.time.OffsetDateTime
import java.time.ZoneOffset
import java.util.concurrent.ForkJoinPool
import com.futo.polycentric.core.ensureServerAndBackfill
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
class StatePolycentric {
private data class LikeDislikeEntry(val unixMilliseconds: Long, val hasLiked: Boolean, val hasDisliked: Boolean);
@@ -173,6 +176,15 @@ class StatePolycentric {
}
_likeDislikeMap = newMap
// Ensure current server is registered & synced (runs in background)
kotlinx.coroutines.GlobalScope.launch(Dispatchers.IO) {
try {
processHandle.ensureServerAndBackfill()
} catch (e: Throwable) {
Logger.w(TAG, "Failed to ensure server and backfill: "+e.message)
}
}
} else {
_activeProcessHandle.setAndSave("");
_likeDislikeMap = hashMapOf()
@@ -73,7 +73,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter_regular"
android:text="Further customize your profile, make platform claims, and other creator-specific features in the Harbor app."
android:text="Further customize your profile, make platform claims, and other creator-specific features in the Polycentric app."
android:textSize="12dp"
android:linksClickable="true"
android:paddingLeft="20dp"
@@ -90,7 +90,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter_regular"
android:text="https://harbor.social"
android:text="https://polycentric.io"
android:textSize="12dp"
android:linksClickable="true"
android:paddingLeft="20dp"
@@ -107,7 +107,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter_regular"
android:text="After you've installed Harbor you can export this profile to Harbor using the Export button."
android:text="After you've installed Polycentric you can export this profile to Polycentric using the Export button."
android:textSize="12dp"
android:linksClickable="true"
android:paddingLeft="20dp"
@@ -132,15 +132,6 @@
app:layout_constraintTop_toBottomOf="@id/text_cta"
app:layout_constraintBottom_toBottomOf="parent">
<com.futo.platformplayer.views.buttons.BigButton
android:id="@+id/button_open_harbor_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:buttonText="Harbor Profile"
app:buttonSubText="See your Harbor profile in a browser"
app:buttonIcon="@drawable/ic_export"
android:layout_marginTop="8dp" />
<com.futo.platformplayer.views.buttons.BigButton
android:id="@+id/button_moderation"
android:layout_width="match_parent"