Update from pacakges & make android seek better to use (#594)

This commit is contained in:
Zoe Roux 2024-08-12 10:25:21 +02:00 committed by GitHub
commit 195ed11c62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 2973 additions and 3760 deletions

View File

@ -11,8 +11,8 @@ COPY packages/models/package.json packages/models/package.json
RUN yarn --immutable
COPY . .
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
RUN yarn build:web
@ -25,8 +25,8 @@ COPY --from=builder /app/apps/web/.next/static ./.next/static/
COPY --from=builder /app/apps/web/public ./public
EXPOSE 8901
ENV PORT 8901
ENV PORT=8901
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
CMD ["node", "server.js"]

View File

@ -11,7 +11,7 @@ COPY packages/primitives/package.json packages/primitives/package.json
COPY packages/models/package.json packages/models/package.json
RUN yarn --immutable
ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_TELEMETRY_DISABLED=1
EXPOSE 3000
EXPOSE 8081
ENTRYPOINT ["yarn", "dev"]

View File

@ -56,10 +56,6 @@ const config: ExpoConfig = {
backgroundColor: "#eff1f5",
},
splash,
permissions: [
"android.permission.FOREGROUND_SERVICE",
"android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK",
],
},
updates: {
url: "https://u.expo.dev/55de6b52-c649-4a15-9a45-569ff5ed036c",
@ -73,27 +69,16 @@ const config: ExpoConfig = {
projectId: "55de6b52-c649-4a15-9a45-569ff5ed036c",
},
},
plugins: ["expo-build-properties", "expo-localization"],
};
const withForegroundService = (c: ExpoConfig): ExpoConfig => {
return withAndroidManifest(c, async (config) => {
const manifest = config.modResults.manifest;
manifest.application![0].service ??= [];
manifest.application![0].service.push({
$: {
"android:name": "com.brentvatne.exoplayer.VideoPlaybackService",
"android:exported": "false",
"android:foregroundServiceType": "mediaPlayback",
},
"intent-filter": [
plugins: [
"expo-build-properties",
"expo-localization",
[
"react-native-video",
{
action: [{ $: { "android:name": "androidx.media3.session.MediaSessionService" } }],
enableNotificationControls: true,
},
],
});
return config;
});
],
};
export default withForegroundService(config);
export default config;

View File

@ -40,6 +40,8 @@ export default function SignGuard() {
<Stack
screenOptions={{
navigationBarColor: "transparent",
// @ts-expect-error Not yet available. Waiting for expo-router update.
navigationBarTranslucent: true,
headerTitle: () => <NavbarTitle />,
headerRight: () => <NavbarRight />,
contentStyle: {

View File

@ -18,54 +18,53 @@
"@formatjs/intl-displaynames": "^6.6.8",
"@formatjs/intl-locale": "^4.0.0",
"@gorhom/portal": "^1.0.14",
"@kesha-antonov/react-native-background-downloader": "^3.1.3",
"@kesha-antonov/react-native-background-downloader": "^3.2.0",
"@kyoo/ui": "workspace:^",
"@material-symbols/svg-400": "^0.18.0",
"@react-native-community/netinfo": "11.3.1",
"@shopify/flash-list": "1.6.4",
"@tanstack/query-sync-storage-persister": "^5.38.0",
"@tanstack/react-query": "^5.39.0",
"@tanstack/react-query-persist-client": "^5.39.0",
"@material-symbols/svg-400": "^0.22.0",
"@react-native-community/netinfo": "11.3.2",
"@shopify/flash-list": "1.7.1",
"@tanstack/query-sync-storage-persister": "^5.51.21",
"@tanstack/react-query": "^5.51.23",
"@tanstack/react-query-persist-client": "^5.51.23",
"array-shuffle": "^3.0.0",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"expo": "^51.0.8",
"expo-build-properties": "~0.12.1",
"expo-constants": "~16.0.1",
"expo-dev-client": "~4.0.14",
"expo": "^51.0.26",
"expo-build-properties": "~0.12.5",
"expo-constants": "~16.0.2",
"expo-dev-client": "~4.0.22",
"expo-file-system": "~17.0.1",
"expo-font": "~12.0.5",
"expo-image-picker": "~15.0.5",
"expo-font": "~12.0.9",
"expo-image-picker": "~15.0.7",
"expo-linear-gradient": "~13.0.2",
"expo-linking": "~6.3.1",
"expo-localization": "~15.0.3",
"expo-navigation-bar": "~3.0.4",
"expo-router": "3.5.14",
"expo-navigation-bar": "~3.0.7",
"expo-router": "3.5.21",
"expo-screen-orientation": "~7.0.5",
"expo-secure-store": "~13.0.1",
"expo-secure-store": "~13.0.2",
"expo-status-bar": "~1.12.1",
"expo-updates": "~0.25.14",
"i18next": "^23.11.5",
"expo-updates": "~0.25.22",
"i18next": "^23.12.2",
"intl-pluralrules": "^2.0.1",
"moti": "^0.29.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "^14.1.2",
"react-native": "0.74.1",
"react": "18.3.1",
"react-i18next": "^15.0.1",
"react-native": "0.74.5",
"react-native-blurhash": "^2.0.3",
"react-native-fast-image": "^8.6.3",
"react-native-mmkv": "^2.12.2",
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "4.10.1",
"react-native-screens": "~3.31.1",
"react-native-reanimated": "~3.15.0",
"react-native-safe-area-context": "4.10.8",
"react-native-screens": "3.34.0",
"react-native-svg": "15.2.0",
"react-native-uuid": "^2.0.2",
"react-native-video": "^6.1.2",
"react-native-video": "^6.4.3",
"yoshiki": "1.2.14"
},
"devDependencies": {
"@babel/core": "^7.24.6",
"react-native-svg-transformer": "^1.4.0",
"typescript": "~5.3.3"
"@babel/core": "^7.25.2",
"react-native-svg-transformer": "^1.5.0",
"typescript": "~5.5.4"
},
"installConfig": {
"hoistingLimits": "workspaces"

View File

@ -51,8 +51,14 @@ const nextConfig = {
alias: {
...config.resolve.alias,
"react-native$": "react-native-web",
"react-native/Libraries/Image/AssetRegistry$":
"react-native-web/dist/modules/AssetRegistry",
// "react-native/Libraries/Image/AssetRegistry$":
// "react-native-web/dist/modules/AssetRegistry",
"react-native/Libraries/EventEmitter/RCTDeviceEventEmitter$":
"react-native-web/dist/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter",
"react-native/Libraries/vendor/emitter/EventEmitter$":
"react-native-web/dist/vendor/react-native/emitter/EventEmitter",
"react-native/Libraries/EventEmitter/NativeEventEmitter$":
"react-native-web/dist/vendor/react-native/NativeEventEmitter",
},
extensions: [".web.ts", ".web.tsx", ".web.js", ".web.jsx", ...config.resolve.extensions],
};
@ -94,6 +100,7 @@ const nextConfig = {
"@kyoo/ui",
"@kyoo/primitives",
"@kyoo/models",
"@react-native/assets-registry",
"solito",
"react-native",
"react-native-web",

View File

@ -16,45 +16,45 @@
"@kyoo/models": "workspace:^",
"@kyoo/primitives": "workspace:^",
"@kyoo/ui": "workspace:^",
"@material-symbols/svg-400": "^0.18.0",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-select": "^2.0.0",
"@tanstack/react-query": "^5.39.0",
"@tanstack/react-query-devtools": "^5.39.0",
"@material-symbols/svg-400": "^0.22.0",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-select": "^2.1.1",
"@tanstack/react-query": "^5.51.23",
"@tanstack/react-query-devtools": "^5.51.23",
"array-shuffle": "^3.0.0",
"expo-image-picker": "~15.0.5",
"expo-image-picker": "~15.0.7",
"expo-linear-gradient": "^13.0.2",
"expo-modules-core": "^1.12.11",
"hls.js": "^1.5.8",
"i18next": "^23.11.5",
"jassub": "^1.7.15",
"jotai": "^2.8.1",
"expo-modules-core": "^1.12.20",
"hls.js": "^1.5.14",
"i18next": "^23.12.2",
"jassub": "1.7.15",
"jotai": "^2.9.2",
"moti": "^0.29.0",
"next": "14.2.3",
"next": "14.2.5",
"next-translate": "^2.6.2",
"raf": "^3.4.1",
"react": "18.2.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-i18next": "^14.1.2",
"react-native-reanimated": "3.11.0",
"react-native-svg": "15.3.0",
"react-native-video": "^6.1.2",
"react-i18next": "^15.0.1",
"react-native-reanimated": "3.15.0",
"react-native-svg": "15.2.0",
"react-native-video": "^6.4.3",
"react-native-web": "0.19.12",
"react-tooltip": "^5.26.4",
"react-tooltip": "^5.28.0",
"solito": "^4.2.2",
"srt-webvtt": "zoriya/srt-webvtt#build",
"superjson": "^2.2.1",
"sweetalert2": "^11.11.0",
"sweetalert2": "^11.12.4",
"yoshiki": "1.2.14",
"zod": "^3.23.8"
},
"devDependencies": {
"@svgr/webpack": "^8.1.0",
"@types/node": "20.12.12",
"@types/node": "22.2.0",
"@types/react-dom": "18.3.0",
"copy-webpack-plugin": "^12.0.2",
"react-native": "0.74.1",
"typescript": "^5.4.5",
"webpack": "^5.91.0"
"react-native": "0.74.5",
"typescript": "^5.5.4",
"webpack": "^5.93.0"
}
}

View File

@ -17,8 +17,8 @@
},
"workspaces": ["apps/*", "packages/*"],
"devDependencies": {
"@biomejs/biome": "1.7.3",
"typescript": "5.4.5"
"@biomejs/biome": "1.8.3",
"typescript": "5.5.4"
},
"packageManager": "yarn@3.2.4"
}

View File

@ -6,7 +6,7 @@
"packageManager": "yarn@3.2.4",
"devDependencies": {
"react-native-mmkv": "^2.12.2",
"typescript": "^5.4.5"
"typescript": "^5.5.4"
},
"peerDependencies": {
"@tanstack/react-query": "*",

View File

@ -6,7 +6,7 @@
"packageManager": "yarn@3.2.4",
"devDependencies": {
"@gorhom/portal": "^1.0.14",
"typescript": "^5.4.5"
"typescript": "^5.5.4"
},
"peerDependencies": {
"@gorhom/portal": "*",
@ -53,14 +53,14 @@
},
"dependencies": {
"@expo/html-elements": "^0.10.1",
"@tanstack/react-query": "^5.39.0",
"@tanstack/react-query": "^5.51.23",
"solito": "^4.2.2"
},
"optionalDependencies": {
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-select": "^2.1.1",
"blurhash": "^2.0.5",
"react-native-blurhash": "^2.0.3",
"react-native-fast-image": "^8.6.3",
"react-native-safe-area-context": "4.10.1"
"react-native-safe-area-context": "4.10.8"
}
}

View File

@ -10,10 +10,10 @@
},
"devDependencies": {
"@gorhom/portal": "^1.0.14",
"@shopify/flash-list": "^1.6.4",
"@shopify/flash-list": "^1.7.1",
"@types/langmap": "^0.0.3",
"react-native-uuid": "^2.0.2",
"typescript": "^5.4.5"
"typescript": "^5.5.4"
},
"peerDependencies": {
"@gorhom/portal": "*",
@ -35,9 +35,9 @@
"yoshiki": "*"
},
"optionalDependencies": {
"@kesha-antonov/react-native-background-downloader": "^3.1.3",
"@kesha-antonov/react-native-background-downloader": "^3.2.0",
"expo-file-system": "^17.0.1",
"expo-router": "^3.5.14"
"expo-router": "^3.5.21"
},
"peerDependenciesMeta": {
"@kesha-antonov/react-native-background-downloader": {

View File

@ -40,7 +40,7 @@ import { FlashList } from "@shopify/flash-list";
import { useRouter } from "expo-router";
import { type Atom, useAtomValue } from "jotai";
import { useTranslation } from "react-i18next";
import { type ImageStyle, View } from "react-native";
import { View } from "react-native";
import { percent, useYoshiki } from "yoshiki/native";
import { EpisodeLine, displayRuntime, episodeDisplayNumber } from "../details/episode";
import { EmptyView } from "../fetch";

View File

@ -71,9 +71,9 @@ export const RightButtons = ({
selected={!selectedSubtitle}
onSelect={() => setSubtitle(null)}
/>
{subtitles.map((x) => (
{subtitles.map((x, i) => (
<Menu.Item
key={x.index}
key={x.index ?? i}
label={x.link ? getDisplayName(x) : `${getDisplayName(x)} (${x.codec})`}
selected={selectedSubtitle === x}
disabled={!x.link}

View File

@ -146,7 +146,7 @@ export const Player = ({
<Video
metadata={{
title: title ?? t("show.episodeNoMetadata"),
subtitle: subtitle ?? undefined,
artist: subtitle ?? undefined,
description: data?.overview ?? undefined,
imageUri: image?.medium,
next: next,

View File

@ -27,12 +27,14 @@ import { durationAtom, playAtom, progressAtom } from "./state";
export const MediaSessionManager = ({
title,
subtitle,
artist,
imageUri,
previous,
next,
}: {
title?: string;
subtitle?: string;
artist?: string;
imageUri?: string | null;
previous?: string;
next?: string;
@ -48,9 +50,10 @@ export const MediaSessionManager = ({
navigator.mediaSession.metadata = new MediaMetadata({
title: title,
album: subtitle,
artist: artist,
artwork: imageUri ? [{ src: imageUri }] : undefined,
});
}, [title, subtitle, imageUri]);
}, [title, subtitle, artist, imageUri]);
useEffect(() => {
if (!("mediaSession" in navigator)) return;

View File

@ -20,7 +20,7 @@
import { type Audio, type Episode, type Subtitle, getLocalSetting, useAccount } from "@kyoo/models";
import { useSnackbar } from "@kyoo/primitives";
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
import { atom, getDefaultStore, useAtom, useAtomValue, useSetAtom } from "jotai";
import { useAtomCallback } from "jotai/utils";
import {
type ElementRef,
@ -33,7 +33,7 @@ import {
} from "react";
import { useTranslation } from "react-i18next";
import { Platform } from "react-native";
import NativeVideo, { canPlay, type VideoProps } from "./video";
import NativeVideo, { canPlay, type VideoMetadata, type VideoProps } from "./video";
export const playAtom = atom(true);
export const loadAtom = atom(false);
@ -114,14 +114,7 @@ export const Video = memo(function Video({
setError: (error: string | undefined) => void;
fonts?: string[];
startTime?: number | null;
metadata: {
title?: string;
subtitle?: string;
description?: string;
imageUri?: string;
previous?: string;
next?: string;
};
metadata: VideoMetadata & { next?: string; previous?: string };
} & Partial<VideoProps>) {
const ref = useRef<ElementRef<typeof NativeVideo> | null>(null);
const [isPlaying, setPlay] = useAtom(playAtom);
@ -239,6 +232,7 @@ export const Video = memo(function Video({
showNotificationControls
playInBackground
playWhenInactive
disableDisconnectError
paused={!isPlaying}
muted={isMuted}
volume={volume}
@ -252,7 +246,10 @@ export const Video = memo(function Video({
setPrivateProgress(progress.currentTime);
setBuffered(progress.playableDuration);
}}
onPlaybackStateChanged={(state) => setPlay(state.isPlaying)}
onPlaybackStateChanged={(state) => {
if (state.isSeeking || getDefaultStore().get(loadAtom)) return;
setPlay(state.isPlaying);
}}
fonts={fonts}
subtitles={subtitles}
onMediaUnsupported={() => {

View File

@ -246,8 +246,8 @@ const Video = forwardRef<{ seek: (value: number) => void }, VideoProps>(function
onLoadedMetadata={() => {
if (source.startPosition) setProgress(source.startPosition / 1000);
}}
onPlay={() => onPlaybackStateChanged?.({ isPlaying: true })}
onPause={() => onPlaybackStateChanged?.({ isPlaying: false })}
onPlay={() => onPlaybackStateChanged?.({ isPlaying: true, isSeeking: false })}
onPause={() => onPlaybackStateChanged?.({ isPlaying: false, isSeeking: false })}
onEnded={onEnd}
{...css({ width: "100%", height: "100%", objectFit: "contain" })}
/>

File diff suppressed because it is too large Load Diff