Skip to content

Commit fe3f24c

Browse files
committed
RU-T46 Native PPT Android fix
1 parent 375900b commit fe3f24c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

plugins/withMediaButtonModule.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,18 @@ const withMediaButtonModule = (config) => {
481481

482482
// Check if MediaButtonPackage is already imported/added
483483
if (!mainApplication.contents.includes('MediaButtonPackage')) {
484+
// Get the package name from the first line of the file
485+
const packageMatch = mainApplication.contents.match(/^package\s+([^\s]+)/);
486+
const packageName = packageMatch ? packageMatch[1] : 'com.resgrid.unit';
487+
488+
// Add import statement for MediaButtonPackage after the package declaration
489+
const importStatement = `import ${packageName}.MediaButtonPackage`;
490+
if (!mainApplication.contents.includes(importStatement)) {
491+
// Add import after the package declaration line
492+
mainApplication.contents = mainApplication.contents.replace(/^(package\s+[^\n]+\n)/, `$1${importStatement}\n`);
493+
console.log('[withMediaButtonModule] Added MediaButtonPackage import');
494+
}
495+
484496
// Add the package to getPackages()
485497
// Find the packages list and add our package
486498
const packagesPattern = /val packages = PackageList\(this\)\.packages(\.toMutableList\(\))?/;

0 commit comments

Comments
 (0)