chore: sync test app UI with improved recovery timing
- Update test app index.html with improved UI refresh timing after force-stop - Includes immediate + delayed refresh pattern for better recovery detection - Better error handling for database not ready scenarios
This commit is contained in:
@@ -346,6 +346,60 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load configuration status (plugin settings and native fetcher)
|
||||||
|
function loadConfigurationStatus() {
|
||||||
|
console.log('[Config Check] Checking configuration status...');
|
||||||
|
const configStatus = document.getElementById('configStatus');
|
||||||
|
const fetcherStatus = document.getElementById('fetcherStatus');
|
||||||
|
|
||||||
|
if (!window.DailyNotification) {
|
||||||
|
console.warn('[Config Check] DailyNotification plugin not available');
|
||||||
|
configStatus.innerHTML = '❌ Plugin unavailable';
|
||||||
|
fetcherStatus.innerHTML = '❌ Plugin unavailable';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if plugin settings are configured
|
||||||
|
// Plugin settings are stored internally, so we check by trying to get status
|
||||||
|
// For now, we'll check if native fetcher config exists as a proxy
|
||||||
|
// TODO: Add explicit plugin settings check method
|
||||||
|
window.DailyNotification.getConfig({ key: 'native_fetcher_config' })
|
||||||
|
.then(result => {
|
||||||
|
console.log('[Config Check] Native fetcher config result:', JSON.stringify(result));
|
||||||
|
if (result && result.config && result.config.configValue) {
|
||||||
|
try {
|
||||||
|
const configValue = JSON.parse(result.config.configValue);
|
||||||
|
if (configValue.apiBaseUrl && configValue.apiBaseUrl.length > 0) {
|
||||||
|
console.log('[Config Check] ✅ Native fetcher is configured');
|
||||||
|
fetcherStatus.innerHTML = '✅ Configured';
|
||||||
|
} else {
|
||||||
|
console.log('[Config Check] ⚠️ Native fetcher config exists but is empty');
|
||||||
|
fetcherStatus.innerHTML = '❌ Not configured';
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[Config Check] Failed to parse config value:', e);
|
||||||
|
fetcherStatus.innerHTML = '❌ Error';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('[Config Check] ❌ Native fetcher config not found');
|
||||||
|
fetcherStatus.innerHTML = '❌ Not configured';
|
||||||
|
}
|
||||||
|
|
||||||
|
// For plugin settings, we assume configured if native fetcher is configured
|
||||||
|
// This is a heuristic - in production, add explicit check
|
||||||
|
if (fetcherStatus.innerHTML.includes('✅')) {
|
||||||
|
configStatus.innerHTML = '✅ Configured';
|
||||||
|
} else {
|
||||||
|
configStatus.innerHTML = '❌ Not configured';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('[Config Check] Failed to check configuration:', error);
|
||||||
|
configStatus.innerHTML = '❌ Error';
|
||||||
|
fetcherStatus.innerHTML = '❌ Error';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function loadChannelStatus() {
|
function loadChannelStatus() {
|
||||||
const channelStatus = document.getElementById('channelStatus');
|
const channelStatus = document.getElementById('channelStatus');
|
||||||
|
|
||||||
@@ -568,11 +622,12 @@
|
|||||||
// Load plugin status automatically on page load
|
// Load plugin status automatically on page load
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
console.log('Page loaded, loading plugin status...');
|
console.log('Page loaded, loading plugin status...');
|
||||||
// Small delay to ensure Capacitor is ready
|
// Small delay to ensure Capacitor is ready
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
loadPluginStatus();
|
loadPluginStatus();
|
||||||
loadPermissionStatus();
|
loadPermissionStatus();
|
||||||
loadChannelStatus();
|
loadChannelStatus();
|
||||||
|
loadConfigurationStatus();
|
||||||
|
|
||||||
// Initialize last known next notification time
|
// Initialize last known next notification time
|
||||||
if (window.DailyNotification) {
|
if (window.DailyNotification) {
|
||||||
@@ -600,6 +655,7 @@
|
|||||||
loadPluginStatus();
|
loadPluginStatus();
|
||||||
loadPermissionStatus();
|
loadPermissionStatus();
|
||||||
loadChannelStatus();
|
loadChannelStatus();
|
||||||
|
loadConfigurationStatus();
|
||||||
|
|
||||||
// Also check for recent notifications that might have been missed
|
// Also check for recent notifications that might have been missed
|
||||||
if (window.DailyNotification) {
|
if (window.DailyNotification) {
|
||||||
|
|||||||
Reference in New Issue
Block a user