- Remove echo() method from DailyNotificationPlugin.java - Update Android test app to show 'Plugin is loaded and ready!' instead of echo test - Update web test app to remove echo method call - Update iOS test app to remove echo method call - Update documentation to remove echo test references - Replace echo test with simple plugin availability check The echo test was only used for initial plugin verification and is no longer needed since the plugin now has comprehensive notification functionality. This simplifies the codebase and removes unnecessary test code.
169 lines
6.0 KiB
HTML
169 lines
6.0 KiB
HTML
<!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">
|
|
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
|
<meta http-equiv="Pragma" content="no-cache">
|
|
<meta http-equiv="Expires" content="0">
|
|
<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>
|
|
console.log('Script loading...');
|
|
|
|
// Mock DailyNotification plugin for WebView testing
|
|
if (!window.DailyNotification) {
|
|
console.log('Creating mock DailyNotification plugin...');
|
|
window.DailyNotification = {
|
|
echo: function(options) {
|
|
return Promise.resolve({ value: `Mock echo: ${options.value}` });
|
|
},
|
|
configure: function(config) {
|
|
console.log('Mock configure called with:', config);
|
|
return Promise.resolve();
|
|
},
|
|
getStatus: function() {
|
|
return Promise.resolve({
|
|
configured: true,
|
|
platform: 'web-mock',
|
|
lastFetch: new Date().toISOString()
|
|
});
|
|
}
|
|
};
|
|
}
|
|
|
|
// Define functions immediately and attach to window
|
|
function testPlugin() {
|
|
console.log('testPlugin called');
|
|
const status = document.getElementById('status');
|
|
status.innerHTML = 'Testing plugin...';
|
|
|
|
try {
|
|
if (!window.DailyNotification) {
|
|
status.innerHTML = 'DailyNotification plugin not available';
|
|
return;
|
|
}
|
|
// Plugin is loaded and ready
|
|
status.innerHTML = 'Plugin is loaded and ready!';
|
|
} catch (error) {
|
|
status.innerHTML = `Plugin test failed: ${error.message}`;
|
|
}
|
|
}
|
|
|
|
function configurePlugin() {
|
|
console.log('configurePlugin called');
|
|
const status = document.getElementById('status');
|
|
status.innerHTML = 'Configuring plugin...';
|
|
|
|
try {
|
|
if (!window.DailyNotification) {
|
|
status.innerHTML = 'DailyNotification plugin not available';
|
|
return;
|
|
}
|
|
window.DailyNotification.configure({
|
|
fetchUrl: 'https://api.example.com/daily-content',
|
|
scheduleTime: '09:00',
|
|
enableNotifications: true
|
|
})
|
|
.then(() => {
|
|
status.innerHTML = 'Plugin configured successfully!';
|
|
})
|
|
.catch(error => {
|
|
status.innerHTML = `Configuration failed: ${error.message}`;
|
|
});
|
|
} catch (error) {
|
|
status.innerHTML = `Configuration failed: ${error.message}`;
|
|
}
|
|
}
|
|
|
|
function checkStatus() {
|
|
console.log('checkStatus called');
|
|
const status = document.getElementById('status');
|
|
status.innerHTML = 'Checking plugin status...';
|
|
|
|
try {
|
|
if (!window.DailyNotification) {
|
|
status.innerHTML = 'DailyNotification plugin not available';
|
|
return;
|
|
}
|
|
window.DailyNotification.getStatus()
|
|
.then(result => {
|
|
status.innerHTML = `Plugin status: ${JSON.stringify(result, null, 2)}`;
|
|
})
|
|
.catch(error => {
|
|
status.innerHTML = `Status check failed: ${error.message}`;
|
|
});
|
|
} catch (error) {
|
|
status.innerHTML = `Status check failed: ${error.message}`;
|
|
}
|
|
}
|
|
|
|
// Attach to window object
|
|
window.testPlugin = testPlugin;
|
|
window.configurePlugin = configurePlugin;
|
|
window.checkStatus = checkStatus;
|
|
|
|
console.log('Functions attached to window:', {
|
|
testPlugin: typeof window.testPlugin,
|
|
configurePlugin: typeof window.configurePlugin,
|
|
checkStatus: typeof window.checkStatus
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|