diff --git a/Wunderlist.alfredworkflow b/Wunderlist.alfredworkflow index 371f17a..95cc485 100644 Binary files a/Wunderlist.alfredworkflow and b/Wunderlist.alfredworkflow differ diff --git a/bower.json b/bower.json index ec5f42b..e843a49 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "alfred-wunderlist-workflow", - "version": "0.5.3", + "version": "0.5.4", "dependencies": {}, "private": true, "devDependencies": {} diff --git a/lib/alfred-workflow b/lib/alfred-workflow index f439c2b..3202232 160000 --- a/lib/alfred-workflow +++ b/lib/alfred-workflow @@ -1 +1 @@ -Subproject commit f439c2b9b76b750b5d2eb2417ef3a55b7f4dff9e +Subproject commit 320223291e5e9ef072e5552a6620add40ea67251 diff --git a/package.json b/package.json index 1d79495..30a0203 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "alfred-wunderlist-workflow", - "version": "0.5.3", + "version": "0.5.4", "dependencies": {}, "private": true, "devDependencies": { diff --git a/src/wunderlist/handlers/preferences.py b/src/wunderlist/handlers/preferences.py index f372ba1..3b20f1d 100644 --- a/src/wunderlist/handlers/preferences.py +++ b/src/wunderlist/handlers/preferences.py @@ -2,7 +2,7 @@ from wunderlist.models.user import User from wunderlist.models.preferences import Preferences -from wunderlist.util import workflow, parsedatetime_calendar, parsedatetime_constants, format_time, update_prerelease_channel +from wunderlist.util import workflow, parsedatetime_calendar, parsedatetime_constants, format_time from wunderlist import icons def _parse_time(phrase): @@ -210,7 +210,6 @@ def commit(args): prefs.prerelease_channel = not prefs.prerelease_channel # Update the workflow settings and reverify the update data - update_prerelease_channel() workflow().check_update(True) if prefs.prerelease_channel: diff --git a/src/wunderlist/models/preferences.py b/src/wunderlist/models/preferences.py index a1bfde3..8972281 100644 --- a/src/wunderlist/models/preferences.py +++ b/src/wunderlist/models/preferences.py @@ -6,7 +6,7 @@ EXPLICIT_KEYWORDS_KEY = 'explicit_keywords' AUTOMATIC_REMINDERS_KEY = 'automatic_reminders' REMINDER_TODAY_OFFSET_KEY = 'reminder_today_offset' -PRERELEASE_CHANNEL_KEY = 'prerelease_channel' +PRERELEASES_KEY = '__workflow_prereleases' class Preferences(object): @@ -41,6 +41,14 @@ def current_prefs(cls): def __init__(self, data): self._data = data or {} + # Clean up old prerelease preference + if 'prerelease_channel' in self._data: + # Migrate to the alfred-workflow preference + self.prerelease_channel = self._data['prerelease_channel'] + del self._data['prerelease_channel'] + + workflow().store_data('prefs', self._data) + def _set(self, key, value): self._data[key] = value @@ -102,9 +110,9 @@ def automatic_reminders(self, automatic_reminders): @property def prerelease_channel(self): - return self._get(PRERELEASE_CHANNEL_KEY, False) + return workflow().settings.get(PRERELEASES_KEY, False) @prerelease_channel.setter def prerelease_channel(self, prerelease_channel): - self._set(PRERELEASE_CHANNEL_KEY, prerelease_channel) + workflow().settings[PRERELEASES_KEY] = prerelease_channel diff --git a/src/wunderlist/util.py b/src/wunderlist/util.py index 9814112..b327682 100644 --- a/src/wunderlist/util.py +++ b/src/wunderlist/util.py @@ -8,36 +8,24 @@ def workflow(): if _workflow is None: version = '__VERSION__' - _update_settings = { - 'github_slug': 'idpaterson/alfred-wunderlist-workflow', - 'version': version, - # Check for updates daily - # TODO: check less frequently as the workflow becomes more - # stable - 'frequency': 1, - # Download pre-release updates if enabled in preferences or if - # a prerelease is currently installed - 'prerelease': '-' in version - } _workflow = Workflow( capture_args=False, - update_settings=_update_settings + update_settings={ + 'github_slug': 'idpaterson/alfred-wunderlist-workflow', + 'version': version, + # Check for updates daily + # TODO: check less frequently as the workflow becomes more + # stable + 'frequency': 1, + # Always download pre-release updates if a prerelease is + # currently installed + 'prerelease': '-' in version + } ) - # Check preferences after initializing the workflow since the workflow - # is required for checking preferences - update_prerelease_channel() - return _workflow -def update_prerelease_channel(): - from wunderlist.models.preferences import Preferences - - prefs = Preferences.current_prefs() - - _update_settings['prerelease'] = prefs.prerelease_channel - def parsedatetime_calendar(): from parsedatetime import Calendar, Constants