Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Google News): Add Google News Patches, CustomTabs and GMSCore Integration #3111

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

benjy3gg
Copy link

@benjy3gg benjy3gg commented May 2, 2024

This Patch implements CustomTabs in Google News (com.google.android.apps.magazines).
This sets a flag that is otherwise false to true -> Instead of opening articles in ChromeWebView it uses the Default Browser

This also implements Basic GMSCore Support.
Login and Logout works.
Clicking on "Manager your Google Account" doesn't open the GMSCore settings -> same problem as in Youtube.

@benjy3gg
Copy link
Author

benjy3gg commented May 2, 2024

depends on this pullrequest in revanced-integrations:
ReVanced/revanced-integrations#628

otherwise i get an error in the onCreate method of StartActivity

@@ -0,0 +1,26 @@
package app.revanced.patches.magazines.misc.customtabs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably better to move the package from magazines to "googlenews". I was thinking about moving everything under the respective app's package, so for YouTube, the patches would be in: app.revanced.patches.com.google.android.youtube. For now, naming it "googlenews" is conventional with how we named the other packages.

Opcode.IPUT_BOOLEAN
),
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lcom/google/apps/dots/android/modules/reading/customtabs/CustomTabsArticleLauncher;" && methodDef.accessFlags == AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably an .endsWith() check is simpler here.

Opcode.IPUT_BOOLEAN
),
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lcom/google/apps/dots/android/modules/reading/customtabs/CustomTabsArticleLauncher;" && methodDef.accessFlags == AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AccessFlags is a field in MethodFingerprint. Use that.

import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags

internal object GooglePlayUtilityFingerprint : MethodFingerprint(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fingerprint looks similar to another. Might remove one and move the other to a shared location under app.revanced.patches package similar to other shared fingerprints. The fingerprint can then be used in both patches.

Opcode.MOVE_RESULT_OBJECT, // move-result-object v2
),
insertIndexResolver = { method ->
instructions = method.toMutable().getInstructions()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A toMutabe call should not be necessary. You can simply get the methods instructions via method.implementation.instructions

import com.android.tools.smali.dexlib2.iface.instruction.Instruction

private var index: Int = -1
private var instructions: List<Instruction> = listOf()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field is not necessary. contextRegisterResolver has a reference to the method.

import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import com.android.tools.smali.dexlib2.iface.instruction.Instruction

private var index: Int = -1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this field into the fingerprint object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants