Files
Matthew 92bb566631 fix(ios): configure method parameter parsing and improve build process
Fix configure() method to read parameters directly from CAPPluginCall
instead of expecting nested options object, matching Android implementation.

Improve build process to ensure canonical UI is always copied:
- iOS build script: Copy www/index.html to test app before build
- Android build.gradle: Add copyCanonicalUI task to run before build
- Ensures test apps always use latest UI from www/index.html

This fixes the issue where configure() was returning 'Configuration
options required' error because it expected a nested options object
when Capacitor passes parameters directly on the call object.
2025-11-19 20:09:01 -08:00

85 lines
3.2 KiB
Groovy

apply plugin: 'com.android.application'
android {
namespace "com.timesafari.dailynotification"
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.timesafari.dailynotification"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
flatDir{
dirs 'libs'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
implementation project(':capacitor-android')
implementation project(':daily-notification-plugin')
// Daily Notification Plugin Dependencies
implementation "androidx.room:room-runtime:2.6.1"
implementation "androidx.work:work-runtime-ktx:2.9.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
annotationProcessor "androidx.room:room-compiler:2.6.1"
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
// Note: capacitor-cordova-android-plugins not needed for standalone Android test app
}
apply from: 'capacitor.build.gradle'
// Copy canonical UI from www/index.html before each build
task copyCanonicalUI(type: Copy) {
description = 'Copies canonical UI from www/index.html to test app'
group = 'build'
def repoRoot = project.rootProject.projectDir.parentFile.parentFile
def canonicalUI = new File(repoRoot, 'www/index.html')
def targetUI = new File(projectDir, 'src/main/assets/public/index.html')
if (canonicalUI.exists()) {
from canonicalUI
into targetUI.parentFile
rename { 'index.html' }
println "✅ Copied canonical UI from ${canonicalUI} to ${targetUI}"
} else {
println "⚠️ Canonical UI not found at ${canonicalUI}, skipping copy"
}
}
// Make copy task run before build
preBuild.dependsOn copyCanonicalUI
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}