fix: restore and display configuration status after force-stop
- Add loadConfigurationStatus() function to check if plugin/fetcher are configured
- Call loadConfigurationStatus() on page load and app resume (visibility change)
- Add logging to getConfig() to track configuration restoration from database
- UI now shows ✅ Configured status after force-stop recovery
Previously, after force-stop recovery:
- Configuration was stored in database but UI didn't check for it
- configStatus and fetcherStatus remained as 'Not configured' even though config existed
- No logging to track when configuration was restored
The fix:
- loadConfigurationStatus() queries database for native_fetcher_config
- Updates UI status indicators (configStatus, fetcherStatus) based on database state
- Called automatically on page load and when app becomes visible
- Android logs 'DNP-CONFIG: Configuration restored from database' when config is loaded
This ensures the 'Ready to test...' UI block shows correct configuration status
after force-stop recovery, matching the actual database state.
This commit is contained in:
@@ -2072,6 +2072,8 @@ open class DailyNotificationPlugin : Plugin() {
|
||||
val options = call.getObject("options")
|
||||
val timesafariDid = options?.getString("timesafariDid")
|
||||
|
||||
Log.d(TAG, "DNP-CONFIG: Loading config from database: key=$key, timesafariDid=${timesafariDid?.take(20)}...")
|
||||
|
||||
val entity = if (timesafariDid != null) {
|
||||
getDatabase().notificationConfigDao().getConfigByKeyAndDid(key, timesafariDid)
|
||||
} else {
|
||||
@@ -2079,8 +2081,10 @@ open class DailyNotificationPlugin : Plugin() {
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
Log.i(TAG, "DNP-CONFIG: Configuration restored from database: key=$key, configType=${entity.configType}, hasValue=${entity.configValue.isNotEmpty()}")
|
||||
call.resolve(configToJson(entity))
|
||||
} else {
|
||||
Log.d(TAG, "DNP-CONFIG: Configuration not found in database: key=$key")
|
||||
call.resolve(JSObject().apply { put("config", null) })
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
||||
Reference in New Issue
Block a user