You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
5.9 KiB
165 lines
5.9 KiB
<!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 = {
|
|
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>
|
|
|