Update main.yml
This commit is contained in:
parent
ebe3c572bb
commit
fcfa11d032
1 changed files with 6 additions and 32 deletions
38
.github/workflows/main.yml
vendored
38
.github/workflows/main.yml
vendored
|
|
@ -25,40 +25,14 @@ jobs:
|
||||||
|
|
||||||
- name: Patch Track Player
|
- name: Patch Track Player
|
||||||
run: |
|
run: |
|
||||||
# 1. Create missing trackPlayer.js so original plugin import doesn't crash
|
|
||||||
node scripts/patch-track-player.js
|
node scripts/patch-track-player.js
|
||||||
|
node scripts/fix-track-player-plugin.js
|
||||||
# 2. Also rewrite app.plugin.js to pure CommonJS as safety fallback
|
|
||||||
PLUGIN_PATH="node_modules/react-native-track-player/app.plugin.js"
|
|
||||||
cat << 'EOF' > "$PLUGIN_PATH"
|
|
||||||
const { withInfoPlist } = require('@expo/config-plugins');
|
|
||||||
module.exports = function(config) {
|
|
||||||
return withInfoPlist(config, (config) => {
|
|
||||||
if (!config.modResults.UIBackgroundModes) {
|
|
||||||
config.modResults.UIBackgroundModes = [];
|
|
||||||
}
|
|
||||||
if (!config.modResults.UIBackgroundModes.includes('audio')) {
|
|
||||||
config.modResults.UIBackgroundModes.push('audio');
|
|
||||||
}
|
|
||||||
return config;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
EOF
|
|
||||||
echo "Track player patched OK"
|
|
||||||
|
|
||||||
# 3. Add plugin back to app.json so AppDelegate gets audio mode set
|
|
||||||
node -e "
|
node -e "
|
||||||
const fs = require('fs');
|
var fs=require('fs');
|
||||||
const cfg = JSON.parse(fs.readFileSync('app.json', 'utf8'));
|
var cfg=JSON.parse(fs.readFileSync('app.json','utf8'));
|
||||||
const plugins = cfg.expo.plugins || [];
|
var p=cfg.expo.plugins||[];
|
||||||
if (!plugins.includes('react-native-track-player')) {
|
if(!p.includes('react-native-track-player')){p.unshift('react-native-track-player');cfg.expo.plugins=p;fs.writeFileSync('app.json',JSON.stringify(cfg,null,2));}
|
||||||
plugins.unshift('react-native-track-player');
|
console.log('app.json plugins:',cfg.expo.plugins);
|
||||||
cfg.expo.plugins = plugins;
|
|
||||||
fs.writeFileSync('app.json', JSON.stringify(cfg, null, 2));
|
|
||||||
console.log('Added plugin to app.json');
|
|
||||||
} else {
|
|
||||||
console.log('Plugin already in app.json');
|
|
||||||
}
|
|
||||||
"
|
"
|
||||||
|
|
||||||
- name: Fix PNG assets
|
- name: Fix PNG assets
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue