Allow hiding option items depending on available extension and version in the host
ClosedPublic

Authored by broulik on May 10 2019, 7:46 AM.

Details

Summary

We already have somewhat of a versioning system available in the host and it stores and exposes information about what extension it supports and in what version.
This makes this information available to the options page and allows hiding elements using the data-requires-extension="foo" and data-requires-extension-version-minimum="2" attributes.
This is for better compatibility when adding new features to the host which is released independently of the extension.
Since the settings are still read and the items still added to the DOM, saving settings will not touch/change the enabled state of unsupported extensions should you use the extension on multiple computers with different versions of the host.

Test Plan

Depends on D21112

  • Added a new item with required extension attribute, didn't add it to the host, had the item successfully hidden
  • Added a new item with a required version of 2, had the item successfully hidden
  • Verified that saving would still write the enabled state correctly

Diff Detail

Repository
R856 Plasma Browser Integration
Lint
Lint Skipped
Unit
Unit Tests Skipped
broulik created this revision.May 10 2019, 7:46 AM
Restricted Application added a project: Plasma. · View Herald TranscriptMay 10 2019, 7:46 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.May 10 2019, 7:46 AM
fvogt added inline comments.May 27 2019, 11:55 AM
extension/options.js
100

AFAICT it doesn't conflict, but IMO it's a bit confusing if there's both a global array subsystemStatus in extension.js and a function subsystemStatus() in options.js.

broulik added inline comments.Jun 12 2019, 9:03 AM
extension/options.js
100

I'll rename this to getSubsystemStatus() then

fvogt requested changes to this revision.Jul 5 2019, 11:58 AM
This revision now requires changes to proceed.Jul 5 2019, 11:58 AM
broulik updated this revision to Diff 63702.Aug 14 2019, 8:19 AM
  • use new promise-based reply message API
fvogt added inline comments.Aug 14 2019, 8:47 AM
extension/options.js
207

Consistency (and grammar): let requiresExtension

215

Redundant

host/settings.cpp
145

Move that a scope up as QJsonObject ret and you save two lines of code (and more when more events get added)

broulik marked 3 inline comments as done.Aug 14 2019, 8:49 AM

Depends on the

broulik updated this revision to Diff 63704.Aug 14 2019, 8:52 AM
  • required→requires
  • redundant check
  • ret var
broulik updated this revision to Diff 63705.Aug 14 2019, 8:55 AM
  • Check the right thing...
fvogt accepted this revision.Aug 14 2019, 9:02 AM
This revision is now accepted and ready to land.Aug 14 2019, 9:02 AM
This revision was automatically updated to reflect the committed changes.