generated from ReVanced/revanced-patches-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(All): Add
Remove internet permission
patch
- Loading branch information
1 parent
41ee15c
commit 5c7e3d5
Showing
3 changed files
with
31 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
public final class dev/jkcarino/revanced/patches/example/ExamplePatch : app/revanced/patcher/patch/BytecodePatch { | ||
public static final field INSTANCE Ldev/jkcarino/revanced/patches/example/ExamplePatch; | ||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V | ||
public final class dev/jkcarino/revanced/patches/all/misc/network/RemoveInternetPermissionPatch : app/revanced/patcher/patch/ResourcePatch { | ||
public static final field INSTANCE Ldev/jkcarino/revanced/patches/all/misc/network/RemoveInternetPermissionPatch; | ||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V | ||
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V | ||
} | ||
|
28 changes: 28 additions & 0 deletions
28
...in/kotlin/dev/jkcarino/revanced/patches/all/misc/network/RemoveInternetPermissionPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package dev.jkcarino.revanced.patches.all.misc.network | ||
|
||
import app.revanced.patcher.data.ResourceContext | ||
import app.revanced.patcher.patch.ResourcePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import org.w3c.dom.Element | ||
|
||
@Patch( | ||
name = "Remove internet permission", | ||
description = "Removes unnecessary internet permission from apps that can function without internet access.", | ||
use = false | ||
) | ||
@Suppress("unused") | ||
object RemoveInternetPermissionPatch : ResourcePatch() { | ||
override fun execute(context: ResourceContext) { | ||
context.xmlEditor["AndroidManifest.xml"].use { editor -> | ||
val usesPermissions = editor.file.getElementsByTagName("uses-permission") | ||
|
||
for (i in 0 until usesPermissions.length) { | ||
val element = usesPermissions.item(i) as? Element ?: continue | ||
if (element.getAttribute("android:name") == "android.permission.INTERNET") { | ||
element.parentNode.removeChild(element) | ||
break | ||
} | ||
} | ||
} | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
src/main/kotlin/dev/jkcarino/revanced/patches/example/ExamplePatch.kt
This file was deleted.
Oops, something went wrong.