chore(mobile): upgrade Expo and remove iOS workarounds
This commit is contained in:
21 files changed
+2408
-2520
No files matched your search
@@ -65,9 +65,7 @@
|
||||
}
|
||||
],
|
||||
"expo-image",
|
||||
"expo-status-bar",
|
||||
"./plugins/with-ios-pod-deployment-target.js",
|
||||
"./plugins/with-ios-scene-lifecycle.js"
|
||||
"expo-status-bar"
|
||||
],
|
||||
"experiments": {
|
||||
"typedRoutes": true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DarkTheme, DefaultTheme, ThemeProvider } from "expo-router"
|
||||
import { NativeTabs } from "expo-router/unstable-native-tabs"
|
||||
import { NativeTabs } from "expo-router/native-tabs"
|
||||
import { DynamicColorIOS, Platform, useColorScheme } from "react-native"
|
||||
import { useMemo } from "react"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ProfileHeaderButton } from "@/components/profile-header-button"
|
||||
import { tabStackScreenTitles, useStackScreenOptions } from "@/lib/navigation"
|
||||
|
||||
export const unstable_settings = {
|
||||
initialRouteName: "index",
|
||||
anchor: "index",
|
||||
}
|
||||
|
||||
export default function HomeLayout() {
|
||||
@@ -12,7 +12,6 @@ export default function HomeLayout() {
|
||||
|
||||
return (
|
||||
<Stack
|
||||
initialRouteName="index"
|
||||
screenOptions={({ route }) => ({
|
||||
...baseOptions,
|
||||
title: tabStackScreenTitles[route.name] ?? "Home",
|
||||
|
||||
@@ -160,7 +160,7 @@ export default function QueueScreen() {
|
||||
)
|
||||
)}
|
||||
</View>
|
||||
) : null
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ProfileHeaderButton } from "@/components/profile-header-button"
|
||||
import { tabStackScreenTitles, useStackScreenOptions } from "@/lib/navigation"
|
||||
|
||||
export const unstable_settings = {
|
||||
initialRouteName: "index",
|
||||
anchor: "index",
|
||||
}
|
||||
|
||||
export default function LibraryLayout() {
|
||||
@@ -12,7 +12,6 @@ export default function LibraryLayout() {
|
||||
|
||||
return (
|
||||
<Stack
|
||||
initialRouteName="index"
|
||||
screenOptions={({ route }) => ({
|
||||
...baseOptions,
|
||||
title: tabStackScreenTitles[route.name] ?? "Library",
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ProfileHeaderButton } from "@/components/profile-header-button"
|
||||
import { tabStackScreenTitles, useStackScreenOptions } from "@/lib/navigation"
|
||||
|
||||
export const unstable_settings = {
|
||||
initialRouteName: "index",
|
||||
anchor: "index",
|
||||
}
|
||||
|
||||
export default function SearchLayout() {
|
||||
@@ -12,7 +12,6 @@ export default function SearchLayout() {
|
||||
|
||||
return (
|
||||
<Stack
|
||||
initialRouteName="index"
|
||||
screenOptions={({ route }) => ({
|
||||
...baseOptions,
|
||||
title: tabStackScreenTitles[route.name] ?? "Search",
|
||||
|
||||
@@ -2,6 +2,5 @@ module.exports = function (api) {
|
||||
api.cache(true)
|
||||
return {
|
||||
presets: ["babel-preset-expo"],
|
||||
plugins: ["react-native-reanimated/plugin"],
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@ export function MediaGridList({
|
||||
content: MediaItem[]
|
||||
paddingBottom: number
|
||||
onEndReached?: () => void
|
||||
ListHeaderComponent?: ReactElement | null
|
||||
ListHeaderComponent?: ReactElement
|
||||
contentInset?: boolean
|
||||
}) {
|
||||
const cardWidth = useTwoColumnCardWidth()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Ionicons } from "@expo/vector-icons"
|
||||
import { NativeTabs } from "expo-router/unstable-native-tabs"
|
||||
import { NativeTabs } from "expo-router/native-tabs"
|
||||
import { useRouter } from "expo-router"
|
||||
import { Platform, Pressable, StyleSheet, Text, View } from "react-native"
|
||||
|
||||
|
||||
@@ -16,7 +16,9 @@ import {
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
type CellRendererProps,
|
||||
type LayoutChangeEvent,
|
||||
type StyleProp,
|
||||
type ViewStyle,
|
||||
} from "react-native"
|
||||
import { Gesture, GestureDetector } from "react-native-gesture-handler"
|
||||
import Animated, {
|
||||
@@ -267,7 +269,12 @@ export function NowPlayingQueue({
|
||||
style,
|
||||
children,
|
||||
onLayout,
|
||||
}: CellRendererProps<QueueListItem>) {
|
||||
}: {
|
||||
item: QueueListItem
|
||||
style: StyleProp<ViewStyle>
|
||||
children: ReactNode
|
||||
onLayout?: (event: LayoutChangeEvent) => void
|
||||
}) {
|
||||
const queueIndex = item.type === "upcoming" ? item.queueIndex : -1
|
||||
const lift = useAnimatedStyle(() => ({
|
||||
zIndex:
|
||||
|
||||
@@ -122,7 +122,7 @@ function SearchResultsBody({ searchQuery }: { searchQuery: string }) {
|
||||
<View style={styles.section}>
|
||||
<ContentCarousel title="Playlists" content={playlistResults} />
|
||||
</View>
|
||||
) : null
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -1,47 +1,21 @@
|
||||
import type { AudioMetadata, AudioPlaylist } from "expo-audio"
|
||||
import type {
|
||||
AudioLockScreenOptions,
|
||||
AudioMetadata,
|
||||
AudioPlaylist,
|
||||
} from "expo-audio"
|
||||
|
||||
/**
|
||||
* Lock-screen options added in Expo SDK 58 (`expo-audio` playlist lock screen).
|
||||
* SDK 57 only understands seek-forward/back; next/previous are ignored until upgrade.
|
||||
*/
|
||||
export type PlaylistLockScreenOptions = {
|
||||
isLiveStream?: boolean
|
||||
showNextTrack?: boolean
|
||||
showPreviousTrack?: boolean
|
||||
showSeekBackward?: boolean
|
||||
showSeekForward?: boolean
|
||||
}
|
||||
|
||||
type PlaylistLockScreenApi = {
|
||||
setActiveForLockScreen: (
|
||||
active: boolean,
|
||||
metadata?: AudioMetadata,
|
||||
options?: PlaylistLockScreenOptions
|
||||
) => void
|
||||
updateLockScreenMetadata?: (metadata: AudioMetadata) => void
|
||||
clearLockScreenControls?: () => void
|
||||
}
|
||||
|
||||
const TRACK_SKIP_LOCK_SCREEN_OPTIONS: PlaylistLockScreenOptions = {
|
||||
const TRACK_SKIP_LOCK_SCREEN_OPTIONS: AudioLockScreenOptions = {
|
||||
showNextTrack: true,
|
||||
showPreviousTrack: true,
|
||||
showSeekForward: false,
|
||||
showSeekBackward: false,
|
||||
}
|
||||
|
||||
function lockScreenApi(playlist: AudioPlaylist): PlaylistLockScreenApi | null {
|
||||
const candidate = playlist as AudioPlaylist & Partial<PlaylistLockScreenApi>
|
||||
if (typeof candidate.setActiveForLockScreen !== "function") {
|
||||
return null
|
||||
}
|
||||
return candidate as PlaylistLockScreenApi
|
||||
}
|
||||
|
||||
export function activatePlaylistLockScreen(
|
||||
playlist: AudioPlaylist,
|
||||
metadata: AudioMetadata
|
||||
) {
|
||||
lockScreenApi(playlist)?.setActiveForLockScreen(
|
||||
playlist.setActiveForLockScreen(
|
||||
true,
|
||||
metadata,
|
||||
TRACK_SKIP_LOCK_SCREEN_OPTIONS
|
||||
@@ -52,29 +26,14 @@ export function updatePlaylistLockScreenMetadata(
|
||||
playlist: AudioPlaylist,
|
||||
metadata: AudioMetadata
|
||||
) {
|
||||
const api = lockScreenApi(playlist)
|
||||
if (typeof api?.updateLockScreenMetadata === "function") {
|
||||
api.updateLockScreenMetadata(metadata)
|
||||
return
|
||||
}
|
||||
api?.setActiveForLockScreen(true, metadata, TRACK_SKIP_LOCK_SCREEN_OPTIONS)
|
||||
playlist.updateLockScreenMetadata(metadata)
|
||||
}
|
||||
|
||||
export function deactivatePlaylistLockScreen(playlist: AudioPlaylist) {
|
||||
const api = lockScreenApi(playlist)
|
||||
if (typeof api?.clearLockScreenControls === "function") {
|
||||
api.clearLockScreenControls()
|
||||
return
|
||||
}
|
||||
api?.setActiveForLockScreen(false)
|
||||
playlist.clearLockScreenControls()
|
||||
}
|
||||
|
||||
export function releaseAudioPlaylist(playlist: AudioPlaylist) {
|
||||
deactivatePlaylistLockScreen(playlist)
|
||||
const withDestroy = playlist as AudioPlaylist & {
|
||||
destroy?: () => void
|
||||
}
|
||||
if (typeof withDestroy.destroy === "function") {
|
||||
withDestroy.destroy()
|
||||
}
|
||||
playlist.destroy()
|
||||
}
|
||||
@@ -1,20 +1,9 @@
|
||||
import type { NativeStackNavigationOptions } from "expo-router"
|
||||
import { useColorScheme } from "react-native"
|
||||
|
||||
import { colors } from "@/lib/theme"
|
||||
import type { ScreenProps as BaseScreenProps } from "expo-router/build/useScreens"
|
||||
import type {
|
||||
NativeStackNavigationEventMap,
|
||||
NativeStackNavigationOptions,
|
||||
} from "expo-router/build/react-navigation/native-stack"
|
||||
import type { ParamListBase, StackNavigationState } from "expo-router/build/react-navigation/native"
|
||||
|
||||
type StackBaseScreenProps = BaseScreenProps<
|
||||
NativeStackNavigationOptions,
|
||||
StackNavigationState<ParamListBase>,
|
||||
NativeStackNavigationEventMap
|
||||
>
|
||||
|
||||
type StackScreenOptions = StackBaseScreenProps["options"]
|
||||
type StackScreenOptions = NativeStackNavigationOptions
|
||||
|
||||
export const tabStackScreenTitles: Record<string, string> = {
|
||||
"browse/albums": "Albums",
|
||||
|
||||
+33
-29
@@ -13,44 +13,48 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@convex-dev/auth": "^0.0.93",
|
||||
"@expo/ui": "~57.0.4",
|
||||
"@expo/dom-webview": "~58.0.2",
|
||||
"@expo/metro-runtime": "~58.0.14",
|
||||
"@expo/ui": "~58.0.21",
|
||||
"@expo/vector-icons": "^15.0.2",
|
||||
"@otunes/convex": "workspace:*",
|
||||
"@react-native-async-storage/async-storage": "2.2.0",
|
||||
"@react-native-community/slider": "5.2.0",
|
||||
"@react-native-community/slider": "5.2.1",
|
||||
"@react-native/metro-config": "0.88.0",
|
||||
"convex": "^1.40.0",
|
||||
"expo": "~57.0.4",
|
||||
"expo-asset": "~57.0.3",
|
||||
"expo-audio": "^57.0.0",
|
||||
"expo-blur": "~57.0.0",
|
||||
"expo-constants": "~57.0.3",
|
||||
"expo-dev-client": "~57.0.5",
|
||||
"expo-font": "~57.0.0",
|
||||
"expo-haptics": "~57.0.0",
|
||||
"expo-image": "~57.0.0",
|
||||
"expo-image-picker": "~57.0.2",
|
||||
"expo-linking": "~57.0.2",
|
||||
"expo-router": "~57.0.4",
|
||||
"expo-secure-store": "~57.0.0",
|
||||
"expo-sharing": "~57.0.3",
|
||||
"expo-splash-screen": "~57.0.2",
|
||||
"expo-status-bar": "~57.0.0",
|
||||
"expo-symbols": "~57.0.0",
|
||||
"react": "19.2.3",
|
||||
"react-native": "0.86.0",
|
||||
"react-native-gesture-handler": "~2.32.0",
|
||||
"expo": "~58.0.16",
|
||||
"expo-asset": "~58.0.17",
|
||||
"expo-audio": "^58.0.9",
|
||||
"expo-blur": "~58.0.5",
|
||||
"expo-constants": "~58.0.12",
|
||||
"expo-dev-client": "~58.0.14",
|
||||
"expo-font": "~58.0.9",
|
||||
"expo-haptics": "~58.0.7",
|
||||
"expo-image": "~58.0.16",
|
||||
"expo-image-picker": "~58.0.10",
|
||||
"expo-linking": "~58.0.13",
|
||||
"expo-router": "~58.0.24",
|
||||
"expo-secure-store": "~58.0.2",
|
||||
"expo-sharing": "~58.0.19",
|
||||
"expo-splash-screen": "~58.0.10",
|
||||
"expo-status-bar": "~58.0.3",
|
||||
"expo-symbols": "~58.0.4",
|
||||
"react": "19.3.0",
|
||||
"react-dom": "19.3.0",
|
||||
"react-native": "0.88.0",
|
||||
"react-native-gesture-handler": "~3.3.0",
|
||||
"react-native-image-colors": "^2.6.0",
|
||||
"react-native-reanimated": "4.5.0",
|
||||
"react-native-safe-area-context": "~5.7.0",
|
||||
"react-native-screens": "4.25.2",
|
||||
"react-native-svg": "15.15.4",
|
||||
"react-native-worklets": "0.10.0",
|
||||
"react-native-reanimated": "4.7.1",
|
||||
"react-native-safe-area-context": "~5.10.1",
|
||||
"react-native-screens": "4.30.0",
|
||||
"react-native-svg": "15.16.0",
|
||||
"react-native-worklets": "0.13.0",
|
||||
"sonner-native": "^0.26.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20",
|
||||
"@types/react": "~19.2.2",
|
||||
"babel-preset-expo": "^57.0.2",
|
||||
"@types/react": "~19.3.0",
|
||||
"babel-preset-expo": "^58.0.18",
|
||||
"typescript": "~6.0.3"
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
const { createRequire } = require("module");
|
||||
|
||||
const expoRequire = createRequire(require.resolve("expo/package.json"));
|
||||
const { withPodfile } = expoRequire("@expo/config-plugins");
|
||||
|
||||
const MARKER = "Xcode 26 rejects Pod deployment targets below iOS 15.0";
|
||||
|
||||
const DEPLOYMENT_TARGET_FIX = `
|
||||
# ${MARKER}. Resource bundles keep the podspec
|
||||
# version (AsyncStorage 13.4, RNSVG 12.4); React Native only bumps native targets.
|
||||
installer.pods_project.targets.each do |target|
|
||||
target.build_configurations.each do |build_config|
|
||||
deployment_target = build_config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
|
||||
next if deployment_target.nil?
|
||||
next unless deployment_target.to_s.match?(/\\A\\d+(?:\\.\\d+)?\\z/)
|
||||
if deployment_target.to_f < 15.1
|
||||
build_config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.1'
|
||||
end
|
||||
end
|
||||
end
|
||||
`;
|
||||
|
||||
function insertPodDeploymentTargetFix(contents) {
|
||||
if (contents.includes(MARKER)) {
|
||||
return contents;
|
||||
}
|
||||
|
||||
const call = "react_native_post_install(";
|
||||
const start = contents.indexOf(call);
|
||||
if (start === -1) {
|
||||
throw new Error(
|
||||
"Podfile is missing react_native_post_install, so the iOS deployment target fix could not be applied.",
|
||||
);
|
||||
}
|
||||
|
||||
let depth = 0;
|
||||
for (let index = start + call.length - 1; index < contents.length; index += 1) {
|
||||
const character = contents[index];
|
||||
if (character === "(") {
|
||||
depth += 1;
|
||||
} else if (character === ")") {
|
||||
depth -= 1;
|
||||
if (depth === 0) {
|
||||
const end = index + 1;
|
||||
return `${contents.slice(0, end)}\n${DEPLOYMENT_TARGET_FIX}${contents.slice(end)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"Podfile has an unbalanced react_native_post_install call, so the iOS deployment target fix could not be applied.",
|
||||
);
|
||||
}
|
||||
|
||||
/** Raise Pod target deployment targets to the Xcode 26 minimum. */
|
||||
function withIosPodDeploymentTarget(config) {
|
||||
return withPodfile(config, (mod) => {
|
||||
mod.modResults.contents = insertPodDeploymentTargetFix(mod.modResults.contents);
|
||||
return mod;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = withIosPodDeploymentTarget;
|
||||
module.exports.insertPodDeploymentTargetFix = insertPodDeploymentTargetFix;
|
||||
@@ -1,125 +0,0 @@
|
||||
const { createRequire } = require("module");
|
||||
|
||||
const expoRequire = createRequire(require.resolve("expo/package.json"));
|
||||
const { withAppDelegate, withInfoPlist } = expoRequire("@expo/config-plugins");
|
||||
|
||||
const WINDOW_BLOCK = `#if os(iOS) || os(tvOS)
|
||||
window = UIWindow(frame: UIScreen.main.bounds)
|
||||
factory.startReactNative(
|
||||
withModuleName: "main",
|
||||
in: window,
|
||||
launchOptions: launchOptions)
|
||||
#endif`;
|
||||
|
||||
const SCENE_DELEGATE = `
|
||||
@objc(SceneDelegate)
|
||||
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
var window: UIWindow?
|
||||
|
||||
func scene(
|
||||
_ scene: UIScene,
|
||||
willConnectTo session: UISceneSession,
|
||||
options connectionOptions: UIScene.ConnectionOptions
|
||||
) {
|
||||
guard let windowScene = scene as? UIWindowScene,
|
||||
let appDelegate = UIApplication.shared.delegate as? AppDelegate
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
if let existingWindow = window {
|
||||
existingWindow.windowScene = windowScene
|
||||
return
|
||||
}
|
||||
|
||||
let window = UIWindow(windowScene: windowScene)
|
||||
self.window = window
|
||||
appDelegate.window = window
|
||||
appDelegate.reactNativeFactory?.startReactNative(
|
||||
withModuleName: "main",
|
||||
in: window,
|
||||
launchOptions: appDelegate.launchOptions
|
||||
)
|
||||
|
||||
deliver(connectionOptions, to: appDelegate)
|
||||
}
|
||||
|
||||
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
||||
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
|
||||
for context in URLContexts {
|
||||
_ = appDelegate.application(UIApplication.shared, open: context.url, options: [:])
|
||||
}
|
||||
}
|
||||
|
||||
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
|
||||
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
|
||||
_ = appDelegate.application(
|
||||
UIApplication.shared,
|
||||
continue: userActivity,
|
||||
restorationHandler: { _ in }
|
||||
)
|
||||
}
|
||||
|
||||
private func deliver(
|
||||
_ connectionOptions: UIScene.ConnectionOptions,
|
||||
to appDelegate: AppDelegate
|
||||
) {
|
||||
for context in connectionOptions.urlContexts {
|
||||
_ = appDelegate.application(UIApplication.shared, open: context.url, options: [:])
|
||||
}
|
||||
for userActivity in connectionOptions.userActivities {
|
||||
_ = appDelegate.application(
|
||||
UIApplication.shared,
|
||||
continue: userActivity,
|
||||
restorationHandler: { _ in }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
function enableSceneLifecycle(contents) {
|
||||
if (contents.includes("@objc(SceneDelegate)")) {
|
||||
return contents;
|
||||
}
|
||||
if (!contents.includes(WINDOW_BLOCK)) {
|
||||
throw new Error(
|
||||
"AppDelegate.swift is missing the UIWindow startup block, so the UIScene lifecycle could not be applied.",
|
||||
);
|
||||
}
|
||||
|
||||
let next = contents.replace(
|
||||
"var window: UIWindow?\n",
|
||||
"var window: UIWindow?\n var launchOptions: [UIApplication.LaunchOptionsKey: Any]?\n",
|
||||
);
|
||||
next = next.replace(
|
||||
WINDOW_BLOCK,
|
||||
" // The window is created in SceneDelegate. This SDK refuses to launch without a UIScene.\n self.launchOptions = launchOptions",
|
||||
);
|
||||
return `${next.trimEnd()}\n${SCENE_DELEGATE}`;
|
||||
}
|
||||
|
||||
/** Adopt the UIScene lifecycle required by the current iOS SDK. */
|
||||
function withIosSceneLifecycle(config) {
|
||||
config = withInfoPlist(config, (mod) => {
|
||||
mod.modResults.UIApplicationSceneManifest = {
|
||||
UIApplicationSupportsMultipleScenes: false,
|
||||
UISceneConfigurations: {
|
||||
UIWindowSceneSessionRoleApplication: [
|
||||
{
|
||||
UISceneConfigurationName: "Default Configuration",
|
||||
UISceneDelegateClassName: "SceneDelegate",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
return mod;
|
||||
});
|
||||
|
||||
return withAppDelegate(config, (mod) => {
|
||||
mod.modResults.contents = enableSceneLifecycle(mod.modResults.contents);
|
||||
return mod;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = withIosSceneLifecycle;
|
||||
@@ -25,12 +25,12 @@
|
||||
"jose": "^6.2.3",
|
||||
"lucide-react": "^1.17.0",
|
||||
"music-metadata": "11.12.3",
|
||||
"next": "16.2.6",
|
||||
"next": "16.4.2",
|
||||
"next-themes": "^0.4.6",
|
||||
"radix-ui": "^1.4.3",
|
||||
"react": "19.2.4",
|
||||
"react": "19.3.1",
|
||||
"react-day-picker": "^10.0.1",
|
||||
"react-dom": "19.2.4",
|
||||
"react-dom": "19.3.1",
|
||||
"react-resizable-panels": "^4.11.2",
|
||||
"recharts": "^3.8.0",
|
||||
"shadcn": "^4.8.3",
|
||||
@@ -44,10 +44,10 @@
|
||||
"@convex-dev/eslint-plugin": "^2.0.0",
|
||||
"@tailwindcss/postcss": "^4",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "16.2.6",
|
||||
"eslint-config-next": "16.4.2",
|
||||
"tailwindcss": "^4",
|
||||
"typescript": "^5"
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
"packageManager": "pnpm@10.1.0",
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"expo-audio@57.0.0": "patches/expo-audio@57.0.0.patch"
|
||||
"expo-audio@58.0.9": "patches/expo-audio@58.0.9.patch"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
diff --git a/ios/AudioPlaylist.swift b/ios/AudioPlaylist.swift
|
||||
index db2c6af75ec8766757fc16c7db2f3ae365c275a0..52682780e06bbd0583eb47032dac560206b23aeb 100644
|
||||
--- a/ios/AudioPlaylist.swift
|
||||
+++ b/ios/AudioPlaylist.swift
|
||||
@@ -149,17 +149,22 @@ public class AudioPlaylist: SharedRef<AVQueuePlayer>, Playable {
|
||||
return
|
||||
}
|
||||
|
||||
- let wasPlaying = isPlaying
|
||||
sources.insert(source, at: index)
|
||||
|
||||
if index <= currentTrackIndex {
|
||||
+ // Earlier tracks aren't queued in the player, so only the index moves.
|
||||
currentTrackIndex += 1
|
||||
+ } else if let item = AudioUtils.createAVPlayerItem(from: source) {
|
||||
+ // Queue the item in place so the playing item is left alone.
|
||||
+ let queued = ref.items()
|
||||
+ let offset = index - currentTrackIndex
|
||||
+ let after = offset - 1 < queued.count ? queued[offset - 1] : queued.last
|
||||
+ ref.insert(item, after: after)
|
||||
+ if currentItem == nil {
|
||||
+ currentItem = ref.currentItem
|
||||
+ }
|
||||
}
|
||||
|
||||
- rebuildPlaylist(startingAt: currentTrackIndex)
|
||||
- if wasPlaying {
|
||||
- play(at: currentRate)
|
||||
- }
|
||||
updateStatus(with: ["trackCount": trackCount])
|
||||
}
|
||||
|
||||
@@ -180,10 +185,13 @@ public class AudioPlaylist: SharedRef<AVQueuePlayer>, Playable {
|
||||
play(at: currentRate)
|
||||
}
|
||||
} else if index < currentTrackIndex {
|
||||
+ // Earlier tracks aren't queued in the player, so only the index moves.
|
||||
currentTrackIndex -= 1
|
||||
- rebuildPlaylist(startingAt: currentTrackIndex)
|
||||
- if wasPlaying {
|
||||
- play(at: currentRate)
|
||||
+ } else {
|
||||
+ let queued = ref.items()
|
||||
+ let offset = index - currentTrackIndex
|
||||
+ if offset < queued.count {
|
||||
+ ref.remove(queued[offset])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
diff --git a/ios/AudioPlaylist.swift b/ios/AudioPlaylist.swift
|
||||
--- a/ios/AudioPlaylist.swift
|
||||
+++ b/ios/AudioPlaylist.swift
|
||||
@@ -179,20 +179,31 @@
|
||||
return
|
||||
}
|
||||
|
||||
- let wasPlaying = isPlaying
|
||||
- let resumeIndex: Int
|
||||
- if ref.currentItem != nil {
|
||||
- resumeIndex = index <= currentTrackIndex ? currentTrackIndex + 1 : currentTrackIndex
|
||||
- } else {
|
||||
- resumeIndex = index
|
||||
- }
|
||||
sources.insert(source, at: index)
|
||||
|
||||
- previousTrackIndex = resumeIndex
|
||||
- rebuildPlaylist(startingAt: resumeIndex)
|
||||
- if wasPlaying {
|
||||
- play(at: currentRate)
|
||||
+ // Nothing is loaded yet, so rebuilding does not interrupt playback.
|
||||
+ guard ref.currentItem != nil else {
|
||||
+ previousTrackIndex = index
|
||||
+ rebuildPlaylist(startingAt: index)
|
||||
+ updateStatus(with: ["trackCount": trackCount])
|
||||
+ return
|
||||
}
|
||||
+
|
||||
+ if index <= currentTrackIndex {
|
||||
+ // Earlier tracks are not queued. Keep the playing item and shift indexes.
|
||||
+ playerItems.insert(nil, at: index)
|
||||
+ previousTrackIndex = currentTrackIndex
|
||||
+ } else if let item = AudioUtils.createAVPlayerItem(from: source) {
|
||||
+ // Queue the item in place so the playing item is left alone.
|
||||
+ playerItems.insert(item, at: index)
|
||||
+ let queued = ref.items()
|
||||
+ let offset = index - currentTrackIndex
|
||||
+ let after = offset - 1 < queued.count ? queued[offset - 1] : queued.last
|
||||
+ ref.insert(item, after: after)
|
||||
+ } else {
|
||||
+ playerItems.insert(nil, at: index)
|
||||
+ }
|
||||
+
|
||||
updateStatus(with: ["trackCount": trackCount])
|
||||
}
|
||||
|
||||
@@ -213,12 +224,11 @@
|
||||
play(at: currentRate)
|
||||
}
|
||||
} else if index < current {
|
||||
- let resumeIndex = current - 1
|
||||
- previousTrackIndex = resumeIndex
|
||||
- rebuildPlaylist(startingAt: resumeIndex)
|
||||
- if wasPlaying {
|
||||
- play(at: currentRate)
|
||||
+ // Earlier tracks are not queued, so only the index moves.
|
||||
+ if index < playerItems.count {
|
||||
+ playerItems.remove(at: index)
|
||||
}
|
||||
+ previousTrackIndex = currentTrackIndex
|
||||
} else if index < playerItems.count {
|
||||
if let item = playerItems[index] {
|
||||
ref.remove(item)
|
||||
Generated
+2275
-2165
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user