diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/CachedRichTextParser.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/CachedRichTextParser.kt index 553b26d3e..2ac35e33c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/CachedRichTextParser.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/CachedRichTextParser.kt @@ -26,11 +26,9 @@ import com.vitorpamplona.amethyst.commons.richtext.RichTextViewerState import com.vitorpamplona.quartz.events.ImmutableListOfLists object CachedRichTextParser { - val richTextCache = LruCache(50) + private val richTextCache = LruCache(50) - // fun getCached(content: String): RichTextViewerState? = richTextCache[content] - - fun hashCodeCache( + private fun hashCodeCache( content: String, tags: ImmutableListOfLists, callbackUri: String?, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt index 48b3664e4..9333beb03 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt @@ -954,7 +954,7 @@ fun WatchIsHiddenUser( fun getIdentityClaimIcon(identity: IdentityClaim): Int = when (identity) { - is TwitterIdentity -> R.drawable.twitter + is TwitterIdentity -> R.drawable.x is TelegramIdentity -> R.drawable.telegram is MastodonIdentity -> R.drawable.mastodon is GitHubIdentity -> R.drawable.github diff --git a/amethyst/src/main/res/drawable/twitter.xml b/amethyst/src/main/res/drawable/twitter.xml deleted file mode 100644 index 82cf785b6..000000000 --- a/amethyst/src/main/res/drawable/twitter.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/amethyst/src/main/res/drawable/x.xml b/amethyst/src/main/res/drawable/x.xml new file mode 100644 index 000000000..5548bf909 --- /dev/null +++ b/amethyst/src/main/res/drawable/x.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/amethyst/src/main/res/values/strings.xml b/amethyst/src/main/res/values/strings.xml index 4cae6f21b..bd472d74f 100644 --- a/amethyst/src/main/res/values/strings.xml +++ b/amethyst/src/main/res/values/strings.xml @@ -255,11 +255,11 @@ Github Gist w/ Proof Telegram Mastodon Post ID w/ Proof - Twitter Status w/ Proof + X Status w/ Proof https://gist.github.com/<user>/<gist> https://t.me/<proof post> https://<server>/<user>/<proof post> - https://twitter.com/<user>/status/<proof post> + https://x.com/<user>/status/<proof post> "<Unable to decrypt private message>\n\nYou were cited in a private/encrypted conversation between %1$s and %2$s." Add New Account Accounts diff --git a/quartz/src/main/java/com/vitorpamplona/quartz/events/MetadataEvent.kt b/quartz/src/main/java/com/vitorpamplona/quartz/events/MetadataEvent.kt index b0af7212e..b37017d8b 100644 --- a/quartz/src/main/java/com/vitorpamplona/quartz/events/MetadataEvent.kt +++ b/quartz/src/main/java/com/vitorpamplona/quartz/events/MetadataEvent.kt @@ -45,7 +45,7 @@ abstract class IdentityClaim( fun create( platformIdentity: String, proof: String, - ): IdentityClaim? { + ): IdentityClaim { val (platform, identity) = platformIdentity.split(':') return when (platform.lowercase()) { @@ -87,7 +87,7 @@ class TwitterIdentity( identity: String, proof: String, ) : IdentityClaim(identity, proof) { - override fun toProofUrl() = "https://twitter.com/$identity/status/$proof" + override fun toProofUrl() = "https://x.com/$identity/status/$proof" override fun platform() = platform @@ -97,7 +97,7 @@ class TwitterIdentity( fun parseProofUrl(proofUrl: String): TwitterIdentity? { return try { if (proofUrl.isBlank()) return null - val path = proofUrl.removePrefix("https://twitter.com/").split("?")[0].split("/") + val path = proofUrl.removePrefix("https://x.com/").split("?")[0].split("/") TwitterIdentity(path[0], path[2]) } catch (e: Exception) { @@ -166,7 +166,7 @@ class MetadataEvent( .filter { it.firstOrNull() == "i" } .mapNotNull { try { - IdentityClaim.create(it.get(1), it.get(2)) + IdentityClaim.create(it[1], it[2]) } catch (e: Exception) { Log.e("MetadataEvent", "Can't parse identity [${it.joinToString { "," }}]", e) null @@ -265,26 +265,5 @@ class MetadataEvent( currentJson.put(key, value.trim()) } } - - fun createFromScratch( - newName: String, - signer: NostrSigner, - createdAt: Long = TimeUtils.now(), - onReady: (MetadataEvent) -> Unit, - ) { - val prop = ObjectMapper().createObjectNode() - prop.put("name", newName.trim()) - - val writer = StringWriter() - ObjectMapper().writeValue(writer, prop) - - val tags = mutableListOf>() - - tags.add( - arrayOf("alt", "User profile for $newName"), - ) - - signer.sign(createdAt, KIND, tags.toTypedArray(), writer.buffer.toString(), onReady) - } } }