mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
fix: rename auto rotate to follow device orientation
This commit is contained in:
@@ -279,7 +279,7 @@ function Layout() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// If the user has auto rotate enabled, unlock the orientation
|
// If the user has auto rotate enabled, unlock the orientation
|
||||||
if (Platform.isTV) return;
|
if (Platform.isTV) return;
|
||||||
if (settings.autoRotate === true) {
|
if (settings.followDeviceOrientation === true) {
|
||||||
ScreenOrientation.unlockAsync();
|
ScreenOrientation.unlockAsync();
|
||||||
} else {
|
} else {
|
||||||
// If the user has auto rotate disabled, lock the orientation to portrait
|
// If the user has auto rotate disabled, lock the orientation to portrait
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export const OtherSettings: React.FC = () => {
|
|||||||
|
|
||||||
const disabled = useMemo(
|
const disabled = useMemo(
|
||||||
() =>
|
() =>
|
||||||
pluginSettings?.autoRotate?.locked === true &&
|
pluginSettings?.followDeviceOrientation?.locked === true &&
|
||||||
pluginSettings?.defaultVideoOrientation?.locked === true &&
|
pluginSettings?.defaultVideoOrientation?.locked === true &&
|
||||||
pluginSettings?.safeAreaInControlsEnabled?.locked === true &&
|
pluginSettings?.safeAreaInControlsEnabled?.locked === true &&
|
||||||
pluginSettings?.showCustomMenuLinks?.locked === true &&
|
pluginSettings?.showCustomMenuLinks?.locked === true &&
|
||||||
@@ -76,32 +76,47 @@ export const OtherSettings: React.FC = () => {
|
|||||||
ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT,
|
ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const orientationTranslations = useMemo(
|
||||||
|
() => ({
|
||||||
|
[ScreenOrientation.OrientationLock.DEFAULT]: "home.settings.other.orientations.DEFAULT",
|
||||||
|
[ScreenOrientation.OrientationLock.PORTRAIT_UP]: "home.settings.other.orientations.PORTRAIT_UP",
|
||||||
|
[ScreenOrientation.OrientationLock.LANDSCAPE_LEFT]: "home.settings.other.orientations.LANDSCAPE_LEFT",
|
||||||
|
[ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT]: "home.settings.other.orientations.LANDSCAPE_RIGHT",
|
||||||
|
}),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
if (!settings) return null;
|
if (!settings) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DisabledSetting disabled={disabled}>
|
<DisabledSetting disabled={disabled}>
|
||||||
<ListGroup title={t("home.settings.other.other_title")} className="">
|
<ListGroup title={t("home.settings.other.other_title")} className="">
|
||||||
<ListItem title={t("home.settings.other.auto_rotate")} disabled={pluginSettings?.autoRotate?.locked}>
|
<ListItem
|
||||||
|
title={t("home.settings.other.follow_device_orientation")}
|
||||||
|
disabled={pluginSettings?.followDeviceOrientation?.locked}
|
||||||
|
>
|
||||||
<Switch
|
<Switch
|
||||||
value={settings.autoRotate}
|
value={settings.followDeviceOrientation}
|
||||||
disabled={pluginSettings?.autoRotate?.locked}
|
disabled={pluginSettings?.followDeviceOrientation?.locked}
|
||||||
onValueChange={(value) => updateSettings({ autoRotate: value })}
|
onValueChange={(value) => updateSettings({ followDeviceOrientation: value })}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
<ListItem
|
<ListItem
|
||||||
title={t("home.settings.other.video_orientation")}
|
title={t("home.settings.other.video_orientation")}
|
||||||
disabled={pluginSettings?.defaultVideoOrientation?.locked || settings.autoRotate}
|
disabled={pluginSettings?.defaultVideoOrientation?.locked || settings.followDeviceOrientation}
|
||||||
>
|
>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
data={orientations}
|
data={orientations}
|
||||||
disabled={pluginSettings?.defaultVideoOrientation?.locked || settings.autoRotate}
|
disabled={pluginSettings?.defaultVideoOrientation?.locked || settings.followDeviceOrientation}
|
||||||
keyExtractor={String}
|
keyExtractor={String}
|
||||||
titleExtractor={(item) => ScreenOrientationEnum[item]}
|
titleExtractor={(item) => t(ScreenOrientationEnum[item])}
|
||||||
title={
|
title={
|
||||||
<TouchableOpacity className="flex flex-row items-center justify-between py-3 pl-3">
|
<TouchableOpacity className="flex flex-row items-center justify-between py-3 pl-3">
|
||||||
<Text className="mr-1 text-[#8E8D91]">
|
<Text className="mr-1 text-[#8E8D91]">
|
||||||
{t(ScreenOrientationEnum[settings.defaultVideoOrientation])}
|
{t(
|
||||||
|
orientationTranslations[settings.defaultVideoOrientation as keyof typeof orientationTranslations]
|
||||||
|
) || "Unknown Orientation"}
|
||||||
</Text>
|
</Text>
|
||||||
<Ionicons name="chevron-expand-sharp" size={18} color="#5A5960" />
|
<Ionicons name="chevron-expand-sharp" size={18} color="#5A5960" />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|||||||
@@ -9,21 +9,17 @@ export const useOrientationSettings = () => {
|
|||||||
const [settings] = useSettings();
|
const [settings] = useSettings();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (settings?.autoRotate) {
|
if (settings?.followDeviceOrientation) {
|
||||||
ScreenOrientation.lockAsync(
|
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT);
|
||||||
ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT
|
|
||||||
);
|
|
||||||
} else if (settings?.defaultVideoOrientation) {
|
} else if (settings?.defaultVideoOrientation) {
|
||||||
ScreenOrientation.lockAsync(settings.defaultVideoOrientation);
|
ScreenOrientation.lockAsync(settings.defaultVideoOrientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (settings?.autoRotate) {
|
if (settings?.followDeviceOrientation) {
|
||||||
ScreenOrientation.unlockAsync();
|
ScreenOrientation.unlockAsync();
|
||||||
} else {
|
} else {
|
||||||
ScreenOrientation.lockAsync(
|
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP);
|
||||||
ScreenOrientation.OrientationLock.PORTRAIT_UP
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, [settings]);
|
}, [settings]);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"other_title": "Sonstiges",
|
"other_title": "Sonstiges",
|
||||||
"auto_rotate": "Automatische Drehung",
|
"follow_device_orientation": "Automatische Drehung",
|
||||||
"video_orientation": "Videoausrichtung",
|
"video_orientation": "Videoausrichtung",
|
||||||
"orientation": "Ausrichtung",
|
"orientation": "Ausrichtung",
|
||||||
"orientations": {
|
"orientations": {
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
"OTHER": "Andere",
|
"OTHER": "Andere",
|
||||||
"UNKNOWN": "Unbekannt"
|
"UNKNOWN": "Unbekannt"
|
||||||
},
|
},
|
||||||
"safe_area_in_controls": "Sicherer Bereich in den Steuerungen",
|
"safe_area_in_controls": "Sicherer Bereich in den Steuerungen",
|
||||||
"video_player": "Video player",
|
"video_player": "Video player",
|
||||||
"video_players": {
|
"video_players": {
|
||||||
"VLC_3": "VLC 3",
|
"VLC_3": "VLC 3",
|
||||||
@@ -152,7 +152,7 @@
|
|||||||
"default": "Standard",
|
"default": "Standard",
|
||||||
"optimized_version_hint": "Gib die URL für den optimierten Server ein. Die URL sollte http oder https enthalten und optional den Port.",
|
"optimized_version_hint": "Gib die URL für den optimierten Server ein. Die URL sollte http oder https enthalten und optional den Port.",
|
||||||
"read_more_about_optimized_server": "Mehr über den optimierten Server lesen.",
|
"read_more_about_optimized_server": "Mehr über den optimierten Server lesen.",
|
||||||
"url":"URL",
|
"url": "URL",
|
||||||
"server_url_placeholder": "http(s)://domain.org:port"
|
"server_url_placeholder": "http(s)://domain.org:port"
|
||||||
},
|
},
|
||||||
"plugins": {
|
"plugins": {
|
||||||
@@ -215,7 +215,7 @@
|
|||||||
"app_language_description": "Wähle die Sprache für die App aus.",
|
"app_language_description": "Wähle die Sprache für die App aus.",
|
||||||
"system": "System"
|
"system": "System"
|
||||||
},
|
},
|
||||||
"toasts":{
|
"toasts": {
|
||||||
"error_deleting_files": "Fehler beim Löschen von Dateien",
|
"error_deleting_files": "Fehler beim Löschen von Dateien",
|
||||||
"background_downloads_enabled": "Hintergrunddownloads aktiviert",
|
"background_downloads_enabled": "Hintergrunddownloads aktiviert",
|
||||||
"background_downloads_disabled": "Hintergrunddownloads deaktiviert",
|
"background_downloads_disabled": "Hintergrunddownloads deaktiviert",
|
||||||
@@ -412,7 +412,7 @@
|
|||||||
"for_kids": "Für Kinder",
|
"for_kids": "Für Kinder",
|
||||||
"news": "Nachrichten"
|
"news": "Nachrichten"
|
||||||
},
|
},
|
||||||
"jellyseerr":{
|
"jellyseerr": {
|
||||||
"confirm": "Bestätigen",
|
"confirm": "Bestätigen",
|
||||||
"cancel": "Abbrechen",
|
"cancel": "Abbrechen",
|
||||||
"yes": "Ja",
|
"yes": "Ja",
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"other_title": "Other",
|
"other_title": "Other",
|
||||||
"auto_rotate": "Auto rotate",
|
"follow_device_orientation": "Follow device orientation",
|
||||||
"video_orientation": "Video orientation",
|
"video_orientation": "Video orientation",
|
||||||
"orientation": "Orientation",
|
"orientation": "Orientation",
|
||||||
"orientations": {
|
"orientations": {
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
"hide_libraries": "Hide Libraries",
|
"hide_libraries": "Hide Libraries",
|
||||||
"select_liraries_you_want_to_hide": "Select the libraries you want to hide from the Library tab and home page sections.",
|
"select_liraries_you_want_to_hide": "Select the libraries you want to hide from the Library tab and home page sections.",
|
||||||
"disable_haptic_feedback": "Disable Haptic Feedback",
|
"disable_haptic_feedback": "Disable Haptic Feedback",
|
||||||
"default_quality": "Default quality",
|
"default_quality": "Default quality"
|
||||||
},
|
},
|
||||||
"downloads": {
|
"downloads": {
|
||||||
"downloads_title": "Downloads",
|
"downloads_title": "Downloads",
|
||||||
@@ -222,7 +222,7 @@
|
|||||||
"connected": "Connected",
|
"connected": "Connected",
|
||||||
"could_not_connect": "Could not connect",
|
"could_not_connect": "Could not connect",
|
||||||
"invalid_url": "Invalid URL"
|
"invalid_url": "Invalid URL"
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
"sessions": {
|
"sessions": {
|
||||||
"title": "Sessions",
|
"title": "Sessions",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
"server_is_taking_too_long_to_respond_try_again_later": "El servidor está tardando mucho en responder, inténtalo de nuevo más tarde.",
|
"server_is_taking_too_long_to_respond_try_again_later": "El servidor está tardando mucho en responder, inténtalo de nuevo más tarde.",
|
||||||
"server_received_too_many_requests_try_again_later": "El servidor está recibiendo muchas peticiones, inténtalo de nuevo más tarde.",
|
"server_received_too_many_requests_try_again_later": "El servidor está recibiendo muchas peticiones, inténtalo de nuevo más tarde.",
|
||||||
"there_is_a_server_error": "Hay un error en el servidor",
|
"there_is_a_server_error": "Hay un error en el servidor",
|
||||||
"an_unexpected_error_occured_did_you_enter_the_correct_url": "Ha ocurrido un error inesperado. ¿Has introducido la URL correcta?"
|
"an_unexpected_error_occured_did_you_enter_the_correct_url": "Ha ocurrido un error inesperado. ¿Has introducido la URL correcta?"
|
||||||
},
|
},
|
||||||
"server": {
|
"server": {
|
||||||
"enter_url_to_jellyfin_server": "Introduce la URL de tu servidor Jellyfin",
|
"enter_url_to_jellyfin_server": "Introduce la URL de tu servidor Jellyfin",
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"other_title": "Otros",
|
"other_title": "Otros",
|
||||||
"auto_rotate": "Rotación automática",
|
"follow_device_orientation": "Rotación automática",
|
||||||
"video_orientation": "Orientación de vídeo",
|
"video_orientation": "Orientación de vídeo",
|
||||||
"orientation": "Orientación",
|
"orientation": "Orientación",
|
||||||
"orientations": {
|
"orientations": {
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
"OTHER": "Otra",
|
"OTHER": "Otra",
|
||||||
"UNKNOWN": "Desconocida"
|
"UNKNOWN": "Desconocida"
|
||||||
},
|
},
|
||||||
"safe_area_in_controls": "Área segura en controles",
|
"safe_area_in_controls": "Área segura en controles",
|
||||||
"video_player": "Video player",
|
"video_player": "Video player",
|
||||||
"video_players": {
|
"video_players": {
|
||||||
"VLC_3": "VLC 3",
|
"VLC_3": "VLC 3",
|
||||||
@@ -215,7 +215,7 @@
|
|||||||
"app_language_description": "Selecciona el idioma de la app.",
|
"app_language_description": "Selecciona el idioma de la app.",
|
||||||
"system": "Sistema"
|
"system": "Sistema"
|
||||||
},
|
},
|
||||||
"toasts":{
|
"toasts": {
|
||||||
"error_deleting_files": "Error al eliminar archivos",
|
"error_deleting_files": "Error al eliminar archivos",
|
||||||
"background_downloads_enabled": "Descargas en segundo plano habilitadas",
|
"background_downloads_enabled": "Descargas en segundo plano habilitadas",
|
||||||
"background_downloads_disabled": "Descargas en segundo plano deshabilitadas",
|
"background_downloads_disabled": "Descargas en segundo plano deshabilitadas",
|
||||||
@@ -412,7 +412,7 @@
|
|||||||
"for_kids": "Para niños",
|
"for_kids": "Para niños",
|
||||||
"news": "Noticias"
|
"news": "Noticias"
|
||||||
},
|
},
|
||||||
"jellyseerr":{
|
"jellyseerr": {
|
||||||
"confirm": "Confirmar",
|
"confirm": "Confirmar",
|
||||||
"cancel": "Cancelar",
|
"cancel": "Cancelar",
|
||||||
"yes": "Sí",
|
"yes": "Sí",
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"other_title": "Autres",
|
"other_title": "Autres",
|
||||||
"auto_rotate": "Rotation automatique",
|
"follow_device_orientation": "Rotation automatique",
|
||||||
"video_orientation": "Orientation vidéo",
|
"video_orientation": "Orientation vidéo",
|
||||||
"orientation": "Orientation",
|
"orientation": "Orientation",
|
||||||
"orientations": {
|
"orientations": {
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
"OTHER": "Autre",
|
"OTHER": "Autre",
|
||||||
"UNKNOWN": "Inconnu"
|
"UNKNOWN": "Inconnu"
|
||||||
},
|
},
|
||||||
"safe_area_in_controls": "Zone de sécurité dans les contrôles",
|
"safe_area_in_controls": "Zone de sécurité dans les contrôles",
|
||||||
"video_player": "Video player",
|
"video_player": "Video player",
|
||||||
"video_players": {
|
"video_players": {
|
||||||
"VLC_3": "VLC 3",
|
"VLC_3": "VLC 3",
|
||||||
@@ -139,7 +139,6 @@
|
|||||||
"select_liraries_you_want_to_hide": "Sélectionnez les bibliothèques que vous souhaitez masquer dans l’onglet Bibliothèque et les sections de la page d’accueil.",
|
"select_liraries_you_want_to_hide": "Sélectionnez les bibliothèques que vous souhaitez masquer dans l’onglet Bibliothèque et les sections de la page d’accueil.",
|
||||||
"disable_haptic_feedback": "Désactiver le retour haptique",
|
"disable_haptic_feedback": "Désactiver le retour haptique",
|
||||||
"default_quality": "Qualité par défaut"
|
"default_quality": "Qualité par défaut"
|
||||||
|
|
||||||
},
|
},
|
||||||
"downloads": {
|
"downloads": {
|
||||||
"downloads_title": "Téléchargements",
|
"downloads_title": "Téléchargements",
|
||||||
@@ -216,7 +215,7 @@
|
|||||||
"app_language_description": "Sélectionnez la langue de l'application",
|
"app_language_description": "Sélectionnez la langue de l'application",
|
||||||
"system": "Système"
|
"system": "Système"
|
||||||
},
|
},
|
||||||
"toasts":{
|
"toasts": {
|
||||||
"error_deleting_files": "Erreur lors de la suppression des fichiers",
|
"error_deleting_files": "Erreur lors de la suppression des fichiers",
|
||||||
"background_downloads_enabled": "Téléchargements en arrière-plan activés",
|
"background_downloads_enabled": "Téléchargements en arrière-plan activés",
|
||||||
"background_downloads_disabled": "Téléchargements en arrière-plan désactivés",
|
"background_downloads_disabled": "Téléchargements en arrière-plan désactivés",
|
||||||
@@ -413,7 +412,7 @@
|
|||||||
"for_kids": "Pour enfants",
|
"for_kids": "Pour enfants",
|
||||||
"news": "Actualités"
|
"news": "Actualités"
|
||||||
},
|
},
|
||||||
"jellyseerr":{
|
"jellyseerr": {
|
||||||
"confirm": "Confirmer",
|
"confirm": "Confirmer",
|
||||||
"cancel": "Annuler",
|
"cancel": "Annuler",
|
||||||
"yes": "Oui",
|
"yes": "Oui",
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"other_title": "Altro",
|
"other_title": "Altro",
|
||||||
"auto_rotate": "Rotazione automatica",
|
"follow_device_orientation": "Rotazione automatica",
|
||||||
"video_orientation": "Orientamento del video",
|
"video_orientation": "Orientamento del video",
|
||||||
"orientation": "Orientamento",
|
"orientation": "Orientamento",
|
||||||
"orientations": {
|
"orientations": {
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
"OTHER": "Altro",
|
"OTHER": "Altro",
|
||||||
"UNKNOWN": "Sconosciuto"
|
"UNKNOWN": "Sconosciuto"
|
||||||
},
|
},
|
||||||
"safe_area_in_controls": "Area sicura per i controlli",
|
"safe_area_in_controls": "Area sicura per i controlli",
|
||||||
"video_player": "Video player",
|
"video_player": "Video player",
|
||||||
"video_players": {
|
"video_players": {
|
||||||
"VLC_3": "VLC 3",
|
"VLC_3": "VLC 3",
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"other_title": "その他",
|
"other_title": "その他",
|
||||||
"auto_rotate": "画面の自動回転",
|
"follow_device_orientation": "画面の自動回転",
|
||||||
"video_orientation": "動画の向き",
|
"video_orientation": "動画の向き",
|
||||||
"orientation": "向き",
|
"orientation": "向き",
|
||||||
"orientations": {
|
"orientations": {
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
"OTHER": "その他",
|
"OTHER": "その他",
|
||||||
"UNKNOWN": "不明"
|
"UNKNOWN": "不明"
|
||||||
},
|
},
|
||||||
"safe_area_in_controls": "コントロールの安全エリア",
|
"safe_area_in_controls": "コントロールの安全エリア",
|
||||||
"video_player": "Video player",
|
"video_player": "Video player",
|
||||||
"video_players": {
|
"video_players": {
|
||||||
"VLC_3": "VLC 3",
|
"VLC_3": "VLC 3",
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"other_title": "Andere",
|
"other_title": "Andere",
|
||||||
"auto_rotate": "Automatisch draaien",
|
"follow_device_orientation": "Automatisch draaien",
|
||||||
"video_orientation": "Video oriëntatie",
|
"video_orientation": "Video oriëntatie",
|
||||||
"orientation": "Oriëntatie",
|
"orientation": "Oriëntatie",
|
||||||
"orientations": {
|
"orientations": {
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
"OTHER": "Andere",
|
"OTHER": "Andere",
|
||||||
"UNKNOWN": "Onbekend"
|
"UNKNOWN": "Onbekend"
|
||||||
},
|
},
|
||||||
"safe_area_in_controls": "Veilig gebied in bedieningen",
|
"safe_area_in_controls": "Veilig gebied in bedieningen",
|
||||||
"video_player": "Video player",
|
"video_player": "Video player",
|
||||||
"video_players": {
|
"video_players": {
|
||||||
"VLC_3": "VLC 3",
|
"VLC_3": "VLC 3",
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"other_title": "Diğer",
|
"other_title": "Diğer",
|
||||||
"auto_rotate": "Otomatik Döndürme",
|
"follow_device_orientation": "Otomatik Döndürme",
|
||||||
"video_orientation": "Video Yönü",
|
"video_orientation": "Video Yönü",
|
||||||
"orientation": "Yön",
|
"orientation": "Yön",
|
||||||
"orientations": {
|
"orientations": {
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
"OTHER": "Diğer",
|
"OTHER": "Diğer",
|
||||||
"UNKNOWN": "Bilinmeyen"
|
"UNKNOWN": "Bilinmeyen"
|
||||||
},
|
},
|
||||||
"safe_area_in_controls": "Kontrollerde Güvenli Alan",
|
"safe_area_in_controls": "Kontrollerde Güvenli Alan",
|
||||||
"video_player": "Video player",
|
"video_player": "Video player",
|
||||||
"video_players": {
|
"video_players": {
|
||||||
"VLC_3": "VLC 3",
|
"VLC_3": "VLC 3",
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"other_title": "其他",
|
"other_title": "其他",
|
||||||
"auto_rotate": "自动旋转",
|
"follow_device_orientation": "自动旋转",
|
||||||
"video_orientation": "视频方向",
|
"video_orientation": "视频方向",
|
||||||
"orientation": "方向",
|
"orientation": "方向",
|
||||||
"orientations": {
|
"orientations": {
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
"OTHER": "其他",
|
"OTHER": "其他",
|
||||||
"UNKNOWN": "未知"
|
"UNKNOWN": "未知"
|
||||||
},
|
},
|
||||||
"safe_area_in_controls": "控制中的安全区域",
|
"safe_area_in_controls": "控制中的安全区域",
|
||||||
"video_player": "Video player",
|
"video_player": "Video player",
|
||||||
"video_players": {
|
"video_players": {
|
||||||
"VLC_3": "VLC 3",
|
"VLC_3": "VLC 3",
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"other_title": "其他",
|
"other_title": "其他",
|
||||||
"auto_rotate": "自動旋轉",
|
"follow_device_orientation": "自動旋轉",
|
||||||
"video_orientation": "影片方向",
|
"video_orientation": "影片方向",
|
||||||
"orientation": "方向",
|
"orientation": "方向",
|
||||||
"orientations": {
|
"orientations": {
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
"OTHER": "其他",
|
"OTHER": "其他",
|
||||||
"UNKNOWN": "未知"
|
"UNKNOWN": "未知"
|
||||||
},
|
},
|
||||||
"safe_area_in_controls": "控制中的安全區域",
|
"safe_area_in_controls": "控制中的安全區域",
|
||||||
"video_player": "Video player",
|
"video_player": "Video player",
|
||||||
"video_players": {
|
"video_players": {
|
||||||
"VLC_3": "VLC 3",
|
"VLC_3": "VLC 3",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
import { Bitrate, BITRATES } from "@/components/BitrateSelector";
|
import { Bitrate, BITRATES } from "@/components/BitrateSelector";
|
||||||
import { apiAtom } from "@/providers/JellyfinProvider";
|
import { apiAtom } from "@/providers/JellyfinProvider";
|
||||||
import { writeInfoLog } from "@/utils/log";
|
import { writeInfoLog } from "@/utils/log";
|
||||||
import {Video} from "@/utils/jellyseerr/server/models/Movie";
|
import { Video } from "@/utils/jellyseerr/server/models/Movie";
|
||||||
|
|
||||||
const STREAMYFIN_PLUGIN_ID = "1e9e5d386e6746158719e98a5c34f004";
|
const STREAMYFIN_PLUGIN_ID = "1e9e5d386e6746158719e98a5c34f004";
|
||||||
const STREAMYFIN_PLUGIN_SETTINGS = "STREAMYFIN_PLUGIN_SETTINGS";
|
const STREAMYFIN_PLUGIN_SETTINGS = "STREAMYFIN_PLUGIN_SETTINGS";
|
||||||
@@ -26,30 +26,17 @@ export type DownloadOption = {
|
|||||||
value: DownloadQuality;
|
value: DownloadQuality;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ScreenOrientationEnum: Record<
|
export const ScreenOrientationEnum: Record<ScreenOrientation.OrientationLock, string> = {
|
||||||
ScreenOrientation.OrientationLock,
|
[ScreenOrientation.OrientationLock.DEFAULT]: "home.settings.other.orientations.DEFAULT",
|
||||||
string
|
[ScreenOrientation.OrientationLock.ALL]: "home.settings.other.orientations.ALL",
|
||||||
> = {
|
[ScreenOrientation.OrientationLock.PORTRAIT]: "home.settings.other.orientations.PORTRAIT",
|
||||||
[ScreenOrientation.OrientationLock.DEFAULT]:
|
[ScreenOrientation.OrientationLock.PORTRAIT_UP]: "home.settings.other.orientations.PORTRAIT_UP",
|
||||||
"home.settings.other.orientations.DEFAULT",
|
[ScreenOrientation.OrientationLock.PORTRAIT_DOWN]: "home.settings.other.orientations.PORTRAIT_DOWN",
|
||||||
[ScreenOrientation.OrientationLock.ALL]:
|
[ScreenOrientation.OrientationLock.LANDSCAPE]: "home.settings.other.orientations.LANDSCAPE",
|
||||||
"home.settings.other.orientations.ALL",
|
[ScreenOrientation.OrientationLock.LANDSCAPE_LEFT]: "home.settings.other.orientations.LANDSCAPE_LEFT",
|
||||||
[ScreenOrientation.OrientationLock.PORTRAIT]:
|
[ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT]: "home.settings.other.orientations.LANDSCAPE_RIGHT",
|
||||||
"home.settings.other.orientations.PORTRAIT",
|
[ScreenOrientation.OrientationLock.OTHER]: "home.settings.other.orientations.OTHER",
|
||||||
[ScreenOrientation.OrientationLock.PORTRAIT_UP]:
|
[ScreenOrientation.OrientationLock.UNKNOWN]: "home.settings.other.orientations.UNKNOWN",
|
||||||
"home.settings.other.orientations.PORTRAIT_UP",
|
|
||||||
[ScreenOrientation.OrientationLock.PORTRAIT_DOWN]:
|
|
||||||
"home.settings.other.orientations.PORTRAIT_DOWN",
|
|
||||||
[ScreenOrientation.OrientationLock.LANDSCAPE]:
|
|
||||||
"home.settings.other.orientations.LANDSCAPE",
|
|
||||||
[ScreenOrientation.OrientationLock.LANDSCAPE_LEFT]:
|
|
||||||
"home.settings.other.orientations.LANDSCAPE_LEFT",
|
|
||||||
[ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT]:
|
|
||||||
"home.settings.other.orientations.LANDSCAPE_RIGHT",
|
|
||||||
[ScreenOrientation.OrientationLock.OTHER]:
|
|
||||||
"home.settings.other.orientations.OTHER",
|
|
||||||
[ScreenOrientation.OrientationLock.UNKNOWN]:
|
|
||||||
"home.settings.other.orientations.UNKNOWN",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DownloadOptions: DownloadOption[] = [
|
export const DownloadOptions: DownloadOption[] = [
|
||||||
@@ -116,12 +103,12 @@ export type HomeSectionNextUpResolver = {
|
|||||||
export enum VideoPlayer {
|
export enum VideoPlayer {
|
||||||
// NATIVE, //todo: changes will make this a lot more easier to implement if we want. delete if not wanted
|
// NATIVE, //todo: changes will make this a lot more easier to implement if we want. delete if not wanted
|
||||||
VLC_3,
|
VLC_3,
|
||||||
VLC_4
|
VLC_4,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Settings = {
|
export type Settings = {
|
||||||
home?: Home | null;
|
home?: Home | null;
|
||||||
autoRotate?: boolean;
|
followDeviceOrientation?: boolean;
|
||||||
forceLandscapeInVideoPlayer?: boolean;
|
forceLandscapeInVideoPlayer?: boolean;
|
||||||
deviceProfile?: "Expo" | "Native" | "Old";
|
deviceProfile?: "Expo" | "Native" | "Old";
|
||||||
mediaListCollectionIds?: string[];
|
mediaListCollectionIds?: string[];
|
||||||
@@ -170,7 +157,7 @@ export type StreamyfinPluginConfig = {
|
|||||||
|
|
||||||
const defaultValues: Settings = {
|
const defaultValues: Settings = {
|
||||||
home: null,
|
home: null,
|
||||||
autoRotate: true,
|
followDeviceOrientation: true,
|
||||||
forceLandscapeInVideoPlayer: false,
|
forceLandscapeInVideoPlayer: false,
|
||||||
deviceProfile: "Expo",
|
deviceProfile: "Expo",
|
||||||
mediaListCollectionIds: [],
|
mediaListCollectionIds: [],
|
||||||
@@ -214,8 +201,7 @@ const defaultValues: Settings = {
|
|||||||
const loadSettings = (): Partial<Settings> => {
|
const loadSettings = (): Partial<Settings> => {
|
||||||
try {
|
try {
|
||||||
const jsonValue = storage.getString("settings");
|
const jsonValue = storage.getString("settings");
|
||||||
const loadedValues: Partial<Settings> =
|
const loadedValues: Partial<Settings> = jsonValue != null ? JSON.parse(jsonValue) : {};
|
||||||
jsonValue != null ? JSON.parse(jsonValue) : {};
|
|
||||||
|
|
||||||
return loadedValues;
|
return loadedValues;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -237,9 +223,7 @@ const saveSettings = (settings: Settings) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const settingsAtom = atom<Partial<Settings> | null>(null);
|
export const settingsAtom = atom<Partial<Settings> | null>(null);
|
||||||
export const pluginSettingsAtom = atom(
|
export const pluginSettingsAtom = atom(storage.get<PluginLockableSettings>(STREAMYFIN_PLUGIN_SETTINGS));
|
||||||
storage.get<PluginLockableSettings>(STREAMYFIN_PLUGIN_SETTINGS)
|
|
||||||
);
|
|
||||||
|
|
||||||
export const useSettings = () => {
|
export const useSettings = () => {
|
||||||
const [api] = useAtom(apiAtom);
|
const [api] = useAtom(apiAtom);
|
||||||
@@ -275,12 +259,13 @@ export const useSettings = () => {
|
|||||||
}, [api]);
|
}, [api]);
|
||||||
|
|
||||||
const updateSettings = (update: Partial<Settings>) => {
|
const updateSettings = (update: Partial<Settings>) => {
|
||||||
if (settings) {
|
if (!_settings) return;
|
||||||
const newSettings = { ..._settings, ...update };
|
const hasChanges = Object.entries(update).some(([key, value]) => _settings[key as keyof Settings] !== value);
|
||||||
|
|
||||||
|
if (hasChanges) {
|
||||||
|
// Merge default settings, current settings, and updates to ensure all required properties exist
|
||||||
|
const newSettings = { ...defaultValues, ..._settings, ...update } as Settings;
|
||||||
setSettings(newSettings);
|
setSettings(newSettings);
|
||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
saveSettings(newSettings);
|
saveSettings(newSettings);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -290,31 +275,24 @@ export const useSettings = () => {
|
|||||||
// use user settings first and fallback on admin setting if required.
|
// use user settings first and fallback on admin setting if required.
|
||||||
const settings: Settings = useMemo(() => {
|
const settings: Settings = useMemo(() => {
|
||||||
let unlockedPluginDefaults = {} as Settings;
|
let unlockedPluginDefaults = {} as Settings;
|
||||||
const overrideSettings = Object.entries(pluginSettings || {}).reduce(
|
const overrideSettings = Object.entries(pluginSettings || {}).reduce((acc, [key, setting]) => {
|
||||||
(acc, [key, setting]) => {
|
if (setting) {
|
||||||
if (setting) {
|
const { value, locked } = setting;
|
||||||
const { value, locked } = setting;
|
|
||||||
|
|
||||||
// Make sure we override default settings with plugin settings when they are not locked.
|
// Make sure we override default settings with plugin settings when they are not locked.
|
||||||
// Admin decided what users defaults should be and grants them the ability to change them too.
|
// Admin decided what users defaults should be and grants them the ability to change them too.
|
||||||
if (
|
if (locked === false && value && _settings?.[key as keyof Settings] !== value) {
|
||||||
locked === false &&
|
unlockedPluginDefaults = Object.assign(unlockedPluginDefaults, {
|
||||||
value &&
|
[key as keyof Settings]: value,
|
||||||
_settings?.[key as keyof Settings] !== value
|
|
||||||
) {
|
|
||||||
unlockedPluginDefaults = Object.assign(unlockedPluginDefaults, {
|
|
||||||
[key as keyof Settings]: value,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
acc = Object.assign(acc, {
|
|
||||||
[key]: locked ? value : _settings?.[key as keyof Settings] ?? value,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return acc;
|
|
||||||
},
|
acc = Object.assign(acc, {
|
||||||
{} as Settings
|
[key]: locked ? value : _settings?.[key as keyof Settings] ?? value,
|
||||||
);
|
});
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, {} as Settings);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...defaultValues,
|
...defaultValues,
|
||||||
@@ -323,11 +301,5 @@ export const useSettings = () => {
|
|||||||
};
|
};
|
||||||
}, [_settings, pluginSettings]);
|
}, [_settings, pluginSettings]);
|
||||||
|
|
||||||
return [
|
return [settings, updateSettings, pluginSettings, setPluginSettings, refreshStreamyfinPluginSettings] as const;
|
||||||
settings,
|
|
||||||
updateSettings,
|
|
||||||
pluginSettings,
|
|
||||||
setPluginSettings,
|
|
||||||
refreshStreamyfinPluginSettings,
|
|
||||||
] as const;
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user