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(Mi Fitness): Add Force English locale and Fix login patch #2734

Merged
merged 11 commits into from Mar 25, 2024

Conversation

pisek
Copy link
Contributor

@pisek pisek commented Feb 15, 2024

Added patches for MiFitness to get Mi Band CN version to use english language without changing the phone locale to EN

override fun execute(context: BytecodeContext) {
LoginFingerprint.result?.mutableMethod?.addInstruction(
0,
"const/4 p2, 0x0",
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure parameter 2 is never gonna change?

Copy link
Contributor Author

@pisek pisek Feb 19, 2024

Choose a reason for hiding this comment

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

Well, no i am not sure as i am not the owner of the original app;)
Any proposal of how to do it in a better way?
It is a constructor fingerprint that takes boolean as second param. This param, if false, disables Android phone account login and enables login/password login

Copy link
Member

Choose a reason for hiding this comment

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

If this parameter is used somewhere in the code, you can obtain it from one of the instructions. If the compiled code updates the register count, the parameter 2 shifts accordingly, but since you'd obtain it from an existing instruction, you'd correctly reference the necessary register.

Copy link
Member

Choose a reason for hiding this comment

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

@pisek The parameter seems still to be hardcoded

Copy link
Contributor Author

@pisek pisek Mar 19, 2024

Choose a reason for hiding this comment

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

@oSumAtrIX , what do you mean?
I have changed XiaomiAccountManagerConstructorFingerprint to point directly to the param that i need.

package app.revanced.patches.mifitness.misc.login.fingerprints

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

internal object XiaomiAccountManagerConstructorFingerprint : MethodFingerprint(
    accessFlags = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
    customFingerprint = { methodDef, _ ->
        methodDef.definingClass == "Lcom/xiaomi/passport/accountmanager/XiaomiAccountManager;"
    },
    parameters = listOf(
        "Landroid/content/Context;",
        "Z",
    ),
)

So in this case i will always use 2nd param - boolean.

The instruction that uses p2 is if-nez p2, :cond_0

What do you propose?

Copy link
Member

Choose a reason for hiding this comment

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

In this case, the fingerprint could fail to resolve, which is about as fatal as the parameter changing because the patch would stop working in both cases. Instead, if you obtain the register from an existing instruction, the failure would be reduced down to the instruction shifting changing or moving. For now this is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, i have updated the code to get the reg from instruction. Could you re-review?

@pisek pisek requested a review from oSumAtrIX February 19, 2024 12:02
override fun execute(context: BytecodeContext) {
LoginFingerprint.result?.mutableMethod?.addInstruction(
0,
"const/4 p2, 0x0",
Copy link
Member

Choose a reason for hiding this comment

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

If this parameter is used somewhere in the code, you can obtain it from one of the instructions. If the compiled code updates the register count, the parameter 2 shifts accordingly, but since you'd obtain it from an existing instruction, you'd correctly reference the necessary register.

@pisek
Copy link
Contributor Author

pisek commented Feb 26, 2024

Could anyone of you guy take a look at what is wrong with the build?
Error: Input required and not supplied: gpg_private_key
I am not sure what to do with it...

@LisoUseInAIKyrios
Copy link
Contributor

Try rebasing off dev branch (or merge dev and accept dev branch for the conflicts)

@oSumAtrIX
Copy link
Member

The GPG key is necessary for the publication tasks; this is not relevant in the build task:

image

@LisoUseInAIKyrios
Copy link
Contributor

Could anyone of you guy take a look at what is wrong with the build? Error: Input required and not supplied: gpg_private_key I am not sure what to do with it...

The error is only on your GitHub branch because you don't have a publishing key setup to create GitHub releases. You can ignore the error.

This PR branch is building locally for me without any issues.

@pisek
Copy link
Contributor Author

pisek commented Feb 29, 2024

Ok, so as I understand, it is ready to be merged :)

@LisoUseInAIKyrios LisoUseInAIKyrios marked this pull request as ready for review February 29, 2024 11:36
override fun execute(context: BytecodeContext) {
LoginFingerprint.result?.mutableMethod?.addInstruction(
0,
"const/4 p2, 0x0",
Copy link
Member

Choose a reason for hiding this comment

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

@pisek The parameter seems still to be hardcoded

@oSumAtrIX oSumAtrIX marked this pull request as draft March 2, 2024 07:28
@LisoUseInAIKyrios LisoUseInAIKyrios marked this pull request as ready for review March 19, 2024 16:08
@pisek pisek requested a review from oSumAtrIX March 20, 2024 11:37
@oSumAtrIX oSumAtrIX changed the title feat(Mi Fitness): MiBand CN language fix + app login to mi servers feat(Mi Fitness): Add Force English locale patch Mar 25, 2024
@oSumAtrIX oSumAtrIX changed the title feat(Mi Fitness): Add Force English locale patch feat(Mi Fitness): Add Force English locale and `Fix login´ patch Mar 25, 2024
@oSumAtrIX oSumAtrIX changed the title feat(Mi Fitness): Add Force English locale and `Fix login´ patch feat(Mi Fitness): Add Force English locale and Fix login patch Mar 25, 2024
@oSumAtrIX oSumAtrIX merged commit 7a25791 into ReVanced:dev Mar 25, 2024
2 checks passed
Copy link

welcome bot commented Mar 25, 2024

Thank you for contributing to ReVanced. Join us on Discord to receive a role for your contribution.

revanced-bot pushed a commit that referenced this pull request Mar 25, 2024
# [4.4.0-dev.11](v4.4.0-dev.10...v4.4.0-dev.11) (2024-03-25)

### Features

* **Mi Fitness:** Add `Force English locale` and `Fix login` patch ([#2734](#2734)) ([7a25791](7a25791))
* **Sync for Lemmy:** Add `Disable ads` patch ([#2872](#2872)) ([0785819](0785819))
revanced-bot pushed a commit that referenced this pull request Mar 27, 2024
# [4.4.0](v4.3.0...v4.4.0) (2024-03-27)

### Bug Fixes

* **TikTok:** Hook application context earlier to prevent crash ([#2893](#2893)) ([395ccda](395ccda))
* **YouTube - Client spoof:** Spoof all user agents ([44a8a13](44a8a13))
* **YouTube - Downloads:** Use new task context ([#2841](#2841)) ([6d88cb4](6d88cb4))
* **YouTube - Hide ads:** Prevent app crash if hiding fullscreen ads is not possible ([#2910](#2910)) ([9f50470](9f50470))
* **YouTube Music:** Fix compatibility with latest versions ([#2924](#2924)) ([8378c84](8378c84))
* **YouTube:** Fix video playback by switching to ReVanced GmsCore vendor ([#2907](#2907)) ([33ea122](33ea122))
* **YouTube:** Move setting to correct screen ([a16eda8](a16eda8))

### Features

* **Instagram - Hide timeline ads:** Make compatible with latest versions ([a212f29](a212f29))
* **Mi Fitness:** Add `Force English locale` and `Fix login` patch ([#2734](#2734)) ([7a25791](7a25791))
* **Sync for Lemmy:** Add `Disable ads` patch ([#2872](#2872)) ([0785819](0785819))
* **YouTube - Downloads:** Use external downloader when selecting 'Download' in home feed flyout menu ([#2881](#2881)) ([10afc8c](10afc8c))
* **YouTube - External downloader:** Add ability to use in-app download button ([d900011](d900011))
* **YouTube - Hide layout components:** Filter home/search results by keywords ([#2853](#2853)) ([5916204](5916204))
* **YouTube - Hide Shorts components:** Hide like and dislike buttons ([2df0892](2df0892))
* **YouTube - Hide Shorts components:** Hide sound metadata label ([ea7d1e0](ea7d1e0))
* **YouTube - Hide Shorts components:** Hide title and full video link label ([e7b64e1](e7b64e1))
* **YouTube - Hide Shorts components:** Selectively hide Shorts for home / subscription / search ([#2925](#2925)) ([497c067](497c067))
* **YouTube :** Remove `HDR auto brightness` patch ([#2863](#2863)) ([b4c7bf4](b4c7bf4))
* **YouTube Vanced:** Remove `Hide ads` patch ([87887e4](87887e4))
* **YouTube:** Support version `19.05`, `19.06`, `19.07`, `19.08` and `19.09` ([#2862](#2862)) ([f044dde](f044dde))
E85Addict pushed a commit to E85Addict/revanced-patches that referenced this pull request Mar 27, 2024
# [4.4.0](v4.3.0...v4.4.0) (2024-03-27)

### Bug Fixes

* **TikTok:** Hook application context earlier to prevent crash ([ReVanced#2893](https://github.com/E85Addict/revanced-patches/issues/2893)) ([395ccda](395ccda))
* **YouTube - Client spoof:** Spoof all user agents ([44a8a13](44a8a13))
* **YouTube - Downloads:** Use new task context ([ReVanced#2841](https://github.com/E85Addict/revanced-patches/issues/2841)) ([6d88cb4](6d88cb4))
* **YouTube - Hide ads:** Prevent app crash if hiding fullscreen ads is not possible ([ReVanced#2910](https://github.com/E85Addict/revanced-patches/issues/2910)) ([9f50470](9f50470))
* **YouTube Music:** Fix compatibility with latest versions ([ReVanced#2924](https://github.com/E85Addict/revanced-patches/issues/2924)) ([8378c84](8378c84))
* **YouTube:** Fix video playback by switching to ReVanced GmsCore vendor ([ReVanced#2907](https://github.com/E85Addict/revanced-patches/issues/2907)) ([33ea122](33ea122))
* **YouTube:** Move setting to correct screen ([a16eda8](a16eda8))

### Features

* **Instagram - Hide timeline ads:** Make compatible with latest versions ([a212f29](a212f29))
* **Mi Fitness:** Add `Force English locale` and `Fix login` patch ([ReVanced#2734](https://github.com/E85Addict/revanced-patches/issues/2734)) ([7a25791](7a25791))
* **Sync for Lemmy:** Add `Disable ads` patch ([ReVanced#2872](https://github.com/E85Addict/revanced-patches/issues/2872)) ([0785819](0785819))
* **YouTube - Downloads:** Use external downloader when selecting 'Download' in home feed flyout menu ([ReVanced#2881](https://github.com/E85Addict/revanced-patches/issues/2881)) ([10afc8c](10afc8c))
* **YouTube - External downloader:** Add ability to use in-app download button ([d900011](d900011))
* **YouTube - Hide layout components:** Filter home/search results by keywords ([ReVanced#2853](https://github.com/E85Addict/revanced-patches/issues/2853)) ([5916204](5916204))
* **YouTube - Hide Shorts components:** Hide like and dislike buttons ([2df0892](2df0892))
* **YouTube - Hide Shorts components:** Hide sound metadata label ([ea7d1e0](ea7d1e0))
* **YouTube - Hide Shorts components:** Hide title and full video link label ([e7b64e1](e7b64e1))
* **YouTube - Hide Shorts components:** Selectively hide Shorts for home / subscription / search ([ReVanced#2925](https://github.com/E85Addict/revanced-patches/issues/2925)) ([497c067](497c067))
* **YouTube :** Remove `HDR auto brightness` patch ([ReVanced#2863](https://github.com/E85Addict/revanced-patches/issues/2863)) ([b4c7bf4](b4c7bf4))
* **YouTube Vanced:** Remove `Hide ads` patch ([87887e4](87887e4))
* **YouTube:** Support version `19.05`, `19.06`, `19.07`, `19.08` and `19.09` ([ReVanced#2862](https://github.com/E85Addict/revanced-patches/issues/2862)) ([f044dde](f044dde))

### Performance Improvements

* Personal Logo && Add upstream sync ([5022724](5022724))
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