preliminary support for astra desktop

This commit is contained in:
Boof2015
2026-07-01 00:43:51 -04:00
parent 8f23c6a1e2
commit 76a5183dfb
25 changed files with 3145 additions and 0 deletions
@@ -0,0 +1,43 @@
import { requireOptionalNativeModule, type NativeModule } from 'expo-modules-core';
export type AstraDesktopRemoteSessionCommand =
| { command: 'play' }
| { command: 'pause' }
| { command: 'toggle-play' }
| { command: 'previous' }
| { command: 'next' }
| { command: 'toggle-favorite' }
| { command: 'seek'; position: number }
| { command: 'stop' };
export interface AstraDesktopRemoteSessionState {
title?: string | null;
artist?: string | null;
album?: string | null;
desktopName?: string | null;
artworkDataUrl?: string | null;
playbackState: 'stopped' | 'playing' | 'paused' | 'loading';
hasTrack: boolean;
duration?: number | null;
position?: number | null;
updatedAt?: number | null;
isFavorite?: boolean;
}
type AstraDesktopRemoteSessionEvents = {
onDesktopRemoteCommand: (event: AstraDesktopRemoteSessionCommand) => void;
};
declare class AstraDesktopRemoteSessionModuleType extends NativeModule<AstraDesktopRemoteSessionEvents> {
setNowPlaying(state: AstraDesktopRemoteSessionState): void;
clear(): void;
}
const native = requireOptionalNativeModule<AstraDesktopRemoteSessionModuleType>('AstraDesktopRemoteSession');
export const AstraDesktopRemoteSession = native ?? {
addListener: () => ({ remove: () => {} }),
removeAllListeners: () => {},
setNowPlaying: () => {},
clear: () => {},
};