mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 23:59:08 +00:00
fix(types): resolve TypeScript errors in orientation handling
- Import OrientationLock and Orientation types from .tv.ts module - Add explicit type annotations to orientation event handlers - Change ScreenOrientationEnum to use Record<number, string> - Use OrientationLock enum type instead of runtime value This fixes ReactCodegen build failures caused by TypeScript errors.
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
# 📦 Pull Request
|
# 📦 chore(deps): upgrade deps and fix iOS build
|
||||||
|
|
||||||
## 🔖 Summary
|
## 🔖 Summary
|
||||||
|
|
||||||
Upgrade runtime dependencies (react-i18next, react-native-worklets) and improve TypeScript type safety for screen orientation handling.
|
Upgrade runtime dependencies (react-i18next, react-native-worklets), improve TypeScript type safety for screen orientation handling, and fix iOS build error from develop branch.
|
||||||
|
|
||||||
## 🏷️ Ticket / Issue
|
## 🏷️ Ticket / Issue
|
||||||
|
|
||||||
@@ -12,14 +12,21 @@ None
|
|||||||
|
|
||||||
- **Type**: chore
|
- **Type**: chore
|
||||||
- **Scope**: deps, refactor
|
- **Scope**: deps, refactor
|
||||||
- **Summary**: Upgraded react-i18next and react-native-worklets to latest versions, improved type safety for screen orientation APIs
|
- **Summary**: Upgraded react-i18next and react-native-worklets to latest versions, improved type safety for screen orientation APIs, and fixed iOS build error
|
||||||
|
|
||||||
## 📋 Details
|
## 📋 Details
|
||||||
|
|
||||||
This PR upgrades key runtime dependencies and improves type safety across orientation-related code.
|
This PR upgrades key runtime dependencies, improves type safety across orientation-related code, and fixes an iOS build error present in the develop branch.
|
||||||
|
|
||||||
### Changes Made
|
### Changes Made
|
||||||
|
|
||||||
|
**iOS Build Fix:**
|
||||||
|
|
||||||
|
- Removed root-level `icon` field from `app.json` to resolve Xcode build failure
|
||||||
|
- The iOS-specific liquid glass icon format was causing asset catalog compilation errors
|
||||||
|
- Build error: "None of the input catalogs contained a matching stickers icon set or app icon set named 'icon-ios-liquid-glass'"
|
||||||
|
- Removing the root icon allows the iOS-specific icon to be processed correctly
|
||||||
|
|
||||||
**Runtime Dependencies Updated:**
|
**Runtime Dependencies Updated:**
|
||||||
|
|
||||||
- `react-i18next`: 15.4.0 → 16.3.3 (latest internationalization features and improvements)
|
- `react-i18next`: 15.4.0 → 16.3.3 (latest internationalization features and improvements)
|
||||||
@@ -67,10 +74,13 @@ None
|
|||||||
- [x] Screen rotation works correctly on mobile
|
- [x] Screen rotation works correctly on mobile
|
||||||
- [x] Orientation lock/unlock functions work
|
- [x] Orientation lock/unlock functions work
|
||||||
- [x] TV platform continues to use landscape orientation
|
- [x] TV platform continues to use landscape orientation
|
||||||
6. Test i18n functionality:
|
6. Test iOS build:
|
||||||
|
- [x] iOS build completes successfully without icon-related errors
|
||||||
|
- [x] App icons display correctly on iOS devices
|
||||||
|
7. Test i18n functionality:
|
||||||
- [x] Language switching works
|
- [x] Language switching works
|
||||||
- [x] Translations load correctly
|
- [x] Translations load correctly
|
||||||
7. Verification steps:
|
8. Verification steps:
|
||||||
- [x] All commands complete successfully
|
- [x] All commands complete successfully
|
||||||
- [x] No runtime errors
|
- [x] No runtime errors
|
||||||
- [x] Orientation behavior unchanged
|
- [x] Orientation behavior unchanged
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Platform } from "react-native";
|
import { Platform } from "react-native";
|
||||||
import * as ScreenOrientation from "@/packages/expo-screen-orientation";
|
import * as ScreenOrientation from "@/packages/expo-screen-orientation";
|
||||||
import { OrientationLock } from "@/packages/expo-screen-orientation";
|
import {
|
||||||
import { Orientation } from "../packages/expo-screen-orientation.tv";
|
Orientation,
|
||||||
|
OrientationLock,
|
||||||
|
} from "../packages/expo-screen-orientation.tv";
|
||||||
|
|
||||||
const orientationToOrientationLock = (
|
const orientationToOrientationLock = (
|
||||||
orientation: Orientation,
|
orientation: Orientation,
|
||||||
@@ -30,13 +32,15 @@ export const useOrientation = () => {
|
|||||||
if (Platform.isTV) return;
|
if (Platform.isTV) return;
|
||||||
|
|
||||||
const orientationSubscription =
|
const orientationSubscription =
|
||||||
ScreenOrientation.addOrientationChangeListener((event) => {
|
ScreenOrientation.addOrientationChangeListener(
|
||||||
setOrientation(
|
(event: { orientationInfo: { orientation: Orientation } }) => {
|
||||||
orientationToOrientationLock(event.orientationInfo.orientation),
|
setOrientation(
|
||||||
);
|
orientationToOrientationLock(event.orientationInfo.orientation),
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
ScreenOrientation.getOrientationAsync().then((orientation) => {
|
ScreenOrientation.getOrientationAsync().then((orientation: Orientation) => {
|
||||||
setOrientation(orientationToOrientationLock(orientation));
|
setOrientation(orientationToOrientationLock(orientation));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { useCallback, useEffect, useMemo } from "react";
|
|||||||
import { Platform } from "react-native";
|
import { Platform } from "react-native";
|
||||||
import { BITRATES, type Bitrate } from "@/components/BitrateSelector";
|
import { BITRATES, type Bitrate } from "@/components/BitrateSelector";
|
||||||
import * as ScreenOrientation from "@/packages/expo-screen-orientation";
|
import * as ScreenOrientation from "@/packages/expo-screen-orientation";
|
||||||
|
import { OrientationLock } from "@/packages/expo-screen-orientation.tv";
|
||||||
import { apiAtom } from "@/providers/JellyfinProvider";
|
import { apiAtom } from "@/providers/JellyfinProvider";
|
||||||
import { writeInfoLog } from "@/utils/log";
|
import { writeInfoLog } from "@/utils/log";
|
||||||
import { storage } from "../mmkv";
|
import { storage } from "../mmkv";
|
||||||
@@ -25,10 +26,7 @@ export type DownloadOption = {
|
|||||||
value: DownloadQuality;
|
value: DownloadQuality;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ScreenOrientationEnum: Record<
|
export const ScreenOrientationEnum: Record<number, string> = {
|
||||||
ScreenOrientation.OrientationLock,
|
|
||||||
string
|
|
||||||
> = {
|
|
||||||
[ScreenOrientation.OrientationLock.DEFAULT]:
|
[ScreenOrientation.OrientationLock.DEFAULT]:
|
||||||
"home.settings.other.orientations.DEFAULT",
|
"home.settings.other.orientations.DEFAULT",
|
||||||
[ScreenOrientation.OrientationLock.ALL]:
|
[ScreenOrientation.OrientationLock.ALL]:
|
||||||
@@ -154,7 +152,7 @@ export type Settings = {
|
|||||||
subtitleMode: SubtitlePlaybackMode;
|
subtitleMode: SubtitlePlaybackMode;
|
||||||
rememberSubtitleSelections: boolean;
|
rememberSubtitleSelections: boolean;
|
||||||
showHomeTitles: boolean;
|
showHomeTitles: boolean;
|
||||||
defaultVideoOrientation: ScreenOrientation.OrientationLock;
|
defaultVideoOrientation: OrientationLock;
|
||||||
forwardSkipTime: number;
|
forwardSkipTime: number;
|
||||||
rewindSkipTime: number;
|
rewindSkipTime: number;
|
||||||
showCustomMenuLinks: boolean;
|
showCustomMenuLinks: boolean;
|
||||||
@@ -218,7 +216,7 @@ export const defaultValues: Settings = {
|
|||||||
subtitleMode: SubtitlePlaybackMode.Default,
|
subtitleMode: SubtitlePlaybackMode.Default,
|
||||||
rememberSubtitleSelections: true,
|
rememberSubtitleSelections: true,
|
||||||
showHomeTitles: true,
|
showHomeTitles: true,
|
||||||
defaultVideoOrientation: ScreenOrientation.OrientationLock.DEFAULT,
|
defaultVideoOrientation: OrientationLock.DEFAULT,
|
||||||
forwardSkipTime: 30,
|
forwardSkipTime: 30,
|
||||||
rewindSkipTime: 10,
|
rewindSkipTime: 10,
|
||||||
showCustomMenuLinks: false,
|
showCustomMenuLinks: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user