Compare commits

...

2 Commits

Author SHA1 Message Date
semantic-release-bot
e8f4890edd chore(release): 2.114.0 [skip ci]
# [2.114.0](https://github.com/revanced/revanced-patches/compare/v2.113.0...v2.114.0) (2022-11-20)

### Features

* **youtube:** `disable-zoom-haptics` patch ([#1079](https://github.com/revanced/revanced-patches/issues/1079)) ([974a042](9463f11dbf))
2022-11-20 13:26:23 +00:00
aliernfrog
9463f11dbf feat(youtube): disable-zoom-haptics patch (#1079) 2022-11-20 14:24:41 +01:00
7 changed files with 82 additions and 2 deletions

View File

@@ -1,3 +1,10 @@
# [2.114.0](https://github.com/revanced/revanced-patches/compare/v2.113.0...v2.114.0) (2022-11-20)
### Features
* **youtube:** `disable-zoom-haptics` patch ([#1079](https://github.com/revanced/revanced-patches/issues/1079)) ([a7cfba5](https://github.com/revanced/revanced-patches/commit/a7cfba54fbb3ee0ee5511a45d0b3c4620eb0c861))
# [2.113.0](https://github.com/revanced/revanced-patches/compare/v2.112.0...v2.113.0) (2022-11-19)

View File

@@ -115,6 +115,7 @@ The official Patch bundle provided by ReVanced and the community.
| `swipe-controls` | Adds volume and brightness swipe controls. | 17.43.36 |
| `downloads` | Enables downloading music and videos from YouTube. | 17.43.36 |
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 17.43.36 |
| `disable-zoom-haptics` | Disables haptics when zooming. | all |
| `settings` | Adds settings for ReVanced to YouTube. | all |
| `open-links-directly` | Bypasses redirect links and allows opening links directly. | 17.43.36 |
| `microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 17.43.36 |

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.113.0
version = 2.114.0

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
package app.revanced.patches.youtube.misc.zoomhaptics.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube")])
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class ZoomHapticsCompatibility

View File

@@ -0,0 +1,9 @@
package app.revanced.patches.youtube.misc.zoomhaptics.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object ZoomHapticsFingerprint : MethodFingerprint(
strings = listOf(
"Failed to haptics vibrate for video zoom"
)
)

View File

@@ -0,0 +1,54 @@
package app.revanced.patches.youtube.misc.zoomhaptics.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
import app.revanced.patches.youtube.misc.zoomhaptics.annotations.ZoomHapticsCompatibility
import app.revanced.patches.youtube.misc.zoomhaptics.fingerprints.ZoomHapticsFingerprint
@Patch
@Name("disable-zoom-haptics")
@Description("Disables haptics when zooming.")
@DependsOn([SettingsPatch::class])
@ZoomHapticsCompatibility
@Version("0.0.1")
class ZoomHapticsPatch : BytecodePatch(
listOf(ZoomHapticsFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference(
"revanced_disable_zoom_haptics",
StringResource("revanced_disable_zoom_haptics_title", "Disable zoom haptics"),
true,
StringResource("revanced_disable_zoom_haptics_summary_on", "Haptics are disabled"),
StringResource("revanced_disable_zoom_haptics_summary_off", "Haptics are enabled")
)
)
val zoomHapticsFingerprintMethod = ZoomHapticsFingerprint.result!!.mutableMethod
zoomHapticsFingerprintMethod.addInstructions(
0, """
invoke-static { }, Lapp/revanced/integrations/patches/ZoomHapticsPatch;->shouldVibrate()Z
move-result v0
if-nez v0, :vibrate
return-void
""", listOf(ExternalLabel("vibrate", zoomHapticsFingerprintMethod.instruction(0)))
)
return PatchResultSuccess()
}
}