mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-04-29 22:24:27 +02:00
feat(Proton Mail): Add Remove 'Sent from' signature
patch (#4514)
This commit is contained in:
parent
ef1916113d
commit
34c14c9b44
@ -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;
|
||||
}
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user