mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-30 09:32:50 +01:00
refactor: migrate app.config and Expo config plugins to TypeScript (#1718)
This commit is contained in:
36
plugins/withExcludeMedia3Dash.ts
Normal file
36
plugins/withExcludeMedia3Dash.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { type ConfigPlugin, withAppBuildGradle } from "expo/config-plugins";
|
||||
|
||||
const withExcludeMedia3Dash: ConfigPlugin = (config) => {
|
||||
return withAppBuildGradle(config, (config) => {
|
||||
const contents = config.modResults.contents;
|
||||
|
||||
// Add exclusion for duplicate media3 modules before dependencies block
|
||||
const exclusionBlock = `
|
||||
configurations.all {
|
||||
// Exclude duplicate media3 modules to avoid conflict between react-native-video and react-native-track-player
|
||||
exclude group: 'androidx.media3', module: 'media3-exoplayer-dash'
|
||||
exclude group: 'androidx.media3', module: 'media3-exoplayer-smoothstreaming'
|
||||
exclude group: 'androidx.media3', module: 'media3-exoplayer-rtsp'
|
||||
}
|
||||
`;
|
||||
|
||||
// Check if exclusion already exists
|
||||
if (contents.includes("media3-exoplayer-dash")) {
|
||||
return config;
|
||||
}
|
||||
|
||||
// Insert before the dependencies block
|
||||
const dependenciesIndex = contents.indexOf("dependencies {");
|
||||
if (dependenciesIndex !== -1) {
|
||||
config.modResults.contents =
|
||||
contents.slice(0, dependenciesIndex) +
|
||||
exclusionBlock +
|
||||
"\n" +
|
||||
contents.slice(dependenciesIndex);
|
||||
}
|
||||
|
||||
return config;
|
||||
});
|
||||
};
|
||||
|
||||
export default withExcludeMedia3Dash;
|
||||
Reference in New Issue
Block a user