amethyst
amethyst copied to clipboard
[BUG] Tagging Issue: App Crashes
Describe the bug The app crashes when you try to tag "@" a user in a reply to a note.
To Reproduce Steps to reproduce the behavior:
- Select a note.
- Tag "@" a user in a reply to the note.
- The app crashes.
Expected behavior A user is successfully tagged in a reply to a note.
Device (please complete the following information):
- Android Version [e.g. 33]: GrapheneOS Android 14
- App Version [e.g. v0.20.3]: v0.83.8
I couldn't reproduce it.
It can be dependant on what specific note is being replied to, what is the full content of your reply and what user you are trying to tag.
Can you share those details?
Or maybe a video recording of the screen when it happens?
Here's a crash report. I think some OS variations have a check that sometimes breaks. It doesn't seem to happen on Google's Android :(
The issue should be in the index calculations from com.vitorpamplona.amethyst.ui.actions.UrlUserTagTransformation. But I don't know if is a problem on our code or on the OS code.
Video: https://v.nostr.build/PLMZ.mp4
type: crash
osVersion: google/barbet/barbet:14/UQ1A.240105.002/2024012600:user/release-keys
package: com.vitorpamplona.amethyst:350
process: com.vitorpamplona.amethyst
processUptime: 22003 + 1519 ms
installer: dev.imranr.obtainium
java.lang.IllegalArgumentException: offset(15) is out of bounds [0, 15)
at androidx.compose.ui.text.MultiParagraph.requireIndexInRange(Unknown Source:51)
at androidx.compose.ui.text.MultiParagraph.fillBoundingBoxes-8ffj60Q(Unknown Source:4)
at androidx.compose.ui.text.input.CursorAnchorInfoBuilder_androidKt.addCharacterBounds(Unknown Source:31)
at androidx.compose.ui.text.input.CursorAnchorInfoBuilder_androidKt.build(Unknown Source:93)
at androidx.compose.ui.text.input.CursorAnchorInfoController.updateCursorAnchorInfo(Unknown Source:73)
at androidx.compose.ui.text.input.CursorAnchorInfoController.updateTextLayoutResult(Unknown Source:20)
at androidx.compose.ui.text.input.TextInputServiceAndroid.updateTextLayoutResult(Unknown Source:8)
at androidx.compose.ui.text.input.TextInputSession.updateTextLayoutResult(Unknown Source:14)
at androidx.compose.foundation.text.TextFieldDelegate$Companion.updateTextLayoutResult$foundation_release(Unknown Source:40)
at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$onPositionedModifier$1.invoke(SourceFile:20)
at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$onPositionedModifier$1.invoke(SourceFile:1)
at androidx.compose.ui.layout.OnGloballyPositionedNode.onGloballyPositioned(Unknown Source:2)
at androidx.compose.ui.node.LayoutNode.dispatchOnPositionedCallbacks$ui_release(Unknown Source:82)
at androidx.compose.ui.node.OnPositionedDispatcher.dispatchHierarchy(Unknown Source:0)
at androidx.compose.ui.node.OnPositionedDispatcher.dispatchHierarchy(Unknown Source:25)
at androidx.compose.ui.node.OnPositionedDispatcher.dispatchHierarchy(Unknown Source:25)
at androidx.compose.ui.node.OnPositionedDispatcher.dispatchHierarchy(Unknown Source:25)
at androidx.compose.ui.node.OnPositionedDispatcher.dispatchHierarchy(Unknown Source:25)
at androidx.compose.ui.node.OnPositionedDispatcher.dispatchHierarchy(Unknown Source:25)
at androidx.compose.ui.node.OnPositionedDispatcher.dispatchHierarchy(Unknown Source:25)
at androidx.compose.ui.node.OnPositionedDispatcher.dispatch(Unknown Source:74)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.dispatchOnPositionedCallbacks(Unknown Source:11)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.dispatchOnPositionedCallbacks$default(Unknown Source:5)
at androidx.compose.ui.platform.AndroidComposeView.measureAndLayout(Unknown Source:45)
at androidx.compose.ui.node.Owner.measureAndLayout$default(Unknown Source:7)
at androidx.compose.ui.platform.AndroidComposeView.dispatchDraw(Unknown Source:16)
at android.view.View.draw(View.java:23903)
at android.view.View.updateDisplayListIfDirty(View.java:22767)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4543)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4516)
at android.view.View.updateDisplayListIfDirty(View.java:22723)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4543)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4516)
at android.view.View.updateDisplayListIfDirty(View.java:22723)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4543)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4516)
at android.view.View.updateDisplayListIfDirty(View.java:22723)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4543)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4516)
at android.view.View.updateDisplayListIfDirty(View.java:22723)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:694)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:700)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:798)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:5144)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4835)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4011)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2650)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9526)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1343)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1352)
at android.view.Choreographer.doCallbacks(Choreographer.java:952)
at android.view.Choreographer.doFrame(Choreographer.java:882)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1326)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8279)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ExecInit.main(ExecInit.java:49)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:359)
FYI, this seems to be an issue that only happens on the default keyboard of Graphene OS. Changing the keyboard fixes it.
https://coracle.social/notes/nevent1qyt8wumn8ghj7un9d3shjtnddaehgu3wwp6kytcpzemhxue69uhkummnw3ezu7rdwgh8ymmrddej7qghwaehxw309aux6u3ww4ek2mn0wd68ytn0wfnj7qgewaehxw309aex2mrp0yhxummnw3exzarf9e3k7mf0qyv8wumn8ghj7cmp9ehhyctwvajhq6tvdshxgetk9uq3jamnwvaz7tmvd9nksarwd9hxwun9d3shjtnrdakj7qghwaehxw309amxjar0wghxummnw3erztnrdakj7qgawaehxw309ahx7um5wghx6at5d9h8jampd3kx2apwvdhk6tcpzemhxue69uhk2er9dchxummnw3ezumrpdejz7qgmwaehxw309aex2mrp0yhx7unpdenk2urfd3kzuer9wchsqgxhrqmlyasagpmc0hqzeuapzlalsprve560tmewt3zsp34p2u3j0q7cuy75
FYI, this seems to be an issue that only happens on the default keyboard of Graphene OS. Changing the keyboard fixes it.
https://coracle.social/notes/nevent1qyt8wumn8ghj7un9d3shjtnddaehgu3wwp6kytcpzemhxue69uhkummnw3ezu7rdwgh8ymmrddej7qghwaehxw309aux6u3ww4ek2mn0wd68ytn0wfnj7qgewaehxw309aex2mrp0yhxummnw3exzarf9e3k7mf0qyv8wumn8ghj7cmp9ehhyctwvajhq6tvdshxgetk9uq3jamnwvaz7tmvd9nksarwd9hxwun9d3shjtnrdakj7qghwaehxw309amxjar0wghxummnw3erztnrdakj7qgawaehxw309ahx7um5wghx6at5d9h8jampd3kx2apwvdhk6tcpzemhxue69uhk2er9dchxummnw3ezumrpdejz7qgmwaehxw309aex2mrp0yhx7unpdenk2urfd3kzuer9wchsqgxhrqmlyasagpmc0hqzeuapzlalsprve560tmewt3zsp34p2u3j0q7cuy75
I don't use the default keyboard.
Florisboard also has the same issue. Anysoft, GBoard and Unexpected Keyboards seem to work.
Does anyone have any idea where in the code we should be looking to fix this? It wasn't a problem on older versions of Amethyst. It was promptly reported since tagging people is an extremely common operation. Probably introduced in 0.83.8 or 0.83.9? Possibly as far back as 0.83.7.
I'll try to grab a test phone and see if I can determine the exact release that introduced this issue and report back here with whatever I find.
It's not on our code. The stack trace doesn't know any particular issues that can be handled on our codebase. But if you want to take a look, it is a bug that happens when the UrlUserTagTransformation class is used. VisualTransformations map the npub
to the user's name in the edit field, reducing the length of the text. The issue happens because some keyboards run their auto-correct procedures in the modified text but with indexes of the original text, which causes an OutOfBounds exception.
Currently, the Alpha release of FlorisBoard has this issue fixed. OpenBoard and whatever Graphene uses as the default keyboard still have these issues. AnySoft, Unexpected Keyboard, and GBoard never crash.
This was solved on v0.87.6