Expand XRepo and XHook interface for XPosed modules.

pull/206/head
Fox2Code 2 years ago
parent eeda837690
commit e0dd5a3e8c

@ -10,6 +10,8 @@ import androidx.annotation.Keep;
import com.fox2code.mmm.manager.ModuleManager;
import com.fox2code.mmm.repo.RepoManager;
import java.util.Collection;
/**
* Class made to expose some manager functions to xposed modules.
* It will not be obfuscated on release builds
@ -57,4 +59,9 @@ public class XHooks {
public static XRepo getXRepo(String url) {
return RepoManager.getINSTANCE_UNSAFE().get(url);
}
@Keep
public static Collection<XRepo> getXRepos() {
return RepoManager.getINSTANCE_UNSAFE().getXRepos();
}
}

@ -16,4 +16,7 @@ public abstract class XRepo {
@Keep
public abstract void setEnabled(boolean enabled);
@Keep
public abstract String getName();
}

@ -222,6 +222,7 @@ public class RepoData extends XRepo {
// Repo data info getters
@NonNull
@Override
public String getName() {
if (isNonNull(this.name))
return this.name;

@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
import com.fox2code.mmm.MainApplication;
import com.fox2code.mmm.XHooks;
import com.fox2code.mmm.XRepo;
import com.fox2code.mmm.androidacy.AndroidacyRepoData;
import com.fox2code.mmm.manager.ModuleInfo;
import com.fox2code.mmm.utils.Files;
@ -19,6 +20,7 @@ import com.fox2code.mmm.utils.SyncManager;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@ -367,4 +369,8 @@ public final class RepoManager extends SyncManager {
public CustomRepoManager getCustomRepoManager() {
return customRepoManager;
}
public Collection<XRepo> getXRepos() {
return new LinkedHashSet<>(this.repoData.values());
}
}

Loading…
Cancel
Save