You've already forked Tricky-Addon-Update-Target-List
mirror of
https://github.com/KOWX712/Tricky-Addon-Update-Target-List.git
synced 2025-09-06 06:37:09 +00:00
better logic
now can show app that excluded by keyword as deselected.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
# Each app package name should be on a new line
|
||||
oneplus
|
||||
coloros
|
||||
miui
|
||||
com.android.patch
|
||||
me.bmax.apatch
|
||||
me.garfieldhan.apatch.next
|
||||
|
||||
@@ -44,29 +44,38 @@ async function readExcludeFile() {
|
||||
}
|
||||
}
|
||||
|
||||
// Function to check if an app name should be excluded
|
||||
function isExcluded(appName) {
|
||||
return excludeList.some(excludeItem => appName.includes(excludeItem));
|
||||
}
|
||||
|
||||
// Function to fetch, sort, and render the app list
|
||||
async function fetchAppList() {
|
||||
try {
|
||||
await readExcludeFile();
|
||||
const result = await execCommand("pm list packages -3 </dev/null 2>&1 | cat");
|
||||
const packageList = result.split("\n").map(line => line.replace("package:", "").trim()).filter(Boolean);
|
||||
|
||||
const sortedApps = packageList.sort((a, b) => {
|
||||
const aInExclude = excludeList.includes(a);
|
||||
const bInExclude = excludeList.includes(b);
|
||||
const aInExclude = isExcluded(a);
|
||||
const bInExclude = isExcluded(b);
|
||||
return aInExclude === bInExclude ? a.localeCompare(b) : aInExclude ? 1 : -1;
|
||||
});
|
||||
|
||||
appListContainer.innerHTML = "";
|
||||
sortedApps.forEach(appName => {
|
||||
const appElement = document.importNode(appTemplate, true);
|
||||
appElement.querySelector(".name").textContent = appName;
|
||||
const checkbox = appElement.querySelector(".checkbox");
|
||||
checkbox.checked = !excludeList.includes(appName);
|
||||
checkbox.checked = !isExcluded(appName);
|
||||
appListContainer.appendChild(appElement);
|
||||
});
|
||||
|
||||
console.log("App list fetched, sorted, and rendered successfully.");
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch or render app list:", error);
|
||||
}
|
||||
|
||||
floatingBtn.style.transform = 'translateY(-100px)';
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"description": "Extra exclude option for root related apps",
|
||||
"data": [
|
||||
{
|
||||
"info": "Root Manager",
|
||||
"info": "Root manager",
|
||||
"apps": [
|
||||
{
|
||||
"name": "Magisk",
|
||||
@@ -31,7 +31,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "Miscellaneous Root Related App",
|
||||
"info": "Root related app that won't detect bootloader",
|
||||
"apps": [
|
||||
{
|
||||
"name": "LSPosed Manager",
|
||||
@@ -58,6 +58,15 @@
|
||||
"package-name": "com.omarea.vtools"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": "General app that won't detect bootloader",
|
||||
"apps": [
|
||||
{
|
||||
"name": "",
|
||||
"package-name": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user