OBSSparkle.mm 1.0 KB

123456789101112131415161718192021222324252627282930
  1. #import "OBSSparkle.hpp"
  2. #import "OBSUpdateDelegate.h"
  3. OBSSparkle::OBSSparkle(const char *branch, QAction *checkForUpdatesAction)
  4. {
  5. @autoreleasepool {
  6. updaterDelegate = [[OBSUpdateDelegate alloc] init];
  7. updaterDelegate.branch = [NSString stringWithUTF8String:branch];
  8. updaterDelegate.updaterController =
  9. [[SPUStandardUpdaterController alloc] initWithStartingUpdater:YES updaterDelegate:updaterDelegate
  10. userDriverDelegate:nil];
  11. [updaterDelegate observeCanCheckForUpdatesWithAction:checkForUpdatesAction];
  12. }
  13. }
  14. void OBSSparkle::setBranch(const char *branch)
  15. {
  16. updaterDelegate.branch = [NSString stringWithUTF8String:branch];
  17. }
  18. void OBSSparkle::checkForUpdates(bool manualCheck)
  19. {
  20. @autoreleasepool {
  21. if (manualCheck) {
  22. [updaterDelegate.updaterController checkForUpdates:nil];
  23. } else {
  24. [updaterDelegate.updaterController.updater checkForUpdatesInBackground];
  25. }
  26. }
  27. }