Skip to content

Commit

Permalink
Dirty fix for Sonoma menuWillOpen
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codechimp committed Sep 27, 2023
1 parent 45d24bf commit 746b0c3
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 20 deletions.
37 changes: 29 additions & 8 deletions HA Menu.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -329,8 +329,9 @@
491F5291217CBF5200105921 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1120;
LastUpgradeCheck = 1220;
LastUpgradeCheck = 1500;
ORGANIZATIONNAME = CodeChimp;
TargetAttributes = {
491F5298217CBF5200105921 = {
Expand Down Expand Up @@ -529,9 +530,11 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand All @@ -546,7 +549,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 11.5;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -592,9 +595,11 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand All @@ -603,7 +608,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 11.5;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
Expand All @@ -622,14 +627,16 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 30;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "HA Menu/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 2.7.0;
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 2.7.1;
OTHER_SWIFT_FLAGS = "-D DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-Menu";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -646,14 +653,16 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 30;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "HA Menu/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 2.7.0;
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 2.7.1;
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-Menu";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -667,13 +676,15 @@
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
INFOPLIST_FILE = "HA MenuTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-MenuTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -688,13 +699,15 @@
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
INFOPLIST_FILE = "HA MenuTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-MenuTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -708,13 +721,15 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
INFOPLIST_FILE = "HA MenuUITests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-MenuUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -728,13 +743,15 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
INFOPLIST_FILE = "HA MenuUITests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-MenuUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -751,14 +768,16 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 30;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "HA Menu Launcher/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 2.7.0;
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 2.7.1;
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-Menu-Launcher";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand All @@ -775,14 +794,16 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 30;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = VZ3Z8BPWPW;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "HA Menu Launcher/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 2.7.0;
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 2.7.1;
PRODUCT_BUNDLE_IDENTIFIER = "org.codechimp.HA-Menu-Launcher";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion HA Menu.xcodeproj/xcshareddata/xcschemes/HA Menu.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
22 changes: 12 additions & 10 deletions HA Menu/MenuItemController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,23 @@ final class MenuItemController: NSObject, NSMenuDelegate {
}

public func menuWillOpen(_ menu: NSMenu){
self.removeDynamicMenuItems()
// Dirty fix for Sonoma which doesn't like menu items being changed during WillOpen
DispatchQueue.main.async {
self.removeDynamicMenuItems()

self.addDynamicMenuItems(){
result in
switch result {
case .success( _):
self.checkForUpdate()
case .failure( _):
break
self.addDynamicMenuItems(){
result in
switch result {
case .success( _):
self.checkForUpdate()
case .failure( _):
break
}
}
}
}

public func menuDidClose(_ menu: NSMenu){

}

func buildStaticMenu() {
Expand Down

0 comments on commit 746b0c3

Please sign in to comment.