Files
transmission/macosx/SparkleProxy.mm
Yat Ho cbc5388440 build: bump to C++20 (#7191)
* build: bump to C++20

Co-authored-by: Cœur <coeur@gmx.fr>

* refactor: use designated initializers

* refactor: remove redundant SFINAE

* fix: clang-tidy warnings

* chore: comments about min compiler versions for C++20 features

* build: clang objc++ modules build errors

Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* refactor: add `TR_CONSTEXPR_VEC` and `TR_CONSTEXPR_STR`

* fix: don't use `std::rel_ops`

* chore: housekeeping

* fix: possible fix for macOS linker error

---------

Co-authored-by: Cœur <coeur@gmx.fr>
Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2026-01-20 16:27:34 -06:00

38 lines
1.5 KiB
Plaintext

// This file Copyright © Transmission authors and contributors.
// It may be used under the MIT (SPDX: MIT) license.
// License text can be found in the licenses/ folder.
#if __has_feature(modules)
@import ObjectiveC;
@import AppKit;
#else
#import <objc/runtime.h>
#import <AppKit/AppKit.h>
#endif
#import "NSStringAdditions.h"
// Development-only proxy when app is not signed for running Sparkle
void SUUpdater_checkForUpdates(id /*self*/, SEL /*_cmd*/, ...)
{
dispatch_async(dispatch_get_main_queue(), ^{
NSAlert* alert = [[NSAlert alloc] init];
alert.messageText = LocalizationNotNeeded(@"Sparkle not configured");
alert.informativeText = [NSString
stringWithFormat:@"App needs to be codesigned for Development to support Sparkle with Hardened Runtime. Alternatively, re-codesign without the Hardened Runtime option: `sudo codesign -s - %@`",
NSBundle.mainBundle.bundleURL.lastPathComponent];
[alert runModal];
});
}
/// Proxy SUUpdater if isn't registered at program startup due to codesigning.
__attribute__((constructor)) static void registerSUUpdater()
{
if (!objc_getClass("SUUpdater"))
{
NSLog(@"App is not signed for running Sparkle");
Class SUUpdaterClass = objc_allocateClassPair(objc_getClass("NSObject"), "SUUpdater", 0);
class_addMethod(SUUpdaterClass, sel_getUid("checkForUpdates:"), (IMP)SUUpdater_checkForUpdates, "v@:@");
objc_registerClassPair(SUUpdaterClass);
}
}