Skip to content

Commit

Permalink
Update (generalise) notification text parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrob committed Nov 13, 2024
1 parent 910c393 commit 5d8a85d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions emailproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__author__ = 'Simon Robinson'
__copyright__ = 'Copyright (c) 2024 Simon Robinson'
__license__ = 'Apache 2.0'
__version__ = '2024-11-11' # ISO 8601 (YYYY-MM-DD)
__version__ = '2024-11-13' # ISO 8601 (YYYY-MM-DD)
__package_version__ = '.'.join([str(int(i)) for i in __version__.split('-')]) # for pyproject.toml usage only

import abc
Expand Down Expand Up @@ -2519,8 +2519,9 @@ def userNotificationCenter_shouldPresentNotification_(self, _notification_centre
# noinspection PyPep8Naming
def userNotificationCenter_didActivateNotification_(self, _notification_centre, notification):
notification_text = notification.informativeText()
if 'Please authorise your account ' in notification_text: # hacky, but all we have is the text
self._click(notification_text.split('account ')[-1].split(' ')[0])
username = next((a for a in notification_text.split(' ') if '@' in a), None)
if username and 'Please authorise your account ' in notification_text: # hacky, but all we have is the text
self._click(username)

if sys.platform == 'darwin':
# noinspection PyUnresolvedReferences,PyProtectedMember
Expand Down

0 comments on commit 5d8a85d

Please sign in to comment.