feat(habitica): add Habitica task dashboard#799
Conversation
Noctalia users can now connect Habitica from the shell, see their avatar and stats, inspect active work, and score supported tasks without switching context. The submission follows the registry shape with a real preview image, English strings, README documentation, and local-only credential/cache ignores. Constraint: The registry requires the manifest repository field to point at noctalia-dev/noctalia-plugins. Constraint: The preview image must be 16:9 at 960x540. Rejected: Submit a mock preview | reviewers need a faithful capture of the real plugin UI Confidence: high Scope-risk: narrow Directive: Keep settings.json and cache/ ignored; do not include local Habitica credentials or cached account data. Tested: JSON validation for manifest.json and i18n/en.json Tested: preview.png verified as 960x540 PNG generated from a real Noctalia screenshot Tested: Local grep checks matching the registry code-quality patterns for hardcoded user-facing strings, hardcoded numeric style fields, and console.log Tested: Credential scan found only code field names and empty defaults, not credential values Not-tested: Full GitHub Actions run before PR creation
Automatic Code Quality ReviewFile: habitica/BarWidget.qml
+ tooltip += "\n" + (main?.hpText() || pluginApi?.tr("tooltip.hpFallback")) + " - " + (main?.xpText() || pluginApi?.tr("tooltip.xpFallback")) + " - " + (main?.goldText() || pluginApi?.tr("tooltip.goldFallback")) |
The automatic code-quality review flagged a low-priority translation fallback pattern. The tooltip fallbacks now assign translated labels to local variables before composing the string, keeping behavior unchanged while satisfying the registry guidance. Constraint: Address review automation without changing plugin behavior. Confidence: high Scope-risk: narrow Tested: Local grep check for pluginApi.tr fallback expressions
|
Addressed in |
spiros132
left a comment
There was a problem hiding this comment.
Some feedback about the PR! :D
| root.editColorizationIcon = settings?.colorizationIcon || defaults?.colorizationIcon || "Primary" | ||
| root.editColorizationBadge = settings?.colorizationBadge || defaults?.colorizationBadge || "Error" | ||
| root.editColorizationBadgeText = settings?.colorizationBadgeText || defaults?.colorizationBadgeText || "Primary" | ||
| } |
There was a problem hiding this comment.
Prefer to use property bindings instead of setting them here. For example:
readonly property var cfg: pluginApi?.pluginSettings ?? ({})
readonly property var defaults: pluginApi?.manifest?.metadata?.defaultSettings ?? ({})
property string foo: cfg.foo ?? defaults.foo ?? "Foo"| @@ -0,0 +1,2 @@ | |||
| settings.json | |||
There was a problem hiding this comment.
The settings.json file is already included to get ignored in the root of this repository.
| if (!isConfigured) { | ||
| root.isLoading = false | ||
| root.hasError = true | ||
| root.errorMessage = "Configure your Habitica User ID and API Token in settings." |
There was a problem hiding this comment.
Shouldn't this be in the translations?
|
|
||
| function logDebug(msg) { | ||
| if (debugMode) Logger.d("Habitica", msg) | ||
| } |
There was a problem hiding this comment.
This function isn't needed since Logger.d only prints it out when debug mode is active.
| } | ||
|
|
||
| if (!force && lastFetchTimestamp > 0 && nowSeconds() - lastFetchTimestamp < refreshInterval) { | ||
| logDebug("Skipping refresh; cache is fresh") |
There was a problem hiding this comment.
As before you can use the regular Logger.d function here.
| if (response.data) { | ||
| root.stats = response.data | ||
| } | ||
| ToastService.showNotice("Habitica task scored") |
There was a problem hiding this comment.
Shouldn't this also be in the translations?
| root.tags = cached.tags || [] | ||
| root.lastFetchTimestamp = cached.timestamp || 0 | ||
| root.avatarLastFetchTimestamp = cached.avatarTimestamp || 0 | ||
| logDebug("Loaded Habitica cache") |
There was a problem hiding this comment.
Here as well prefer to use the regular Logger.d functionality.
| } catch (e) { | ||
| Logger.w("Habitica", "Failed to save cache: " + e) | ||
| } | ||
| } |
There was a problem hiding this comment.
Is it possible to use the pluginSettings as cache instead of having two separate files?
| root.fetchAll(true) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
As before both this Process and the FileView could be skipped by using the pluginSettings to save the cache.
Summary
Adds
habitica, a Noctalia Shell plugin for Habitica users.The plugin provides:
Why
Habitica is a task manager/game used for daily routines and habits. This plugin lets users check and score their current Habitica work directly from Noctalia without opening the web or mobile app.
Testing
habitica/manifest.jsonandhabitica/i18n/en.jsonwithpython -m json.toolhabitica/preview.pngis a 960x540 PNGtext,label, anddescriptionstringsborder.width,spacing,pointSize,radius, andmarginstyle fieldsconsole.logNotes
settings.jsonandcache/are ignored so local Habitica credentials and cached API responses are not published.