itsjunetime / smserver

An app to allow Jailbroken iPhones to send texts & attachments from their browser
GNU General Public License v3.0
158 stars 27 forks source link

Cannot display a message that is just a space #90

Closed sabogalc closed 3 years ago

sabogalc commented 3 years ago

I was talking to someone and they were telling me about how something left them speechless, so they sent me a message that was just " ", which displays as a small blank blue bubble on iOS (the more spaces, the longer the bubble). This message didn't display on my Android phone with the BlueBubbles app, or any of my other iMessage forwarding apps, so I sat there confused waiting to receive a message only to check my iPhone and see that it was a blank. Of all the apps with this issue, SMServer was the only one that allowed me to send a blank, and SMServer and WebMessage both displayed a timestamp for the blank message. Blank SMServer Blank iOS See issues here, here, and here

itsjunetime commented 3 years ago

Yeah, so this is kinda a funky issue -- SMServer automatically does not display a text if it is only whitespace. This is due to the fact that apple inserts weird, sometimes (but only sometimes) invisible characters (that are not traditional whitespace like spaces, tabs, or newlines) into the body of every text that contains attachments. So if I do display every message, every message that has attachments will have a few nonsense characters at the beginning of its message, which I would like to avoid.

I guess I could allow empty texts when they have no attachments? I'd have to test that out for a bit, though, to make sure there are no other weird effects. Also, that would mean that you could not send an attachment with just a space, so this wouldn't be a complete solution. I'll keep looking into it.

itsjunetime commented 3 years ago

Update: I lied; I thought it was different characters on each message, turns out it's just the same character each time. I just filtered them all out with string.replacingOccurrences(of: "\u{fffc}", with: "", options: NSString.CompareOptions.literal, range: nil) in the host, and now texts that are only spaces show just fine in the web interface. This will be fixed with the next update.

sabogalc commented 3 years ago

Update: I lied; I thought it was different characters on each message, turns out it's just the same character each time. I just filtered them all out with string.replacingOccurrences(of: "\u{fffc}", with: "", options: NSString.CompareOptions.literal, range: nil) in the host, and now texts that are only spaces show just fine in the web interface. This will be fixed with the next update.

That's great to hear! Will the other developers be notified of this through the link mentions?

itsjunetime commented 3 years ago

I can let them know if they ran into this issue for the same reasoning as me; however, this may be a completely different bug in their apps, so I'll wait to see if they're running into the same issue, and let them know my solution if so.

itsjunetime commented 3 years ago

Alright, I've updated the app and it should include this fix — try it out and let me know if this issue is fixed for you as well.

sabogalc commented 3 years ago

It is fixed, however all blank messages show up only as one space on SMServer instead of however many there actually are (whether it be 1 or 100). Honestly, it isn't that big a deal since either way the message will be conveyed, but I just want to know if it's okay to close this issue like that.

Edit - In WebMessage, the number of spaces displays correctly https://github.com/sgtaziz/WebMessage/issues/48#issuecomment-781883167 Just pinging sgtaziz in case he has any tips 👍

itsjunetime commented 3 years ago

Ah yeah, I know what my issue is — html tags with only whitespace don't show unless you replace them with explicitly viewable whitespace (e.g.  ). I just replaced the first space in each message with a viewable space, I should've replaced each space with  . This'll be fixed in the next version.

itsjunetime commented 3 years ago

Version 0.7.4 is out on twickd.