diff --git a/app.json b/app.json index da2cee2c..e2f796d0 100644 --- a/app.json +++ b/app.json @@ -106,7 +106,8 @@ { "motionPermission": "Allow Streamyfin to access your device motion for landscape video watching." } - ] + ], + "expo-asset" ], "experiments": { "typedRoutes": true diff --git a/app/(auth)/(tabs)/(home)/index.tsx b/app/(auth)/(tabs)/(home)/index.tsx index 9aecff51..98bfc01e 100644 --- a/app/(auth)/(tabs)/(home)/index.tsx +++ b/app/(auth)/(tabs)/(home)/index.tsx @@ -6,6 +6,7 @@ import { Loader } from "@/components/Loader"; import { MediaListSection } from "@/components/medialists/MediaListSection"; import { Colors } from "@/constants/Colors"; import { TAB_HEIGHT } from "@/constants/Values"; +import { hello } from "@/modules/vlc-player"; import { useDownload } from "@/providers/DownloadProvider"; import { apiAtom, userAtom } from "@/providers/JellyfinProvider"; import { useSettings } from "@/utils/atoms/settings"; @@ -382,49 +383,9 @@ export default function index() { ); return ( - - } - key={"home"} - contentContainerStyle={{ - paddingLeft: insets.left, - paddingRight: insets.right, - paddingBottom: 16, - }} - style={{ - marginBottom: TAB_HEIGHT, - }} - > - - - - {sections.map((section, index) => { - if (section.type === "ScrollingCollectionList") { - return ( - - ); - } else if (section.type === "MediaListSection") { - return ( - - ); - } - return null; - })} - - + + {hello()} + ); } diff --git a/bun.lockb b/bun.lockb index a101897e..b1e3bd2f 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/modules/vlc-player/android/.gradle/8.9/checksums/checksums.lock b/modules/vlc-player/android/.gradle/8.9/checksums/checksums.lock new file mode 100644 index 00000000..d3a90046 Binary files /dev/null and b/modules/vlc-player/android/.gradle/8.9/checksums/checksums.lock differ diff --git a/modules/vlc-player/android/.gradle/8.9/dependencies-accessors/gc.properties b/modules/vlc-player/android/.gradle/8.9/dependencies-accessors/gc.properties new file mode 100644 index 00000000..e69de29b diff --git a/modules/vlc-player/android/.gradle/8.9/fileChanges/last-build.bin b/modules/vlc-player/android/.gradle/8.9/fileChanges/last-build.bin new file mode 100644 index 00000000..f76dd238 Binary files /dev/null and b/modules/vlc-player/android/.gradle/8.9/fileChanges/last-build.bin differ diff --git a/modules/vlc-player/android/.gradle/8.9/fileHashes/fileHashes.lock b/modules/vlc-player/android/.gradle/8.9/fileHashes/fileHashes.lock new file mode 100644 index 00000000..da9ec570 Binary files /dev/null and b/modules/vlc-player/android/.gradle/8.9/fileHashes/fileHashes.lock differ diff --git a/modules/vlc-player/android/.gradle/8.9/gc.properties b/modules/vlc-player/android/.gradle/8.9/gc.properties new file mode 100644 index 00000000..e69de29b diff --git a/modules/vlc-player/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/modules/vlc-player/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 00000000..f105b879 Binary files /dev/null and b/modules/vlc-player/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/modules/vlc-player/android/.gradle/buildOutputCleanup/cache.properties b/modules/vlc-player/android/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 00000000..799d484f --- /dev/null +++ b/modules/vlc-player/android/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Thu Oct 10 22:31:55 AEDT 2024 +gradle.version=8.9 diff --git a/modules/vlc-player/android/.gradle/vcs-1/gc.properties b/modules/vlc-player/android/.gradle/vcs-1/gc.properties new file mode 100644 index 00000000..e69de29b diff --git a/modules/vlc-player/android/build.gradle b/modules/vlc-player/android/build.gradle new file mode 100644 index 00000000..ccc7cf47 --- /dev/null +++ b/modules/vlc-player/android/build.gradle @@ -0,0 +1,43 @@ +apply plugin: 'com.android.library' + +group = 'expo.modules.vlcplayer' +version = '0.6.0' + +def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle") +apply from: expoModulesCorePlugin +applyKotlinExpoModulesCorePlugin() +useCoreDependencies() +useExpoPublishing() + +// If you want to use the managed Android SDK versions from expo-modules-core, set this to true. +// The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code. +// Most of the time, you may like to manage the Android SDK versions yourself. +def useManagedAndroidSdkVersions = false +if (useManagedAndroidSdkVersions) { + useDefaultAndroidSdkVersions() +} else { + buildscript { + // Simple helper that allows the root project to override versions declared by this library. + ext.safeExtGet = { prop, fallback -> + rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback + } + } + project.android { + compileSdkVersion safeExtGet("compileSdkVersion", 34) + defaultConfig { + minSdkVersion safeExtGet("minSdkVersion", 21) + targetSdkVersion safeExtGet("targetSdkVersion", 34) + } + } +} + +android { + namespace "expo.modules.vlcplayer" + defaultConfig { + versionCode 1 + versionName "0.6.0" + } + lintOptions { + abortOnError false + } +} diff --git a/modules/vlc-player/android/src/main/AndroidManifest.xml b/modules/vlc-player/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..bdae66c8 --- /dev/null +++ b/modules/vlc-player/android/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/modules/vlc-player/android/src/main/java/expo/modules/vlcplayer/VlcPlayerModule.kt b/modules/vlc-player/android/src/main/java/expo/modules/vlcplayer/VlcPlayerModule.kt new file mode 100644 index 00000000..729ccb57 --- /dev/null +++ b/modules/vlc-player/android/src/main/java/expo/modules/vlcplayer/VlcPlayerModule.kt @@ -0,0 +1,47 @@ +package expo.modules.vlcplayer + +import expo.modules.kotlin.modules.Module +import expo.modules.kotlin.modules.ModuleDefinition + +class VlcPlayerModule : Module() { + // Each module class must implement the definition function. The definition consists of components + // that describes the module's functionality and behavior. + // See https://docs.expo.dev/modules/module-api for more details about available components. + override fun definition() = ModuleDefinition { + // Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument. + // Can be inferred from module's class name, but it's recommended to set it explicitly for clarity. + // The module will be accessible from `requireNativeModule('VlcPlayer')` in JavaScript. + Name("VlcPlayer") + + // Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary. + Constants( + "PI" to Math.PI + ) + + // Defines event names that the module can send to JavaScript. + Events("onChange") + + // Defines a JavaScript synchronous function that runs the native code on the JavaScript thread. + Function("hello") { + "Hello world! 👋" + } + + // Defines a JavaScript function that always returns a Promise and whose native code + // is by default dispatched on the different thread than the JavaScript runtime runs on. + AsyncFunction("setValueAsync") { value: String -> + // Send an event to JavaScript. + sendEvent("onChange", mapOf( + "value" to value + )) + } + + // Enables the module to be used as a native view. Definition components that are accepted as part of + // the view definition: Prop, Events. + View(VlcPlayerView::class) { + // Defines a setter for the `name` prop. + Prop("name") { view: VlcPlayerView, prop: String -> + println(prop) + } + } + } +} diff --git a/modules/vlc-player/android/src/main/java/expo/modules/vlcplayer/VlcPlayerView.kt b/modules/vlc-player/android/src/main/java/expo/modules/vlcplayer/VlcPlayerView.kt new file mode 100644 index 00000000..3f0855ca --- /dev/null +++ b/modules/vlc-player/android/src/main/java/expo/modules/vlcplayer/VlcPlayerView.kt @@ -0,0 +1,7 @@ +package expo.modules.vlcplayer + +import android.content.Context +import expo.modules.kotlin.AppContext +import expo.modules.kotlin.views.ExpoView + +class VlcPlayerView(context: Context, appContext: AppContext) : ExpoView(context, appContext) diff --git a/modules/vlc-player/expo-module.config.json b/modules/vlc-player/expo-module.config.json new file mode 100644 index 00000000..2fbd3167 --- /dev/null +++ b/modules/vlc-player/expo-module.config.json @@ -0,0 +1,9 @@ +{ + "platforms": ["ios", "tvos", "android", "web"], + "ios": { + "modules": ["VlcPlayerModule"] + }, + "android": { + "modules": ["expo.modules.vlcplayer.VlcPlayerModule"] + } +} diff --git a/modules/vlc-player/index.ts b/modules/vlc-player/index.ts new file mode 100644 index 00000000..3d17dbea --- /dev/null +++ b/modules/vlc-player/index.ts @@ -0,0 +1,26 @@ +import { NativeModulesProxy, EventEmitter, Subscription } from 'expo-modules-core'; + +// Import the native module. On web, it will be resolved to VlcPlayer.web.ts +// and on native platforms to VlcPlayer.ts +import VlcPlayerModule from './src/VlcPlayerModule'; +import VlcPlayerView from './src/VlcPlayerView'; +import { ChangeEventPayload, VlcPlayerViewProps } from './src/VlcPlayer.types'; + +// Get the native constant value. +export const PI = VlcPlayerModule.PI; + +export function hello(): string { + return VlcPlayerModule.hello(); +} + +export async function setValueAsync(value: string) { + return await VlcPlayerModule.setValueAsync(value); +} + +const emitter = new EventEmitter(VlcPlayerModule ?? NativeModulesProxy.VlcPlayer); + +export function addChangeListener(listener: (event: ChangeEventPayload) => void): Subscription { + return emitter.addListener('onChange', listener); +} + +export { VlcPlayerView, VlcPlayerViewProps, ChangeEventPayload }; diff --git a/modules/vlc-player/ios/VlcPlayer.podspec b/modules/vlc-player/ios/VlcPlayer.podspec new file mode 100644 index 00000000..d3222c6a --- /dev/null +++ b/modules/vlc-player/ios/VlcPlayer.podspec @@ -0,0 +1,22 @@ +Pod::Spec.new do |s| + s.name = 'VlcPlayer' + s.version = '1.0.0' + s.summary = 'A sample project summary' + s.description = 'A sample project description' + s.author = '' + s.homepage = 'https://docs.expo.dev/modules/' + s.platforms = { :ios => '13.4', :tvos => '13.4' } + s.source = { git: '' } + s.static_framework = true + + s.dependency 'ExpoModulesCore' + s.dependency 'MobileVLCKit' + + # Swift/Objective-C compatibility + s.pod_target_xcconfig = { + 'DEFINES_MODULE' => 'YES', + 'SWIFT_COMPILATION_MODE' => 'wholemodule' + } + + s.source_files = "**/*.{h,m,mm,swift,hpp,cpp}" +end diff --git a/modules/vlc-player/ios/VlcPlayerModule.swift b/modules/vlc-player/ios/VlcPlayerModule.swift new file mode 100644 index 00000000..4097921d --- /dev/null +++ b/modules/vlc-player/ios/VlcPlayerModule.swift @@ -0,0 +1,44 @@ +import ExpoModulesCore + +public class VlcPlayerModule: Module { + // Each module class must implement the definition function. The definition consists of components + // that describes the module's functionality and behavior. + // See https://docs.expo.dev/modules/module-api for more details about available components. + public func definition() -> ModuleDefinition { + // Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument. + // Can be inferred from module's class name, but it's recommended to set it explicitly for clarity. + // The module will be accessible from `requireNativeModule('VlcPlayer')` in JavaScript. + Name("VlcPlayer") + + // Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary. + Constants([ + "PI": Double.pi + ]) + + // Defines event names that the module can send to JavaScript. + Events("onChange") + + // Defines a JavaScript synchronous function that runs the native code on the JavaScript thread. + Function("hello") { + return "Hello world! 👋" + } + + // Defines a JavaScript function that always returns a Promise and whose native code + // is by default dispatched on the different thread than the JavaScript runtime runs on. + AsyncFunction("setValueAsync") { (value: String) in + // Send an event to JavaScript. + self.sendEvent("onChange", [ + "value": value + ]) + } + + // Enables the module to be used as a native view. Definition components that are accepted as part of the + // view definition: Prop, Events. + View(VlcPlayerView.self) { + // Defines a setter for the `name` prop. + Prop("name") { (view: VlcPlayerView, prop: String) in + print(prop) + } + } + } +} diff --git a/modules/vlc-player/ios/VlcPlayerView.swift b/modules/vlc-player/ios/VlcPlayerView.swift new file mode 100644 index 00000000..70c17d44 --- /dev/null +++ b/modules/vlc-player/ios/VlcPlayerView.swift @@ -0,0 +1,7 @@ +import ExpoModulesCore + +// This view will be used as a native component. Make sure to inherit from `ExpoView` +// to apply the proper styling (e.g. border radius and shadows). +class VlcPlayerView: ExpoView { + +} diff --git a/modules/vlc-player/src/VlcPlayer.types.ts b/modules/vlc-player/src/VlcPlayer.types.ts new file mode 100644 index 00000000..6a86dd3f --- /dev/null +++ b/modules/vlc-player/src/VlcPlayer.types.ts @@ -0,0 +1,7 @@ +export type ChangeEventPayload = { + value: string; +}; + +export type VlcPlayerViewProps = { + name: string; +}; diff --git a/modules/vlc-player/src/VlcPlayerModule.ts b/modules/vlc-player/src/VlcPlayerModule.ts new file mode 100644 index 00000000..1db9b184 --- /dev/null +++ b/modules/vlc-player/src/VlcPlayerModule.ts @@ -0,0 +1,5 @@ +import { requireNativeModule } from 'expo-modules-core'; + +// It loads the native module object from the JSI or falls back to +// the bridge module (from NativeModulesProxy) if the remote debugger is on. +export default requireNativeModule('VlcPlayer'); diff --git a/modules/vlc-player/src/VlcPlayerModule.web.ts b/modules/vlc-player/src/VlcPlayerModule.web.ts new file mode 100644 index 00000000..be76495b --- /dev/null +++ b/modules/vlc-player/src/VlcPlayerModule.web.ts @@ -0,0 +1,13 @@ +import { EventEmitter } from 'expo-modules-core'; + +const emitter = new EventEmitter({} as any); + +export default { + PI: Math.PI, + async setValueAsync(value: string): Promise { + emitter.emit('onChange', { value }); + }, + hello() { + return 'Hello world! 👋'; + }, +}; diff --git a/modules/vlc-player/src/VlcPlayerView.tsx b/modules/vlc-player/src/VlcPlayerView.tsx new file mode 100644 index 00000000..50a7547a --- /dev/null +++ b/modules/vlc-player/src/VlcPlayerView.tsx @@ -0,0 +1,11 @@ +import { requireNativeViewManager } from 'expo-modules-core'; +import * as React from 'react'; + +import { VlcPlayerViewProps } from './VlcPlayer.types'; + +const NativeView: React.ComponentType = + requireNativeViewManager('VlcPlayer'); + +export default function VlcPlayerView(props: VlcPlayerViewProps) { + return ; +} diff --git a/modules/vlc-player/src/VlcPlayerView.web.tsx b/modules/vlc-player/src/VlcPlayerView.web.tsx new file mode 100644 index 00000000..d00682d7 --- /dev/null +++ b/modules/vlc-player/src/VlcPlayerView.web.tsx @@ -0,0 +1,11 @@ +import * as React from 'react'; + +import { VlcPlayerViewProps } from './VlcPlayer.types'; + +export default function VlcPlayerView(props: VlcPlayerViewProps) { + return ( +
+ {props.name} +
+ ); +} diff --git a/package.json b/package.json index ed37651a..edb7f16f 100644 --- a/package.json +++ b/package.json @@ -32,12 +32,13 @@ "@types/lodash": "^4.17.9", "@types/uuid": "^10.0.0", "axios": "^1.7.7", - "expo": "~51.0.36", + "expo": "~51.0.37", + "expo-asset": "~10.0.10", "expo-background-fetch": "~12.0.1", "expo-blur": "~13.0.2", "expo-build-properties": "~0.12.5", "expo-constants": "~16.0.2", - "expo-dev-client": "~4.0.27", + "expo-dev-client": "~4.0.28", "expo-device": "~6.0.2", "expo-font": "~12.0.10", "expo-haptics": "~13.0.1", @@ -55,7 +56,7 @@ "expo-status-bar": "~1.12.1", "expo-system-ui": "~3.0.7", "expo-task-manager": "~11.8.2", - "expo-updates": "~0.25.26", + "expo-updates": "~0.25.27", "expo-web-browser": "~13.0.3", "ffmpeg-kit-react-native": "^6.0.2", "install": "^0.13.0",