feat: complete android test app setup
- Create missing capacitor-cordova-android-plugins directory and build files - Add cordova.variables.gradle with proper variable definitions - Create www directory with functional test web app - Add capacitor.config.ts with plugin configuration - Fix test file package names from com.getcapacitor.myapp to com.timesafari.dailynotification - Move test files to correct package directories - Test app now builds successfully and creates APK - Capacitor sync now works (Android portion) - Build script handles both plugin and test app builds The android/app test app is now fully functional and can be used to test the DailyNotification plugin in a real Android environment.
This commit is contained in:
@@ -7,8 +7,7 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
// Plugin development project - no Capacitor integration files needed
|
||||
// apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
||||
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
||||
dependencies {
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.getcapacitor.myapp;
|
||||
package com.timesafari.dailynotification;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -21,6 +21,6 @@ public class ExampleInstrumentedTest {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
|
||||
assertEquals("com.getcapacitor.app", appContext.getPackageName());
|
||||
assertEquals("com.timesafari.dailynotification", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.getcapacitor.myapp;
|
||||
package com.timesafari.dailynotification;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -2,11 +2,19 @@ import { CapacitorConfig } from '@capacitor/cli';
|
||||
|
||||
const config: CapacitorConfig = {
|
||||
appId: 'com.timesafari.dailynotification',
|
||||
appName: 'DailyNotificationPlugin',
|
||||
appName: 'DailyNotification Test App',
|
||||
webDir: 'www',
|
||||
server: {
|
||||
androidScheme: 'https'
|
||||
},
|
||||
plugins: {
|
||||
DailyNotification: {
|
||||
fetchUrl: 'https://api.example.com/daily-content',
|
||||
scheduleTime: '09:00',
|
||||
enableNotifications: true,
|
||||
debugMode: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
export default config;
|
||||
17
ios/App/App/capacitor.config.json
Normal file
17
ios/App/App/capacitor.config.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"appId": "com.timesafari.dailynotification",
|
||||
"appName": "DailyNotification Test App",
|
||||
"webDir": "www",
|
||||
"server": {
|
||||
"androidScheme": "https"
|
||||
},
|
||||
"plugins": {
|
||||
"DailyNotification": {
|
||||
"fetchUrl": "https://api.example.com/daily-content",
|
||||
"scheduleTime": "09:00",
|
||||
"enableNotifications": true,
|
||||
"debugMode": true
|
||||
}
|
||||
},
|
||||
"packageClassList": []
|
||||
}
|
||||
6
ios/App/App/config.xml
Normal file
6
ios/App/App/config.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<access origin="*" />
|
||||
|
||||
|
||||
</widget>
|
||||
0
ios/App/App/public/cordova.js
vendored
Normal file
0
ios/App/App/public/cordova.js
vendored
Normal file
0
ios/App/App/public/cordova_plugins.js
vendored
Normal file
0
ios/App/App/public/cordova_plugins.js
vendored
Normal file
111
ios/App/App/public/index.html
Normal file
111
ios/App/App/public/index.html
Normal file
@@ -0,0 +1,111 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<title>DailyNotification Plugin Test</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 100vh;
|
||||
color: white;
|
||||
}
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
h1 {
|
||||
margin-bottom: 30px;
|
||||
font-size: 2.5em;
|
||||
}
|
||||
.button {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||
color: white;
|
||||
padding: 15px 30px;
|
||||
margin: 10px;
|
||||
border-radius: 25px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.button:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.status {
|
||||
margin-top: 30px;
|
||||
padding: 20px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 10px;
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>🔔 DailyNotification Plugin Test</h1>
|
||||
<p>Test the DailyNotification plugin functionality</p>
|
||||
|
||||
<button class="button" onclick="testPlugin()">Test Plugin</button>
|
||||
<button class="button" onclick="configurePlugin()">Configure Plugin</button>
|
||||
<button class="button" onclick="checkStatus()">Check Status</button>
|
||||
|
||||
<div id="status" class="status">
|
||||
Ready to test...
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
import { DailyNotification } from '@timesafari/daily-notification-plugin';
|
||||
|
||||
window.Capacitor = Capacitor;
|
||||
window.DailyNotification = DailyNotification;
|
||||
|
||||
window.testPlugin = async function() {
|
||||
const status = document.getElementById('status');
|
||||
status.innerHTML = 'Testing plugin...';
|
||||
|
||||
try {
|
||||
const result = await DailyNotification.echo({ value: 'Hello from test app!' });
|
||||
status.innerHTML = `Plugin test successful: ${result.value}`;
|
||||
} catch (error) {
|
||||
status.innerHTML = `Plugin test failed: ${error.message}`;
|
||||
}
|
||||
};
|
||||
|
||||
window.configurePlugin = async function() {
|
||||
const status = document.getElementById('status');
|
||||
status.innerHTML = 'Configuring plugin...';
|
||||
|
||||
try {
|
||||
await DailyNotification.configure({
|
||||
fetchUrl: 'https://api.example.com/daily-content',
|
||||
scheduleTime: '09:00',
|
||||
enableNotifications: true
|
||||
});
|
||||
status.innerHTML = 'Plugin configured successfully!';
|
||||
} catch (error) {
|
||||
status.innerHTML = `Configuration failed: ${error.message}`;
|
||||
}
|
||||
};
|
||||
|
||||
window.checkStatus = async function() {
|
||||
const status = document.getElementById('status');
|
||||
status.innerHTML = 'Checking plugin status...';
|
||||
|
||||
try {
|
||||
const result = await DailyNotification.getStatus();
|
||||
status.innerHTML = `Plugin status: ${JSON.stringify(result, null, 2)}`;
|
||||
} catch (error) {
|
||||
status.innerHTML = `Status check failed: ${error.message}`;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
16
ios/capacitor-cordova-ios-plugins/CordovaPlugins.podspec
Normal file
16
ios/capacitor-cordova-ios-plugins/CordovaPlugins.podspec
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'CordovaPlugins'
|
||||
s.version = '6.2.1'
|
||||
s.summary = 'Autogenerated spec'
|
||||
s.license = 'Unknown'
|
||||
s.homepage = 'https://example.com'
|
||||
s.authors = { 'Capacitor Generator' => 'hi@example.com' }
|
||||
s.source = { :git => 'https://github.com/ionic-team/does-not-exist.git', :tag => '6.2.1' }
|
||||
s.source_files = 'sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
||||
s.ios.deployment_target = '13.0'
|
||||
s.xcconfig = {'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1 WK_WEB_VIEW_ONLY=1' }
|
||||
s.dependency 'CapacitorCordova'
|
||||
s.swift_version = '5.1'
|
||||
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'CordovaPluginsResources'
|
||||
s.version = '0.0.105'
|
||||
s.summary = 'Resources for Cordova plugins'
|
||||
s.social_media_url = 'https://twitter.com/capacitorjs'
|
||||
s.license = 'MIT'
|
||||
s.homepage = 'https://capacitorjs.com/'
|
||||
s.authors = { 'Ionic Team' => 'hi@ionicframework.com' }
|
||||
s.source = { :git => 'https://github.com/ionic-team/capacitor.git', :tag => s.version.to_s }
|
||||
s.resources = ['resources/*']
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'CordovaPluginsStatic'
|
||||
s.version = '6.2.1'
|
||||
s.summary = 'Autogenerated spec'
|
||||
s.license = 'Unknown'
|
||||
s.homepage = 'https://example.com'
|
||||
s.authors = { 'Capacitor Generator' => 'hi@example.com' }
|
||||
s.source = { :git => 'https://github.com/ionic-team/does-not-exist.git', :tag => '6.2.1' }
|
||||
s.source_files = 'sourcesstatic/**/*.{swift,h,m,c,cc,mm,cpp}'
|
||||
s.ios.deployment_target = '13.0'
|
||||
s.xcconfig = {'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1 WK_WEB_VIEW_ONLY=1' }
|
||||
s.dependency 'CapacitorCordova'
|
||||
s.swift_version = '5.1'
|
||||
s.static_framework = true
|
||||
end
|
||||
1
ios/capacitor-cordova-ios-plugins/resources/.gitkeep
Normal file
1
ios/capacitor-cordova-ios-plugins/resources/.gitkeep
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
ios/capacitor-cordova-ios-plugins/sources/.gitkeep
Normal file
1
ios/capacitor-cordova-ios-plugins/sources/.gitkeep
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
111
www/index.html
Normal file
111
www/index.html
Normal file
@@ -0,0 +1,111 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<title>DailyNotification Plugin Test</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 100vh;
|
||||
color: white;
|
||||
}
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
h1 {
|
||||
margin-bottom: 30px;
|
||||
font-size: 2.5em;
|
||||
}
|
||||
.button {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||
color: white;
|
||||
padding: 15px 30px;
|
||||
margin: 10px;
|
||||
border-radius: 25px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.button:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.status {
|
||||
margin-top: 30px;
|
||||
padding: 20px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 10px;
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>🔔 DailyNotification Plugin Test</h1>
|
||||
<p>Test the DailyNotification plugin functionality</p>
|
||||
|
||||
<button class="button" onclick="testPlugin()">Test Plugin</button>
|
||||
<button class="button" onclick="configurePlugin()">Configure Plugin</button>
|
||||
<button class="button" onclick="checkStatus()">Check Status</button>
|
||||
|
||||
<div id="status" class="status">
|
||||
Ready to test...
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
import { DailyNotification } from '@timesafari/daily-notification-plugin';
|
||||
|
||||
window.Capacitor = Capacitor;
|
||||
window.DailyNotification = DailyNotification;
|
||||
|
||||
window.testPlugin = async function() {
|
||||
const status = document.getElementById('status');
|
||||
status.innerHTML = 'Testing plugin...';
|
||||
|
||||
try {
|
||||
const result = await DailyNotification.echo({ value: 'Hello from test app!' });
|
||||
status.innerHTML = `Plugin test successful: ${result.value}`;
|
||||
} catch (error) {
|
||||
status.innerHTML = `Plugin test failed: ${error.message}`;
|
||||
}
|
||||
};
|
||||
|
||||
window.configurePlugin = async function() {
|
||||
const status = document.getElementById('status');
|
||||
status.innerHTML = 'Configuring plugin...';
|
||||
|
||||
try {
|
||||
await DailyNotification.configure({
|
||||
fetchUrl: 'https://api.example.com/daily-content',
|
||||
scheduleTime: '09:00',
|
||||
enableNotifications: true
|
||||
});
|
||||
status.innerHTML = 'Plugin configured successfully!';
|
||||
} catch (error) {
|
||||
status.innerHTML = `Configuration failed: ${error.message}`;
|
||||
}
|
||||
};
|
||||
|
||||
window.checkStatus = async function() {
|
||||
const status = document.getElementById('status');
|
||||
status.innerHTML = 'Checking plugin status...';
|
||||
|
||||
try {
|
||||
const result = await DailyNotification.getStatus();
|
||||
status.innerHTML = `Plugin status: ${JSON.stringify(result, null, 2)}`;
|
||||
} catch (error) {
|
||||
status.innerHTML = `Status check failed: ${error.message}`;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user