feat(youtube/microg-support): handle availability of Vanced MicroG
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package app.revanced.util.microg
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
@ -20,6 +21,17 @@ import org.jf.dexlib2.immutable.reference.ImmutableStringReference
|
||||
* Helper class for applying bytecode patches needed for the microg-support patches.
|
||||
*/
|
||||
internal object MicroGBytecodeHelper {
|
||||
/**
|
||||
* Hook a method to check the availability of MicroG.
|
||||
*
|
||||
* @param fingerprint The fingerprint of the method to add the call for the notice in.
|
||||
*/
|
||||
fun injectNotice(fingerprint: MethodFingerprint) {
|
||||
fingerprint.result!!.mutableMethod.addInstruction(
|
||||
0,
|
||||
"invoke-static {}, Lapp/revanced/integrations/patches/MicroGSupport;->checkAvailability()V"
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform strings with package name out of [fromPackageName] and [toPackageName].
|
||||
|
@ -1,16 +1,26 @@
|
||||
package app.revanced.util.microg
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
||||
|
||||
/**
|
||||
* Helper class for applying resource patches needed for the microg-support patches.
|
||||
*/
|
||||
internal object MicroGResourceHelper {
|
||||
|
||||
/**
|
||||
* Add necessary strings to the strings.xml file.
|
||||
*
|
||||
* @param context The resource context.
|
||||
* @param stringsHost The file which hosts the strings.
|
||||
*/
|
||||
fun addStrings(context: ResourceContext, stringsHost: String = "microg/host/values/strings.xml") = context.mergeStrings(stringsHost)
|
||||
|
||||
/**
|
||||
* Patch the manifest to work with MicroG.
|
||||
*
|
||||
* @param context Bytecode context.
|
||||
* @param fromPackageName Original package name.
|
||||
* @param context The resource context.
|
||||
* @param fromPackageName The original package name.
|
||||
* @param toPackageName The package name to accept.
|
||||
* @param toName The new name of the app.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user