mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-03-18 15:26:17 +00:00
chore: update dependencies and refactor config plugin imports (#993)
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
const {
|
||||
withAndroidManifest: NativeAndroidManifest,
|
||||
} = require("@expo/config-plugins");
|
||||
const { withAndroidManifest } = require("expo/config-plugins");
|
||||
|
||||
const withAndroidManifest = (config) =>
|
||||
NativeAndroidManifest(config, async (config) => {
|
||||
const mainApplication = config.modResults.manifest.application[0];
|
||||
const _withGoogleCastAndroidManifest = (config) =>
|
||||
withAndroidManifest(config, async (mod) => {
|
||||
const mainApplication = mod.modResults.manifest.application[0];
|
||||
|
||||
// Initialize activity array if it doesn't exist
|
||||
if (!mainApplication.activity) {
|
||||
@@ -25,6 +23,7 @@ const withAndroidManifest = (config) =>
|
||||
"com.reactnative.googlecast.RNGCExpandedControllerActivity",
|
||||
"android:theme": "@style/Theme.MaterialComponents.NoActionBar",
|
||||
"android:launchMode": "singleTask",
|
||||
"android:exported": "false",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -33,11 +32,11 @@ const withAndroidManifest = (config) =>
|
||||
(activity) => activity.$?.["android:name"] === ".MainActivity",
|
||||
);
|
||||
|
||||
if (mainActivity) {
|
||||
if (mainActivity?.$) {
|
||||
mainActivity.$["android:supportsPictureInPicture"] = "true";
|
||||
}
|
||||
|
||||
return config;
|
||||
return mod;
|
||||
});
|
||||
|
||||
module.exports = withAndroidManifest;
|
||||
module.exports = _withGoogleCastAndroidManifest;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { readFileSync, writeFileSync } = require("node:fs");
|
||||
const { join } = require("node:path");
|
||||
const { withDangerousMod } = require("@expo/config-plugins");
|
||||
const { withDangerousMod } = require("expo/config-plugins");
|
||||
|
||||
const withChangeNativeAndroidTextToWhite = (expoConfig) =>
|
||||
withDangerousMod(expoConfig, [
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const { withAppDelegate, withXcodeProject } = require("@expo/config-plugins");
|
||||
const { withAppDelegate, withXcodeProject } = require("expo/config-plugins");
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
|
||||
/** @param {import("@expo/config-plugins").ExpoConfig} config */
|
||||
/** @param {import("expo/config-plugins").ExpoConfig} config */
|
||||
function withRNBackgroundDownloader(config) {
|
||||
/* 1️⃣ Add handleEventsForBackgroundURLSession to AppDelegate.swift */
|
||||
config = withAppDelegate(config, (mod) => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const { AndroidConfig, withAndroidManifest } = require("@expo/config-plugins");
|
||||
const { Paths } = require("@expo/config-plugins/build/android");
|
||||
const { AndroidConfig, withAndroidManifest } = require("expo/config-plugins");
|
||||
const path = require("node:path");
|
||||
const fs = require("node:fs");
|
||||
const fsPromises = fs.promises;
|
||||
@@ -7,16 +6,18 @@ const fsPromises = fs.promises;
|
||||
const { getMainApplicationOrThrow } = AndroidConfig.Manifest;
|
||||
|
||||
const withTrustLocalCerts = (config) => {
|
||||
return withAndroidManifest(config, async (config) => {
|
||||
config.modResults = await setCustomConfigAsync(config, config.modResults);
|
||||
return config;
|
||||
return withAndroidManifest(config, async (mod) => {
|
||||
mod.modResults = await setCustomConfigAsync(mod, mod.modResults);
|
||||
return mod;
|
||||
});
|
||||
};
|
||||
|
||||
async function setCustomConfigAsync(config, androidManifest) {
|
||||
const src_file_path = path.join(__dirname, "network_security_config.xml");
|
||||
const res_file_path = path.join(
|
||||
await Paths.getResourceFolderAsync(config.modRequest.projectRoot),
|
||||
await AndroidConfig.Paths.getResourceFolderAsync(
|
||||
config.modRequest.projectRoot,
|
||||
),
|
||||
"xml",
|
||||
"network_security_config.xml",
|
||||
);
|
||||
@@ -31,12 +32,15 @@ async function setCustomConfigAsync(config, androidManifest) {
|
||||
await fsPromises.copyFile(src_file_path, res_file_path);
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`Failed to copy network security config file from ${src_file_path} to ${res_file_path}: ${e.message}`,
|
||||
`Failed to copy network security config file from ${src_file_path} to ${res_file_path}. [Hint: Check Android write permissions and file paths]`,
|
||||
{ cause: e },
|
||||
);
|
||||
}
|
||||
const mainApplication = getMainApplicationOrThrow(androidManifest);
|
||||
mainApplication.$["android:networkSecurityConfig"] =
|
||||
"@xml/network_security_config";
|
||||
if (!mainApplication.$["android:networkSecurityConfig"]) {
|
||||
mainApplication.$["android:networkSecurityConfig"] =
|
||||
"@xml/network_security_config";
|
||||
}
|
||||
|
||||
return androidManifest;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user