vitorpamplona / amethyst

Nostr client for Android
MIT License
1.17k stars 158 forks source link

[BUG] App crashes on "Never translate from..." #1164

Closed davotoula closed 2 weeks ago

davotoula commented 2 weeks ago

Describe the bug App crashes when "Never translate from..." is selected. Root cause seems to be using Client.send without creating a new context.

Process: com.vitorpamplona.amethyst.debug, PID: 14002 com.vitorpamplona.ammolite.service.OnMainThreadException: It should not be in the MainThread at com.vitorpamplona.ammolite.service.MainThreadCheckerKt.checkNotInMainThread(MainThreadChecker.kt:28) at com.vitorpamplona.ammolite.relays.Client.send(Client.kt:258) at com.vitorpamplona.amethyst.model.Account.sendNewAppSpecificData$lambda$71$lambda$70(Account.kt:1098) at com.vitorpamplona.amethyst.model.Account.$r8$lambda$ex9k39k3r6hhwe1LdpH6rrZe66Y(Unknown Source:0) at com.vitorpamplona.amethyst.model.Account$$ExternalSyntheticLambda42.invoke(D8$$SyntheticClass:0) at com.vitorpamplona.quartz.signers.NostrSignerInternal.sign(NostrSignerInternal.kt:42) at com.vitorpamplona.quartz.events.AppSpecificDataEvent$Companion.create(AppSpecificDataEvent.kt:67) at com.vitorpamplona.quartz.events.AppSpecificDataEvent$Companion.create$default(AppSpecificDataEvent.kt:45) at com.vitorpamplona.amethyst.model.Account.sendNewAppSpecificData$lambda$71(Account.kt:1092) at com.vitorpamplona.amethyst.model.Account.$r8$lambda$Oh5JakxZqThiUV1lWk7aIYS6X_g(Unknown Source:0) at com.vitorpamplona.amethyst.model.Account$$ExternalSyntheticLambda70.invoke(D8$$SyntheticClass:0) at com.vitorpamplona.quartz.signers.NostrSignerInternal.nip44Encrypt(NostrSignerInternal.kt:66) at com.vitorpamplona.amethyst.model.Account.sendNewAppSpecificData(Account.kt:1091) at com.vitorpamplona.amethyst.model.Account.sendNewAppSpecificData(Account.kt:1087) at com.vitorpamplona.amethyst.model.Account.toggleDontTranslateFrom(Account.kt:1068) at com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewerKt$TranslationMessage$1$3.invoke$lambda$1$lambda$0(TranslatableRichTextViewer.kt:258) at com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewerKt$TranslationMessage$1$3.$r8$lambda$8ESAqEltZnvBb7bRoKNSZBSAVS4(Unknown Source:0) at com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewerKt$TranslationMessage$1$3$$ExternalSyntheticLambda0.invoke(D8$$SyntheticClass:0)

To Reproduce Steps to reproduce the behavior:

  1. Go to foreign language post
  2. Clicl on "Auto"
  3. Select "Never translate from..."
  4. App crashes

Expected behavior Language is added to "never translate from"

Device (please complete the following information):