Files
obs-studio/frontend/utility/OBSUpdateDelegate.mm
T
PatTheMav d91999b4cf frontend: Add feedUrlStringForUpdater delegate
Adds necessary delegate method to OBSSupdateDelegate to provide
alternative AppCast feed URL at runtime.

The NSString pointer is allowed to be "nil" as Sparkle will only use
a non-nil return value to change from the default feed URL.
2026-06-08 18:49:46 -04:00

46 lines
1.4 KiB
Plaintext

#import "OBSUpdateDelegate.h"
@implementation OBSUpdateDelegate {
}
@synthesize branch;
- (nonnull NSSet<NSString *> *)allowedChannelsForUpdater:(nonnull SPUUpdater *)updater
{
return [NSSet setWithObject:branch];
}
- (void)observeCanCheckForUpdatesWithAction:(nonnull QAction *)action;
{
[_updaterController.updater addObserver:self forKeyPath:NSStringFromSelector(@selector(canCheckForUpdates))
options:(NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew)
context:(void *) action];
}
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary<NSKeyValueChangeKey, id> *)change
context:(void *)context
{
if ([keyPath isEqualToString:NSStringFromSelector(@selector(canCheckForUpdates))]) {
QAction *menuAction = (QAction *) context;
menuAction->setEnabled(_updaterController.updater.canCheckForUpdates);
} else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
- (NSString *)feedURLStringForUpdater:(SPUUpdater *)updater
{
return self.feedUrl;
}
- (void)dealloc
{
@autoreleasepool {
[_updaterController.updater removeObserver:self forKeyPath:NSStringFromSelector(@selector(canCheckForUpdates))];
}
}
@end