Skip to content

Commit 58f8bc8

Browse files
committed
fix: google photos patch logic
1 parent a7fc9b8 commit 58f8bc8

25 files changed

Lines changed: 594 additions & 16 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Gradle files
22
.gradle/
33
build/
4+
!patches/src/main/kotlin/app/morphe/patches/all/misc/build/
5+
!patches/src/main/kotlin/app/morphe/patches/all/misc/build/**
46

57
# Local configuration file (sdk path, etc)
68
local.properties

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
| Strava | `com.strava` | <ul><li>Group kudos</li><li>Hide distractions</li><li>Media download</li><li>Media upload</li><li>Disable quick edit</li><li>Password login</li><li>Block tracking</li><li>Unlock subscription</li><li>Disable upsell</li></ul> |
5757
| Tumblr | `com.tumblr` | <ul><li>Disable ads</li><li>Disable Ad-Free Banner</li><li>Disable in-app update</li><li>Disable blog notification reminder</li><li>Disable gift message popup</li><li>Disable Tumblr TV</li><li>Fix old versions</li><li>Override feature flags</li></ul> |
5858

59-
6059
---
6160

6261
## GPL Compliance
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dependencies {
2+
compileOnly(project(":extensions:shared:library"))
3+
}
4+
5+
extension {
6+
name = "extensions/messenger.mpe"
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<manifest/>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Forked from:
3+
* https://github.com/ReVanced/revanced-patches/blob/6b06b9d1328b971a06d10b4247f4c10f050e4f61/extensions/messenger/src/main/java/app/revanced/extension/messenger/metaai/RemoveMetaAIPatch.java
4+
*/
5+
6+
package app.morphe.extension.messenger.metaai;
7+
8+
import java.util.Collections;
9+
import java.util.HashSet;
10+
import java.util.Set;
11+
12+
import app.morphe.extension.shared.Logger;
13+
14+
@SuppressWarnings("unused")
15+
public class RemoveMetaAIPatch {
16+
private static final Set<Long> loggedIDs = Collections.synchronizedSet(new HashSet<>());
17+
18+
public static boolean overrideBooleanFlag(long id, boolean value) {
19+
try {
20+
if (Long.toString(id).startsWith("REPLACED_BY_PATCH")) {
21+
if (loggedIDs.add(id)) {
22+
Logger.printInfo(() -> "Overriding " + id + " from " + value + " to false");
23+
}
24+
return false;
25+
}
26+
} catch (Exception ex) {
27+
Logger.printException(() -> "overrideBooleanFlag failure", ex);
28+
}
29+
30+
return value;
31+
}
32+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ org.gradle.jvmargs = -Xms512M -Xmx2048M
33
org.gradle.parallel = true
44
android.useAndroidX = true
55
kotlin.code.style = official
6-
version = 1.0.0
6+
version = 1.2.0

patches-list.json

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0.0",
2+
"version": "v1.2.0",
33
"appNames": {
44
"com.google.android.apps.photos": "Google Photos",
55
"com.google.android.apps.magazines": "Google News",
@@ -14,7 +14,10 @@
1414
"jp.pxv.android": "Pixiv",
1515
"com.microblink.photomath": "Photomath",
1616
"com.strava": "Strava",
17-
"com.tumblr": "Tumblr"
17+
"com.tumblr": "Tumblr",
18+
"com.amazon.mShop.android.shopping": "Amazon Shopping",
19+
"com.nis.app": "Inshorts",
20+
"com.facebook.orca": "Messenger"
1821
},
1922
"patches": [
2023
{
@@ -43,6 +46,16 @@
4346
},
4447
"options": []
4548
},
49+
{
50+
"name": "Always allow deep-linking",
51+
"description": "Open Amazon links, even if the app is not set to handle Amazon links.",
52+
"use": true,
53+
"dependencies": [],
54+
"compatiblePackages": {
55+
"com.amazon.mShop.android.shopping": null
56+
},
57+
"options": []
58+
},
4659
{
4760
"name": "Block Snowplow tracking",
4861
"description": "Blocks Snowplow analytics. See https://snowplow.io for more information.",
@@ -181,6 +194,16 @@
181194
},
182195
"options": []
183196
},
197+
{
198+
"name": "Disable typing indicator",
199+
"description": "Disables the indicator while typing a message.",
200+
"use": true,
201+
"dependencies": [],
202+
"compatiblePackages": {
203+
"com.facebook.orca": null
204+
},
205+
"options": []
206+
},
184207
{
185208
"name": "Enable CustomTabs",
186209
"description": "Enables CustomTabs to open articles in your default browser.",
@@ -261,6 +284,16 @@
261284
},
262285
"options": []
263286
},
287+
{
288+
"name": "Hide Facebook button",
289+
"description": "Hides the Facebook button in the top toolbar.",
290+
"use": true,
291+
"dependencies": [],
292+
"compatiblePackages": {
293+
"com.facebook.orca": null
294+
},
295+
"options": []
296+
},
264297
{
265298
"name": "Hide OneDrive migration",
266299
"description": "Hides the OneDrive migration prompt when opening Microsoft Office Lens.",
@@ -283,6 +316,16 @@
283316
},
284317
"options": []
285318
},
319+
{
320+
"name": "Hide ads",
321+
"description": null,
322+
"use": true,
323+
"dependencies": [],
324+
"compatiblePackages": {
325+
"com.nis.app": null
326+
},
327+
"options": []
328+
},
286329
{
287330
"name": "Hide ads",
288331
"description": null,
@@ -393,6 +436,26 @@
393436
}
394437
]
395438
},
439+
{
440+
"name": "Hide inbox ads",
441+
"description": "Hides ads in inbox.",
442+
"use": true,
443+
"dependencies": [],
444+
"compatiblePackages": {
445+
"com.facebook.orca": null
446+
},
447+
"options": []
448+
},
449+
{
450+
"name": "Hide inbox subtabs",
451+
"description": "Hides Home and Channels tabs between active now tray and chats.",
452+
"use": true,
453+
"dependencies": [],
454+
"compatiblePackages": {
455+
"com.facebook.orca": null
456+
},
457+
"options": []
458+
},
396459
{
397460
"name": "Hide purchase reminder",
398461
"description": "Hides the popup that reminds you to purchase the app.",
@@ -473,6 +536,18 @@
473536
},
474537
"options": []
475538
},
539+
{
540+
"name": "Remove Meta AI",
541+
"description": "Removes UI elements related to Meta AI.",
542+
"use": true,
543+
"dependencies": [
544+
"BytecodePatch"
545+
],
546+
"compatiblePackages": {
547+
"com.facebook.orca": null
548+
},
549+
"options": []
550+
},
476551
{
477552
"name": "Remove free accounts limit",
478553
"description": "Removes the limit for maximum free accounts logged in.",
@@ -604,4 +679,4 @@
604679
"options": []
605680
}
606681
]
607-
}
682+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Forked from:
3+
* https://github.com/ReVanced/revanced-patches/blob/6b06b9d1328b971a06d10b4247f4c10f050e4f61/patches/src/main/kotlin/app/revanced/patches/all/misc/build/BaseSpoofBuildInfoPatch.kt
4+
*/
5+
package app.morphe.patches.all.misc.build
6+
7+
import app.morphe.patcher.extensions.InstructionExtensions.getInstruction
8+
import app.morphe.patcher.extensions.InstructionExtensions.replaceInstruction
9+
import app.morphe.patcher.patch.bytecodePatch
10+
import app.morphe.patches.all.misc.transformation.transformInstructionsPatch
11+
import app.morphe.util.getReference
12+
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
13+
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
14+
15+
private const val BUILD_CLASS_DESCRIPTOR = "Landroid/os/Build;"
16+
17+
fun baseSpoofBuildInfoPatch(buildInfoSupplier: () -> BuildInfo) = bytecodePatch {
18+
// Lazy, so that patch options above are initialized before they are accessed.
19+
val replacements by lazy {
20+
with(buildInfoSupplier()) {
21+
buildMap {
22+
if (board != null) put("BOARD", "const-string" to "\"$board\"")
23+
if (bootloader != null) put("BOOTLOADER", "const-string" to "\"$bootloader\"")
24+
if (brand != null) put("BRAND", "const-string" to "\"$brand\"")
25+
if (cpuAbi != null) put("CPU_ABI", "const-string" to "\"$cpuAbi\"")
26+
if (cpuAbi2 != null) put("CPU_ABI2", "const-string" to "\"$cpuAbi2\"")
27+
if (device != null) put("DEVICE", "const-string" to "\"$device\"")
28+
if (display != null) put("DISPLAY", "const-string" to "\"$display\"")
29+
if (fingerprint != null) put("FINGERPRINT", "const-string" to "\"$fingerprint\"")
30+
if (hardware != null) put("HARDWARE", "const-string" to "\"$hardware\"")
31+
if (host != null) put("HOST", "const-string" to "\"$host\"")
32+
if (id != null) put("ID", "const-string" to "\"$id\"")
33+
if (manufacturer != null) put("MANUFACTURER", "const-string" to "\"$manufacturer\"")
34+
if (model != null) put("MODEL", "const-string" to "\"$model\"")
35+
if (odmSku != null) put("ODM_SKU", "const-string" to "\"$odmSku\"")
36+
if (product != null) put("PRODUCT", "const-string" to "\"$product\"")
37+
if (radio != null) put("RADIO", "const-string" to "\"$radio\"")
38+
if (serial != null) put("SERIAL", "const-string" to "\"$serial\"")
39+
if (sku != null) put("SKU", "const-string" to "\"$sku\"")
40+
if (socManufacturer != null) put("SOC_MANUFACTURER", "const-string" to "\"$socManufacturer\"")
41+
if (socModel != null) put("SOC_MODEL", "const-string" to "\"$socModel\"")
42+
if (tags != null) put("TAGS", "const-string" to "\"$tags\"")
43+
if (time != null) put("TIME", "const-wide" to "$time")
44+
if (type != null) put("TYPE", "const-string" to "\"$type\"")
45+
if (user != null) put("USER", "const-string" to "\"$user\"")
46+
}
47+
}
48+
}
49+
50+
dependsOn(
51+
transformInstructionsPatch(
52+
filterMap = filterMap@{ _, _, instruction, instructionIndex ->
53+
val reference = instruction.getReference<FieldReference>() ?: return@filterMap null
54+
if (reference.definingClass != BUILD_CLASS_DESCRIPTOR) return@filterMap null
55+
56+
return@filterMap replacements[reference.name]?.let { instructionIndex to it }
57+
},
58+
transform = { mutableMethod, entry ->
59+
val (index, replacement) = entry
60+
val (opcode, operand) = replacement
61+
val register = mutableMethod.getInstruction<OneRegisterInstruction>(index).registerA
62+
63+
mutableMethod.replaceInstruction(index, "$opcode v$register, $operand")
64+
},
65+
),
66+
)
67+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Forked from:
3+
* https://github.com/ReVanced/revanced-patches/blob/6b06b9d1328b971a06d10b4247f4c10f050e4f61/patches/src/main/kotlin/app/revanced/patches/all/misc/build/BaseSpoofBuildInfoPatch.kt
4+
* (BuildInfo class in same file there)
5+
*/
6+
7+
package app.morphe.patches.all.misc.build
8+
9+
/**
10+
* Build properties to spoof. Used so the app (and Google servers) see a Pixel device
11+
* and grant unlimited storage. Only non-null fields are patched.
12+
*/
13+
data class BuildInfo(
14+
val board: String? = null,
15+
val bootloader: String? = null,
16+
val brand: String? = null,
17+
val cpuAbi: String? = null,
18+
val cpuAbi2: String? = null,
19+
val device: String? = null,
20+
val display: String? = null,
21+
val fingerprint: String? = null,
22+
val hardware: String? = null,
23+
val host: String? = null,
24+
val id: String? = null,
25+
val manufacturer: String? = null,
26+
val model: String? = null,
27+
val odmSku: String? = null,
28+
val product: String? = null,
29+
val radio: String? = null,
30+
val serial: String? = null,
31+
val sku: String? = null,
32+
val socManufacturer: String? = null,
33+
val socModel: String? = null,
34+
val tags: String? = null,
35+
val time: Long? = null,
36+
val type: String? = null,
37+
val user: String? = null,
38+
)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Forked from:
3+
* https://github.com/ReVanced/revanced-patches/blob/6b06b9d1328b971a06d10b4247f4c10f050e4f61/patches/src/main/kotlin/app/revanced/patches/amazon/DeepLinkingPatch.kt
4+
*/
5+
6+
package app.morphe.patches.amazon
7+
8+
import app.morphe.patcher.extensions.InstructionExtensions.addInstructions
9+
import app.morphe.patcher.patch.bytecodePatch
10+
11+
@Suppress("unused")
12+
val deepLinkingPatch = bytecodePatch(
13+
name = "Always allow deep-linking",
14+
description = "Open Amazon links, even if the app is not set to handle Amazon links.",
15+
) {
16+
compatibleWith("com.amazon.mShop.android.shopping")
17+
18+
execute {
19+
DeepLinkingFingerprint.method.addInstructions(
20+
0,
21+
"""
22+
const/4 v0, 0x1
23+
return v0
24+
""",
25+
)
26+
}
27+
}

0 commit comments

Comments
 (0)