// Metro module 10940 (f10941). import { PureComponent } from "react"; import { Linking, View } from "react-native"; import { SPOTIFY_APP_PROTOCOL, SpotifyEndpoints, SpotifyResourceTypes } from "../../spotify/SpotifyConstants"; import { jsx } from "react/jsx-runtime"; import { getConstants } from "../../../utils/native/ClientInfoUtils"; import { HTTP } from "../../../_bundle/sendRequest"; import Linking2 from "../../../lib/native/Linking"; import { Button } from "../../../design/components/Button/native/Button.native"; import Module7920 from "../../../_bundle/Module7920"; import { intl, t } from "../../../intl/index.native"; import { LegacyText } from "../../../design/void/native"; function $mk85930() { return () => {}; } function $mk85931($env) { return (a0) => { const r2 = $env.$parent; const TRACK = r2[8].TRACK; const r7 = $env[0]; return a0 ? r2[4].openURL(r2[7].PLAYER_OPEN(TRACK, r7, true, "mobile")).catch($mk85930()) : (0, r2[1])(r2[3][6]).openURL(r2[7].WEB_OPEN(TRACK, r7, "mobile")); }; } function $mk85932() { return () => {}; } function $mk85933($env) { return (a0) => { const r2 = $env; let env26867 = { $parent: $env }; env26867[0] = a0; const r6 = $env.$parent; return (0, r6[0])(r6[3][7]).getSpotifyMetadataFromActivity(r2[0], r2[1]).then((result) => { const r8 = result.artist_ids[env26867.$parent[2]]; const r16 = env26867.$parent.$parent; const r18 = env26867[0]; const ARTIST = r16[8].ARTIST; return r18 ? r16[4].openURL(r16[7].PLAYER_OPEN(ARTIST, r8, true, "mobile")).catch($mk85930()) : (0, r16[1])(r16[3][6]).openURL(r16[7].WEB_OPEN(ARTIST, r8, "mobile")); }); }; } function $mk85934() { return () => {}; } function $mk85935($env) { return (a0) => { const r2 = $env; const r3 = $env.$parent; let env26868 = { $parent: r3 }; env26868[0] = a0; return (0, r3[0])(r3[3][7]).getSpotifyMetadataFromActivity(r2[0], r2[1]).then(({ album_id }) => { const r2 = env26868.$parent; const r15 = env26868[0]; const ALBUM = r2[8].ALBUM; return r15 ? r2[4].openURL(r2[7].PLAYER_OPEN(ALBUM, album_id, true, "mobile")).catch($mk85930()) : (0, r2[1])(r2[3][6]).openURL(r2[7].WEB_OPEN(ALBUM, album_id, "mobile")); }); }; } function $mk85936() { return () => {}; } let c7367_11, c7367_12, c7367_13; let env7367 = {}; export class SpotifyTrack extends PureComponent { handleOpenSpotifyTrack = () => { let env26869; const r2 = env7367; const activity2 = this.props.activity; const r10 = env26869 = { $parent: r2 }; env26869[0] = void 0; env26869[0] = activity2.sync_id; Linking.canOpenURL(`${SPOTIFY_APP_PROTOCOL}:`).then($mk85931(r10)).catch($mk85932()); }; render() { const props = this.props; const { text, onPress: onPress2 } = props; return (0, jsx)(LegacyText, { onPress: () => { if (onPress2 != null) { onPress2(); } this.handleOpenSpotifyTrack(); }, suppressHighlighting: true, children: text }); } } c7367_11 = SpotifyTrack; export class SpotifyArtists extends PureComponent { handleOpenSpotifyArtist = (a0) => { let env26870; const props = this.props; const r2 = env7367; const { activity: activity2, userId } = props; const r10 = env26870 = { $parent: r2 }; env26870[0] = activity2; env26870[1] = userId; env26870[2] = a0; Linking.canOpenURL(`${SPOTIFY_APP_PROTOCOL}:`).then($mk85933(r10)).catch($mk85934()); }; renderLink(a0, a1, a2) { const onPress3 = this.props.onPress; return {(0, jsx)(LegacyText, { onPress: () => { if (onPress3 != null) { onPress3(); } this.handleOpenSpotifyArtist(a1); }, suppressHighlighting: true, children: a0 })} {a2 ? "" : ", "} ; } render() { const r7 = this.props.artists.split("; "); let c18380_0 = r7.length - 1; return (0, jsx)(LegacyText, { children: r7.map((item, index) => this.renderLink(item, index, index === c18380_0)) }); } } c7367_12 = SpotifyArtists; export class SpotifyAlbum extends PureComponent { handleOpenSpotifyAlbum = () => { let env26871; const props = this.props; const r2 = env7367; const { activity: activity2, userId } = props; const r10 = env26871 = { $parent: r2 }; env26871[0] = activity2; env26871[1] = userId; Linking.canOpenURL(`${SPOTIFY_APP_PROTOCOL}:`).then($mk85935(r10)).catch($mk85936()); }; render() { return (0, jsx)(LegacyText, { onPress: this.handleOpenSpotifyAlbum, suppressHighlighting: true, children: this.props.text }); } } c7367_13 = SpotifyAlbum; export function canOpenSpotifyUrl() { return Linking.canOpenURL(`${SPOTIFY_APP_PROTOCOL}:`); } export function attributeInstall() { HTTP.get({ url: SpotifyEndpoints.INSTALL_ATTRIBUTION(getConstants().Identifier), rejectWithError: true }); } export function openUrl(a0, a1, a2) { return a0 ? Linking.openURL(SpotifyEndpoints.PLAYER_OPEN(a1, a2, true, "mobile")).catch($mk85930()) : Linking2.openURL(SpotifyEndpoints.WEB_OPEN(a1, a2, "mobile")); } export function openTrack(a0) { let env18373; const r1 = env18373 = { $parent: env7367 }; env18373[0] = a0.sync_id; Linking.canOpenURL(`${SPOTIFY_APP_PROTOCOL}:`).then($mk85931(r1)).catch($mk85932()); } export function openArtist(a0, a1, a2) { let env18374; const r1 = env18374 = { $parent: env7367 }; env18374[0] = a0; env18374[1] = a1; env18374[2] = a2; Linking.canOpenURL(`${SPOTIFY_APP_PROTOCOL}:`).then($mk85933(r1)).catch($mk85934()); } export function openAlbum(a0, a1) { let env18375; const r1 = env18375 = { $parent: env7367 }; env18375[0] = a0; env18375[1] = a1; Linking.canOpenURL(`${SPOTIFY_APP_PROTOCOL}:`).then($mk85935(r1)).catch($mk85936()); } export function SpotifyPlayButton(props) { const activity = props.activity; return