GitHawkApp / GitHawk

The (second) best iOS app for GitHub.
http://githawk.com
MIT License
2.88k stars 384 forks source link

Suggested replacement text breaks autocomplete #1514

Open SD10 opened 6 years ago

SD10 commented 6 years ago

If a word is highlighted for a suggested replacement when selecting a user from the menu to create a mention. The wrong text is created.

Moya/Moya#632

Step 1: Type @fb Step 2: The “fb” portion will be highlighted for replacement Step 3: Select user @fbeeper Step 4: The result is a mention for beeper

Bug Report Dump (Auto-generated)
Version 1.18.0 (1518216007)
Device: iPhone 7 (iOS 11.0.2)
TestFlight: false
SD10 commented 6 years ago

Did some digging here:

Need to familiarize myself with MessageViewController codebase to make sense of the stack trace 😕

Quick fix would be if the tap event that accepts the autocorrect could be filtered and ignored

Sent with GitHawk

rnystrom commented 6 years ago

@SD10 can you post the stack trace? Added you as a collab to that codebase too.

SD10 commented 6 years ago

Good (creating a mention without any text highlighted for replacement):

screen shot 2018-02-13 at 6 46 01 am

Bad (creating a mention when text is highlighted for replacement):

screen shot 2018-02-13 at 6 47 33 am

You can see that a lot goes on after item 22 in the bad stack. At the time of 22 the mention is created properly. Essentially, textView(_:shouldChangeTextIn:replacementText:) gets called too many times after creating the mention. Can drill more on the weekend.

rnystrom commented 6 years ago

I think I patched this in Slacks TVC where I temporarily disable and re enable autocorrect when replacing text. Might have to do that here.

Sent with GitHawk

SD10 commented 6 years ago

temporarily disable and re enable autocorrect when replacing text.

That could be rough. IIRC modifying the autocorrectType while a UITextView is the first responder has no effect. Resigning & reactivating the responder status while replacing text is kind of gross from a UX standpoint 😕

SD10 commented 6 years ago

I also can't replicate this bug when using the @ symbol directly from the keyboard. That's likely why this appeared after #1507.

It seems like if you use @ from the keyboard, no autocorrect highlighting occurs until the next space (which is the functionality we want). It's as if Apple has solved this internally for special characters.

SD10 commented 6 years ago

@rnystrom Are the changes I made to MessageViewController present in GitHawk yet? Noticing a new problem and have a different solution 😭😭I'm getting a bunch of single character spaces and punctuation highlighted with autocomplete attributes

Sent with GitHawk

rnystrom commented 6 years ago

@SD10 not yet, have to pod update that dependency. I can hold off tho!

Sent with GitHawk

SD10 commented 6 years ago

GitHawk Upload by SD10

Looks to be unrelated to my changes then 🙄. Happens after any autocorrected word once there is an existing mention. Note: Bug does not show up on simulator.

Sent with GitHawk

SD10 commented 6 years ago

cc @nathantannar4

Just making you aware of this issue. I will look into it more this weekend