3 bug fixes as per the issue description

This commit is contained in:
Philip Abbey
2024-02-05 19:09:26 +00:00
parent 4d4a86f195
commit 0dfcc65469
7 changed files with 72 additions and 60 deletions

View File

@ -67,22 +67,19 @@ class Settings {
// Manage this inside the application or widget only (not a glance or background service process)
if (mIsApp) {
if (mIsBatteryLevelEnabled) {
if (mIsBatteryLevelEnabled and mHasService) {
if (getWebhookId().equals("")) {
mWebhookManager = new WebhookManager();
mWebhookManager.requestWebhookId();
} else if (
mHasService and
((Background.getTemporalEventRegisteredTime() == null) or
(Background.getTemporalEventRegisteredTime() != (mBatteryRefreshRate * 60)))
) {
}
if ((Background.getTemporalEventRegisteredTime() == null) or
(Background.getTemporalEventRegisteredTime() != (mBatteryRefreshRate * 60))) {
Background.registerForTemporalEvent(new Time.Duration(mBatteryRefreshRate * 60)); // Convert to seconds
}
} else {
// Explicitly disable the background event which persists when the application closes.
if (mHasService and (Background.getTemporalEventRegisteredTime() != null)) {
Background.deleteTemporalEvent();
}
// If !mHasService disable the Settings option as user feedback
unsetIsBatteryLevelEnabled();
unsetWebhookId();
}
}