feat(Proton Mail): Add Remove 'Sent from' signature patch (#4514)

This commit is contained in:
Aoife McCullough 2025-04-02 04:58:10 -05:00 committed by GitHub
parent ef1916113d
commit 34c14c9b44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 46 additions and 0 deletions

View File

@ -400,6 +400,10 @@ public final class app/revanced/patches/pixiv/ads/HideAdsPatchKt {
public static final fun getHideAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/protonmail/signature/RemoveSentFromSignaturePatchKt {
public static final fun getRemoveSentFromSignaturePatch ()Lapp/revanced/patcher/patch/ResourcePatch;
}
public final class app/revanced/patches/rar/misc/annoyances/purchasereminder/HidePurchaseReminderPatchKt {
public static final fun getHidePurchaseReminderPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}

View File

@ -0,0 +1,42 @@
package app.revanced.patches.protonmail.signature
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.resourcePatch
import app.revanced.util.findElementByAttributeValue
import java.io.File
@Suppress("unused")
val removeSentFromSignaturePatch = resourcePatch(
name = "Remove 'Sent from' signature",
description = "Removes the 'Sent from Proton Mail mobile' signature from emails.",
) {
compatibleWith("ch.protonmail.android")
execute {
val stringResourceFiles = mutableListOf<File>()
get("res").walk().forEach { file ->
if (file.isFile && file.name.equals("strings.xml", ignoreCase = true)) {
stringResourceFiles.add(file)
}
}
var foundString = false
stringResourceFiles.forEach { filePath ->
document(filePath.absolutePath).use { document ->
var node = document.documentElement.childNodes.findElementByAttributeValue(
"name",
"mail_settings_identity_mobile_footer_default_free"
)
// String is not localized in all languages.
if (node != null) {
node.textContent = ""
foundString = true
}
}
}
if (!foundString) throw PatchException("Could not find 'sent from' string in resources")
}
}