Skip to content

Commit 32752cb

Browse files
authored
Merge pull request #130 from samschott/remove-nsusernotificationcenter-support
Remove macos legacy backend
2 parents 9b0a547 + 5de3c28 commit 32752cb

File tree

3 files changed

+6
-202
lines changed

3 files changed

+6
-202
lines changed

src/desktop_notifier/macos_legacy.py

Lines changed: 0 additions & 166 deletions
This file was deleted.

src/desktop_notifier/macos_support.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919

2020
__all__ = [
21-
"is_bundle",
2221
"is_signed_bundle",
2322
"macos_version",
2423
]
@@ -39,18 +38,6 @@
3938
kSecCSStrictValidate = 1 << 4
4039

4140

42-
def is_bundle() -> bool:
43-
"""
44-
Detect if we are in an app bundle / framework.
45-
46-
:returns: Whether we are inside a valid app bundle or framework.
47-
"""
48-
49-
main_bundle = NSBundle.mainBundle
50-
51-
return main_bundle.bundleIdentifier is not None
52-
53-
5441
def is_signed_bundle() -> bool:
5542
"""
5643
Detect if we are in a signed app bundle / framework.

src/desktop_notifier/main.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,41 +59,24 @@ def get_implementation() -> Type[DesktopNotifierBase]:
5959
:raises RuntimeError: when passing ``macos_legacy = True`` on macOS 12.0 and later.
6060
"""
6161
if platform.system() == "Darwin":
62-
from .macos_support import is_bundle, is_signed_bundle, macos_version
62+
from .macos_support import is_signed_bundle, macos_version
6363

6464
has_unusernotificationcenter = macos_version >= Version("10.14")
65-
has_nsusernotificationcenter = macos_version < Version("12.0")
6665
is_signed = is_signed_bundle()
6766

6867
if has_unusernotificationcenter and is_signed:
6968
# Use modern UNUserNotificationCenter.
7069
from .macos import CocoaNotificationCenter
7170

7271
return CocoaNotificationCenter
73-
74-
elif has_nsusernotificationcenter and is_bundle():
75-
if has_unusernotificationcenter and not is_signed:
72+
else:
73+
if has_unusernotificationcenter:
7674
logger.warning(
77-
"Running outside of a signed Framework or bundle: "
78-
"falling back to NSUserNotificationCenter"
75+
"Notification Center can only be used "
76+
"from a signed Framework or app bundle"
7977
)
8078
else:
81-
logger.warning(
82-
"Running on macOS 10.13 or earlier: "
83-
"falling back to NSUserNotificationCenter"
84-
)
85-
86-
# Use deprecated NSUserNotificationCenter.
87-
from .macos_legacy import CocoaNotificationCenterLegacy
88-
89-
return CocoaNotificationCenterLegacy
90-
91-
else:
92-
# Use dummy backend.
93-
logger.warning(
94-
"Notification Center can only be used "
95-
"from a signed Framework or app bundle"
96-
)
79+
logger.warning("Only macOS 10.14 and later are supported")
9780

9881
from .dummy import DummyNotificationCenter
9982

0 commit comments

Comments
 (0)