-
Notifications
You must be signed in to change notification settings - Fork 497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle RCS messages properly, and improve group MMS #1097
Conversation
…droid Studio (everything else)
…, plus the subject.
Sometimes you would see both of these subjects in gmail: 123-123-1234/Dad 123-123-1234/Dad/Dad
…reads, due to grabbing the contact ID from a random person in each thread
@locofocos Thank you so much for doing this; it will close a large number of outstanding tickets. I will review in detail shortly. (It will still be up to @jberkel to publish to Google Play.) |
I'm really happy with the separation of Again, many thanks. |
// Tip - if you want to try different strategies for computing mmsThreadId against the same messages, | ||
// make sure to generate a new MESSAGE_ID as well. It seems like gmail caches REFERENCES if you reuse the same MESSAGE_ID. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some context, from what I learned doing this: MESSAGE_ID is the unique message on gmail's end. REFERENCES is the field (on gmail's end) that determines which email an email is replying to.
For the last message grouping fix I built, I wasn't seeing it take effect, even after I deleted all my sms backups from gmail and ran the back again. I was able to determine that gmail was caching the REFERENCES field by clicking "show original" in gmail and looking at the message header. I had to force the app to generate new MESSAGE_IDs. Basically there's some string we pass into the hash function that generates MESSAGE_ID. You can just concatenate "v2", "v3", etc. to the hash input. It's almost like bumping a version number. Once I generated a new MESSAGE_ID for those messages I had already backed up before, then my last fix started working.
However, this has repercussions for releasing this fix. I tried backing up all the messages on my phone with a clean build of this current PR. I'm using a different gmail label (SMS-testing
instead of the usual SMS
) to keep things clean, but the app was still generating the same MESSAGE_ID as before. So when I checked on some older (already backed up) messages, they weren't grouped correctly 😢
I can vet this out, but I believe if we version/change the hash input (like we start concatenating "v2"), that will force gmail to recognize these as new messages. So then users will be able to reset the app state and re-backup their existing messages, and then older threads should get fixed 🎉 I expect the old messages would linger around in gmail as well, so there may some duplicates... but users will only get this if they choose to re-backup their existing messages.
This will also be a useful opportunity for me to check against more test messages. I'll check this out some day soon!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good news! Versioning the hash input ab80cc0 fixes this problem nicely. This will be helpful to force gmail to recognize these messages as new threads and group them correctly.
@kurahaupo you're welcome! Thanks for the initial review. I'll get this cleaned up and tested further some time soon, I hope. |
…MS (some messages have images)
…s not broken into 2 threads
…is worked before, but now avoids a warning log
@kurahaupo I've given this some solid testing on my phone, and I'm happy with the result. Is the travis CI build running against this PR? I was looking for the build output so I could at least see which tests I need to update. edit - I might need some some more time to look over the results and debug more. All of those test cases look good. But I did a another huge backup last night, and I'm seeing some ungrouped messages. |
I'll check on the CI when I get home to my PC |
Hi |
@hubono I debated whether I should post a copy of my latest APK build, just in case life happens and we don't get this PR merged. Caveats, if this wasn't obvious:
However, I've been using it for months. No promises, but I'm happy with the results. So here is the APK I built locally from ac71d55 |
@locofocos Question: I am currently running 1.5.11 from the app store. I want to try your improved version to see if it will fix the GMail threading issues I had. I am unclear what the upgrade path is. Since I am sideloading, do I need to uninstall 1.5.11 first? Also, you mention the "backup state" multiple times above but since this is technically a new app sideloaded, does that mean that by default, all my messages on my phone will get backed-up again into GMail? |
@chadcancode Since you're sideloading, yeah, Android will force you to uninstall 1.5.11 first. I made some clarifications to the upgrade path under It's really up to you. If you want a perfect seamless state, do "the harder way". If you don't care about duplicates, use "the lazy way". |
@locofocos may I humbly request that you (or some other kind soul) provide a version compiled in 64-bit, please? On my Pixel 8 Pro I get the error "you can't install the app on your device" when installing. My understanding is that newer phones or Android versions no longer support 32-bit apps. I did uninstall the old app first. |
I made a few changes to get this compiling again - I think Google removed some library versions from their maven repo (thanks Google...). I think we can compile it against 64 bit, but I'm not sure what all is required. I added @kranix0 See if this works on your Pixel 8: SMS.backup.RCS.maybe64bit.cb3a97f.apk.zip |
Actually I think 64 vs 32 bit might not be the issue. Stackoverflow says
and the APK doesn't have any lib folder. So I think it already supported 64 bit phones. This looks much more promising: https://www.reddit.com/r/GooglePixel/comments/17bzbcy/install_failed_deprecated_sdk_version_any_way/ This app uses |
@locofocos amazing… it works! I haven't tested the RCS backup, but it seems to work at least as well as I had on my Pixel 6. Thank you!!! |
This works great on my Pixel 9 Pro with Android 15 QPR1, though first I had to select "allow restricted settings" for the app in Android in order to allow SMS permissions. Many thanks! |
Hello, Thank you for your work! Thanks! |
@eexit as a co-maintainer, I can apply pull requests and make other changes here on github, but I don't have access to make updates on Google Play or on F-Droid. Perhaps other technical users can build and post an APK somewhere that you can download it. |
This worked for me as well. Thank you! |
Hmm. Would making a forked project like "SMS Backup++", "SMS Backup+ Rev" (revived), "SMS Backup+ TNG" or "SMS Backup+ BtL" (Back to Life) or something else make it easier. Giving names is not my strong side - as long as people know its name and origin it will work just fine for me. If a developer account is needed I am quite sure we are several people that would like to sponsor the costs of the US$25: https://support.google.com/googleplay/android-developer/answer/6112435?hl=en#zippy=%2Cstep-pay-registration-fee Please state your price :) |
I swapped out the old version that I had been using for years from the Play Store with the compiled version posted by @locofocos . I then changed my SMS label in GMail to "SMS-old" and backed-up all my messages under a new SMS label. I am having an interesting issue with the threading. Specifically between my wife and my messages. Most of them are broken out into separate messages and not threaded together even though it's just the two of us in the conversation on a decade long thread. I'm confused because the messages I sent show my Google user name in the FROM field while the messages she sent show my phone number in the from field in the format: +1########## +1##########@unknown.email (actual number is obfuscated). What makes it even weirder is I do see some threads between us and it's the same thing as above. Messages in the thread are either FROM my username or To my phone number. Any ideas where this could be going awry? I don't understand if this is on the Google side or the SMS Backup+ side. |
@chadcancode - If I had to guess, it sounds like you missed a step in "Adopting this new version" > "the harder way"
Getting all types of messages lined up required changing the to/from addresses. It wasn't possible to make the new email format compatible with the old format. That's why you need to re-backup whatever time period you still have on your phone for the best continuity of messages. I hope it works out! |
I didn't understand the last set of instructions: I just renamed the label sms to sms-old and backed up all my messages again. I then in Gmail did a lot of lightweight comparison between some messages with the old label vs the new. I was planning on then deleting everything under the old label. Why would the instructions have me change all the old backup emails over to the sms label if I backed everything up from scratch? Also, is there some header that SMS Backup+ is supposed to use to ensure messages are properly threaded? If it matters, I'm on Android and my wife is on iPhone but not sure why that should matter at all. |
There's a pinned issue titled "fork this project" that explains some of the issues with choosing a name, especially if we wish to regain "sensitive access" to read & write messages from a gmail account directly (rather than by trying IMAP).
My main problem is that while I'm a very experienced developer in general, so I can easily read and modify code in many languages, I'm a newbie at setting up a build pipeline. I've run through various tutorials and they all assume that you're starting with a new (empty) code base, so that they conflict with what @jberkel wrote for for this package. And simply copying the existing build doesn't seem to work. |
Fixes #1055 and #1027
This fixes RCS importing 🎉
It also improves how group MMS threads are imported. Basically it includes all the recipients in the "to" field, and puts everyone's name in the subject, so that gmail does a much better job mimicking the group threads on your phone.
I've been toying around with it on my Pixel 3a running Android 10. I've tested with a mix of SMS, group MMS chats, and RCS chats.
I'm completely open to the idea that I was a little heavy-handed with my refactor. I ran with what made sense. I'm fine if someone else wants to take this as as proof-of-concept and run in a slightly different direction to make this mergeable.
TODO
Testing
Tips for testing:
app/src/main/java/com/zegoggles/smssync/service/BackupQueryBuilder.java
. https://www.epochconverter.com/ is your friend here.Some test cases that I've gone through on my phone, and verified that the backup looks correct in Gmail:
BackupItemsFetcher.getItemsForDataType
andConsts.MMS_PROVIDER
/SMS_PROVIDER
. So we would have to build some intermediate caching mechanism that gathers all the SMSs, gathers all the MMSs, interleaves them, then feeds them into the existing logic.Adopting this new version
Here is my 2 cents for how affected users could get their backups into a clean-ish state:
old-backups
. Download the new app version. Reset the backup state (or reinstall the app) and backup everything again (to your favorite label, likeSMS
). For whatever time period you still have on your phone, delete emails from that time period with labelold-backups
. Verify that you have a nice continuity when looking at bothold-backups
andSMS
. Then change all theold-backups
emails over to theSMS
label.