mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-11 20:40:42 +00:00
addon first result in streamscreen
This commit is contained in:
parent
aed4fed56f
commit
7a5ecd3009
2 changed files with 22 additions and 5 deletions
1
mpvKt
Submodule
1
mpvKt
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 01a93062dd73f642cbb0511f6a05f1fd344b36a9
|
||||||
|
|
@ -799,12 +799,28 @@ export const useStreamsScreen = () => {
|
||||||
return addonId === selectedProvider;
|
return addonId === selectedProvider;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Sort entries: installed addons first (in their installation order), then plugins
|
||||||
const sortedEntries = filteredEntries.sort(([addonIdA], [addonIdB]) => {
|
const sortedEntries = filteredEntries.sort(([addonIdA], [addonIdB]) => {
|
||||||
const indexA = addonResponseOrder.indexOf(addonIdA);
|
const isAddonA = installedAddons.some(addon => addon.id === addonIdA);
|
||||||
const indexB = addonResponseOrder.indexOf(addonIdB);
|
const isAddonB = installedAddons.some(addon => addon.id === addonIdB);
|
||||||
if (indexA !== -1 && indexB !== -1) return indexA - indexB;
|
|
||||||
if (indexA !== -1) return -1;
|
// Addons always come before plugins
|
||||||
if (indexB !== -1) return 1;
|
if (isAddonA && !isAddonB) return -1;
|
||||||
|
if (!isAddonA && isAddonB) return 1;
|
||||||
|
|
||||||
|
// Both are addons - sort by installation order
|
||||||
|
if (isAddonA && isAddonB) {
|
||||||
|
const indexA = installedAddons.findIndex(addon => addon.id === addonIdA);
|
||||||
|
const indexB = installedAddons.findIndex(addon => addon.id === addonIdB);
|
||||||
|
return indexA - indexB;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Both are plugins - sort by response order
|
||||||
|
const responseIndexA = addonResponseOrder.indexOf(addonIdA);
|
||||||
|
const responseIndexB = addonResponseOrder.indexOf(addonIdB);
|
||||||
|
if (responseIndexA !== -1 && responseIndexB !== -1) return responseIndexA - responseIndexB;
|
||||||
|
if (responseIndexA !== -1) return -1;
|
||||||
|
if (responseIndexB !== -1) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue