From 24875af9d53e3f1a90fa5e6bd4aaef36bb0c3591 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sat, 27 Jun 2015 23:05:52 +0200 Subject: Check for new versions after start. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After LrMediaWiki is loaded, GitHub is checked for new versions if the user enabled that setting. To parse the response of the GitHub API, a third-party library is used for JSON parsing (JSON.lua). As the GitHub API query for the latest release only returns non-pre-release versions, all releases are queried and the first one is considered the latest. - create MediaWikiInit that queries the new version and shows a message (if necessary) - add MediaWikiInit to Info so that it is run after LrMediaWiki is loaded - add ‘Check version’ setting to the configuration - refactor MediaWikiApi and create performHttpRequest as a generic HTTP request method - add MediaWikiApi.getCurrentPluginVersion to query the GitHub API Fix #44. --- mediawiki.lrdevplugin/MediaWikiPluginInfoProvider.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mediawiki.lrdevplugin/MediaWikiPluginInfoProvider.lua') diff --git a/mediawiki.lrdevplugin/MediaWikiPluginInfoProvider.lua b/mediawiki.lrdevplugin/MediaWikiPluginInfoProvider.lua index ca87904..1f2f66a 100644 --- a/mediawiki.lrdevplugin/MediaWikiPluginInfoProvider.lua +++ b/mediawiki.lrdevplugin/MediaWikiPluginInfoProvider.lua @@ -24,11 +24,13 @@ local MediaWikiPluginInfoProvider = {} MediaWikiPluginInfoProvider.startDialog = function(propertyTable) propertyTable.logging = MediaWikiUtils.getLogging() propertyTable.create_snapshots = MediaWikiUtils.getCreateSnapshots() + propertyTable.check_version = MediaWikiUtils.getCheckVersion() end MediaWikiPluginInfoProvider.endDialog = function(propertyTable) MediaWikiUtils.setLogging(propertyTable.logging) MediaWikiUtils.setCreateSnapshots(propertyTable.create_snapshots) + MediaWikiUtils.setCheckVersion(propertyTable.check_version) end MediaWikiPluginInfoProvider.sectionsForBottomOfDialog = function(viewFactory, propertyTable) @@ -56,6 +58,20 @@ MediaWikiPluginInfoProvider.sectionsForBottomOfDialog = function(viewFactory, pr }, }, + viewFactory:row { + spacing = viewFactory:label_spacing(), + + viewFactory:static_text { + alignment = labelAlignment, + width = LrView.share "label_width", + }, + + viewFactory:checkbox { + value = bind 'check_version', + title = LOC '$$$/LrMediaWiki/Section/Config/Version=Check for new plugin versions after Lightroom starts', + }, + }, + viewFactory:row { spacing = viewFactory:label_spacing(), -- cgit v1.2.1