mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-03 04:28:31 +01:00
feat(android-tv): TV recommendations (#1575)
This commit is contained in:
26
modules/tv-recommendations/src/TvRecommendationsModule.ts
Normal file
26
modules/tv-recommendations/src/TvRecommendationsModule.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { requireNativeModule } from "expo-modules-core";
|
||||
import { Platform } from "react-native";
|
||||
import type { TvRecommendationsModuleType } from "./TvRecommendations.types";
|
||||
|
||||
let TvRecommendationsModule: TvRecommendationsModuleType | null = null;
|
||||
|
||||
if (Platform.OS === "android" && Platform.isTV) {
|
||||
try {
|
||||
TvRecommendationsModule =
|
||||
requireNativeModule<TvRecommendationsModuleType>("TvRecommendations");
|
||||
} catch {
|
||||
TvRecommendationsModule = null;
|
||||
}
|
||||
}
|
||||
|
||||
export function syncTvRecommendations(json: string): boolean {
|
||||
return TvRecommendationsModule?.syncRecommendations(json) ?? false;
|
||||
}
|
||||
|
||||
export function clearTvRecommendations(): boolean {
|
||||
return TvRecommendationsModule?.clearRecommendations() ?? false;
|
||||
}
|
||||
|
||||
export function refreshTvRecommendations(): boolean {
|
||||
return TvRecommendationsModule?.refreshRecommendations() ?? false;
|
||||
}
|
||||
Reference in New Issue
Block a user