ReVanced / revanced-patches

🧩 Patches for ReVanced
https://revanced.app
GNU General Public License v3.0
2.54k stars 294 forks source link

bug: Sync for Reddit Disable Ads patch does not work with latest target app release #660

Closed leo60228 closed 1 year ago

leo60228 commented 1 year ago

Type

Error while patching

Bug description

The Disable Ads patch does not function. Other patches work.

Steps to reproduce

  1. Install Sync for Reddit v23.06.30-13:39
  2. Patch with default patches (Change Oauth Client Id, Disable Ads)

Relevant log output

Initializing installer
Creating working directory
Copying original apk
Unpacking input apk
Reading dex files
Decoding AndroidManifest.xml only, because resources are not needed
Merging integrations
Executing patches
Applied change-oauth-client-id
Failed to apply disable-ads: 'disable-ads' depends on 'DisablePiracyDetectionPatch' but the following error was raised: Failed to resolve PiracyDetectionFingerprint
Repacking patched apk
Not compiling resources because resource patching is not required
Writing modified dex files
Finished!
Installing patched file using root method
Installed!

Screenshots or videos

Screenshot_20230701-174127_Sync

Solution

No response

Additional context

This appears to be the same issue as ReVanced/revanced-patches#2549, which was closed and locked due to not using official tools. I encountered it using Revanced Manager 1.3.8.

Acknowledgements

LisoUseInAIKyrios commented 1 year ago

The app was updated and at first glance it appears the piracy detection functionality was removed. The PiracyDetection code is still bundled, but none of the code in com.github.javiersantos.piracychecker is referenced anywhere.

The piracy detection could be removed and the patch be constrained to the latest release. Or maybe change the piracy patch so it does not fail if trying to patch the newer versions.

There is still some weirdness where it remotely logs to Firebase both the reddit username and the users phone country code:

i.a("hmm detected");
...
String h10 = com.laurencedawson.reddit_sync.singleton.a.d().h(); // Reddit account username
country = ((TelephonyManager) getSystemService("phone")).getSimCountryIso();
...
hashMap.put("account", h10);
hashMap.put("country", country);
...
FirebaseFunctions.l().k("hmmm").a(hashMap);

Hmmm indeed.

LisoUseInAIKyrios commented 1 year ago

For now patch v23.05.03-17:18 as that still works.

oSumAtrIX commented 1 year ago

The code to remove piracy detection was made to bypass modifying the client. As this is not necessary, our best course of action for future versions (or the last), would be to remove the patch or keep it but not return aPatchResultError so it works for older versions too.

Advyt3 commented 1 year ago

This can be fixed by building your own patch and removing the code that removes piracy detection. I already made the patch that works on the latest target version only in my fork of revanced-patches.

oSumAtrIX commented 1 year ago

You can simply remove the ?: return fp.toErrorResult() expression and it should work on any version. The null check would prevent errors in the new version but still allow the fingerprint to work on older versions

Advyt3 commented 1 year ago

You can simply remove the ?: return fp.toErrorResult() expression and it should work on any version. The null check would prevent errors in the new version but still allow the fingerprint to work on older versions

This was genius and much better, stupid me.