Merge branch 'master' into ios-implementation

This commit is contained in:
Matthew Raymer
2025-11-11 01:15:55 -08:00
144 changed files with 7764 additions and 4865 deletions

View File

@@ -5,10 +5,10 @@
*
* Fixes:
* 1. capacitor.plugins.json - Ensures DailyNotification plugin is registered
* 2. capacitor.settings.gradle - Corrects plugin path from android/ to android/plugin/
* 2. capacitor.settings.gradle - Verifies plugin path points to android/ (standard structure)
*
* This script should run automatically after 'npx cap sync android'
* to fix issues with Capacitor's auto-generated files.
* to verify Capacitor's auto-generated files are correct.
*
* @author Matthew Raymer
*/
@@ -60,10 +60,10 @@ function fixCapacitorPlugins() {
}
/**
* Fix capacitor.settings.gradle to point to android/plugin/ instead of android/
* Fix capacitor.settings.gradle to verify plugin path points to android/ (standard structure)
*/
function fixCapacitorSettingsGradle() {
console.log('🔧 Fixing capacitor.settings.gradle...');
console.log('🔧 Verifying capacitor.settings.gradle...');
if (!fs.existsSync(SETTINGS_GRADLE_PATH)) {
console.log(' capacitor.settings.gradle not found (may not be a test-app)');
@@ -74,30 +74,31 @@ function fixCapacitorSettingsGradle() {
let content = fs.readFileSync(SETTINGS_GRADLE_PATH, 'utf8');
const originalContent = content;
// Check if the path already points to android/plugin
if (content.includes('android/plugin')) {
console.log('✅ capacitor.settings.gradle already has correct path (android/plugin)');
return;
}
// Check if the path correctly points to android/ (standard structure)
const correctPath = "project(':timesafari-daily-notification-plugin').projectDir = new File('../node_modules/@timesafari/daily-notification-plugin/android')";
const oldPluginPath = "project(':timesafari-daily-notification-plugin').projectDir = new File('../node_modules/@timesafari/daily-notification-plugin/android/plugin')";
// Check if we need to fix the path (points to android but should be android/plugin)
if (content.includes("project(':timesafari-daily-notification-plugin').projectDir = new File('../node_modules/@timesafari/daily-notification-plugin/android')")) {
// Replace the path
// Check if it's using the old android/plugin/ path (needs fixing)
if (content.includes('android/plugin')) {
console.log('⚠️ capacitor.settings.gradle uses old path (android/plugin/) - fixing to standard structure');
content = content.replace(
"project(':timesafari-daily-notification-plugin').projectDir = new File('../node_modules/@timesafari/daily-notification-plugin/android')",
`// NOTE: Plugin module is in android/plugin/ subdirectory, not android root
// This file is auto-generated by Capacitor, but must be manually corrected for this plugin structure
project(':timesafari-daily-notification-plugin').projectDir = new File('../node_modules/@timesafari/daily-notification-plugin/android/plugin')`
oldPluginPath,
`// Plugin uses standard Capacitor structure: android/ (not android/plugin/)
${correctPath}`
);
fs.writeFileSync(SETTINGS_GRADLE_PATH, content);
console.log('✅ Fixed plugin path in capacitor.settings.gradle (android -> android/plugin)');
if (content !== originalContent) {
fs.writeFileSync(SETTINGS_GRADLE_PATH, content);
console.log('✅ Fixed plugin path in capacitor.settings.gradle (android/plugin -> android)');
}
} else if (content.includes(correctPath) || content.includes("android')")) {
console.log('✅ capacitor.settings.gradle has correct path (android/)');
} else {
console.log(' capacitor.settings.gradle doesn\'t reference the plugin or uses a different structure');
}
} catch (error) {
console.error('❌ Error fixing capacitor.settings.gradle:', error.message);
console.error('❌ Error verifying capacitor.settings.gradle:', error.message);
process.exit(1);
}
}