Fix Polycentric profile file import in MainActivity

- Update handleUnknownText method to detect Polycentric profile data
- Check for 'polycentric://' prefix in shared text files
- Launch PolycentricImportProfileActivity when Polycentric profile is detected
- Add logging for Polycentric profile detection
- Fixes 'unknown url format' error when sharing Polycentric profile files to Grayjay

This completes the file sharing workflow: users can now export Polycentric
profiles to files and share them to Grayjay, which will automatically
detect and import the profile data.
This commit is contained in:
Trevor 2025-08-19 11:48:18 -05:00
commit 1ad3b7ae8f

View file

@ -994,6 +994,15 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
fun handleUnknownText(text: String): Boolean {
try {
// Check for Polycentric profile data
if (text.startsWith("polycentric://")) {
Logger.i(TAG, "Detected Polycentric profile in shared text file")
startActivity(Intent(this, PolycentricImportProfileActivity::class.java).apply {
putExtra("url", text.trim())
})
return true;
}
if (text.startsWith("@/Subscription") || text.startsWith("Subscriptions")) {
val lines = text.split("\n").map { it.trim() }.drop(1).filter { it.isNotEmpty() };
navigate(_fragImportSubscriptions, lines);