New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mobile,Desktop: Resolves #10206: Allow marking a plugin as mobile-only or desktop-only #10229
Mobile,Desktop: Resolves #10206: Allow marking a plugin as mobile-only or desktop-only #10229
Conversation
if (!this.isCompatible(plugin.manifest.app_min_version)) { | ||
throw new Error(`Plugin "${plugin.id}" was disabled because it requires Joplin version ${plugin.manifest.app_min_version} and current version is ${this.appVersion_}.`); | ||
if (!this.isCompatible(plugin.manifest)) { | ||
throw new Error(`Plugin "${plugin.id}" was disabled: ${this.describeIncompatibility(plugin.manifest)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I like this change — previously, the error message included more information about the current Joplin version than it does now. This change does keep the logged and UI error messages consistent, though.
@@ -75,6 +82,7 @@ If no promo tile is provided, your plugin icon will be displayed instead. | |||
"version": "1.0.0", | |||
"author": "John Smith", | |||
"app_min_version": "1.4", | |||
"platforms": ["mobile>=3.0.3", "desktop"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative to including minimum versions directly within the platform string could be to make this a dictionary instead. For example,
"platforms": ["mobile>=3.0.3", "desktop"], | |
"platforms": {"mobile": ">=3.0.3", "desktop": true}, |
The above may be more difficult to work with, however, particularly if most plugins will specify "platforms": ["desktop"]
.
How other apps handle this:
- Obsidian lets plugins specify an
isDesktopOnly
property. Joplin will likely need the ability to specify different minimum versions for different platforms, however (reasoning: 1) different mobile and desktop versions correspond to the same commit and 2) plugin APIs may be added to different platforms at different times). - Expo uses a list of supported platforms, for example
[ "android", "ios" ]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative could be to add an app_min_version_mobile
property.
Is there a check in place to not display the 'recommended' chip, in case it is not supported in mobile? |
Not currently — I think this should be added though. (Note to self: Apply related desktop change in different pull request). Edit: Added in dc43da7. |
Summary
This pull request:
Resolves #10206.
Notes
Compatible platforms can be specified with the
"platforms"
manifest key. Valid platforms aredesktop
andmobile
. For example,"platforms": ["desktop"]
would mean that a plugin only supports desktop and not mobile. To support additional future platform values, Joplin clients ignore other platform types.Because changing the format of
app_min_version
would break old versions of Joplin, theplatforms
key also allows specifying different minimum versions for each platform. For example,"platforms": ["desktop", "mobile>=3.0.5"]
would use the existingapp_min_version
ondesktop
and3.0.5
as the minimum version on mobile. Currently, additional versions specified throughplatforms
must be greater than or equal to the existingapp_min_version
.If
platforms
is not given, it is assumed that the plugin supports all platforms.Screenshots
Incompatible plugins are moved to the end of the search results and are made partially transparent:
Clicking on the "incompatible" badge shows the reason for the incompatibility:
On desktop, incompatible plugins are also sorted to the end. The incompatibility description text has also been changed:
Manual testing
Although this pull request has automated tests, it can be tested manually with the following steps:
test
This has been tested successfully on an Android 12 emulator (mobile) and on Ubuntu 23.10 (desktop).