From fe3f24c12b0f8d4284997cd3ceeb30c5c4eb8b97 Mon Sep 17 00:00:00 2001 From: Shawn Jackson Date: Sat, 24 Jan 2026 12:12:53 -0800 Subject: [PATCH] RU-T46 Native PPT Android fix --- plugins/withMediaButtonModule.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/withMediaButtonModule.js b/plugins/withMediaButtonModule.js index 3e1f72d1..14fb76bc 100644 --- a/plugins/withMediaButtonModule.js +++ b/plugins/withMediaButtonModule.js @@ -481,6 +481,18 @@ const withMediaButtonModule = (config) => { // Check if MediaButtonPackage is already imported/added if (!mainApplication.contents.includes('MediaButtonPackage')) { + // Get the package name from the first line of the file + const packageMatch = mainApplication.contents.match(/^package\s+([^\s]+)/); + const packageName = packageMatch ? packageMatch[1] : 'com.resgrid.unit'; + + // Add import statement for MediaButtonPackage after the package declaration + const importStatement = `import ${packageName}.MediaButtonPackage`; + if (!mainApplication.contents.includes(importStatement)) { + // Add import after the package declaration line + mainApplication.contents = mainApplication.contents.replace(/^(package\s+[^\n]+\n)/, `$1${importStatement}\n`); + console.log('[withMediaButtonModule] Added MediaButtonPackage import'); + } + // Add the package to getPackages() // Find the packages list and add our package const packagesPattern = /val packages = PackageList\(this\)\.packages(\.toMutableList\(\))?/;