From a50eefb6c522460e30363bf0ae43086e27b9c13d Mon Sep 17 00:00:00 2001 From: Camila Date: Tue, 7 Nov 2023 17:52:37 +0100 Subject: [PATCH 1/7] Change minimun mac OS version to 10.13. Signed-off-by: Camila --- cmake/modules/MacOSXBundleInfo.plist.in | 2 +- .../NextcloudIntegration.xcodeproj/project.pbxproj | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmake/modules/MacOSXBundleInfo.plist.in b/cmake/modules/MacOSXBundleInfo.plist.in index e0dba2ef62355..8327c22976671 100644 --- a/cmake/modules/MacOSXBundleInfo.plist.in +++ b/cmake/modules/MacOSXBundleInfo.plist.in @@ -5,7 +5,7 @@ NSPrincipalClass NSApplication LSMinimumSystemVersion - 12.0.0 + 10.13.0 LSUIElement CFBundleDevelopmentRegion diff --git a/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj b/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj index c592022afe4d6..5a635b3d8fab1 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj +++ b/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj @@ -805,7 +805,7 @@ "@executable_path/../Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 10.13; MARKETING_VERSION = 1.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -867,7 +867,7 @@ "@executable_path/../Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 10.13; MARKETING_VERSION = 1.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; @@ -1000,7 +1000,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1051,7 +1051,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; @@ -1106,7 +1106,7 @@ "@executable_path/../Frameworks", "@executable_path/../../../../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = YES; OC_APPLICATION_NAME = ownCloud; OC_APPLICATION_REV_DOMAIN = com.owncloud.desktopclient; @@ -1160,7 +1160,7 @@ "@executable_path/../Frameworks", "@executable_path/../../../../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; OC_APPLICATION_NAME = ownCloud; OC_APPLICATION_REV_DOMAIN = com.owncloud.desktopclient; From a49dfd8644b0386c934b6ccba32d1f1109738e3c Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 13 Nov 2023 09:50:27 +0800 Subject: [PATCH 2/7] Create systray_mac_common file for common systray functions Signed-off-by: Claudio Cambra --- src/gui/CMakeLists.txt | 2 +- src/gui/systray.mm | 39 ++++--------------------- src/gui/systray_mac_common.mm | 55 +++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 35 deletions(-) create mode 100644 src/gui/systray_mac_common.mm diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 1968683e23415..d0746ffa24f4e 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -282,7 +282,7 @@ endif() IF( APPLE ) list(APPEND client_SRCS cocoainitializer_mac.mm) - list(APPEND client_SRCS systray.mm) + list(APPEND client_SRCS systray.mm systray_mac_common.mm) if (BUILD_FILE_PROVIDER_MODULE) list(APPEND client_SRCS diff --git a/src/gui/systray.mm b/src/gui/systray.mm index 707e3269fd429..2cfde7405810e 100644 --- a/src/gui/systray.mm +++ b/src/gui/systray.mm @@ -1,13 +1,13 @@ -#include "QtCore/qurl.h" +#include +#include +#include + #include "account.h" #include "accountstate.h" #include "accountmanager.h" #include "config.h" #include "systray.h" #include "tray/talkreply.h" -#include -#include -#include #import #import @@ -76,7 +76,7 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000 +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_11_0 completionHandler(UNNotificationPresentationOptionSound + UNNotificationPresentationOptionBanner); #else completionHandler(UNNotificationPresentationOptionSound + UNNotificationPresentationOptionAlert); @@ -111,20 +111,6 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center namespace OCC { -double menuBarThickness() -{ - NSMenu * const mainMenu = [[NSApplication sharedApplication] mainMenu]; - - if (mainMenu == nil) { - // Return this educated guess if something goes wrong. - // As of macOS 12.4 this will always return 22, even on notched Macbooks. - qCWarning(lcMacSystray) << "Got nil for main menu. Going with reasonable menu bar height guess."; - return NSStatusBar.systemStatusBar.thickness; - } - - return mainMenu.menuBarHeight; -} - // TODO: Get this to actually check for permissions bool canOsXSendUserNotification() { @@ -266,19 +252,4 @@ void sendOsXTalkNotification(const QString &title, const QString &message, const [center addNotificationRequest:request withCompletionHandler:nil]; } -void setTrayWindowLevelAndVisibleOnAllSpaces(QWindow *window) -{ - NSView * const nativeView = (NSView *)window->winId(); - NSWindow * const nativeWindow = (NSWindow *)(nativeView.window); - [nativeWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorIgnoresCycle | - NSWindowCollectionBehaviorTransient]; - [nativeWindow setLevel:NSMainMenuWindowLevel]; -} - -bool osXInDarkMode() -{ - NSString * const osxMode = [NSUserDefaults.standardUserDefaults stringForKey:@"AppleInterfaceStyle"]; - return [osxMode containsString:@"Dark"]; -} - } // OCC namespace diff --git a/src/gui/systray_mac_common.mm b/src/gui/systray_mac_common.mm new file mode 100644 index 0000000000000..8189acd10951e --- /dev/null +++ b/src/gui/systray_mac_common.mm @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2023 by Claudio Cambra + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include + +#import + +#include "systray.h" + +Q_LOGGING_CATEGORY(lcMacSystrayCommon, "nextcloud.gui.macsystraycommon") + +namespace OCC { + +double menuBarThickness() +{ + NSMenu * const mainMenu = [[NSApplication sharedApplication] mainMenu]; + + if (mainMenu == nil) { + // Return this educated guess if something goes wrong. + // As of macOS 12.4 this will always return 22, even on notched Macbooks. + qCWarning(lcMacSystrayCommon) << "Got nil for main menu. " + << "Going with reasonable menu bar height guess."; + return NSStatusBar.systemStatusBar.thickness; + } + + return mainMenu.menuBarHeight; +} + +void setTrayWindowLevelAndVisibleOnAllSpaces(QWindow *const window) +{ + NSView * const nativeView = (NSView *)window->winId(); + NSWindow * const nativeWindow = (NSWindow *)(nativeView.window); + [nativeWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorIgnoresCycle | + NSWindowCollectionBehaviorTransient]; + [nativeWindow setLevel:NSMainMenuWindowLevel]; +} + +bool osXInDarkMode() +{ + NSString * const osxMode = [NSUserDefaults.standardUserDefaults stringForKey:@"AppleInterfaceStyle"]; + return [osxMode containsString:@"Dark"]; +} + +} From 951cd6a47b507c7853b1a8ea285169e1ed822d5f Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 13 Nov 2023 11:26:36 +0800 Subject: [PATCH 3/7] macosx: Selectively compile UserNotifications component of systray depending on deployment version Signed-off-by: Claudio Cambra --- src/gui/CMakeLists.txt | 6 +- src/gui/systray.cpp | 8 +-- src/gui/systray.h | 2 + ...ay.mm => systray_mac_usernotifications.mm} | 59 ++++++++++++------- 4 files changed, 49 insertions(+), 26 deletions(-) rename src/gui/{systray.mm => systray_mac_usernotifications.mm} (80%) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index d0746ffa24f4e..33d7a6ec68ba6 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -282,7 +282,11 @@ endif() IF( APPLE ) list(APPEND client_SRCS cocoainitializer_mac.mm) - list(APPEND client_SRCS systray.mm systray_mac_common.mm) + list(APPEND client_SRCS systray_mac_common.mm) + + if (NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET OR CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.14) + list(APPEND client_SRCS systray_mac_usernotifications.mm) + endif() if (BUILD_FILE_PROVIDER_MODULE) list(APPEND client_SRCS diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index 510435ebf1b02..5529964341b52 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -74,7 +74,7 @@ void Systray::setTrayEngine(QQmlApplicationEngine *trayEngine) Systray::Systray() : QSystemTrayIcon(nullptr) { -#if defined(Q_OS_MACOS) && defined(BUILD_OWNCLOUD_OSX_BUNDLE) +#if defined(Q_OS_MACOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14 && defined(BUILD_OWNCLOUD_OSX_BUNDLE) setUserNotificationCenterDelegate(); checkNotificationAuth(MacNotificationAuthorizationOptions::Default); // No provisional auth, ask user explicitly first time registerNotificationCategories(QString(tr("Download"))); @@ -517,7 +517,7 @@ void Systray::showMessage(const QString &title, const QString &message, MessageI QDBusConnection::sessionBus().asyncCall(method); } else #endif -#if defined(Q_OS_MACOS) && defined(BUILD_OWNCLOUD_OSX_BUNDLE) +#if defined(Q_OS_MACOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14 && defined(BUILD_OWNCLOUD_OSX_BUNDLE) if (canOsXSendUserNotification()) { sendOsXUserNotification(title, message); } else @@ -529,7 +529,7 @@ void Systray::showMessage(const QString &title, const QString &message, MessageI void Systray::showUpdateMessage(const QString &title, const QString &message, const QUrl &webUrl) { -#if defined(Q_OS_MACOS) && defined(BUILD_OWNCLOUD_OSX_BUNDLE) +#if defined(Q_OS_MACOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14 && defined(BUILD_OWNCLOUD_OSX_BUNDLE) sendOsXUpdateNotification(title, message, webUrl); #else // TODO: Implement custom notifications (i.e. actionable) for other OSes Q_UNUSED(webUrl); @@ -539,7 +539,7 @@ void Systray::showUpdateMessage(const QString &title, const QString &message, co void Systray::showTalkMessage(const QString &title, const QString &message, const QString &token, const QString &replyTo, const AccountStatePtr &accountState) { -#if defined(Q_OS_MACOS) && defined(BUILD_OWNCLOUD_OSX_BUNDLE) +#if defined(Q_OS_MACOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14 && defined(BUILD_OWNCLOUD_OSX_BUNDLE) sendOsXTalkNotification(title, message, token, replyTo, accountState); #else // TODO: Implement custom notifications (i.e. actionable) for other OSes Q_UNUSED(replyTo) diff --git a/src/gui/systray.h b/src/gui/systray.h index 87592e935dc4d..2056b7175eee7 100644 --- a/src/gui/systray.h +++ b/src/gui/systray.h @@ -40,6 +40,7 @@ class AccessManagerFactory : public QQmlNetworkAccessManagerFactory }; #ifdef Q_OS_MACOS +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14 enum MacNotificationAuthorizationOptions { Default = 0, Provisional @@ -52,6 +53,7 @@ bool canOsXSendUserNotification(); void sendOsXUserNotification(const QString &title, const QString &message); void sendOsXUpdateNotification(const QString &title, const QString &message, const QUrl &webUrl); void sendOsXTalkNotification(const QString &title, const QString &message, const QString &token, const QString &replyTo, const AccountStatePtr accountState); +#endif void setTrayWindowLevelAndVisibleOnAllSpaces(QWindow *window); double menuBarThickness(); #endif diff --git a/src/gui/systray.mm b/src/gui/systray_mac_usernotifications.mm similarity index 80% rename from src/gui/systray.mm rename to src/gui/systray_mac_usernotifications.mm index 2cfde7405810e..3d02272c6b312 100644 --- a/src/gui/systray.mm +++ b/src/gui/systray_mac_usernotifications.mm @@ -1,7 +1,24 @@ +/* + * Copyright (C) 2023 by Claudio Cambra + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + #include #include #include +#import +#import + #include "account.h" #include "accountstate.h" #include "accountmanager.h" @@ -9,10 +26,7 @@ #include "systray.h" #include "tray/talkreply.h" -#import -#import - -Q_LOGGING_CATEGORY(lcMacSystray, "nextcloud.gui.macsystray") +Q_LOGGING_CATEGORY(lcMacSystrayUserNotifications, "nextcloud.gui.macsystrayusernotifications") /************************* Private utility functions *************************/ @@ -21,16 +35,16 @@ void sendTalkReply(UNNotificationResponse *response, UNNotificationContent* content) { if (!response || !content) { - qCWarning(lcMacSystray()) << "Invalid notification response or content." - << "Can't send talk reply."; + qCWarning(lcMacSystrayUserNotifications) << "Invalid notification response or content." + << "Can't send talk reply."; return; } UNTextInputNotificationResponse * const textInputResponse = (UNTextInputNotificationResponse*)response; if (!textInputResponse) { - qCWarning(lcMacSystray()) << "Notification response was not a text input response." - << "Can't send talk reply."; + qCWarning(lcMacSystrayUserNotifications) << "Notification response was not a text input response." + << "Can't send talk reply."; return; } @@ -47,16 +61,16 @@ void sendTalkReply(UNNotificationResponse *response, UNNotificationContent* cont const auto accountState = OCC::AccountManager::instance()->accountFromUserId(qAccount); if (!accountState) { - qCWarning(lcMacSystray()) << "Could not find account matching" << qAccount - << "Can't send talk reply."; + qCWarning(lcMacSystrayUserNotifications) << "Could not find account matching" << qAccount + << "Can't send talk reply."; return; } - qCDebug(lcMacSystray()) << "Sending talk reply from macOS notification." - << "Reply is:" << qReply - << "Replying to:" << qReplyTo - << "Token:" << qToken - << "Account:" << qAccount; + qCDebug(lcMacSystrayUserNotifications) << "Sending talk reply from macOS notification." + << "Reply is:" << qReply + << "Replying to:" << qReplyTo + << "Token:" << qToken + << "Account:" << qAccount; // OCC::TalkReply deletes itself once it's done, fire and forget const auto talkReply = new OCC::TalkReply(accountState.data(), OCC::Systray::instance()); @@ -87,13 +101,16 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler { - qCDebug(lcMacSystray()) << "Received notification with category identifier:" << response.notification.request.content.categoryIdentifier - << "and action identifier" << response.actionIdentifier; + qCDebug(lcMacSystrayUserNotifications) << "Received notification with category identifier:" + << response.notification.request.content.categoryIdentifier + << "and action identifier" + << response.actionIdentifier; + UNNotificationContent * const content = response.notification.request.content; if ([content.categoryIdentifier isEqualToString:@"UPDATE"]) { if ([response.actionIdentifier isEqualToString:@"DOWNLOAD_ACTION"] || [response.actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier]) { - qCDebug(lcMacSystray()) << "Opening update download url in browser."; + qCDebug(lcMacSystrayUserNotifications) << "Opening update download url in browser."; [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[content.userInfo objectForKey:@"webUrl"]]]; } } else if ([content.categoryIdentifier isEqualToString:@"TALK_MESSAGE"]) { @@ -167,12 +184,12 @@ void checkNotificationAuth(MacNotificationAuthorizationOptions additionalAuthOpt [center requestAuthorizationWithOptions:(authOptions) completionHandler:^(BOOL granted, NSError * _Nullable error) { // Enable or disable features based on authorization. if (granted) { - qCDebug(lcMacSystray) << "Authorization for notifications has been granted, can display notifications."; + qCDebug(lcMacSystrayUserNotifications) << "Authorization for notifications has been granted, can display notifications."; } else { - qCDebug(lcMacSystray) << "Authorization for notifications not granted."; + qCDebug(lcMacSystrayUserNotifications) << "Authorization for notifications not granted."; if (error) { const auto errorDescription = QString::fromNSString(error.localizedDescription); - qCDebug(lcMacSystray) << "Error from notification center: " << errorDescription; + qCDebug(lcMacSystrayUserNotifications) << "Error from notification center: " << errorDescription; } } }]; From b59f81e799f50afcee7393a941fc419591ca98e2 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 13 Nov 2023 11:35:49 +0800 Subject: [PATCH 4/7] Do not try to link UserNotifications framework when building below 10.14 Signed-off-by: Claudio Cambra --- src/gui/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 33d7a6ec68ba6..526ba6a3988d3 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -682,8 +682,10 @@ if (APPLE) if (BUILD_FILE_PROVIDER_MODULE) target_link_libraries(nextcloudCore PUBLIC Qt5::MacExtras "-framework UserNotifications -framework FileProvider") - else() + elseif(NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET OR CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.14) target_link_libraries(nextcloudCore PUBLIC Qt5::MacExtras "-framework UserNotifications") + else() + target_link_libraries(nextcloudCore PUBLIC Qt5::MacExtras) endif() endif() From b50e1e3aab677ebc788b285a73e1dc722825e3c9 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 13 Nov 2023 11:36:21 +0800 Subject: [PATCH 5/7] Only set BUILD_FILE_PROVIDER_MODULE if deployment target high enough Signed-off-by: Claudio Cambra --- NEXTCLOUD.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEXTCLOUD.cmake b/NEXTCLOUD.cmake index 40d0f2ff403ca..a2d1fbbfea185 100644 --- a/NEXTCLOUD.cmake +++ b/NEXTCLOUD.cmake @@ -77,6 +77,6 @@ if(WIN32) option( BUILD_WIN_TOOLS "Build Win32 migration tools" OFF ) endif() -if (APPLE) +if (APPLE AND (NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET OR CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 11.0)) option( BUILD_FILE_PROVIDER_MODULE "Build the macOS virtual files File Provider module" OFF ) endif() From 11612ca578cf898ba5c0e0d35ee68b27b9368c90 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 13 Nov 2023 11:50:19 +0800 Subject: [PATCH 6/7] Remove unneeded fallback for undefined cmake_osx_deployment_target Signed-off-by: Claudio Cambra --- NEXTCLOUD.cmake | 2 +- src/gui/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NEXTCLOUD.cmake b/NEXTCLOUD.cmake index a2d1fbbfea185..4b49a32b300b1 100644 --- a/NEXTCLOUD.cmake +++ b/NEXTCLOUD.cmake @@ -77,6 +77,6 @@ if(WIN32) option( BUILD_WIN_TOOLS "Build Win32 migration tools" OFF ) endif() -if (APPLE AND (NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET OR CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 11.0)) +if (APPLE AND CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 11.0) option( BUILD_FILE_PROVIDER_MODULE "Build the macOS virtual files File Provider module" OFF ) endif() diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 526ba6a3988d3..85115b0a9c9de 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -284,7 +284,7 @@ IF( APPLE ) list(APPEND client_SRCS cocoainitializer_mac.mm) list(APPEND client_SRCS systray_mac_common.mm) - if (NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET OR CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.14) + if (CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.14) list(APPEND client_SRCS systray_mac_usernotifications.mm) endif() @@ -682,7 +682,7 @@ if (APPLE) if (BUILD_FILE_PROVIDER_MODULE) target_link_libraries(nextcloudCore PUBLIC Qt5::MacExtras "-framework UserNotifications -framework FileProvider") - elseif(NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET OR CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.14) + elseif(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.14) target_link_libraries(nextcloudCore PUBLIC Qt5::MacExtras "-framework UserNotifications") else() target_link_libraries(nextcloudCore PUBLIC Qt5::MacExtras) From cd64e71d8e630ae8910ff708bcbb28931d029f79 Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Thu, 29 Feb 2024 11:56:11 +0100 Subject: [PATCH 7/7] Set min OSX version via cmake. It should now only use the CMAKE_OSX_DEPLOYMENT_TARGET set when building. Signed-off-by: Camila Ayres --- CMakeLists.txt | 4 ++++ .../NextcloudIntegration.xcodeproj/project.pbxproj | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3217aaf30f14e..a196dbba5ce67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,10 @@ endif() project(client) +if(APPLE) + set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0" CACHE STRING "Minimum OSX deployment version") +endif() + include(FeatureSummary) set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES) diff --git a/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj b/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj index 5a635b3d8fab1..c592022afe4d6 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj +++ b/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj @@ -805,7 +805,7 @@ "@executable_path/../Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 12.0; MARKETING_VERSION = 1.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -867,7 +867,7 @@ "@executable_path/../Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 12.0; MARKETING_VERSION = 1.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; @@ -1000,7 +1000,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1051,7 +1051,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; @@ -1106,7 +1106,7 @@ "@executable_path/../Frameworks", "@executable_path/../../../../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; OC_APPLICATION_NAME = ownCloud; OC_APPLICATION_REV_DOMAIN = com.owncloud.desktopclient; @@ -1160,7 +1160,7 @@ "@executable_path/../Frameworks", "@executable_path/../../../../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; OC_APPLICATION_NAME = ownCloud; OC_APPLICATION_REV_DOMAIN = com.owncloud.desktopclient;