mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-06-13 05:37:41 +02:00
chore: Separate extensions by app (#3905)
This commit is contained in:
3
extensions/tumblr/build.gradle.kts
Normal file
3
extensions/tumblr/build.gradle.kts
Normal file
@ -0,0 +1,3 @@
|
||||
dependencies {
|
||||
compileOnly(project(":extensions:tumblr:stub"))
|
||||
}
|
1
extensions/tumblr/src/main/AndroidManifest.xml
Normal file
1
extensions/tumblr/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1 @@
|
||||
<manifest/>
|
@ -0,0 +1,32 @@
|
||||
package app.revanced.extension.tumblr.patches;
|
||||
|
||||
import com.tumblr.rumblr.model.TimelineObject;
|
||||
import com.tumblr.rumblr.model.Timelineable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
public final class TimelineFilterPatch {
|
||||
private static final HashSet<String> blockedObjectTypes = new HashSet<>();
|
||||
|
||||
static {
|
||||
// This dummy gets removed by the TimelineFilterPatch and in its place,
|
||||
// equivalent instructions with a different constant string
|
||||
// will be inserted for each Timeline object type filter.
|
||||
// Modifying this line may break the patch.
|
||||
blockedObjectTypes.add("BLOCKED_OBJECT_DUMMY");
|
||||
}
|
||||
|
||||
// Calls to this method are injected where the list of Timeline objects is first received.
|
||||
// We modify the list filter out elements that we want to hide.
|
||||
public static void filterTimeline(final List<TimelineObject<? extends Timelineable>> timelineObjects) {
|
||||
final var iterator = timelineObjects.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
var timelineElement = iterator.next();
|
||||
if (timelineElement == null) continue;
|
||||
|
||||
String elementType = timelineElement.getData().getTimelineObjectType().toString();
|
||||
if (blockedObjectTypes.contains(elementType)) iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
17
extensions/tumblr/stub/build.gradle.kts
Normal file
17
extensions/tumblr/stub/build.gradle.kts
Normal file
@ -0,0 +1,17 @@
|
||||
plugins {
|
||||
id(libs.plugins.android.library.get().pluginId)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "app.revanced.extension"
|
||||
compileSdk = 33
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 24
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
}
|
1
extensions/tumblr/stub/src/main/AndroidManifest.xml
Normal file
1
extensions/tumblr/stub/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1 @@
|
||||
<manifest/>
|
@ -0,0 +1,8 @@
|
||||
package com.tumblr.rumblr.model;
|
||||
|
||||
public class TimelineObject<T extends Timelineable> {
|
||||
public final T getData() {
|
||||
throw new UnsupportedOperationException("Stub");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.tumblr.rumblr.model;
|
||||
|
||||
public enum TimelineObjectType {
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.tumblr.rumblr.model;
|
||||
|
||||
public interface Timelineable {
|
||||
TimelineObjectType getTimelineObjectType();
|
||||
}
|
Reference in New Issue
Block a user