diff --git a/apps/mobile/README.md b/apps/mobile/README.md index 7fb65bd..9829442 100644 --- a/apps/mobile/README.md +++ b/apps/mobile/README.md @@ -42,3 +42,41 @@ Native sharing supplies media titles and artwork through iOS link metadata and A thumbnail, while sharing the original HTTPS URL. Receiving apps control whether they display previews. If artwork cannot load, the URL is still shared. Existing builds without the native sharing module fall back to URL-only sharing. + +### iPad sidebar + +Expo Router owns navigation through `NativeTabs sidebarAdaptable`. +`native/TabletSidebar.swift` adds UIKit Library and Playlists groups and the pinned +account footer, which the current Expo Router API does not expose. The bridge +reuses the router's tab instances so each destination retains its navigation stack. + +The `react-native-screens` patch checks the selected leaf controller rather than +the group's root controller. It also notifies the sidebar bridge after each native +tab reconciliation, so startup updates cannot replace the Library and Playlists +sections with a flat tab list. Keep both behaviors when updating the dependency. +After changing native modules or dependency patches, run `pod install` in `ios` +and rebuild the development app. + +### Mac Catalyst + +On a Mac with Xcode and CocoaPods installed, generate the iOS project with +Catalyst enabled. Use a separate checkout for Catalyst builds, since prebuild +changes the generated iOS project and its dependency configuration. + +```sh +MAC_CATALYST=1 APP_VARIANT=development pnpm exec expo prebuild --platform ios --clean +open ios/*.xcworkspace +``` + +In Xcode, select the app scheme and the **My Mac (Mac Catalyst)** destination, +select your signing team, then build and run. For a Release build, use Xcode's +Archive action with the Catalyst destination. EAS's existing iOS profiles still +build iPhone/iPad apps. + +The Catalyst plugin enables the Xcode target and React Native's CocoaPods +patches. It disables precompiled React Native and Expo modules so dependencies +can compile for Catalyst. The Mac app derives a separate bundle identifier with +Apple's `maccatalyst.` prefix. System volume stays under macOS control. + +To return a checkout to ordinary iOS builds, rerun prebuild without +`MAC_CATALYST=1`. Keep `APP_VARIANT` consistent when starting Metro. diff --git a/apps/mobile/app.config.ts b/apps/mobile/app.config.ts index 8aa6e7a..009f3d7 100644 --- a/apps/mobile/app.config.ts +++ b/apps/mobile/app.config.ts @@ -28,6 +28,12 @@ export default ({ config }: ConfigContext): ExpoConfig => { return { ...config, + plugins: [ + ...(config.plugins ?? []), + ...(process.env.MAC_CATALYST === "1" + ? ["./plugins/with-mac-catalyst"] + : []), + ], name: `${config.name}${nameSuffix}`, slug: config.slug!, scheme: variant === "production" ? "otunes" : `otunes-${variant}`, diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/_layout.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/_layout.tsx new file mode 100644 index 0000000..9453ea3 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/_layout.tsx @@ -0,0 +1,25 @@ +import { Stack } from "expo-router" + +import { renderTabScreenContent } from "@/components/tab-screen-content" +import { useStackScreenOptions, tabStackScreenTitles } from "@/lib/navigation" +import { tabletSections, TabletSectionContext } from "@/lib/tablet-navigation" + +export default function TabletSectionLayout({ segment }: { segment: string }) { + const section = tabletSections.find((item) => item.group === segment) + const options = useStackScreenOptions() + + return ( + + ({ + ...options, + title: + route.name === "index" + ? section?.title + : tabStackScreenTitles[route.name], + })} + /> + + ) +} diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/album/[id].tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/album/[id].tsx new file mode 100644 index 0000000..f22686e --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/album/[id].tsx @@ -0,0 +1 @@ +export { default } from "../../library/album/[id]" diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/artist/[id].tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/artist/[id].tsx new file mode 100644 index 0000000..0953a71 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/artist/[id].tsx @@ -0,0 +1 @@ +export { default } from "../../library/artist/[id]" diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/albums.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/albums.tsx new file mode 100644 index 0000000..bb0b5fd --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/albums.tsx @@ -0,0 +1 @@ +export { default } from "../../library/browse/albums" diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/artists.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/artists.tsx new file mode 100644 index 0000000..561a24b --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/artists.tsx @@ -0,0 +1 @@ +export { default } from "../../library/browse/artists" diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/playlists.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/playlists.tsx new file mode 100644 index 0000000..a5d9b72 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/playlists.tsx @@ -0,0 +1 @@ +export { default } from "../../library/browse/playlists" diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/songs.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/songs.tsx new file mode 100644 index 0000000..6111e73 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/browse/songs.tsx @@ -0,0 +1 @@ +export { default } from "../../library/browse/songs" diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/index.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/index.tsx new file mode 100644 index 0000000..688cd25 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/index.tsx @@ -0,0 +1,23 @@ +import { useContext } from "react" +import Albums from "../home/browse/albums" +import Artists from "../home/browse/artists" +import Songs from "../home/browse/songs" +import Playlists from "../home/browse/playlists" +import Favorites from "../home/playlist/favorites" +import RecentlyPlayed from "../home/recently-played" +import { TabletSectionContext } from "@/lib/tablet-navigation" + +const screens = { + albums: Albums, + artists: Artists, + songs: Songs, + playlists: Playlists, + favorites: Favorites, + recent: RecentlyPlayed, +} + +export default function TabletSectionScreen() { + const section = useContext(TabletSectionContext) + const Screen = screens[section?.name ?? "albums"] + return +} diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/playlist/[id].tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/playlist/[id].tsx new file mode 100644 index 0000000..eb057b7 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/playlist/[id].tsx @@ -0,0 +1 @@ +export { default } from "../../library/playlist/[id]" diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/playlist/favorites.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/playlist/favorites.tsx new file mode 100644 index 0000000..3a58009 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/playlist/favorites.tsx @@ -0,0 +1 @@ +export { default } from "../../library/playlist/favorites" diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/queue.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/queue.tsx new file mode 100644 index 0000000..4d4acb6 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/queue.tsx @@ -0,0 +1 @@ +export { default } from "../library/queue" diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/recently-added.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/recently-added.tsx new file mode 100644 index 0000000..01eca97 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/recently-added.tsx @@ -0,0 +1 @@ +export { default } from "../library/recently-added" diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/recently-played.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/recently-played.tsx new file mode 100644 index 0000000..18d4064 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/recently-played.tsx @@ -0,0 +1 @@ +export { default } from "../library/recently-played" diff --git a/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/settings.tsx b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/settings.tsx new file mode 100644 index 0000000..9ec79d9 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/(albums,artists,songs,playlists,favorites,recent)/settings.tsx @@ -0,0 +1 @@ +export { default } from "../library/settings" diff --git a/apps/mobile/app/(app)/(tabs)/_layout.tsx b/apps/mobile/app/(app)/(tabs)/_layout.tsx index 261251f..512741d 100644 --- a/apps/mobile/app/(app)/(tabs)/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/_layout.tsx @@ -1,7 +1,10 @@ +import { useTabletLayout } from "@/hooks/use-tablet-layout" +import { TabletMiniPlayer } from "@/components/tablet-mini-player" +import { TabletPlayerLayoutProvider } from "@/contexts/tablet-player-layout" import Animated from "react-native-reanimated" import { NavigationBar } from "expo-navigation-bar" import { - AndroidTabThemeProvider, + ScreenPaletteProvider, useAndroidTabPalette, useAndroidTabBackgroundStyle, useAndroidNativeTabColors, @@ -88,6 +91,7 @@ function useNativeTabColors() { } function TabsContent() { + const tabletLayout = useTabletLayout() const homeColors = useAndroidNativeTabColors() const libraryColors = useAndroidNativeTabColors() const searchColors = useAndroidNativeTabColors() @@ -109,16 +113,12 @@ function TabsContent() { return ( - + {Platform.OS === "android" ? ( ) : null} - {Platform.OS === "ios" && showBottomAccessory ? ( + {Platform.OS === "ios" && !tabletLayout && showBottomAccessory ? ( @@ -162,7 +162,9 @@ function TabsContent() { sf="music.note.square.stack.fill" md="library_music" /> - Library + + {tabletLayout ? "Recently Added" : "Library"} + Search + + + + + + {!keyboardVisible ? : null} + {tabletLayout ? : null} ) } export default function TabsLayout() { - if (Platform.OS !== "android") return return ( - - - + + + + + ) } diff --git a/apps/mobile/app/(app)/(tabs)/home/_layout.tsx b/apps/mobile/app/(app)/(tabs)/home/_layout.tsx index 87b926d..75da6ca 100644 --- a/apps/mobile/app/(app)/(tabs)/home/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/_layout.tsx @@ -1,3 +1,4 @@ +import { renderTabScreenContent } from "@/components/tab-screen-content" import { Stack } from "expo-router" import { ProfileHeaderButton } from "@/components/profile-header-button" @@ -12,6 +13,7 @@ export default function HomeLayout() { return ( ({ ...baseOptions, title: tabStackScreenTitles[route.name] ?? "Home", diff --git a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx index 834ee31..d4ba20d 100644 --- a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx @@ -1,3 +1,7 @@ +import { + CollectionHero, + useCollectionHeroLayout, +} from "@/components/collection-hero" import { PaletteText, PaletteIcon, @@ -6,7 +10,7 @@ import { import Animated from "react-native-reanimated" import { renderAndroidArtworkBackground, - useAndroidScreenPalette, + useScreenPalette, } from "@/contexts/android-tab-theme" import { MusicEntityView } from "@/components/music-entity-view" import { Link, Stack, useIsFocused, useLocalSearchParams } from "expo-router" @@ -67,12 +71,13 @@ export default function AlbumScreen() { const isFocused = useIsFocused() const coverUri = config && typeof id === "string" ? albumCoverUrl(config.serverUrl, id) : "" + const heroLayout = useCollectionHeroLayout() const { palette: artworkPalette, settled } = useCoverPalette( coverUri, album ? album.cover != null : album === null ? false : undefined ) const { palette, onLayout, backgroundStyle } = - useAndroidScreenPalette(artworkPalette) + useScreenPalette(artworkPalette) const songIds = useMemo( () => album?.tracks.map((track) => track.id as Id<"songs">) ?? [], [album] @@ -243,131 +248,161 @@ export default function AlbumScreen() { indicatorStyle={palette.isDark ? "white" : "black"} ListHeaderComponent={ - - - - - - - - {album.title} - - push(`/artist/${album.artist.id}`)} - style={styles.artistPressable} + + + + + + + } + actions={ + + void toggleAlbumFavorite(album.id)} + hitSlop={8} + style={[ + styles.iconAction, + { backgroundColor: palette.surface }, + ]} + > + + +