feat(mobile): block Dolby Atmos downloads on Android

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
joshuafhigginsandClaude Opus 5.5 committed 2026-11-20 15:41:05 -05:00 Verified
1 parent e66a91ed29
commit 28d175bd12
4 files changed
+61 -32

No files matched your search

@@ -1,4 +1,8 @@
import { atmosEnabled, dolbyAtmosSupported } from "@/lib/playback-capabilities" import {
atmosEnabled,
deviceDownloadQualities,
dolbyAtmosSupported,
} from "@/lib/playback-capabilities"
import { Ionicons } from "@expo/vector-icons" import { Ionicons } from "@expo/vector-icons"
import { useAction, useMutation, useQuery } from "convex/react" import { useAction, useMutation, useQuery } from "convex/react"
import { Image } from "expo-image" import { Image } from "expo-image"
@@ -25,7 +29,6 @@ import {
writeRememberedDownloadQuality, writeRememberedDownloadQuality,
} from "@/lib/downloads" } from "@/lib/downloads"
import { import {
DOWNLOAD_QUALITIES,
DOWNLOAD_QUALITY_DETAILS, DOWNLOAD_QUALITY_DETAILS,
DOWNLOAD_QUALITY_LABELS, DOWNLOAD_QUALITY_LABELS,
formatBytes, formatBytes,
@@ -508,7 +511,7 @@ function RememberedQualityCard() {
detail: string detail: string
}[] = [ }[] = [
{ value: null, label: "Ask every time", detail: "Choose when downloading" }, { value: null, label: "Ask every time", detail: "Choose when downloading" },
...DOWNLOAD_QUALITIES.map((quality) => ({ ...deviceDownloadQualities.map((quality) => ({
value: quality, value: quality,
label: DOWNLOAD_QUALITY_LABELS[quality], label: DOWNLOAD_QUALITY_LABELS[quality],
detail: DOWNLOAD_QUALITY_DETAILS[quality], detail: DOWNLOAD_QUALITY_DETAILS[quality],
+37 -28
View File
@@ -34,6 +34,7 @@ import {
writeRememberedDownloadQuality, writeRememberedDownloadQuality,
} from "@/lib/downloads" } from "@/lib/downloads"
import { loadPlaybackSongs } from "@/lib/playback-files" import { loadPlaybackSongs } from "@/lib/playback-files"
import { downloadQualitySupported } from "@/lib/playback-capabilities"
import type { ServerConfig } from "@/lib/server-config" import type { ServerConfig } from "@/lib/server-config"
import { showError } from "@/lib/toast" import { showError } from "@/lib/toast"
import { useThemeColors } from "@/lib/theme" import { useThemeColors } from "@/lib/theme"
@@ -238,36 +239,44 @@ function DownloadQualityPopup({
> >
{pending?.target.title} {pending?.target.title}
</Text> </Text>
{pending?.response.options.map((option) => ( {pending?.response.options
<Pressable .filter((option) => downloadQualitySupported(option.quality))
key={option.quality} .map((option) => (
accessibilityRole="button" <Pressable
style={[styles.row, { borderBottomColor: colors.border }]} key={option.quality}
onPress={() => onPick(option.quality, remember)} accessibilityRole="button"
> style={[styles.row, { borderBottomColor: colors.border }]}
<View style={styles.rowText}> onPress={() => onPick(option.quality, remember)}
{option.quality === "lossless" || >
option.quality === "atmos" ? ( <View style={styles.rowText}>
<AudioFormatBadge {option.quality === "lossless" ||
format={option.quality} option.quality === "atmos" ? (
color={colors.foreground} <AudioFormatBadge
backgroundColor={colors.card} format={option.quality}
/> color={colors.foreground}
) : ( backgroundColor={colors.card}
<Text style={[styles.label, { color: colors.foreground }]}> />
{DOWNLOAD_QUALITY_LABELS[option.quality]} ) : (
<Text
style={[styles.label, { color: colors.foreground }]}
>
{DOWNLOAD_QUALITY_LABELS[option.quality]}
</Text>
)}
<Text
style={{ color: colors.mutedForeground, fontSize: 12 }}
>
{optionDetail(option, songCount)}
</Text> </Text>
)} </View>
<Text style={{ color: colors.mutedForeground, fontSize: 12 }}> <Text
{optionDetail(option, songCount)} style={[styles.size, { color: colors.mutedForeground }]}
>
{option.estimated ? "~" : ""}
{formatBytes(option.bytes)}
</Text> </Text>
</View> </Pressable>
<Text style={[styles.size, { color: colors.mutedForeground }]}> ))}
{option.estimated ? "~" : ""}
{formatBytes(option.bytes)}
</Text>
</Pressable>
))}
<View style={styles.rememberRow}> <View style={styles.rememberRow}>
<Text style={{ color: colors.foreground, fontSize: 15 }}> <Text style={{ color: colors.foreground, fontSize: 15 }}>
Remember my choice Remember my choice
+3 -1
View File
@@ -16,6 +16,7 @@ import {
type DownloadQuality, type DownloadQuality,
} from "@otunes/convex/download-quality" } from "@otunes/convex/download-quality"
import { getAuthCookieHeader } from "@/lib/auth-cookies" import { getAuthCookieHeader } from "@/lib/auth-cookies"
import { downloadQualitySupported } from "@/lib/playback-capabilities"
import type { ServerConfig } from "@/lib/server-config" import type { ServerConfig } from "@/lib/server-config"
const REMEMBERED_QUALITY_KEY = "otunes.download-quality" const REMEMBERED_QUALITY_KEY = "otunes.download-quality"
@@ -298,9 +299,10 @@ export function downloadedCoverUri(url: string) {
export async function readRememberedDownloadQuality() { export async function readRememberedDownloadQuality() {
try { try {
return parseDownloadQuality( const quality = parseDownloadQuality(
await AsyncStorage.getItem(REMEMBERED_QUALITY_KEY) await AsyncStorage.getItem(REMEMBERED_QUALITY_KEY)
) )
return quality && downloadQualitySupported(quality) ? quality : undefined
} catch { } catch {
return undefined return undefined
} }
+15
View File
@@ -1,5 +1,10 @@
import { Platform } from "react-native" import { Platform } from "react-native"
import {
DOWNLOAD_QUALITIES,
type DownloadQuality,
} from "@otunes/convex/download-quality"
// Android Dolby decoder reports do not reliably indicate working Atmos playback. // Android Dolby decoder reports do not reliably indicate working Atmos playback.
export const dolbyAtmosSupported = Platform.OS === "ios" export const dolbyAtmosSupported = Platform.OS === "ios"
@@ -7,3 +12,13 @@ export const dolbyAtmosSupported = Platform.OS === "ios"
export function atmosEnabled(user: { preferAtmos?: boolean }) { export function atmosEnabled(user: { preferAtmos?: boolean }) {
return dolbyAtmosSupported && (user.preferAtmos ?? false) return dolbyAtmosSupported && (user.preferAtmos ?? false)
} }
/** Whether this device may download in a quality. Android cannot download Atmos. */
export function downloadQualitySupported(quality: DownloadQuality) {
return quality !== "atmos" || dolbyAtmosSupported
}
/** Download qualities this device offers, lowest first. */
export const deviceDownloadQualities = DOWNLOAD_QUALITIES.filter(
downloadQualitySupported
)