Merge pull request 'fix(mobile): sync player volume with system audio' (#46) from t3/mobile-system-volume-control into main
Reviewed-on: #46
This commit was merged in pull request #46.
This commit is contained in:
commit
cd9972724f
50 files changed
+1481
-374
No files matched your search
@@ -1,7 +1,7 @@
|
||||
ios/
|
||||
android/
|
||||
/ios/
|
||||
/android/
|
||||
# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
|
||||
# The following patterns were generated by expo-cli
|
||||
|
||||
expo-env.d.ts
|
||||
# @end expo-cli
|
||||
# @end expo-cli
|
||||
+16
-3
@@ -27,7 +27,9 @@
|
||||
"monochromeImage": "./assets/android-icon-monochrome.png",
|
||||
"foregroundImage": "./assets/android-icon-foreground.png",
|
||||
"backgroundColor": "#C60322"
|
||||
}
|
||||
},
|
||||
"userInterfaceStyle": "dark",
|
||||
"softwareKeyboardLayoutMode": "resize"
|
||||
},
|
||||
"plugins": [
|
||||
"expo-router",
|
||||
@@ -49,12 +51,23 @@
|
||||
],
|
||||
"expo-image",
|
||||
"expo-status-bar",
|
||||
"expo-app-intents"
|
||||
"expo-app-intents",
|
||||
"./plugins/with-android-colors",
|
||||
[
|
||||
"expo-navigation-bar",
|
||||
{
|
||||
"enforceContrast": false,
|
||||
"style": "light"
|
||||
}
|
||||
]
|
||||
],
|
||||
"experiments": {
|
||||
"typedRoutes": true,
|
||||
"inlineModules": {
|
||||
"watchedDirectories": ["app-intents"]
|
||||
"watchedDirectories": [
|
||||
"app-intents",
|
||||
"native"
|
||||
]
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
|
||||
@@ -1,37 +1,50 @@
|
||||
import { NavigationBar } from "expo-navigation-bar"
|
||||
import {
|
||||
AndroidTabThemeProvider,
|
||||
useAndroidTabPalette,
|
||||
useAndroidTabSelectedColor,
|
||||
} from "@/contexts/android-tab-theme"
|
||||
import { DarkTheme, DefaultTheme, ThemeProvider } from "expo-router"
|
||||
import { NativeTabs } from "expo-router/native-tabs"
|
||||
import { DynamicColorIOS, Platform, useColorScheme } from "react-native"
|
||||
import { DynamicColorIOS, Platform, View } from "react-native"
|
||||
import { useMemo } from "react"
|
||||
|
||||
import { TabBottomAccessory } from "@/components/mini-player"
|
||||
import { AndroidMiniPlayer, TabBottomAccessory } from "@/components/mini-player"
|
||||
import { useAndroidKeyboardVisible } from "@/hooks/use-android-keyboard-visible"
|
||||
import { usePlaybackQueue } from "@/contexts/playback"
|
||||
import { appleMusic, colors } from "@/lib/theme"
|
||||
import { appleMusic, colors, miniPlayerHeight, useIsDark } from "@/lib/theme"
|
||||
|
||||
export const unstable_settings = { anchor: "library" }
|
||||
|
||||
function useRouterTheme() {
|
||||
const isDark = useColorScheme() === "dark"
|
||||
const themeIsDark = useIsDark()
|
||||
const androidPalette = useAndroidTabPalette()
|
||||
const isDark = Platform.OS === "android" ? androidPalette.isDark : themeIsDark
|
||||
|
||||
return useMemo(() => {
|
||||
const palette = isDark ? colors.dark : colors.light
|
||||
const android = Platform.OS === "android" ? androidPalette : null
|
||||
const base = isDark ? DarkTheme : DefaultTheme
|
||||
|
||||
return {
|
||||
...base,
|
||||
colors: {
|
||||
...base.colors,
|
||||
background: palette.background,
|
||||
card: palette.card,
|
||||
text: palette.foreground,
|
||||
border: palette.border,
|
||||
primary: palette.primary,
|
||||
background: android?.background ?? palette.background,
|
||||
card: android?.surface ?? palette.card,
|
||||
text: android?.foreground ?? palette.foreground,
|
||||
border: android?.divider ?? palette.border,
|
||||
primary: android?.accentText ?? palette.primary,
|
||||
},
|
||||
}
|
||||
}, [isDark])
|
||||
}, [isDark, androidPalette])
|
||||
}
|
||||
|
||||
function useNativeTabColors() {
|
||||
const isDark = useColorScheme() === "dark"
|
||||
const selectedColor = useAndroidTabSelectedColor()
|
||||
const themeIsDark = useIsDark()
|
||||
const androidPalette = useAndroidTabPalette()
|
||||
const isDark = Platform.OS === "android" ? androidPalette.isDark : themeIsDark
|
||||
const inactive = appleMusic.tabInactive
|
||||
|
||||
const iconColor =
|
||||
@@ -41,24 +54,23 @@ function useNativeTabColors() {
|
||||
selected: appleMusic.pink,
|
||||
}
|
||||
: {
|
||||
default: isDark ? inactive : "#636366",
|
||||
selected: appleMusic.pink,
|
||||
default: androidPalette.secondaryForeground,
|
||||
selected: selectedColor,
|
||||
}
|
||||
|
||||
const labelColor =
|
||||
Platform.OS === "ios"
|
||||
? DynamicColorIOS({ dark: inactive, light: "#636366" })
|
||||
: isDark
|
||||
? inactive
|
||||
: "#636366"
|
||||
: androidPalette.secondaryForeground
|
||||
|
||||
return {
|
||||
isDark,
|
||||
tintColor: Platform.OS === "android" ? selectedColor : appleMusic.pink,
|
||||
iconColor,
|
||||
labelStyle: {
|
||||
default: { color: labelColor, fontSize: 10 },
|
||||
selected: {
|
||||
color: appleMusic.pink,
|
||||
color: Platform.OS === "android" ? selectedColor : appleMusic.pink,
|
||||
fontSize: 10,
|
||||
fontWeight: "600" as const,
|
||||
},
|
||||
@@ -67,57 +79,93 @@ function useNativeTabColors() {
|
||||
? "systemChromeMaterialDark"
|
||||
: "systemChromeMaterialLight",
|
||||
backgroundColor:
|
||||
Platform.OS === "ios"
|
||||
? undefined
|
||||
: isDark
|
||||
? appleMusic.background
|
||||
: colors.light.background,
|
||||
Platform.OS === "ios" ? undefined : androidPalette.background,
|
||||
}
|
||||
}
|
||||
|
||||
export default function TabsLayout() {
|
||||
function TabsContent() {
|
||||
const keyboardVisible = useAndroidKeyboardVisible()
|
||||
const routerTheme = useRouterTheme()
|
||||
const tabColors = useNativeTabColors()
|
||||
const { currentSong, queueSongIds } = usePlaybackQueue()
|
||||
const showBottomAccessory = Boolean(currentSong && queueSongIds.length > 0)
|
||||
|
||||
// NativeTabs already owns the tab bar and system navigation insets.
|
||||
const androidContentStyle =
|
||||
Platform.OS === "android"
|
||||
? {
|
||||
paddingBottom:
|
||||
showBottomAccessory && !keyboardVisible ? miniPlayerHeight : 0,
|
||||
}
|
||||
: undefined
|
||||
|
||||
return (
|
||||
<ThemeProvider value={routerTheme}>
|
||||
<NativeTabs
|
||||
blurEffect={
|
||||
tabColors.blurEffect as
|
||||
"systemChromeMaterialDark" | "systemChromeMaterialLight"
|
||||
}
|
||||
backgroundColor={tabColors.backgroundColor}
|
||||
iconColor={tabColors.iconColor}
|
||||
labelStyle={tabColors.labelStyle}
|
||||
tintColor={appleMusic.pink}
|
||||
minimizeBehavior="onScrollDown"
|
||||
>
|
||||
{showBottomAccessory ? (
|
||||
<NativeTabs.BottomAccessory>
|
||||
<TabBottomAccessory />
|
||||
</NativeTabs.BottomAccessory>
|
||||
<View style={{ flex: 1 }}>
|
||||
{Platform.OS === "android" ? (
|
||||
<NavigationBar style={tabColors.isDark ? "light" : "dark"} />
|
||||
) : null}
|
||||
<NativeTabs
|
||||
blurEffect={
|
||||
tabColors.blurEffect as
|
||||
"systemChromeMaterialDark" | "systemChromeMaterialLight"
|
||||
}
|
||||
backgroundColor={tabColors.backgroundColor}
|
||||
iconColor={tabColors.iconColor}
|
||||
labelStyle={tabColors.labelStyle}
|
||||
tintColor={tabColors.tintColor}
|
||||
minimizeBehavior="onScrollDown"
|
||||
{...(Platform.OS === "android"
|
||||
? { disableIndicator: true, rippleColor: tabColors.tintColor }
|
||||
: {})}
|
||||
>
|
||||
{Platform.OS === "ios" && showBottomAccessory ? (
|
||||
<NativeTabs.BottomAccessory>
|
||||
<TabBottomAccessory />
|
||||
</NativeTabs.BottomAccessory>
|
||||
) : null}
|
||||
|
||||
<NativeTabs.Trigger name="home" disableTransparentOnScrollEdge>
|
||||
<NativeTabs.Trigger.Icon sf="house.fill" md="home" />
|
||||
<NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>
|
||||
</NativeTabs.Trigger>
|
||||
<NativeTabs.Trigger
|
||||
name="home"
|
||||
disableTransparentOnScrollEdge
|
||||
contentStyle={androidContentStyle}
|
||||
>
|
||||
<NativeTabs.Trigger.Icon sf="house.fill" md="home" />
|
||||
<NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>
|
||||
</NativeTabs.Trigger>
|
||||
|
||||
<NativeTabs.Trigger name="library" disableTransparentOnScrollEdge>
|
||||
<NativeTabs.Trigger.Icon
|
||||
sf="music.note.square.stack.fill"
|
||||
md="library_music"
|
||||
/>
|
||||
<NativeTabs.Trigger.Label>Library</NativeTabs.Trigger.Label>
|
||||
</NativeTabs.Trigger>
|
||||
<NativeTabs.Trigger
|
||||
name="library"
|
||||
disableTransparentOnScrollEdge
|
||||
contentStyle={androidContentStyle}
|
||||
>
|
||||
<NativeTabs.Trigger.Icon
|
||||
sf="music.note.square.stack.fill"
|
||||
md="library_music"
|
||||
/>
|
||||
<NativeTabs.Trigger.Label>Library</NativeTabs.Trigger.Label>
|
||||
</NativeTabs.Trigger>
|
||||
|
||||
<NativeTabs.Trigger name="search" disableTransparentOnScrollEdge>
|
||||
<NativeTabs.Trigger.Icon sf="magnifyingglass" md="search" />
|
||||
<NativeTabs.Trigger.Label>Search</NativeTabs.Trigger.Label>
|
||||
</NativeTabs.Trigger>
|
||||
</NativeTabs>
|
||||
<NativeTabs.Trigger
|
||||
name="search"
|
||||
disableTransparentOnScrollEdge
|
||||
contentStyle={androidContentStyle}
|
||||
>
|
||||
<NativeTabs.Trigger.Icon sf="magnifyingglass" md="search" />
|
||||
<NativeTabs.Trigger.Label>Search</NativeTabs.Trigger.Label>
|
||||
</NativeTabs.Trigger>
|
||||
</NativeTabs>
|
||||
{!keyboardVisible ? <AndroidMiniPlayer /> : null}
|
||||
</View>
|
||||
</ThemeProvider>
|
||||
)
|
||||
}
|
||||
|
||||
export default function TabsLayout() {
|
||||
if (Platform.OS !== "android") return <TabsContent />
|
||||
return (
|
||||
<AndroidTabThemeProvider>
|
||||
<TabsContent />
|
||||
</AndroidTabThemeProvider>
|
||||
)
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Stack } from "expo-router"
|
||||
import { Platform } from "react-native"
|
||||
|
||||
import { ProfileHeaderButton } from "@/components/profile-header-button"
|
||||
import { tabStackScreenTitles, useStackScreenOptions } from "@/lib/navigation"
|
||||
@@ -14,6 +15,10 @@ export default function HomeLayout() {
|
||||
<Stack
|
||||
screenOptions={({ route }) => ({
|
||||
...baseOptions,
|
||||
...(Platform.OS === "android" &&
|
||||
(route.name === "album/[id]" || route.name === "playlist/[id]")
|
||||
? { animation: "none" as const }
|
||||
: {}),
|
||||
title: tabStackScreenTitles[route.name] ?? "Home",
|
||||
headerRight:
|
||||
route.name === "index" ? () => <ProfileHeaderButton /> : undefined,
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
import { useAndroidScreenPalette } from "@/contexts/android-tab-theme"
|
||||
import { MusicEntityView } from "@/components/music-entity-view"
|
||||
import { Stack, useIsFocused, useLocalSearchParams } from "expo-router"
|
||||
import { StatusBar } from "expo-status-bar"
|
||||
import { memo, useCallback, useEffect, useMemo } from "react"
|
||||
import { FlatList, Pressable, StyleSheet, Text, View } from "react-native"
|
||||
import {
|
||||
FlatList,
|
||||
Platform,
|
||||
Pressable,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
} from "react-native"
|
||||
import { Ionicons } from "@expo/vector-icons"
|
||||
|
||||
import {
|
||||
@@ -57,10 +65,11 @@ export default function AlbumScreen() {
|
||||
const isFocused = useIsFocused()
|
||||
const coverUri =
|
||||
config && typeof id === "string" ? albumCoverUrl(config.serverUrl, id) : ""
|
||||
const { palette, settled } = useCoverPalette(
|
||||
const { palette: artworkPalette, settled } = useCoverPalette(
|
||||
coverUri,
|
||||
album ? album.cover != null : album === null ? false : undefined
|
||||
)
|
||||
const { palette, onLayout } = useAndroidScreenPalette(artworkPalette)
|
||||
const songIds = useMemo(
|
||||
() => album?.tracks.map((track) => track.id as Id<"songs">) ?? [],
|
||||
[album]
|
||||
@@ -147,6 +156,14 @@ export default function AlbumScreen() {
|
||||
title: "",
|
||||
headerLargeTitle: false,
|
||||
headerTintColor: palette.foreground,
|
||||
...(Platform.OS === "android"
|
||||
? {
|
||||
headerStyle: { backgroundColor: palette.background },
|
||||
statusBarStyle: palette.isDark
|
||||
? ("light" as const)
|
||||
: ("dark" as const),
|
||||
}
|
||||
: {}),
|
||||
headerRight: () => (
|
||||
<MediaActionMenu
|
||||
stationArtistId={album.artist.id}
|
||||
@@ -174,6 +191,7 @@ export default function AlbumScreen() {
|
||||
}}
|
||||
/>
|
||||
<FlatList
|
||||
onLayout={onLayout}
|
||||
{...longListProps}
|
||||
data={listItems}
|
||||
keyExtractor={albumListItemKey}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useAndroidScreenPalette } from "@/contexts/android-tab-theme"
|
||||
import { MusicEntityView } from "@/components/music-entity-view"
|
||||
import { useMutation } from "convex/react"
|
||||
import { memo, useCallback, useEffect, useMemo } from "react"
|
||||
@@ -98,10 +99,11 @@ export default function PlaylistScreen() {
|
||||
config && playlistId
|
||||
? playlistCoverUrl(config.serverUrl, playlist?.id ?? playlistId)
|
||||
: ""
|
||||
const { palette, settled } = useCoverPalette(
|
||||
const { palette: artworkPalette, settled } = useCoverPalette(
|
||||
coverUri,
|
||||
playlist ? playlist.cover != null : playlist === null ? false : undefined
|
||||
)
|
||||
const { palette, onLayout } = useAndroidScreenPalette(artworkPalette)
|
||||
|
||||
useEffect(() => {
|
||||
rememberSongs(songs)
|
||||
@@ -146,6 +148,7 @@ export default function PlaylistScreen() {
|
||||
|
||||
return (
|
||||
<PlaylistContent
|
||||
onLayout={onLayout}
|
||||
playlist={playlist}
|
||||
songs={songs}
|
||||
allSongIds={allSongIds}
|
||||
@@ -159,6 +162,7 @@ export default function PlaylistScreen() {
|
||||
}
|
||||
|
||||
function PlaylistContent({
|
||||
onLayout,
|
||||
playlist,
|
||||
songs,
|
||||
allSongIds,
|
||||
@@ -166,6 +170,7 @@ function PlaylistContent({
|
||||
palette,
|
||||
onEndReached,
|
||||
}: {
|
||||
onLayout?: () => void
|
||||
playlist: BrowsePlaylistDetail
|
||||
songs: BrowseSong[]
|
||||
allSongIds: Id<"songs">[] | undefined
|
||||
@@ -269,6 +274,14 @@ function PlaylistContent({
|
||||
title: "",
|
||||
headerLargeTitle: false,
|
||||
headerTintColor: palette.foreground,
|
||||
...(Platform.OS === "android"
|
||||
? {
|
||||
headerStyle: { backgroundColor: palette.background },
|
||||
statusBarStyle: palette.isDark
|
||||
? ("light" as const)
|
||||
: ("dark" as const),
|
||||
}
|
||||
: {}),
|
||||
headerRight: () => (
|
||||
<MediaActionMenu
|
||||
selectedCount={songIds.length}
|
||||
@@ -295,6 +308,8 @@ function PlaylistContent({
|
||||
deletePlaylist,
|
||||
handlePlaylistDetailAction,
|
||||
palette.foreground,
|
||||
palette.background,
|
||||
palette.isDark,
|
||||
playlistId,
|
||||
router,
|
||||
songIds,
|
||||
@@ -331,6 +346,7 @@ function PlaylistContent({
|
||||
) : null}
|
||||
<Stack.Screen options={screenOptions} />
|
||||
<FlatList
|
||||
onLayout={onLayout}
|
||||
{...longListProps}
|
||||
data={songs}
|
||||
keyExtractor={songKey}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Image } from "expo-image"
|
||||
import * as ImagePicker from "expo-image-picker"
|
||||
import { useState } from "react"
|
||||
import {
|
||||
Platform,
|
||||
Pressable,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
@@ -495,7 +496,10 @@ function UsersSection({
|
||||
</Text>
|
||||
{user.isAdmin ? (
|
||||
<View
|
||||
style={[styles.badge, { backgroundColor: colors.muted }]}
|
||||
style={[
|
||||
styles.badge,
|
||||
{ backgroundColor: colors.muted },
|
||||
]}
|
||||
>
|
||||
<Text
|
||||
style={[
|
||||
@@ -650,7 +654,16 @@ function SwitchRow({
|
||||
<Text style={{ color: colors.mutedForeground }}>{subtitle}</Text>
|
||||
) : null}
|
||||
</View>
|
||||
<Switch value={value} onValueChange={onValueChange} />
|
||||
<Switch
|
||||
value={value}
|
||||
onValueChange={onValueChange}
|
||||
{...(Platform.OS === "android"
|
||||
? {
|
||||
trackColor: { false: colors.muted, true: colors.primary },
|
||||
thumbColor: colors.foreground,
|
||||
}
|
||||
: {})}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Stack } from "expo-router"
|
||||
import { Platform } from "react-native"
|
||||
|
||||
import { ProfileHeaderButton } from "@/components/profile-header-button"
|
||||
import { tabStackScreenTitles, useStackScreenOptions } from "@/lib/navigation"
|
||||
@@ -14,6 +15,10 @@ export default function LibraryLayout() {
|
||||
<Stack
|
||||
screenOptions={({ route }) => ({
|
||||
...baseOptions,
|
||||
...(Platform.OS === "android" &&
|
||||
(route.name === "album/[id]" || route.name === "playlist/[id]")
|
||||
? { animation: "none" as const }
|
||||
: {}),
|
||||
title: tabStackScreenTitles[route.name] ?? "Library",
|
||||
headerRight:
|
||||
route.name === "index" ? () => <ProfileHeaderButton /> : undefined,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Stack } from "expo-router"
|
||||
import { Platform } from "react-native"
|
||||
|
||||
import { ProfileHeaderButton } from "@/components/profile-header-button"
|
||||
import { tabStackScreenTitles, useStackScreenOptions } from "@/lib/navigation"
|
||||
@@ -14,6 +15,10 @@ export default function SearchLayout() {
|
||||
<Stack
|
||||
screenOptions={({ route }) => ({
|
||||
...baseOptions,
|
||||
...(Platform.OS === "android" &&
|
||||
(route.name === "album/[id]" || route.name === "playlist/[id]")
|
||||
? { animation: "none" as const }
|
||||
: {}),
|
||||
title: tabStackScreenTitles[route.name] ?? "Search",
|
||||
headerRight:
|
||||
route.name === "index" ? () => <ProfileHeaderButton /> : undefined,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { Platform } from "react-native"
|
||||
import { useThemeColors } from "@/lib/theme"
|
||||
import { Stack } from "expo-router"
|
||||
import { useCallback } from "react"
|
||||
|
||||
@@ -5,6 +7,7 @@ import { SearchResults } from "@/components/search-results"
|
||||
import { useDebouncedSearch } from "@/hooks/use-debounced-search"
|
||||
|
||||
export default function SearchScreen() {
|
||||
const colors = useThemeColors()
|
||||
const { searchQuery, onQueryChange, onSearchSubmit } = useDebouncedSearch()
|
||||
|
||||
const handleChangeText = useCallback(
|
||||
@@ -21,6 +24,15 @@ export default function SearchScreen() {
|
||||
onChangeText={handleChangeText}
|
||||
onSearchButtonPress={onSearchSubmit}
|
||||
autoCapitalize="none"
|
||||
{...(Platform.OS === "android"
|
||||
? {
|
||||
barTintColor: colors.background,
|
||||
textColor: colors.foreground,
|
||||
tintColor: colors.primary,
|
||||
hintTextColor: colors.mutedForeground,
|
||||
headerIconColor: colors.foreground,
|
||||
}
|
||||
: {})}
|
||||
/>
|
||||
|
||||
<SearchResults searchQuery={searchQuery} />
|
||||
|
||||
@@ -66,7 +66,8 @@ export default function AppLayout() {
|
||||
<Stack.Screen
|
||||
name="settings"
|
||||
options={{
|
||||
headerShown: false,
|
||||
headerShown: Platform.OS === "android",
|
||||
title: "Settings",
|
||||
presentation:
|
||||
Platform.OS === "ios" ? "modal" : "fullScreenModal",
|
||||
animation: "slide_from_bottom",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NavigationBar } from "expo-navigation-bar"
|
||||
import { MusicEntityView } from "@/components/music-entity-view"
|
||||
import { useRouter } from "expo-router"
|
||||
import { Stack, useRouter } from "expo-router"
|
||||
import * as Haptics from "expo-haptics"
|
||||
import { StatusBar } from "expo-status-bar"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
@@ -29,6 +30,7 @@ import { api } from "@otunes/convex/_generated/api"
|
||||
import { playbackFormat } from "@otunes/convex/playback-stream"
|
||||
|
||||
import { AudioFormatBadge } from "@/components/audio-format-badge"
|
||||
import { AudioOutputButton } from "@/components/audio-output-button"
|
||||
import { CoverImage } from "@/components/cover-image"
|
||||
import { MarqueeText } from "@/components/marquee-text"
|
||||
import {
|
||||
@@ -47,6 +49,7 @@ import { useServerConfig } from "@/contexts/server-config"
|
||||
import { useCachedQuery } from "@/hooks/use-cached-query"
|
||||
import { useCoverPalette } from "@/hooks/use-cover-palette"
|
||||
import { useMediaMenuActions } from "@/hooks/use-media-menu-actions"
|
||||
import { useSystemVolume } from "@/hooks/use-system-volume"
|
||||
import { formatDuration, formatRemainingDuration } from "@/lib/format"
|
||||
import {
|
||||
nowPlayingColors,
|
||||
@@ -80,14 +83,13 @@ export default function PlayerScreen() {
|
||||
repeatEnabled,
|
||||
currentTime,
|
||||
duration,
|
||||
volume,
|
||||
queueSongIds,
|
||||
setIsPlaying,
|
||||
setVolume,
|
||||
seekTo,
|
||||
skipNext,
|
||||
skipPrevious,
|
||||
} = usePlayback()
|
||||
const { volume, setVolume, available: volumeAvailable } = useSystemVolume()
|
||||
const [showQueue, setShowQueue] = useState(false)
|
||||
const [stageHeight, setStageHeight] = useState(0)
|
||||
const [scrubTime, setScrubTime] = useState<number | null>(null)
|
||||
@@ -216,6 +218,14 @@ export default function PlayerScreen() {
|
||||
return (
|
||||
<Animated.View style={[styles.root, backgroundStyle, dismissStyle]}>
|
||||
<StatusBar style={colors.isDark ? "light" : "dark"} />
|
||||
{Platform.OS === "android" ? (
|
||||
<>
|
||||
<Stack.Screen
|
||||
options={{ statusBarStyle: colors.isDark ? "light" : "dark" }}
|
||||
/>
|
||||
<NavigationBar style={colors.isDark ? "light" : "dark"} />
|
||||
</>
|
||||
) : null}
|
||||
|
||||
<MusicEntityView
|
||||
kind="song"
|
||||
@@ -377,31 +387,34 @@ export default function PlayerScreen() {
|
||||
</TransportButton>
|
||||
</View>
|
||||
|
||||
<PlayerSlider
|
||||
accessibilityLabel="Volume"
|
||||
value={volume}
|
||||
maximumValue={1}
|
||||
fillColor={colors.sliderFill}
|
||||
activeFillColor={colors.foreground}
|
||||
trackColor={colors.sliderTrack}
|
||||
onValueChange={setVolume}
|
||||
leading={
|
||||
<PlayerSymbol
|
||||
name="speaker.fill"
|
||||
fallback="volume-low"
|
||||
size={14}
|
||||
color={colors.secondaryForeground}
|
||||
/>
|
||||
}
|
||||
trailing={
|
||||
<PlayerSymbol
|
||||
name="speaker.wave.3.fill"
|
||||
fallback="volume-high"
|
||||
size={14}
|
||||
color={colors.secondaryForeground}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
{volumeAvailable ? (
|
||||
<PlayerSlider
|
||||
accessibilityLabel="Volume"
|
||||
commitHoldMs={0}
|
||||
value={volume}
|
||||
maximumValue={1}
|
||||
fillColor={colors.sliderFill}
|
||||
activeFillColor={colors.foreground}
|
||||
trackColor={colors.sliderTrack}
|
||||
onValueChange={setVolume}
|
||||
leading={
|
||||
<PlayerSymbol
|
||||
name="speaker.fill"
|
||||
fallback="volume-low"
|
||||
size={14}
|
||||
color={colors.secondaryForeground}
|
||||
/>
|
||||
}
|
||||
trailing={
|
||||
<PlayerSymbol
|
||||
name="speaker.wave.3.fill"
|
||||
fallback="volume-high"
|
||||
size={14}
|
||||
color={colors.secondaryForeground}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
<View style={styles.footer}>
|
||||
<Pressable
|
||||
@@ -419,21 +432,10 @@ export default function PlayerScreen() {
|
||||
color={colors.foreground}
|
||||
/>
|
||||
</Pressable>
|
||||
<Pressable
|
||||
disabled
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={Platform.OS === "ios" ? "AirPlay" : "Cast"}
|
||||
accessibilityState={{ disabled: true }}
|
||||
style={[styles.queueButton, styles.unavailable]}
|
||||
>
|
||||
<PlayerSymbol
|
||||
name="airplay.audio"
|
||||
fallback={{ material: "cast" }}
|
||||
size={27}
|
||||
weight="semibold"
|
||||
color={colors.foreground}
|
||||
/>
|
||||
</Pressable>
|
||||
<AudioOutputButton
|
||||
color={colors.foreground}
|
||||
style={styles.queueButton}
|
||||
/>
|
||||
<Pressable
|
||||
onPress={toggleQueue}
|
||||
hitSlop={8}
|
||||
|
||||
@@ -1 +1,16 @@
|
||||
export { default } from "./(tabs)/home/settings"
|
||||
import { Platform } from "react-native"
|
||||
import { SafeAreaView } from "react-native-safe-area-context"
|
||||
|
||||
import SettingsScreen from "./(tabs)/home/settings"
|
||||
|
||||
export default function Settings() {
|
||||
if (Platform.OS !== "android") return <SettingsScreen />
|
||||
return (
|
||||
<SafeAreaView
|
||||
edges={["bottom", "left", "right"]}
|
||||
style={{ flex: 1, backgroundColor: "#000" }}
|
||||
>
|
||||
<SettingsScreen />
|
||||
</SafeAreaView>
|
||||
)
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useConvexAuth } from "@convex-dev/auth/react"
|
||||
import { DarkTheme, Stack, ThemeProvider } from "expo-router"
|
||||
import { StatusBar } from "expo-status-bar"
|
||||
import { useColorScheme } from "react-native"
|
||||
import { useIsDark } from "@/lib/theme"
|
||||
import { GestureHandlerRootView } from "react-native-gesture-handler"
|
||||
import { SafeAreaProvider } from "react-native-safe-area-context"
|
||||
|
||||
@@ -47,14 +47,14 @@ function RootNavigator() {
|
||||
}
|
||||
|
||||
export default function RootLayout() {
|
||||
const colorScheme = useColorScheme()
|
||||
const isDark = useIsDark()
|
||||
|
||||
return (
|
||||
<GestureHandlerRootView style={{ flex: 1, backgroundColor: "#000" }}>
|
||||
<SafeAreaProvider>
|
||||
<ServerConfigProvider>
|
||||
<ConvexAppProvider>
|
||||
<StatusBar style={colorScheme === "dark" ? "light" : "dark"} />
|
||||
<StatusBar style={isDark ? "light" : "dark"} />
|
||||
<ThemeProvider value={navigationTheme}>
|
||||
<RootNavigator />
|
||||
</ThemeProvider>
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import { useState } from "react"
|
||||
import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
} from "react-native"
|
||||
import { StyleSheet, Text, View } from "react-native"
|
||||
import { SafeAreaView } from "react-native-safe-area-context"
|
||||
|
||||
import { KeyboardForm } from "@/components/keyboard-form"
|
||||
|
||||
import { Button, Card, Input } from "@/components/ui/primitives"
|
||||
import { useServerConfig } from "@/contexts/server-config"
|
||||
import { spacing, useThemeColors } from "@/lib/theme"
|
||||
@@ -41,10 +37,7 @@ export default function ServerScreen() {
|
||||
|
||||
return (
|
||||
<SafeAreaView style={[styles.safe, { backgroundColor: colors.background }]}>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === "ios" ? "padding" : undefined}
|
||||
style={styles.container}
|
||||
>
|
||||
<KeyboardForm style={styles.container}>
|
||||
<View style={styles.hero}>
|
||||
<Text style={[styles.brand, { color: colors.foreground }]}>
|
||||
oTunes
|
||||
@@ -82,7 +75,7 @@ export default function ServerScreen() {
|
||||
onPress={() => void handleContinue()}
|
||||
/>
|
||||
</Card>
|
||||
</KeyboardAvoidingView>
|
||||
</KeyboardForm>
|
||||
</SafeAreaView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import type { PropsWithChildren } from "react"
|
||||
import { KeyboardAvoidingView, Platform } from "react-native"
|
||||
import { SafeAreaView } from "react-native-safe-area-context"
|
||||
|
||||
/** RN modals have their own window; protect their actions from navigation and IME. */
|
||||
export function AndroidSheet({ children }: PropsWithChildren) {
|
||||
if (Platform.OS !== "android") return children
|
||||
return (
|
||||
<KeyboardAvoidingView behavior="height" style={{ flex: 1 }}>
|
||||
<SafeAreaView edges={["bottom", "left", "right"]} style={{ flex: 1 }}>
|
||||
{children}
|
||||
</SafeAreaView>
|
||||
</KeyboardAvoidingView>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import {
|
||||
requireNativeView,
|
||||
requireOptionalNativeModule,
|
||||
type NativeModule,
|
||||
} from "expo"
|
||||
import {
|
||||
Platform,
|
||||
Pressable,
|
||||
type StyleProp,
|
||||
type ViewProps,
|
||||
type ViewStyle,
|
||||
} from "react-native"
|
||||
|
||||
import { PlayerSymbol } from "@/components/player-symbol"
|
||||
import { showError } from "@/lib/toast"
|
||||
|
||||
type AudioOutputModule = NativeModule & {
|
||||
showPicker: () => Promise<boolean>
|
||||
}
|
||||
|
||||
const audioOutput =
|
||||
requireOptionalNativeModule<AudioOutputModule>("AudioOutput")
|
||||
const AirPlayPicker =
|
||||
Platform.OS === "ios" && audioOutput
|
||||
? requireNativeView<ViewProps & { tint: string }>("AudioOutput")
|
||||
: null
|
||||
|
||||
export function AudioOutputButton({
|
||||
color,
|
||||
style,
|
||||
}: {
|
||||
color: string
|
||||
style: StyleProp<ViewStyle>
|
||||
}) {
|
||||
if (AirPlayPicker) {
|
||||
return <AirPlayPicker tint={color} style={style} />
|
||||
}
|
||||
|
||||
const available =
|
||||
Platform.OS === "android" && Platform.Version >= 33 && audioOutput !== null
|
||||
|
||||
async function showPicker() {
|
||||
try {
|
||||
if (!(await audioOutput?.showPicker())) {
|
||||
showError("Audio output selection is unavailable on this device.")
|
||||
}
|
||||
} catch {
|
||||
showError("Audio output selection could not be opened.")
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
onPress={showPicker}
|
||||
disabled={!available}
|
||||
hitSlop={8}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={Platform.OS === "ios" ? "AirPlay" : "Audio output"}
|
||||
accessibilityState={{ disabled: !available }}
|
||||
style={[style, !available && { opacity: 0.35 }]}
|
||||
>
|
||||
<PlayerSymbol
|
||||
name="airplay.audio"
|
||||
fallback={{ material: "cast" }}
|
||||
size={27}
|
||||
weight="semibold"
|
||||
color={color}
|
||||
/>
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
@@ -2,16 +2,11 @@ import { useAuthActions } from "@convex-dev/auth/react"
|
||||
import { Link } from "expo-router"
|
||||
import { useQuery } from "convex/react"
|
||||
import { useState } from "react"
|
||||
import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
Pressable,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
} from "react-native"
|
||||
import { Pressable, StyleSheet, Text, View } from "react-native"
|
||||
import { SafeAreaView } from "react-native-safe-area-context"
|
||||
|
||||
import { KeyboardForm } from "@/components/keyboard-form"
|
||||
|
||||
import { Button, Card, Input } from "@/components/ui/primitives"
|
||||
import { useServerConfig } from "@/contexts/server-config"
|
||||
import { api } from "@otunes/convex/_generated/api"
|
||||
@@ -92,14 +87,15 @@ export function AuthForm({ flow }: { flow: AuthFlow }) {
|
||||
|
||||
return (
|
||||
<SafeAreaView style={[styles.safe, { backgroundColor: colors.background }]}>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === "ios" ? "padding" : undefined}
|
||||
style={styles.container}
|
||||
>
|
||||
<KeyboardForm style={styles.container}>
|
||||
<Card>
|
||||
<View style={styles.header}>
|
||||
<Text style={[styles.title, { color: colors.foreground }]}>{text.title}</Text>
|
||||
<Text style={[styles.description, { color: colors.mutedForeground }]}>
|
||||
<Text style={[styles.title, { color: colors.foreground }]}>
|
||||
{text.title}
|
||||
</Text>
|
||||
<Text
|
||||
style={[styles.description, { color: colors.mutedForeground }]}
|
||||
>
|
||||
{text.description}
|
||||
</Text>
|
||||
{config ? (
|
||||
@@ -111,8 +107,8 @@ export function AuthForm({ flow }: { flow: AuthFlow }) {
|
||||
|
||||
{signupsDisabled ? (
|
||||
<Text style={{ color: colors.mutedForeground }}>
|
||||
New account registration is currently disabled. Contact an administrator if you need
|
||||
access.
|
||||
New account registration is currently disabled. Contact an
|
||||
administrator if you need access.
|
||||
</Text>
|
||||
) : (
|
||||
<View style={styles.form}>
|
||||
@@ -137,16 +133,28 @@ export function AuthForm({ flow }: { flow: AuthFlow }) {
|
||||
onChangeText={setPassword}
|
||||
placeholder="Password"
|
||||
secureTextEntry
|
||||
autoComplete={flow === "signIn" ? "current-password" : "new-password"}
|
||||
autoComplete={
|
||||
flow === "signIn" ? "current-password" : "new-password"
|
||||
}
|
||||
/>
|
||||
{error ? (
|
||||
<Text style={{ color: colors.destructive }}>{error}</Text>
|
||||
) : null}
|
||||
<Button
|
||||
title={text.submit}
|
||||
loading={submitting}
|
||||
onPress={() => void handleSubmit()}
|
||||
/>
|
||||
{error ? <Text style={{ color: colors.destructive }}>{error}</Text> : null}
|
||||
<Button title={text.submit} loading={submitting} onPress={() => void handleSubmit()} />
|
||||
{!hideSignUpLink ? (
|
||||
<View style={styles.switchRow}>
|
||||
<Text style={{ color: colors.mutedForeground }}>{text.switchPrompt} </Text>
|
||||
<Text style={{ color: colors.mutedForeground }}>
|
||||
{text.switchPrompt}{" "}
|
||||
</Text>
|
||||
<Link href={text.switchHref} asChild>
|
||||
<Pressable>
|
||||
<Text style={{ color: colors.foreground, fontWeight: "600" }}>
|
||||
<Text
|
||||
style={{ color: colors.foreground, fontWeight: "600" }}
|
||||
>
|
||||
{text.switchLabel}
|
||||
</Text>
|
||||
</Pressable>
|
||||
@@ -167,7 +175,7 @@ export function AuthForm({ flow }: { flow: AuthFlow }) {
|
||||
>
|
||||
<Text style={{ color: colors.mutedForeground }}>Change server</Text>
|
||||
</Pressable>
|
||||
</KeyboardAvoidingView>
|
||||
</KeyboardForm>
|
||||
</SafeAreaView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { PropsWithChildren } from "react"
|
||||
import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
ScrollView,
|
||||
type StyleProp,
|
||||
type ViewStyle,
|
||||
} from "react-native"
|
||||
|
||||
/** Android resizes for the IME; scrolling keeps tall forms and actions reachable. */
|
||||
export function KeyboardForm({
|
||||
children,
|
||||
style,
|
||||
}: PropsWithChildren<{ style?: StyleProp<ViewStyle> }>) {
|
||||
if (Platform.OS === "android") {
|
||||
return (
|
||||
<ScrollView
|
||||
style={{ flex: 1 }}
|
||||
contentContainerStyle={[style, { flex: undefined, flexGrow: 1 }]}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
keyboardDismissMode="on-drag"
|
||||
>
|
||||
{children}
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<KeyboardAvoidingView behavior="padding" style={style}>
|
||||
{children}
|
||||
</KeyboardAvoidingView>
|
||||
)
|
||||
}
|
||||
@@ -3,7 +3,9 @@ import { Ionicons } from "@expo/vector-icons"
|
||||
import { memo, useCallback, type ReactElement } from "react"
|
||||
import {
|
||||
FlatList,
|
||||
Platform,
|
||||
Pressable,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
@@ -33,6 +35,7 @@ import {
|
||||
export type MediaItem = BrowseAlbum | BrowseArtist | PlaylistSummary
|
||||
|
||||
const GRID_INITIAL_ROWS = 5
|
||||
const MAX_NON_VIRTUAL_CAROUSEL_ITEMS = 10
|
||||
|
||||
export const AlbumCard = memo(function AlbumCard({
|
||||
album,
|
||||
@@ -306,14 +309,30 @@ function ContentCarouselBody({
|
||||
/>
|
||||
) : null}
|
||||
</Pressable>
|
||||
<FlatList
|
||||
data={content}
|
||||
keyExtractor={mediaItemKey}
|
||||
renderItem={renderCarouselItem}
|
||||
horizontal
|
||||
showsHorizontalScrollIndicator={false}
|
||||
contentContainerStyle={styles.carouselContent}
|
||||
/>
|
||||
{Platform.OS === "android" &&
|
||||
content.length <= MAX_NON_VIRTUAL_CAROUSEL_ITEMS ? (
|
||||
<ScrollView
|
||||
horizontal
|
||||
style={styles.androidCarousel}
|
||||
showsHorizontalScrollIndicator={false}
|
||||
contentContainerStyle={styles.carouselContent}
|
||||
>
|
||||
{content.map((item) => (
|
||||
<View key={mediaItemKey(item)}>
|
||||
<CarouselCard item={item} width={carouselCardWidth} />
|
||||
</View>
|
||||
))}
|
||||
</ScrollView>
|
||||
) : (
|
||||
<FlatList
|
||||
data={content}
|
||||
keyExtractor={mediaItemKey}
|
||||
renderItem={renderCarouselItem}
|
||||
horizontal
|
||||
showsHorizontalScrollIndicator={false}
|
||||
contentContainerStyle={styles.carouselContent}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -343,6 +362,10 @@ const styles = StyleSheet.create({
|
||||
fontSize: 22,
|
||||
fontWeight: "700",
|
||||
},
|
||||
androidCarousel: {
|
||||
// Horizontal lists should measure their cards, not stretch the Home sections.
|
||||
flexGrow: 0,
|
||||
},
|
||||
carouselContent: {
|
||||
gap: spacing.md,
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { MenuView, type MenuAction } from "@expo/ui/community/menu"
|
||||
import type { MenuAction } from "@expo/ui/community/menu"
|
||||
import { MenuView } from "@/components/media-menu"
|
||||
import { requireNativeView } from "expo"
|
||||
import type { ComponentType, ReactNode } from "react"
|
||||
import {
|
||||
@@ -171,8 +172,7 @@ export function buildMediaMenuActions(
|
||||
actions.push({
|
||||
id: item.action,
|
||||
title: item.label(countSuffix, favorited, playlistLabel),
|
||||
image:
|
||||
item.action === "favorite" && favorited ? "star.fill" : item.image,
|
||||
image: item.action === "favorite" && favorited ? "star.fill" : item.image,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
import { Ionicons } from "@expo/vector-icons"
|
||||
import type { ComponentProps } from "react"
|
||||
import type { MediaAction } from "@/components/media-context-menu"
|
||||
import type { MenuComponentProps } from "@expo/ui/community/menu"
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuItem,
|
||||
Host,
|
||||
RNHostView,
|
||||
Text,
|
||||
} from "@expo/ui/jetpack-compose"
|
||||
import { useState } from "react"
|
||||
import { Pressable, View } from "react-native"
|
||||
import { Gesture, GestureDetector } from "react-native-gesture-handler"
|
||||
|
||||
import { appleMusic } from "@/lib/theme"
|
||||
|
||||
const actionIcons = {
|
||||
share: "share-outline",
|
||||
playlist: "list-outline",
|
||||
"play-next": "play-forward-outline",
|
||||
"play-last": "list",
|
||||
shuffle: "shuffle",
|
||||
"create-station": "radio-outline",
|
||||
favorite: "star-outline",
|
||||
"go-artist": "person-outline",
|
||||
"go-album": "disc-outline",
|
||||
"delete-playlist": "trash-outline",
|
||||
} satisfies Record<MediaAction, ComponentProps<typeof Ionicons>["name"]>
|
||||
|
||||
// The community MenuView creates a dynamic-color Host internally. Own this
|
||||
// Android host so menus use the same fixed palette as the rest of the app.
|
||||
export function MenuView({
|
||||
actions,
|
||||
children,
|
||||
style,
|
||||
shouldOpenOnLongPress,
|
||||
onPressAction,
|
||||
}: MenuComponentProps) {
|
||||
const [expanded, setExpanded] = useState(false)
|
||||
const longPress = Gesture.LongPress()
|
||||
.runOnJS(true)
|
||||
.onStart(() => setExpanded(true))
|
||||
return (
|
||||
<View style={style}>
|
||||
<Host
|
||||
colorScheme="dark"
|
||||
seedColor={appleMusic.pink}
|
||||
colorOverrides={{
|
||||
primary: appleMusic.pink,
|
||||
onPrimary: "#FFFFFF",
|
||||
surface: "#000000",
|
||||
onSurface: "#FFFFFF",
|
||||
onSurfaceVariant: "#FFFFFF",
|
||||
surfaceContainer: "#1C1C1E",
|
||||
surfaceContainerHigh: "#1C1C1E",
|
||||
surfaceTint: "#000000",
|
||||
outline: "#545458",
|
||||
outlineVariant: "#545458",
|
||||
error: "#FF453A",
|
||||
}}
|
||||
matchContents
|
||||
>
|
||||
<DropdownMenu
|
||||
expanded={expanded}
|
||||
onDismissRequest={() => setExpanded(false)}
|
||||
color={appleMusic.elevated}
|
||||
cornerRadius={4}
|
||||
shadowElevation={0}
|
||||
properties={{ clippingEnabled: false }}
|
||||
>
|
||||
<DropdownMenu.Trigger>
|
||||
<RNHostView matchContents>
|
||||
{shouldOpenOnLongPress ? (
|
||||
<GestureDetector gesture={longPress}>
|
||||
<View collapsable={false}>{children}</View>
|
||||
</GestureDetector>
|
||||
) : (
|
||||
<Pressable
|
||||
onPress={() => setExpanded(true)}
|
||||
accessible={false}
|
||||
focusable={false}
|
||||
android_disableSound
|
||||
>
|
||||
<View pointerEvents="none">{children}</View>
|
||||
</Pressable>
|
||||
)}
|
||||
</RNHostView>
|
||||
</DropdownMenu.Trigger>
|
||||
<DropdownMenu.Items>
|
||||
{actions
|
||||
.filter((action) => !action.attributes?.hidden)
|
||||
.map((action) => (
|
||||
<DropdownMenuItem
|
||||
key={action.id ?? action.title}
|
||||
enabled={!action.attributes?.disabled}
|
||||
elementColors={{
|
||||
textColor: action.attributes?.destructive
|
||||
? "#FF453A"
|
||||
: "#FFFFFF",
|
||||
}}
|
||||
onClick={() => {
|
||||
setExpanded(false)
|
||||
onPressAction?.({
|
||||
nativeEvent: { event: action.id ?? action.title },
|
||||
})
|
||||
}}
|
||||
>
|
||||
<DropdownMenuItem.LeadingIcon>
|
||||
<RNHostView matchContents>
|
||||
<Ionicons
|
||||
name={
|
||||
action.id === "favorite" &&
|
||||
action.image === "star.fill"
|
||||
? "star"
|
||||
: (actionIcons[action.id as MediaAction] ??
|
||||
"ellipsis-horizontal")
|
||||
}
|
||||
size={20}
|
||||
color={
|
||||
action.attributes?.destructive ? "#FF453A" : "#FFFFFF"
|
||||
}
|
||||
accessible={false}
|
||||
/>
|
||||
</RNHostView>
|
||||
</DropdownMenuItem.LeadingIcon>
|
||||
<DropdownMenuItem.Text>
|
||||
<Text>{action.title}</Text>
|
||||
</DropdownMenuItem.Text>
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenu.Items>
|
||||
</DropdownMenu>
|
||||
</Host>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { MenuView } from "@expo/ui/community/menu"
|
||||
@@ -1,20 +1,20 @@
|
||||
import {
|
||||
useAndroidTabPalette,
|
||||
useAndroidTabHasArtworkPalette,
|
||||
} from "@/contexts/android-tab-theme"
|
||||
import { Ionicons } from "@expo/vector-icons"
|
||||
import { NativeTabs } from "expo-router/native-tabs"
|
||||
import { useRouter } from "expo-router"
|
||||
import { Platform, Pressable, StyleSheet, Text, View } from "react-native"
|
||||
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
|
||||
import { CoverImage } from "@/components/cover-image"
|
||||
|
||||
import { usePlaybackActions, usePlaybackQueue } from "@/contexts/playback"
|
||||
import { useServerConfig } from "@/contexts/server-config"
|
||||
import { albumCoverUrl } from "@/lib/urls"
|
||||
import {
|
||||
miniPlayerHeight,
|
||||
tabBarHeight,
|
||||
useBlurTint,
|
||||
useMiniPlayerBackground,
|
||||
useThemeColors,
|
||||
} from "@/lib/theme"
|
||||
import { miniPlayerHeight, tabBarHeight, useThemeColors } from "@/lib/theme"
|
||||
|
||||
function MiniPlayerContent({
|
||||
placement,
|
||||
@@ -25,10 +25,19 @@ function MiniPlayerContent({
|
||||
variant: "bar" | "accessory"
|
||||
onOpenPlayer: () => void
|
||||
}) {
|
||||
const colors = useThemeColors()
|
||||
const theme = useThemeColors()
|
||||
const palette = useAndroidTabPalette()
|
||||
const colors =
|
||||
Platform.OS === "android"
|
||||
? {
|
||||
...theme,
|
||||
foreground: palette.foreground,
|
||||
mutedForeground: palette.secondaryForeground,
|
||||
}
|
||||
: theme
|
||||
const { config } = useServerConfig()
|
||||
const { currentSong, isPlaying } = usePlaybackQueue()
|
||||
const { setIsPlaying, skipNext } = usePlaybackActions()
|
||||
const { setIsPlaying, skipNext, skipPrevious } = usePlaybackActions()
|
||||
|
||||
if (!currentSong || !config) {
|
||||
return null
|
||||
@@ -112,6 +121,20 @@ function MiniPlayerContent({
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.controls}>
|
||||
{Platform.OS === "android" && !isAccessory ? (
|
||||
<Pressable
|
||||
style={styles.controlButton}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel="Previous track"
|
||||
onPress={(event) => {
|
||||
event.stopPropagation()
|
||||
void skipPrevious()
|
||||
}}
|
||||
hitSlop={6}
|
||||
>
|
||||
<Ionicons name="play-back" size={24} color={colors.foreground} />
|
||||
</Pressable>
|
||||
) : null}
|
||||
<Pressable
|
||||
style={styles.controlButton}
|
||||
onPress={(event) => {
|
||||
@@ -142,13 +165,28 @@ function MiniPlayerContent({
|
||||
}
|
||||
|
||||
function MiniPlayerChrome({ children }: { children: React.ReactNode }) {
|
||||
const colors = useThemeColors()
|
||||
const backgroundColor = useMiniPlayerBackground()
|
||||
const palette = useAndroidTabPalette()
|
||||
const hasArtworkPalette = useAndroidTabHasArtworkPalette()
|
||||
|
||||
return (
|
||||
<View style={[styles.androidBar, { backgroundColor }]}>
|
||||
<View style={[styles.topBorder, { backgroundColor: colors.border }]} />
|
||||
<View style={[styles.androidBar, { backgroundColor: palette.background }]}>
|
||||
{children}
|
||||
{hasArtworkPalette ? (
|
||||
<View
|
||||
style={[
|
||||
styles.separator,
|
||||
styles.topBorder,
|
||||
{ backgroundColor: palette.secondaryForeground },
|
||||
]}
|
||||
/>
|
||||
) : null}
|
||||
<View
|
||||
style={[
|
||||
styles.separator,
|
||||
styles.bottomBorder,
|
||||
{ backgroundColor: palette.secondaryForeground },
|
||||
]}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -178,43 +216,31 @@ export function TabBottomAccessory() {
|
||||
|
||||
return content
|
||||
}
|
||||
//
|
||||
// function useFloatingMiniPlayerLayout() {
|
||||
// const segments = useSegments() as string[]
|
||||
// const insets = useSafeAreaInsets()
|
||||
//
|
||||
// const onPlayerModal = segments.includes("player")
|
||||
// const onAuthFlow =
|
||||
// segments.includes("signin") ||
|
||||
// segments.includes("signup") ||
|
||||
// segments.includes("server")
|
||||
// const onTabs = segments.includes("(tabs)")
|
||||
//
|
||||
// const bottom = insets.bottom + (onTabs ? 0 : 0)
|
||||
//
|
||||
// return {
|
||||
// bottom,
|
||||
// hidden: onPlayerModal || onAuthFlow || onTabs,
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// export function FloatingMiniPlayer() {
|
||||
// const router = useRouter()
|
||||
// const { bottom, hidden } = useFloatingMiniPlayerLayout()
|
||||
// const { currentSong, queueSongIds } = usePlayback()
|
||||
//
|
||||
// if (hidden || !currentSong || queueSongIds.length === 0) {
|
||||
// return null
|
||||
// }
|
||||
//
|
||||
// return (
|
||||
// <View pointerEvents="box-none" style={[styles.floatingContainer, { bottom }]}>
|
||||
// <MiniPlayerChrome>
|
||||
// <MiniPlayerContent onOpenPlayer={() => router.push("/player")} />
|
||||
// </MiniPlayerChrome>
|
||||
// </View>
|
||||
// )
|
||||
// }
|
||||
/** NativeTabs.BottomAccessory only renders on iOS. */
|
||||
export function AndroidMiniPlayer() {
|
||||
const router = useRouter()
|
||||
const insets = useSafeAreaInsets()
|
||||
const { currentSong, queueSongIds } = usePlaybackQueue()
|
||||
if (Platform.OS !== "android" || !currentSong || queueSongIds.length === 0) {
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<View
|
||||
style={[
|
||||
styles.floatingContainer,
|
||||
{ bottom: tabBarHeight + insets.bottom },
|
||||
]}
|
||||
>
|
||||
<MiniPlayerChrome>
|
||||
<MiniPlayerContent
|
||||
placement="regular"
|
||||
variant="bar"
|
||||
onOpenPlayer={() => router.push("/player")}
|
||||
/>
|
||||
</MiniPlayerChrome>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
floatingContainer: {
|
||||
@@ -234,9 +260,15 @@ const styles = StyleSheet.create({
|
||||
androidBar: {
|
||||
overflow: "hidden",
|
||||
},
|
||||
topBorder: {
|
||||
height: StyleSheet.hairlineWidth,
|
||||
separator: {
|
||||
position: "absolute",
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: 1,
|
||||
zIndex: 1,
|
||||
},
|
||||
topBorder: { top: 0 },
|
||||
bottomBorder: { bottom: 0 },
|
||||
content: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
|
||||
@@ -34,6 +34,7 @@ export function PlayerSlider({
|
||||
leading,
|
||||
trailing,
|
||||
accessibilityLabel,
|
||||
commitHoldMs = COMMIT_HOLD_MS,
|
||||
}: {
|
||||
value: number
|
||||
maximumValue: number
|
||||
@@ -46,6 +47,8 @@ export function PlayerSlider({
|
||||
leading?: ReactNode
|
||||
trailing?: ReactNode
|
||||
accessibilityLabel: string
|
||||
/** Seeking needs a hold while playback catches up; system volume does not. */
|
||||
commitHoldMs?: number
|
||||
}) {
|
||||
const max = maximumValue > 0 ? maximumValue : 1
|
||||
const fraction = useSharedValue(clamp(value / max))
|
||||
@@ -64,16 +67,28 @@ export function PlayerSlider({
|
||||
onValueChange,
|
||||
onSlidingStart,
|
||||
onSlidingComplete,
|
||||
value,
|
||||
commitHoldMs,
|
||||
max,
|
||||
})
|
||||
callbacks.current = { onValueChange, onSlidingStart, onSlidingComplete, max }
|
||||
callbacks.current = {
|
||||
onValueChange,
|
||||
onSlidingStart,
|
||||
onSlidingComplete,
|
||||
value,
|
||||
commitHoldMs,
|
||||
max,
|
||||
}
|
||||
|
||||
const gesture = useMemo(() => {
|
||||
const start = () => callbacks.current.onSlidingStart?.()
|
||||
const change = (next: number) =>
|
||||
callbacks.current.onValueChange?.(next * callbacks.current.max)
|
||||
const complete = (next: number) => {
|
||||
holdUntil.current = Date.now() + COMMIT_HOLD_MS
|
||||
holdUntil.current = Date.now() + callbacks.current.commitHoldMs
|
||||
if (callbacks.current.commitHoldMs === 0) {
|
||||
fraction.value = clamp(callbacks.current.value / callbacks.current.max)
|
||||
}
|
||||
callbacks.current.onSlidingComplete?.(next * callbacks.current.max)
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { formatDuration } from "@/lib/format"
|
||||
import { albumCoverUrl } from "@/lib/urls"
|
||||
import { miniPlayerHeight, spacing, useThemeColors } from "@/lib/theme"
|
||||
import { memo, useCallback } from "react"
|
||||
import { Pressable, StyleSheet, Text, View } from "react-native"
|
||||
import { Platform, Pressable, StyleSheet, Text, View } from "react-native"
|
||||
|
||||
import {
|
||||
MediaContextMenu,
|
||||
@@ -155,7 +155,8 @@ export const SongListRow = memo(function SongListRow({
|
||||
})
|
||||
|
||||
export const tabContentBottomInset = spacing.lg
|
||||
export const contentBottomInset = miniPlayerHeight + spacing.lg
|
||||
export const contentBottomInset =
|
||||
Platform.OS === "android" ? spacing.lg : miniPlayerHeight + spacing.lg
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
row: {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Platform,
|
||||
Pressable,
|
||||
PressableProps,
|
||||
StyleProp,
|
||||
@@ -85,6 +86,13 @@ export function Input({ style, ...props }: TextInputProps) {
|
||||
return (
|
||||
<TextInput
|
||||
{...props}
|
||||
{...(Platform.OS === "android"
|
||||
? {
|
||||
selectionColor: colors.primary,
|
||||
cursorColor: colors.primary,
|
||||
selectionHandleColor: colors.primary,
|
||||
}
|
||||
: {})}
|
||||
placeholderTextColor={colors.mutedForeground}
|
||||
style={[
|
||||
styles.input,
|
||||
@@ -102,7 +110,12 @@ export function Input({ style, ...props }: TextInputProps) {
|
||||
export function Card({ children }: { children: React.ReactNode }) {
|
||||
const colors = useThemeColors()
|
||||
return (
|
||||
<View style={[styles.card, { backgroundColor: colors.card, borderColor: colors.border }]}>
|
||||
<View
|
||||
style={[
|
||||
styles.card,
|
||||
{ backgroundColor: colors.card, borderColor: colors.border },
|
||||
]}
|
||||
>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import { Toaster as SonnerToaster } from "sonner-native"
|
||||
import { useColorScheme } from "react-native"
|
||||
|
||||
import { colors, radius } from "@/lib/theme"
|
||||
import { radius, useIsDark, useThemeColors } from "@/lib/theme"
|
||||
|
||||
export function Toaster() {
|
||||
const scheme = useColorScheme()
|
||||
const themeColors = scheme === "dark" ? colors.dark : colors.light
|
||||
const isDark = useIsDark()
|
||||
const themeColors = useThemeColors()
|
||||
|
||||
return (
|
||||
<SonnerToaster
|
||||
position="top-center"
|
||||
theme={scheme === "dark" ? "dark" : "light"}
|
||||
theme={isDark ? "dark" : "light"}
|
||||
toastOptions={{
|
||||
style: {
|
||||
backgroundColor: themeColors.card,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { AndroidSheet } from "@/components/android-sheet"
|
||||
import { useConvex, useMutation } from "convex/react"
|
||||
import {
|
||||
createContext,
|
||||
@@ -246,51 +247,53 @@ export function AddToPlaylistProvider({ children }: { children: ReactNode }) {
|
||||
transparent
|
||||
onRequestClose={closeAddToPlaylist}
|
||||
>
|
||||
<Pressable style={styles.overlay} onPress={closeAddToPlaylist}>
|
||||
<Pressable
|
||||
style={[
|
||||
styles.sheet,
|
||||
{ backgroundColor: colors.card, borderColor: colors.border },
|
||||
]}
|
||||
onPress={(event) => event.stopPropagation()}
|
||||
>
|
||||
<Text style={[styles.title, { color: colors.foreground }]}>
|
||||
Add to Playlist
|
||||
</Text>
|
||||
<FlatList
|
||||
style={styles.list}
|
||||
data={ownedPlaylists ?? []}
|
||||
keyExtractor={(playlist) => playlist.id}
|
||||
renderItem={({
|
||||
item: playlist,
|
||||
}: {
|
||||
item: OwnedPlaylistForAdd
|
||||
}) => (
|
||||
<Pressable
|
||||
style={styles.row}
|
||||
disabled={addingToPlaylistId !== null}
|
||||
onPress={() =>
|
||||
void handleAddToPlaylist(playlist.id, playlist.songIds)
|
||||
}
|
||||
>
|
||||
<Text style={{ color: colors.foreground }}>
|
||||
{playlist.title}
|
||||
</Text>
|
||||
</Pressable>
|
||||
)}
|
||||
/>
|
||||
<Button
|
||||
title="New Playlist"
|
||||
variant="secondary"
|
||||
onPress={() => {
|
||||
selectionRequestIdRef.current += 1
|
||||
setOpen(false)
|
||||
setNewPlaylistName("")
|
||||
setCreateOpen(true)
|
||||
}}
|
||||
/>
|
||||
<AndroidSheet>
|
||||
<Pressable style={styles.overlay} onPress={closeAddToPlaylist}>
|
||||
<Pressable
|
||||
style={[
|
||||
styles.sheet,
|
||||
{ backgroundColor: colors.card, borderColor: colors.border },
|
||||
]}
|
||||
onPress={(event) => event.stopPropagation()}
|
||||
>
|
||||
<Text style={[styles.title, { color: colors.foreground }]}>
|
||||
Add to Playlist
|
||||
</Text>
|
||||
<FlatList
|
||||
style={styles.list}
|
||||
data={ownedPlaylists ?? []}
|
||||
keyExtractor={(playlist) => playlist.id}
|
||||
renderItem={({
|
||||
item: playlist,
|
||||
}: {
|
||||
item: OwnedPlaylistForAdd
|
||||
}) => (
|
||||
<Pressable
|
||||
style={[styles.row, { borderBottomColor: colors.border }]}
|
||||
disabled={addingToPlaylistId !== null}
|
||||
onPress={() =>
|
||||
void handleAddToPlaylist(playlist.id, playlist.songIds)
|
||||
}
|
||||
>
|
||||
<Text style={{ color: colors.foreground }}>
|
||||
{playlist.title}
|
||||
</Text>
|
||||
</Pressable>
|
||||
)}
|
||||
/>
|
||||
<Button
|
||||
title="New Playlist"
|
||||
variant="secondary"
|
||||
onPress={() => {
|
||||
selectionRequestIdRef.current += 1
|
||||
setOpen(false)
|
||||
setNewPlaylistName("")
|
||||
setCreateOpen(true)
|
||||
}}
|
||||
/>
|
||||
</Pressable>
|
||||
</Pressable>
|
||||
</Pressable>
|
||||
</AndroidSheet>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
@@ -299,38 +302,43 @@ export function AddToPlaylistProvider({ children }: { children: ReactNode }) {
|
||||
transparent
|
||||
onRequestClose={() => setCreateOpen(false)}
|
||||
>
|
||||
<Pressable style={styles.overlay} onPress={() => setCreateOpen(false)}>
|
||||
<AndroidSheet>
|
||||
<Pressable
|
||||
style={[
|
||||
styles.createSheet,
|
||||
{ backgroundColor: colors.card, borderColor: colors.border },
|
||||
]}
|
||||
onPress={(event) => event.stopPropagation()}
|
||||
style={styles.overlay}
|
||||
onPress={() => setCreateOpen(false)}
|
||||
>
|
||||
<Text style={[styles.title, { color: colors.foreground }]}>
|
||||
New Playlist
|
||||
</Text>
|
||||
<Input
|
||||
value={newPlaylistName}
|
||||
onChangeText={setNewPlaylistName}
|
||||
placeholder="Playlist name"
|
||||
autoFocus
|
||||
/>
|
||||
<View style={styles.createActions}>
|
||||
<Button
|
||||
title="Cancel"
|
||||
variant="ghost"
|
||||
onPress={() => setCreateOpen(false)}
|
||||
<Pressable
|
||||
style={[
|
||||
styles.createSheet,
|
||||
{ backgroundColor: colors.card, borderColor: colors.border },
|
||||
]}
|
||||
onPress={(event) => event.stopPropagation()}
|
||||
>
|
||||
<Text style={[styles.title, { color: colors.foreground }]}>
|
||||
New Playlist
|
||||
</Text>
|
||||
<Input
|
||||
value={newPlaylistName}
|
||||
onChangeText={setNewPlaylistName}
|
||||
placeholder="Playlist name"
|
||||
autoFocus
|
||||
/>
|
||||
<Button
|
||||
title="Create"
|
||||
loading={submitting}
|
||||
disabled={!newPlaylistName.trim()}
|
||||
onPress={() => void handleCreatePlaylist()}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.createActions}>
|
||||
<Button
|
||||
title="Cancel"
|
||||
variant="ghost"
|
||||
onPress={() => setCreateOpen(false)}
|
||||
/>
|
||||
<Button
|
||||
title="Create"
|
||||
loading={submitting}
|
||||
disabled={!newPlaylistName.trim()}
|
||||
onPress={() => void handleCreatePlaylist()}
|
||||
/>
|
||||
</View>
|
||||
</Pressable>
|
||||
</Pressable>
|
||||
</Pressable>
|
||||
</AndroidSheet>
|
||||
</Modal>
|
||||
</AddToPlaylistContext.Provider>
|
||||
)
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
import {
|
||||
useIsFocused,
|
||||
useNavigation,
|
||||
usePreventRemove,
|
||||
useRoute,
|
||||
type NativeStackNavigationProp,
|
||||
} from "expo-router"
|
||||
import {
|
||||
createContext,
|
||||
useCallback,
|
||||
useContext,
|
||||
useLayoutEffect,
|
||||
useMemo,
|
||||
useState,
|
||||
type PropsWithChildren,
|
||||
} from "react"
|
||||
import { Platform } from "react-native"
|
||||
|
||||
import { themeCoverPalette, type CoverPalette } from "@/lib/cover-palette"
|
||||
import { useIsDark, useThemeColors } from "@/lib/theme"
|
||||
|
||||
type TabTheme = {
|
||||
palette: CoverPalette
|
||||
selectedColor: string
|
||||
hasArtworkPalette: boolean
|
||||
setPalette: (palette: CoverPalette | null, owner: string) => void
|
||||
}
|
||||
const AndroidTabTheme = createContext<TabTheme | null>(null)
|
||||
|
||||
function useDefaultPalette() {
|
||||
const theme = useThemeColors()
|
||||
const isDark = useIsDark()
|
||||
return useMemo(() => themeCoverPalette(theme, isDark), [theme, isDark])
|
||||
}
|
||||
|
||||
export function AndroidTabThemeProvider({ children }: PropsWithChildren) {
|
||||
const defaultPalette = useDefaultPalette()
|
||||
const [screen, setScreen] = useState<{
|
||||
palette: CoverPalette
|
||||
owner: string
|
||||
} | null>(null)
|
||||
const palette = screen?.palette ?? null
|
||||
const setPalette = useCallback(
|
||||
(palette: CoverPalette | null, owner: string) => {
|
||||
setScreen((current) =>
|
||||
palette ? { palette, owner } : current?.owner === owner ? null : current
|
||||
)
|
||||
},
|
||||
[]
|
||||
)
|
||||
const artworkPalette =
|
||||
palette &&
|
||||
(palette.background !== defaultPalette.background ||
|
||||
palette.foreground !== defaultPalette.foreground ||
|
||||
palette.secondaryForeground !== defaultPalette.secondaryForeground ||
|
||||
palette.accent !== defaultPalette.accent)
|
||||
? palette
|
||||
: null
|
||||
const value = useMemo(
|
||||
() => ({
|
||||
palette: artworkPalette ?? defaultPalette,
|
||||
selectedColor: artworkPalette?.foreground ?? defaultPalette.accentText,
|
||||
hasArtworkPalette: artworkPalette !== null,
|
||||
setPalette,
|
||||
}),
|
||||
[defaultPalette, artworkPalette, setPalette]
|
||||
)
|
||||
return (
|
||||
<AndroidTabTheme.Provider value={value}>
|
||||
{children}
|
||||
</AndroidTabTheme.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
export function useAndroidTabPalette() {
|
||||
const theme = useContext(AndroidTabTheme)
|
||||
const defaultPalette = useDefaultPalette()
|
||||
return theme?.palette ?? defaultPalette
|
||||
}
|
||||
|
||||
export function useAndroidTabHasArtworkPalette() {
|
||||
return useContext(AndroidTabTheme)?.hasArtworkPalette ?? false
|
||||
}
|
||||
|
||||
export function useAndroidTabSelectedColor() {
|
||||
const theme = useContext(AndroidTabTheme)
|
||||
const defaultPalette = useDefaultPalette()
|
||||
return theme?.selectedColor ?? defaultPalette.accentText
|
||||
}
|
||||
|
||||
/** Keep Android artwork screens and shared bars on the same displayed palette. */
|
||||
export function useAndroidScreenPalette(palette: CoverPalette) {
|
||||
const isFocused = useIsFocused()
|
||||
const owner = useRoute().key
|
||||
const navigation =
|
||||
useNavigation<NativeStackNavigationProp<Record<string, undefined>>>()
|
||||
const [appeared, setAppeared] = useState(false)
|
||||
const [leaving, setLeaving] = useState(false)
|
||||
const [laidOut, setLaidOut] = useState(false)
|
||||
const onLayout = useCallback(() => setLaidOut(true), [])
|
||||
const theme = useContext(AndroidTabTheme)
|
||||
const setPalette = theme?.setPalette
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (Platform.OS !== "android") return
|
||||
return navigation.addListener("transitionEnd", ({ data }) => {
|
||||
setAppeared(!data.closing)
|
||||
})
|
||||
}, [navigation])
|
||||
|
||||
usePreventRemove(Platform.OS === "android" && !leaving, ({ repeat }) => {
|
||||
setLeaving(true)
|
||||
setPalette?.(null, owner)
|
||||
// Let the page and bars paint their shared destination colors before the
|
||||
// native stack removes the page. React blur happens too early for this.
|
||||
requestAnimationFrame(() => requestAnimationFrame(repeat))
|
||||
})
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (
|
||||
Platform.OS !== "android" ||
|
||||
!setPalette ||
|
||||
!isFocused ||
|
||||
!laidOut ||
|
||||
!appeared ||
|
||||
leaving
|
||||
)
|
||||
return
|
||||
setPalette(palette, owner)
|
||||
return () => setPalette(null, owner)
|
||||
}, [appeared, isFocused, laidOut, leaving, owner, palette, setPalette])
|
||||
|
||||
return {
|
||||
palette: Platform.OS === "android" && theme ? theme.palette : palette,
|
||||
onLayout: Platform.OS === "android" ? onLayout : undefined,
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@ import {
|
||||
type ReactNode,
|
||||
} from "react"
|
||||
import { AppState } from "react-native"
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage"
|
||||
|
||||
import {
|
||||
ANONYMOUS_CACHE_SCOPE,
|
||||
@@ -57,8 +56,6 @@ import {
|
||||
const PREVIOUS_TRACK_RESTART_THRESHOLD_SECONDS = 5
|
||||
const PROGRESS_SAVE_INTERVAL_MS = 5000
|
||||
const PREFETCH_UPCOMING_SONGS = 5
|
||||
const VOLUME_STORAGE_KEY = "otunes:volume"
|
||||
const DEFAULT_VOLUME = 0.8
|
||||
|
||||
function lockScreenMetadata(
|
||||
song: BrowseSong,
|
||||
@@ -79,13 +76,11 @@ type PlaybackContextValue = {
|
||||
shuffleEnabled: boolean
|
||||
repeatEnabled: RepeatMode
|
||||
isPlaying: boolean
|
||||
volume: number
|
||||
currentTime: number
|
||||
duration: number
|
||||
seekTo: (seconds: number) => void
|
||||
waitForPlaybackReady: (playing?: boolean) => Promise<void>
|
||||
setIsPlaying: (playing: boolean) => void
|
||||
setVolume: (volume: number) => void
|
||||
playInOrder: (songIds: Id<"songs">[]) => Promise<void>
|
||||
playShuffled: (songIds: Id<"songs">[]) => Promise<void>
|
||||
addToQueueNext: (songIds: Id<"songs">[]) => Promise<void>
|
||||
@@ -268,9 +263,6 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
const seekInFlightRef = useRef(false)
|
||||
const loadRequestIdRef = useRef(0)
|
||||
const playRequestRef = useRef(0)
|
||||
const volumeRef = useRef(DEFAULT_VOLUME)
|
||||
const volumeChangedRef = useRef(false)
|
||||
const volumeSaveTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
const ignoreTrackChangeTimerRef = useRef<ReturnType<
|
||||
typeof setTimeout
|
||||
> | null>(null)
|
||||
@@ -278,7 +270,6 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
const [isPlaying, setIsPlayingState] = useState(false)
|
||||
const [currentTime, setCurrentTime] = useState(0)
|
||||
const [measuredDuration, setDuration] = useState(0)
|
||||
const [volume, setVolumeState] = useState(DEFAULT_VOLUME)
|
||||
const [progressToRestore, setProgressToRestore] = useState<number | null>(
|
||||
null
|
||||
)
|
||||
@@ -466,7 +457,8 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
updateInterval: 500,
|
||||
loop: repeatToPlaylistLoop(storeRef.current.getState().repeatEnabled),
|
||||
})
|
||||
playlist.volume = volumeRef.current
|
||||
// System volume controls loudness; keep the player gain at full scale.
|
||||
playlist.volume = 1
|
||||
statusSubscriptionRef.current = playlist.addListener(
|
||||
"playlistStatusUpdate",
|
||||
handlePlaylistStatusUpdate
|
||||
@@ -498,42 +490,12 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
}
|
||||
})
|
||||
|
||||
void AsyncStorage.getItem(VOLUME_STORAGE_KEY)
|
||||
.then((stored) => {
|
||||
if (!cancelled && !volumeChangedRef.current && stored) {
|
||||
const parsed = Number(stored)
|
||||
if (Number.isFinite(parsed)) {
|
||||
const restoredVolume = Math.min(1, Math.max(0, parsed))
|
||||
volumeRef.current = restoredVolume
|
||||
setVolumeState(restoredVolume)
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
|
||||
return () => {
|
||||
cancelled = true
|
||||
if (volumeSaveTimerRef.current) {
|
||||
clearTimeout(volumeSaveTimerRef.current)
|
||||
volumeSaveTimerRef.current = null
|
||||
}
|
||||
if (volumeChangedRef.current) {
|
||||
void AsyncStorage.setItem(
|
||||
VOLUME_STORAGE_KEY,
|
||||
String(volumeRef.current)
|
||||
).catch(() => {})
|
||||
}
|
||||
destroyPlaylist()
|
||||
}
|
||||
}, [destroyPlaylist])
|
||||
|
||||
useEffect(() => {
|
||||
volumeRef.current = volume
|
||||
if (playlistRef.current) {
|
||||
playlistRef.current.volume = volume
|
||||
}
|
||||
}, [volume])
|
||||
|
||||
useEffect(() => {
|
||||
const playlist = playlistRef.current
|
||||
if (playlist) {
|
||||
@@ -553,25 +515,6 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
}
|
||||
}, [])
|
||||
|
||||
const setVolume = useCallback((nextVolume: number) => {
|
||||
const clamped = Math.min(1, Math.max(0, nextVolume))
|
||||
volumeChangedRef.current = true
|
||||
volumeRef.current = clamped
|
||||
setVolumeState(clamped)
|
||||
if (volumeSaveTimerRef.current) {
|
||||
clearTimeout(volumeSaveTimerRef.current)
|
||||
}
|
||||
volumeSaveTimerRef.current = setTimeout(() => {
|
||||
volumeSaveTimerRef.current = null
|
||||
void AsyncStorage.setItem(VOLUME_STORAGE_KEY, String(clamped)).catch(
|
||||
() => {}
|
||||
)
|
||||
}, 250)
|
||||
if (playlistRef.current) {
|
||||
playlistRef.current.volume = clamped
|
||||
}
|
||||
}, [])
|
||||
|
||||
const seekTo = useCallback(
|
||||
async (seconds: number) => {
|
||||
const playlist = playlistRef.current
|
||||
@@ -704,7 +647,6 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
playlist.skipTo(currentIndex)
|
||||
}
|
||||
playlist.loop = repeatToPlaylistLoop(repeatEnabled)
|
||||
playlist.volume = volumeRef.current
|
||||
if (metadata) {
|
||||
updatePlaylistLockScreenMetadata(playlist, metadata)
|
||||
}
|
||||
@@ -818,7 +760,6 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
}
|
||||
loadedSongIdsRef.current = windowSongIds
|
||||
loadedLoadKeyRef.current = loadKey
|
||||
playlist.volume = volumeRef.current
|
||||
playlist.loop = repeatToPlaylistLoop(repeatEnabled)
|
||||
activatePlaylistLockScreen(
|
||||
playlist,
|
||||
@@ -1345,11 +1286,9 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
shuffleEnabled: playback.shuffleEnabled,
|
||||
repeatEnabled,
|
||||
isPlaying: isPlaybackActive,
|
||||
volume,
|
||||
currentTime,
|
||||
duration,
|
||||
seekTo,
|
||||
setVolume,
|
||||
}),
|
||||
[
|
||||
actionsValue,
|
||||
@@ -1363,8 +1302,6 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
queueSongIds,
|
||||
repeatEnabled,
|
||||
seekTo,
|
||||
setVolume,
|
||||
volume,
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { useEffect, useState } from "react"
|
||||
import { Keyboard, Platform } from "react-native"
|
||||
|
||||
export function useAndroidKeyboardVisible() {
|
||||
const [visible, setVisible] = useState(false)
|
||||
useEffect(() => {
|
||||
if (Platform.OS !== "android") return
|
||||
setVisible(Keyboard.isVisible())
|
||||
const show = Keyboard.addListener("keyboardDidShow", () => setVisible(true))
|
||||
const hide = Keyboard.addListener("keyboardDidHide", () =>
|
||||
setVisible(false)
|
||||
)
|
||||
return () => {
|
||||
show.remove()
|
||||
hide.remove()
|
||||
}
|
||||
}, [])
|
||||
return visible
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import { requireOptionalNativeModule, type EventEmitter } from "expo"
|
||||
import { useCallback, useEffect, useState } from "react"
|
||||
import { AppState } from "react-native"
|
||||
|
||||
type VolumeState = { volume: number; available: boolean }
|
||||
type VolumeEvents = { onVolumeChange: (state: VolumeState) => void }
|
||||
interface SystemVolumeModule extends EventEmitter<VolumeEvents> {
|
||||
getState(): Promise<VolumeState>
|
||||
setVolume(volume: number): Promise<void>
|
||||
}
|
||||
|
||||
const native = requireOptionalNativeModule<SystemVolumeModule>("SystemVolume")
|
||||
|
||||
/** The device owns volume. Never restore an app-specific level on launch. */
|
||||
export function useSystemVolume() {
|
||||
const [state, setState] = useState<VolumeState>({
|
||||
volume: 0,
|
||||
available: false,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (!native) return
|
||||
let active = true
|
||||
let revision = 0
|
||||
const listener = native.addListener("onVolumeChange", (next) => {
|
||||
revision++
|
||||
if (active) setState(next)
|
||||
})
|
||||
const refresh = async () => {
|
||||
const requestedRevision = ++revision
|
||||
try {
|
||||
const next = await native.getState()
|
||||
if (active && requestedRevision === revision) setState(next)
|
||||
} catch {
|
||||
if (active && requestedRevision === revision) {
|
||||
setState((value) => ({ ...value, available: false }))
|
||||
}
|
||||
}
|
||||
}
|
||||
void refresh()
|
||||
const foreground = AppState.addEventListener("change", (next) => {
|
||||
if (next === "active") void refresh()
|
||||
})
|
||||
return () => {
|
||||
active = false
|
||||
listener.remove()
|
||||
foreground.remove()
|
||||
}
|
||||
}, [])
|
||||
|
||||
const setVolume = useCallback((value: number) => {
|
||||
if (!native || !Number.isFinite(value)) return
|
||||
const volume = Math.min(1, Math.max(0, value))
|
||||
void native.setVolume(volume).catch(() => {
|
||||
setState((current) => ({ ...current, available: false }))
|
||||
})
|
||||
}, [])
|
||||
|
||||
return { ...state, setVolume }
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { NativeStackNavigationOptions } from "expo-router"
|
||||
import { useColorScheme } from "react-native"
|
||||
import { Platform } from "react-native"
|
||||
|
||||
import { colors } from "@/lib/theme"
|
||||
import { useThemeColors } from "@/lib/theme"
|
||||
|
||||
type StackScreenOptions = NativeStackNavigationOptions
|
||||
|
||||
@@ -18,8 +18,7 @@ export const tabStackScreenTitles: Record<string, string> = {
|
||||
export function useStackScreenOptions(
|
||||
overrides?: StackScreenOptions
|
||||
): StackScreenOptions {
|
||||
const scheme = useColorScheme()
|
||||
const theme = scheme === "dark" ? colors.dark : colors.light
|
||||
const theme = useThemeColors()
|
||||
|
||||
return {
|
||||
headerLargeTitle: true,
|
||||
@@ -27,6 +26,16 @@ export function useStackScreenOptions(
|
||||
headerTintColor: theme.foreground,
|
||||
headerLargeTitleStyle: { color: theme.foreground },
|
||||
headerBackButtonDisplayMode: "minimal",
|
||||
...(Platform.OS === "android"
|
||||
? {
|
||||
headerLargeTitle: false,
|
||||
headerTransparent: false,
|
||||
headerStyle: { backgroundColor: theme.background },
|
||||
headerShadowVisible: false,
|
||||
statusBarStyle: "light" as const,
|
||||
contentStyle: { backgroundColor: theme.background },
|
||||
}
|
||||
: {}),
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
@@ -50,12 +50,12 @@ export const colors = {
|
||||
export type ThemeColors = (typeof colors)[keyof typeof colors]
|
||||
|
||||
export function useThemeColors(): ThemeColors {
|
||||
const scheme = useColorScheme()
|
||||
return scheme === "dark" ? colors.dark : colors.light
|
||||
return useIsDark() ? colors.dark : colors.light
|
||||
}
|
||||
|
||||
export function useIsDark(): boolean {
|
||||
return useColorScheme() === "dark"
|
||||
const scheme = useColorScheme()
|
||||
return Platform.OS === "android" || scheme === "dark"
|
||||
}
|
||||
|
||||
export function useBlurTint(): "light" | "dark" {
|
||||
@@ -84,13 +84,13 @@ export const radius = {
|
||||
} as const
|
||||
|
||||
export const miniPlayerHeight = 56
|
||||
export const tabBarHeight = Platform.OS === "ios" ? 49 : 56
|
||||
export const tabBarHeight = Platform.OS === "ios" ? 49 : 80
|
||||
export const playerBarHeight = miniPlayerHeight
|
||||
export const carouselCardWidth = 160
|
||||
|
||||
export function useTwoColumnCardWidth(
|
||||
horizontalPadding = spacing.lg,
|
||||
gap = spacing.md,
|
||||
gap = spacing.md
|
||||
) {
|
||||
const { width } = useWindowDimensions()
|
||||
return Math.floor((width - horizontalPadding * 2 - gap) / 2)
|
||||
|
||||
@@ -86,8 +86,13 @@ export function songAudioSource(
|
||||
: undefined
|
||||
const name = options?.songTitle
|
||||
|
||||
if (headers || name) {
|
||||
return { uri, ...(name ? { name } : {}), ...(headers ? { headers } : {}) }
|
||||
if (headers || name || useHls) {
|
||||
return {
|
||||
uri,
|
||||
...(useHls ? { mimeType: "application/x-mpegURL" } : {}),
|
||||
...(name ? { name } : {}),
|
||||
...(headers ? { headers } : {}),
|
||||
}
|
||||
}
|
||||
|
||||
return uri
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/android/build/
|
||||
@@ -0,0 +1,15 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'expo-module-gradle-plugin'
|
||||
}
|
||||
|
||||
group = 'expo.modules.audiooutput'
|
||||
version = '1.0.0'
|
||||
|
||||
android {
|
||||
namespace 'expo.modules.audiooutput'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.mediarouter:mediarouter:1.8.1'
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- Android 13's switcher helper checks for a system broadcast receiver. -->
|
||||
<queries>
|
||||
<package android:name="com.android.systemui" />
|
||||
<intent>
|
||||
<action android:name="com.android.settings.panel.action.MEDIA_OUTPUT" />
|
||||
</intent>
|
||||
</queries>
|
||||
</manifest>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package expo.modules.audiooutput
|
||||
|
||||
import android.os.Build
|
||||
import androidx.mediarouter.app.SystemOutputSwitcherDialogController
|
||||
import expo.modules.kotlin.functions.Queues
|
||||
import expo.modules.kotlin.modules.Module
|
||||
import expo.modules.kotlin.modules.ModuleDefinition
|
||||
|
||||
class AudioOutputModule : Module() {
|
||||
override fun definition() = ModuleDefinition {
|
||||
Name("AudioOutput")
|
||||
|
||||
AsyncFunction("showPicker") {
|
||||
val activity = appContext.currentActivity
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || activity == null) {
|
||||
false
|
||||
} else {
|
||||
// AndroidX handles Android 13's system intent and Android 14+'s public API.
|
||||
SystemOutputSwitcherDialogController.showDialog(activity)
|
||||
}
|
||||
}.runOnQueue(Queues.MAIN)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"platforms": ["apple", "android"],
|
||||
"apple": {
|
||||
"modules": ["AudioOutputModule"]
|
||||
},
|
||||
"android": {
|
||||
"modules": ["expo.modules.audiooutput.AudioOutputModule"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'AudioOutput'
|
||||
s.version = '1.0.0'
|
||||
s.summary = 'Native audio output selection for oTunes'
|
||||
s.description = s.summary
|
||||
s.license = { :type => 'MIT' }
|
||||
s.author = 'oTunes'
|
||||
s.homepage = 'https://otunes.abunchofknowitalls.com'
|
||||
s.platforms = { :ios => '16.4' }
|
||||
s.swift_version = '5.9'
|
||||
s.source = { :git => '' }
|
||||
s.static_framework = true
|
||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
||||
s.dependency 'ExpoModulesCore'
|
||||
s.frameworks = 'AVKit'
|
||||
s.source_files = '**/*.swift'
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
import AVKit
|
||||
import ExpoModulesCore
|
||||
|
||||
public class AudioOutputModule: Module {
|
||||
public func definition() -> ModuleDefinition {
|
||||
Name("AudioOutput")
|
||||
|
||||
View(AudioOutputView.self) {
|
||||
Prop("tint") { (view: AudioOutputView, color: UIColor) in
|
||||
view.picker.tintColor = color
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final class AudioOutputView: ExpoView {
|
||||
let picker = AVRoutePickerView()
|
||||
|
||||
required init(appContext: AppContext? = nil) {
|
||||
super.init(appContext: appContext)
|
||||
picker.prioritizesVideoDevices = false
|
||||
picker.backgroundColor = .clear
|
||||
addSubview(picker)
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
picker.frame = bounds
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "otunes-audio-output",
|
||||
"version": "1.0.0",
|
||||
"private": true
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.abunchofknowitalls.otunes
|
||||
|
||||
import android.content.Context
|
||||
import android.database.ContentObserver
|
||||
import android.media.AudioManager
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.provider.Settings
|
||||
import expo.modules.kotlin.functions.Queues
|
||||
import expo.modules.kotlin.modules.Module
|
||||
import expo.modules.kotlin.modules.ModuleDefinition
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class SystemVolume : Module() {
|
||||
private val context get() = requireNotNull(appContext.reactContext)
|
||||
private val audio get() = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
private var observer: ContentObserver? = null
|
||||
private var lastState: Map<String, Any>? = null
|
||||
|
||||
override fun definition() = ModuleDefinition {
|
||||
Name("SystemVolume")
|
||||
Events("onVolumeChange")
|
||||
|
||||
AsyncFunction("getState") { state() }.runOnQueue(Queues.MAIN)
|
||||
|
||||
AsyncFunction("setVolume") { value: Double ->
|
||||
if (value.isFinite() && available()) {
|
||||
val maximum = audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
|
||||
val minimum = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
audio.getStreamMinVolume(AudioManager.STREAM_MUSIC)
|
||||
} else {
|
||||
0
|
||||
}
|
||||
val index = (value.coerceIn(0.0, 1.0) * maximum).roundToInt().coerceIn(minimum, maximum)
|
||||
audio.setStreamVolume(AudioManager.STREAM_MUSIC, index, 0)
|
||||
publishState()
|
||||
}
|
||||
}.runOnQueue(Queues.MAIN)
|
||||
|
||||
OnStartObserving {
|
||||
lastState = null
|
||||
observer = object : ContentObserver(Handler(Looper.getMainLooper())) {
|
||||
override fun onChange(selfChange: Boolean) = publishState()
|
||||
}.also {
|
||||
context.contentResolver.registerContentObserver(Settings.System.CONTENT_URI, true, it)
|
||||
}
|
||||
}
|
||||
|
||||
OnStopObserving { stopObserving() }
|
||||
OnDestroy { stopObserving() }
|
||||
}
|
||||
|
||||
private fun available(): Boolean =
|
||||
!audio.isVolumeFixed && audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC) > 0
|
||||
|
||||
private fun state(): Map<String, Any> {
|
||||
val maximum = audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
|
||||
return mapOf(
|
||||
"volume" to if (maximum > 0) audio.getStreamVolume(AudioManager.STREAM_MUSIC).toDouble() / maximum else 0.0,
|
||||
"available" to available()
|
||||
)
|
||||
}
|
||||
|
||||
private fun publishState() {
|
||||
val next = state()
|
||||
if (next != lastState) {
|
||||
lastState = next
|
||||
sendEvent("onVolumeChange", next)
|
||||
}
|
||||
}
|
||||
|
||||
private fun stopObserving() {
|
||||
observer?.let { context.contentResolver.unregisterContentObserver(it) }
|
||||
observer = null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import AVFAudio
|
||||
import MediaPlayer
|
||||
import UIKit
|
||||
internal import ExpoModulesCore
|
||||
|
||||
/// Bridges system volume without changing the playback audio session or player gain.
|
||||
final class SystemVolume: Module {
|
||||
private var volumeView: MPVolumeView?
|
||||
private var observation: NSKeyValueObservation?
|
||||
|
||||
public func definition() -> ExpoModulesCore.ModuleDefinition {
|
||||
Name("SystemVolume")
|
||||
Events("onVolumeChange")
|
||||
|
||||
AsyncFunction("getState") { () -> [String: Any] in
|
||||
self.prepareVolumeView()
|
||||
return self.state()
|
||||
}.runOnQueue(.main)
|
||||
|
||||
AsyncFunction("setVolume") { (value: Double) in
|
||||
self.prepareVolumeView()
|
||||
guard value.isFinite,
|
||||
let slider = self.volumeView?.subviews.compactMap({ $0 as? UISlider }).first
|
||||
else { return }
|
||||
slider.setValue(Float(min(1, max(0, value))), animated: false)
|
||||
slider.sendActions(for: .valueChanged)
|
||||
slider.sendActions(for: .touchUpInside)
|
||||
}.runOnQueue(.main)
|
||||
|
||||
OnStartObserving {
|
||||
self.observation = AVAudioSession.sharedInstance().observe(
|
||||
\.outputVolume, options: [.new]
|
||||
) { [weak self] _, _ in
|
||||
guard let self else { return }
|
||||
self.sendEvent("onVolumeChange", self.state())
|
||||
}
|
||||
}
|
||||
|
||||
OnStopObserving {
|
||||
self.observation = nil
|
||||
}
|
||||
|
||||
OnDestroy {
|
||||
self.observation = nil
|
||||
let view = self.volumeView
|
||||
self.volumeView = nil
|
||||
DispatchQueue.main.async { view?.removeFromSuperview() }
|
||||
}
|
||||
}
|
||||
|
||||
private func prepareVolumeView() {
|
||||
#if !targetEnvironment(simulator)
|
||||
if volumeView == nil {
|
||||
// MPVolumeView must belong to a window to control the device's volume.
|
||||
let view = MPVolumeView(frame: CGRect(x: -200, y: -200, width: 120, height: 30))
|
||||
view.showsRouteButton = false
|
||||
volumeView = view
|
||||
}
|
||||
if volumeView?.window == nil {
|
||||
let window = UIApplication.shared.connectedScenes
|
||||
.compactMap { $0 as? UIWindowScene }
|
||||
.flatMap { $0.windows }
|
||||
.first { $0.isKeyWindow }
|
||||
if let volumeView { window?.addSubview(volumeView) }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private func state() -> [String: Any] {
|
||||
#if targetEnvironment(simulator)
|
||||
// Simulator's host audio controls do not update AVAudioSession.outputVolume.
|
||||
let available = false
|
||||
#else
|
||||
// The control remains visible on physical iPhones, including during route changes.
|
||||
let available = true
|
||||
#endif
|
||||
return ["volume": AVAudioSession.sharedInstance().outputVolume, "available": available]
|
||||
}
|
||||
}
|
||||
@@ -34,12 +34,14 @@
|
||||
"expo-image": "~58.0.16",
|
||||
"expo-image-picker": "~58.0.10",
|
||||
"expo-linking": "~58.0.14",
|
||||
"expo-navigation-bar": "~58.0.4",
|
||||
"expo-router": "~58.0.25",
|
||||
"expo-secure-store": "~58.0.2",
|
||||
"expo-sharing": "~58.0.20",
|
||||
"expo-splash-screen": "~58.0.11",
|
||||
"expo-status-bar": "~58.0.4",
|
||||
"expo-symbols": "~58.0.4",
|
||||
"expo-system-ui": "~58.0.6",
|
||||
"react": "19.3.0",
|
||||
"react-dom": "19.3.0",
|
||||
"react-native": "0.88.0",
|
||||
@@ -57,5 +59,12 @@
|
||||
"@types/react": "~19.3.0",
|
||||
"babel-preset-expo": "^58.0.18",
|
||||
"typescript": "~6.0.3"
|
||||
},
|
||||
"expo": {
|
||||
"autolinking": {
|
||||
"buildFromSource": [
|
||||
"expo-audio"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
const { withAndroidStyles } = require("expo/config-plugins")
|
||||
|
||||
// Native controls and system bars must never fall back to device theme colors.
|
||||
module.exports = (config) =>
|
||||
withAndroidStyles(config, (config) => {
|
||||
const theme = config.modResults.resources.style.find(
|
||||
(style) => style.$.name === "AppTheme"
|
||||
)
|
||||
const colors = {
|
||||
colorPrimary: "#FA2D48",
|
||||
colorPrimaryDark: "#000000",
|
||||
colorAccent: "#FA2D48",
|
||||
"android:windowBackground": "#000000",
|
||||
"android:statusBarColor": "#000000",
|
||||
"android:navigationBarColor": "#000000",
|
||||
"android:windowLightStatusBar": "false",
|
||||
"android:windowLightNavigationBar": "false",
|
||||
"android:enforceStatusBarContrast": "false",
|
||||
"android:enforceNavigationBarContrast": "false",
|
||||
}
|
||||
for (const [name, value] of Object.entries(colors)) {
|
||||
theme.item = theme.item.filter((item) => item.$.name !== name)
|
||||
theme.item.push({ $: { name }, _: value })
|
||||
}
|
||||
return config
|
||||
})
|
||||
@@ -4,7 +4,7 @@ diff --git a/ios/AudioPlaylist.swift b/ios/AudioPlaylist.swift
|
||||
@@ -179,20 +179,31 @@
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
- let wasPlaying = isPlaying
|
||||
- let resumeIndex: Int
|
||||
- if ref.currentItem != nil {
|
||||
@@ -13,7 +13,7 @@ diff --git a/ios/AudioPlaylist.swift b/ios/AudioPlaylist.swift
|
||||
- resumeIndex = index
|
||||
- }
|
||||
sources.insert(source, at: index)
|
||||
|
||||
|
||||
- previousTrackIndex = resumeIndex
|
||||
- rebuildPlaylist(startingAt: resumeIndex)
|
||||
- if wasPlaying {
|
||||
@@ -43,7 +43,7 @@ diff --git a/ios/AudioPlaylist.swift b/ios/AudioPlaylist.swift
|
||||
+
|
||||
updateStatus(with: ["trackCount": trackCount])
|
||||
}
|
||||
|
||||
|
||||
@@ -213,12 +224,11 @@
|
||||
play(at: currentRate)
|
||||
}
|
||||
@@ -61,3 +61,101 @@ diff --git a/ios/AudioPlaylist.swift b/ios/AudioPlaylist.swift
|
||||
} else if index < playerItems.count {
|
||||
if let item = playerItems[index] {
|
||||
ref.remove(item)
|
||||
diff --git a/android/src/main/java/expo/modules/audio/AudioPlaylist.kt b/android/src/main/java/expo/modules/audio/AudioPlaylist.kt
|
||||
--- a/android/src/main/java/expo/modules/audio/AudioPlaylist.kt
|
||||
+++ b/android/src/main/java/expo/modules/audio/AudioPlaylist.kt
|
||||
@@ -9,2 +9,3 @@
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
+import androidx.media3.exoplayer.source.MediaSource
|
||||
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
|
||||
@@ -53,3 +54,3 @@
|
||||
|
||||
- private var createMediaItemForSource: ((AudioSource) -> MediaItem?)? = null
|
||||
+ private var createMediaSourceForSource: ((AudioSource) -> MediaSource?)? = null
|
||||
|
||||
@@ -60,4 +61,4 @@
|
||||
|
||||
- fun setMediaItemCreator(creator: (AudioSource) -> MediaItem?) {
|
||||
- this.createMediaItemForSource = creator
|
||||
+ fun setMediaSourceCreator(creator: (AudioSource) -> MediaSource?) {
|
||||
+ this.createMediaSourceForSource = creator
|
||||
}
|
||||
@@ -67,5 +68,5 @@
|
||||
sources.forEach { source ->
|
||||
- createMediaItemForSource?.invoke(source)?.let { mediaItem ->
|
||||
+ createMediaSourceForSource?.invoke(source)?.let { mediaItem ->
|
||||
validSources.add(source)
|
||||
- ref.addMediaItem(mediaItem)
|
||||
+ ref.addMediaSource(mediaItem)
|
||||
}
|
||||
@@ -151,5 +152,5 @@
|
||||
fun add(source: AudioSource) {
|
||||
- val mediaItem = createMediaItemForSource?.invoke(source) ?: return
|
||||
+ val mediaItem = createMediaSourceForSource?.invoke(source) ?: return
|
||||
sources.add(source)
|
||||
- ref.addMediaItem(mediaItem)
|
||||
+ ref.addMediaSource(mediaItem)
|
||||
sendStatusUpdate(mapOf("trackCount" to trackCount))
|
||||
@@ -161,5 +162,5 @@
|
||||
}
|
||||
- val mediaItem = createMediaItemForSource?.invoke(source) ?: return
|
||||
+ val mediaItem = createMediaSourceForSource?.invoke(source) ?: return
|
||||
sources.add(index, source)
|
||||
- ref.addMediaItem(index, mediaItem)
|
||||
+ ref.addMediaSource(index, mediaItem)
|
||||
sendStatusUpdate(mapOf("trackCount" to trackCount))
|
||||
diff --git a/android/src/main/java/expo/modules/audio/AudioModule.kt b/android/src/main/java/expo/modules/audio/AudioModule.kt
|
||||
--- a/android/src/main/java/expo/modules/audio/AudioModule.kt
|
||||
+++ b/android/src/main/java/expo/modules/audio/AudioModule.kt
|
||||
@@ -909,14 +909,4 @@
|
||||
playlist.loopMode = loop
|
||||
- playlist.setMediaItemCreator { source ->
|
||||
- source.uri?.let { uriString ->
|
||||
- val uri = uriString.toUri()
|
||||
- when {
|
||||
- isRawResource(uri) -> {
|
||||
- val file = getResourceName(uri, uriString)
|
||||
- MediaItem.fromUri(getRawResourceURI(file))
|
||||
- }
|
||||
- else -> MediaItem.fromUri(uri)
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ // Use the same per-source headers and stream type as standalone players.
|
||||
+ playlist.setMediaSourceCreator { source -> createMediaItem(source) }
|
||||
playlist.loadInitialPlaylist()
|
||||
@@ -1130,3 +1120,3 @@
|
||||
}
|
||||
- else -> MediaItem.fromUri(uri)
|
||||
+ else -> MediaItem.Builder().setUri(uri).setMimeType(source.mimeType).build()
|
||||
}
|
||||
@@ -1196,3 +1186,3 @@
|
||||
val uri = mediaItem.localConfiguration?.uri
|
||||
- return when (val type = uri?.let { retrieveStreamType(it) }) {
|
||||
+ return when (val type = uri?.let { Util.inferContentTypeForUriAndMimeType(it, mediaItem.localConfiguration?.mimeType) }) {
|
||||
CONTENT_TYPE_SS -> SsMediaSource.Factory(factory)
|
||||
diff --git a/android/src/main/java/expo/modules/audio/AudioRecords.kt b/android/src/main/java/expo/modules/audio/AudioRecords.kt
|
||||
--- a/android/src/main/java/expo/modules/audio/AudioRecords.kt
|
||||
+++ b/android/src/main/java/expo/modules/audio/AudioRecords.kt
|
||||
@@ -15,3 +15,4 @@
|
||||
@Field val headers: Map<String, String>?,
|
||||
- @Field val name: String? = null
|
||||
+ @Field val name: String? = null,
|
||||
+ @Field val mimeType: String? = null
|
||||
) : Record
|
||||
diff --git a/src/Audio.types.ts b/src/Audio.types.ts
|
||||
--- a/src/Audio.types.ts
|
||||
+++ b/src/Audio.types.ts
|
||||
@@ -38,2 +38,4 @@
|
||||
headers?: Record<string, string>;
|
||||
+ /** MIME type for streams whose URL has no file extension, such as HLS. */
|
||||
+ mimeType?: string;
|
||||
/**
|
||||
diff --git a/build/Audio.types.d.ts b/build/Audio.types.d.ts
|
||||
--- a/build/Audio.types.d.ts
|
||||
+++ b/build/Audio.types.d.ts
|
||||
@@ -31,2 +31,4 @@
|
||||
headers?: Record<string, string>;
|
||||
+ /** MIME type for streams whose URL has no file extension, such as HLS. */
|
||||
+ mimeType?: string;
|
||||
/**
|
||||
Generated
+44
-3
@@ -6,7 +6,7 @@ settings:
|
||||
|
||||
patchedDependencies:
|
||||
expo-audio@58.0.10:
|
||||
hash: 316b70cb0213ecf24723e4074c1bde7ef15a627e8bf5d8f938c0be9965f1b4e8
|
||||
hash: e01ad6e484db76d810c2df5bf9c376eccf8d4c5359736b626868ea8bd8dac566
|
||||
path: patches/expo-audio@58.0.10.patch
|
||||
|
||||
importers:
|
||||
@@ -63,7 +63,7 @@ importers:
|
||||
version: 58.0.18(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)(typescript@6.0.3)
|
||||
expo-audio:
|
||||
specifier: ~58.0.10
|
||||
version: 58.0.10(patch_hash=316b70cb0213ecf24723e4074c1bde7ef15a627e8bf5d8f938c0be9965f1b4e8)(expo-asset@58.0.18(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)(typescript@6.0.3))(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)
|
||||
version: 58.0.10(patch_hash=e01ad6e484db76d810c2df5bf9c376eccf8d4c5359736b626868ea8bd8dac566)(expo-asset@58.0.18(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)(typescript@6.0.3))(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)
|
||||
expo-blur:
|
||||
specifier: ~58.0.5
|
||||
version: 58.0.5(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)
|
||||
@@ -88,6 +88,9 @@ importers:
|
||||
expo-linking:
|
||||
specifier: ~58.0.14
|
||||
version: 58.0.14(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)(typescript@6.0.3)
|
||||
expo-navigation-bar:
|
||||
specifier: ~58.0.4
|
||||
version: 58.0.4(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)
|
||||
expo-router:
|
||||
specifier: ~58.0.25
|
||||
version: 58.0.25(114ad080e17b889d99a70734d72d1fb4)
|
||||
@@ -106,6 +109,9 @@ importers:
|
||||
expo-symbols:
|
||||
specifier: ~58.0.4
|
||||
version: 58.0.4(expo-font@58.0.9)(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)
|
||||
expo-system-ui:
|
||||
specifier: ~58.0.6
|
||||
version: 58.0.6(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))
|
||||
react:
|
||||
specifier: 19.3.0
|
||||
version: 19.3.0
|
||||
@@ -4120,6 +4126,13 @@ packages:
|
||||
expo-modules-macros@0.22.0:
|
||||
resolution: {integrity: sha512-IHY+FkILfG19qsyf9G/z7dcWVgsyqdkWsvvob3n5nWKa2meCCAGeEjp42N68fG8Ta6dn/bsceuma7uh2i6ho9g==}
|
||||
|
||||
expo-navigation-bar@58.0.4:
|
||||
resolution: {integrity: sha512-XO1Ljy9MlmVLYlmIGUNHxTCcHN8TjlbYQnf+jqjoxpbPxDCXDCSaX0+F7rKh0G4CUehKsfoebbMO/VIy87qSqg==}
|
||||
peerDependencies:
|
||||
expo: '*'
|
||||
react: '*'
|
||||
react-native: '*'
|
||||
|
||||
expo-router@58.0.25:
|
||||
resolution: {integrity: sha512-sFumF6yUbxcSfiYcd+5vJjjIbVN0wo5X0F9SEnoNlmmvzoI9jD6k9dcSMnoe5ywquWonUEAdcHcpfsa087/8sQ==}
|
||||
peerDependencies:
|
||||
@@ -4197,6 +4210,16 @@ packages:
|
||||
react: '*'
|
||||
react-native: '*'
|
||||
|
||||
expo-system-ui@58.0.6:
|
||||
resolution: {integrity: sha512-K1+GIYhNDc4J0lJAL0m8giesP1dgfavhN+joA6FQ45r1FXAWwS1PaueCiCJaq5hB6z5iAYT7b9XqYp76UU65yw==}
|
||||
peerDependencies:
|
||||
expo: '*'
|
||||
react-native: '*'
|
||||
react-native-web: '*'
|
||||
peerDependenciesMeta:
|
||||
react-native-web:
|
||||
optional: true
|
||||
|
||||
expo-updates-interface@58.0.1:
|
||||
resolution: {integrity: sha512-OF+3BtMXtUsXWDfpHVNus9yHpx7WjMwjxDfeeN9LQBYSq/UtYmNNHBSfzChYTuqljWFSOAHRfsDykV9EB73Wlg==}
|
||||
peerDependencies:
|
||||
@@ -11050,7 +11073,7 @@ snapshots:
|
||||
- supports-color
|
||||
- typescript
|
||||
|
||||
expo-audio@58.0.10(patch_hash=316b70cb0213ecf24723e4074c1bde7ef15a627e8bf5d8f938c0be9965f1b4e8)(expo-asset@58.0.18(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)(typescript@6.0.3))(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0):
|
||||
expo-audio@58.0.10(patch_hash=e01ad6e484db76d810c2df5bf9c376eccf8d4c5359736b626868ea8bd8dac566)(expo-asset@58.0.18(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)(typescript@6.0.3))(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0):
|
||||
dependencies:
|
||||
expo: 58.0.17(@babel/core@7.29.7)(@expo/dom-webview@58.0.2)(@expo/metro-runtime@58.0.15)(expo-router@58.0.25)(react-dom@19.3.0(react@19.3.0))(react-native-worklets@0.13.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0))(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)(typescript@6.0.3)
|
||||
expo-asset: 58.0.18(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)(typescript@6.0.3)
|
||||
@@ -11198,6 +11221,15 @@ snapshots:
|
||||
'@expo/modules-macros-win32-arm64': 0.22.0
|
||||
'@expo/modules-macros-win32-x64': 0.22.0
|
||||
|
||||
expo-navigation-bar@58.0.4(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0):
|
||||
dependencies:
|
||||
debug: 4.4.3
|
||||
expo: 58.0.17(@babel/core@7.29.7)(@expo/dom-webview@58.0.2)(@expo/metro-runtime@58.0.15)(expo-router@58.0.25)(react-dom@19.3.0(react@19.3.0))(react-native-worklets@0.13.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0))(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)(typescript@6.0.3)
|
||||
react: 19.3.0
|
||||
react-native: 0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
expo-router@58.0.25(114ad080e17b889d99a70734d72d1fb4):
|
||||
dependencies:
|
||||
'@expo/log-box': 58.0.13(@expo/dom-webview@58.0.2)(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)
|
||||
@@ -11278,6 +11310,15 @@ snapshots:
|
||||
react-native: 0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0)
|
||||
sf-symbols-typescript: 2.2.0
|
||||
|
||||
expo-system-ui@58.0.6(expo@58.0.17)(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0)):
|
||||
dependencies:
|
||||
'@react-native/normalize-colors': 0.88.0
|
||||
debug: 4.4.3
|
||||
expo: 58.0.17(@babel/core@7.29.7)(@expo/dom-webview@58.0.2)(@expo/metro-runtime@58.0.15)(expo-router@58.0.25)(react-dom@19.3.0(react@19.3.0))(react-native-worklets@0.13.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0))(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)(typescript@6.0.3)
|
||||
react-native: 0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
expo-updates-interface@58.0.1(expo@58.0.17):
|
||||
dependencies:
|
||||
expo: 58.0.17(@babel/core@7.29.7)(@expo/dom-webview@58.0.2)(@expo/metro-runtime@58.0.15)(expo-router@58.0.25)(react-dom@19.3.0(react@19.3.0))(react-native-worklets@0.13.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0))(react-native@0.88.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0(@babel/core@7.29.7))(@types/react@19.3.0)(react@19.3.0))(react@19.3.0)(typescript@6.0.3)
|
||||
|
||||
Reference in new issue
Block a user