Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(youtube/return-youtube-dislike): support for shorts (#312)
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de> Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
- Loading branch information
1 parent
fb1a69a
commit 0aef5e6
Showing
5 changed files
with
417 additions
and
255 deletions.
There are no files selected for viewing
27 changes: 18 additions & 9 deletions
27
app/src/main/java/app/revanced/integrations/patches/ReturnYouTubeDislikePatch.java
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,39 +1,48 @@ | ||
package app.revanced.integrations.patches; | ||
|
||
import java.util.concurrent.atomic.AtomicReference; | ||
|
||
import android.text.Spanned; | ||
import app.revanced.integrations.returnyoutubedislike.ReturnYouTubeDislike; | ||
|
||
import java.util.concurrent.atomic.AtomicReference; | ||
|
||
/** | ||
* Used by app.revanced.patches.youtube.layout.returnyoutubedislike.patch.ReturnYouTubeDislikePatch | ||
*/ | ||
public class ReturnYouTubeDislikePatch { | ||
|
||
/** | ||
* Called when the video id changes | ||
* Injection point | ||
*/ | ||
public static void newVideoLoaded(String videoId) { | ||
ReturnYouTubeDislike.newVideoLoaded(videoId); | ||
} | ||
|
||
/** | ||
* Injection point | ||
* | ||
* Called when a litho text component is created | ||
*/ | ||
public static void onComponentCreated(Object conversionContext, AtomicReference<Object> textRef) { | ||
ReturnYouTubeDislike.onComponentCreated(conversionContext, textRef); | ||
} | ||
|
||
/** | ||
* Injection point | ||
* | ||
* Called when a Shorts dislike Spannable is created | ||
*/ | ||
public static Spanned onShortsComponentCreated(Spanned dislike) { | ||
return ReturnYouTubeDislike.onShortsComponentCreated(dislike); | ||
} | ||
|
||
/** | ||
* Injection point | ||
* | ||
* Called when the like/dislike button is clicked | ||
* | ||
* @param vote -1 (dislike), 0 (none) or 1 (like) | ||
*/ | ||
public static void sendVote(int vote) { | ||
for (ReturnYouTubeDislike.Vote v : ReturnYouTubeDislike.Vote.values()) { | ||
if (v.value == vote) { | ||
ReturnYouTubeDislike.sendVote(v); | ||
return; | ||
} | ||
} | ||
ReturnYouTubeDislike.sendVote(vote); | ||
} | ||
} |
Oops, something went wrong.