mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
chore: Apply linting rules and add git hok (#611)
Co-authored-by: Fredrik Burmester <fredrik.burmester@gmail.com>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
const { withAndroidManifest: NativeAndroidManifest } = require("@expo/config-plugins");
|
||||
const {
|
||||
withAndroidManifest: NativeAndroidManifest,
|
||||
} = require("@expo/config-plugins");
|
||||
|
||||
const withAndroidManifest = (config) =>
|
||||
NativeAndroidManifest(config, async (config) => {
|
||||
NativeAndroidManifest(config, async (config) => {
|
||||
const mainApplication = config.modResults.manifest.application[0];
|
||||
|
||||
// Initialize activity array if it doesn't exist
|
||||
@@ -9,27 +11,30 @@ const withAndroidManifest = (config) =>
|
||||
mainApplication.activity = [];
|
||||
}
|
||||
|
||||
const googleCastActivityExists = mainApplication.activity.some(activity =>
|
||||
activity.$?.["android:name"] === "com.reactnative.googlecast.RNGCExpandedControllerActivity"
|
||||
const googleCastActivityExists = mainApplication.activity.some(
|
||||
(activity) =>
|
||||
activity.$?.["android:name"] ===
|
||||
"com.reactnative.googlecast.RNGCExpandedControllerActivity",
|
||||
);
|
||||
|
||||
// Only add the activity if it doesn't already exist
|
||||
if (!googleCastActivityExists) {
|
||||
mainApplication.activity.push({
|
||||
$: {
|
||||
"android:name": "com.reactnative.googlecast.RNGCExpandedControllerActivity",
|
||||
"android:name":
|
||||
"com.reactnative.googlecast.RNGCExpandedControllerActivity",
|
||||
"android:theme": "@style/Theme.MaterialComponents.NoActionBar",
|
||||
"android:launchMode": "singleTask",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const mainActivity = mainApplication.activity.find(activity =>
|
||||
activity.$?.["android:name"] === ".MainActivity"
|
||||
const mainActivity = mainApplication.activity.find(
|
||||
(activity) => activity.$?.["android:name"] === ".MainActivity",
|
||||
);
|
||||
|
||||
if (mainActivity) {
|
||||
mainActivity.$["android:supportsPictureInPicture"] = "true"
|
||||
mainActivity.$["android:supportsPictureInPicture"] = "true";
|
||||
}
|
||||
|
||||
return config;
|
||||
|
||||
@@ -14,12 +14,15 @@ const withChangeNativeAndroidTextToWhite = (expoConfig) =>
|
||||
"main",
|
||||
"res",
|
||||
"values",
|
||||
"styles.xml"
|
||||
"styles.xml",
|
||||
);
|
||||
|
||||
let stylesXml = readFileSync(stylesXmlPath, "utf8");
|
||||
|
||||
stylesXml = stylesXml.replace(/@android:color\/black/g, "@android:color/white");
|
||||
stylesXml = stylesXml.replace(
|
||||
/@android:color\/black/g,
|
||||
"@android:color/white",
|
||||
);
|
||||
|
||||
writeFileSync(stylesXmlPath, stylesXml, { encoding: "utf8" });
|
||||
}
|
||||
@@ -27,4 +30,4 @@ const withChangeNativeAndroidTextToWhite = (expoConfig) =>
|
||||
},
|
||||
]);
|
||||
|
||||
module.exports = withChangeNativeAndroidTextToWhite;
|
||||
module.exports = withChangeNativeAndroidTextToWhite;
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
const { withGradleProperties } = require('expo/config-plugins');
|
||||
const { withGradleProperties } = require("expo/config-plugins");
|
||||
|
||||
function setGradlePropertiesValue(config, key, value) {
|
||||
return withGradleProperties(config, exportedConfig => {
|
||||
return withGradleProperties(config, (exportedConfig) => {
|
||||
const props = exportedConfig.modResults;
|
||||
const keyIdx = props.findIndex(item => item.type === 'property' && item.key === key);
|
||||
const keyIdx = props.findIndex(
|
||||
(item) => item.type === "property" && item.key === key,
|
||||
);
|
||||
const property = {
|
||||
type: 'property',
|
||||
type: "property",
|
||||
key,
|
||||
value
|
||||
value,
|
||||
};
|
||||
|
||||
if (keyIdx >= 0) {
|
||||
props.splice(keyIdx, 1, property);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
props.push(property);
|
||||
}
|
||||
|
||||
@@ -24,17 +25,13 @@ function setGradlePropertiesValue(config, key, value) {
|
||||
module.exports = function withCustomPlugin(config) {
|
||||
// Expo 52 is not setting this
|
||||
// https://github.com/expo/expo/issues/32558
|
||||
config = setGradlePropertiesValue(
|
||||
config,
|
||||
'android.enableJetifier',
|
||||
'true',
|
||||
);
|
||||
config = setGradlePropertiesValue(config, "android.enableJetifier", "true");
|
||||
|
||||
// Increase memory
|
||||
config = setGradlePropertiesValue(
|
||||
config,
|
||||
'org.gradle.jvmargs',
|
||||
'-Xmx4096m -XX:MaxMetaspaceSize=1024m',
|
||||
config,
|
||||
"org.gradle.jvmargs",
|
||||
"-Xmx4096m -XX:MaxMetaspaceSize=1024m",
|
||||
);
|
||||
return config;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -16,12 +16,12 @@ function withRNBackgroundDownloader(expoConfig) {
|
||||
|
||||
// Find the index of the AppDelegate import statement
|
||||
const importIndex = appDelegateLines.findIndex((line) =>
|
||||
/^#import "AppDelegate.h"/.test(line)
|
||||
/^#import "AppDelegate.h"/.test(line),
|
||||
);
|
||||
|
||||
// Find the index of the last line before the @end statement
|
||||
const endStatementIndex = appDelegateLines.findIndex((line) =>
|
||||
/@end/.test(line)
|
||||
/@end/.test(line),
|
||||
);
|
||||
|
||||
// Insert the import statement if it's not already present
|
||||
@@ -34,7 +34,7 @@ function withRNBackgroundDownloader(expoConfig) {
|
||||
appDelegateLines.splice(
|
||||
endStatementIndex,
|
||||
0,
|
||||
backgroundDownloaderDelegate
|
||||
backgroundDownloaderDelegate,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ async function setCustomConfigAsync(config, androidManifest) {
|
||||
const res_file_path = path.join(
|
||||
await Paths.getResourceFolderAsync(config.modRequest.projectRoot),
|
||||
"xml",
|
||||
"network_security_config.xml"
|
||||
"network_security_config.xml",
|
||||
);
|
||||
|
||||
const res_dir = path.resolve(res_file_path, "..");
|
||||
@@ -31,7 +31,7 @@ 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}: ${e.message}`,
|
||||
);
|
||||
}
|
||||
const mainApplication = getMainApplicationOrThrow(androidManifest);
|
||||
|
||||
Reference in New Issue
Block a user