Skip to content

Commit

Permalink
updated to Sparkle 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mstarke committed Nov 17, 2022
1 parent bc83364 commit 45e2402
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
12 changes: 6 additions & 6 deletions MacPass/Base.lproj/UpdatePreferences.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15702" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15702"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -16,10 +16,10 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1">
<rect key="frame" x="0.0" y="0.0" width="400" height="95"/>
<rect key="frame" x="0.0" y="0.0" width="400" height="94"/>
<subviews>
<button verticalHuggingPriority="500" translatesAutoresizingMaskIntoConstraints="NO" id="Z6x-oU-NC5">
<rect key="frame" x="22" y="59" width="221" height="18"/>
<rect key="frame" x="22" y="59" width="225" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="ppB-Ka-SVN"/>
</constraints>
Expand All @@ -29,10 +29,10 @@
</buttonCell>
</button>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pWJ-eJ-MBf">
<rect key="frame" x="144" y="17" width="114" height="25"/>
<rect key="frame" x="143" y="16" width="115" height="25"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="Hl5-gO-B1c">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="RKd-H8-eCF">
<items>
<menuItem title="every Hour" tag="3600" id="DjF-1I-6Nq"/>
Expand Down
2 changes: 2 additions & 0 deletions MacPass/MPAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
APPKIT_EXTERN NSString *const MPDidChangeStoredKeyFilesSettings;

@class MPEntryContextMenuDelegate;
@class SPUUpdater;

@interface MPAppDelegate : NSObject <NSApplicationDelegate, NSMenuDelegate>

Expand All @@ -36,6 +37,7 @@ APPKIT_EXTERN NSString *const MPDidChangeStoredKeyFilesSettings;
@property (strong) IBOutlet NSMenu *exportMenu;

@property (strong, readonly) MPEntryContextMenuDelegate *itemActionMenuDelegate;
@property (strong, readonly) SPUUpdater *updater;
@property (readonly) BOOL isTerminating;

@property (nonatomic) BOOL isAllowedToStoreKeyFile;
Expand Down
7 changes: 5 additions & 2 deletions MacPass/MPAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ @interface MPAppDelegate () {
}

@property (strong) NSWindow *welcomeWindow;
@property (strong) SPUUpdater *updater;
@property (strong) IBOutlet NSWindow *passwordCreatorWindow;
@property (strong, nonatomic) MPPreferencesWindowController *preferencesController;
@property (strong, nonatomic) MPPasswordCreatorViewController *passwordCreatorController;
Expand Down Expand Up @@ -217,7 +218,9 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification {
[MPPluginHost sharedHost];
#if !defined(DEBUG) && !defined(NO_SPARKLE)
/* Disable updates if in debug or nosparkle */
[SUUpdater sharedUpdater];
SPUStandardUserDriver *userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:NSBundle.mainBundle delegate:nil];
self.updater = [[SPUUpdater alloc] initWithHostBundle:NSBundle.mainBundle applicationBundle:NSBundle.mainBundle userDriver:userDriver delegate:nil];
[self.updater startUpdater:nil];
#endif
self.startupState |= MPAppStartupStateFinishedLaunch;
// Here we just opt-in for allowing our bar to be customized throughout the app.
Expand Down Expand Up @@ -364,7 +367,7 @@ - (void)checkForUpdates:(id)sender {
[alert addButtonWithTitle:NSLocalizedString(@"OK", @"Ok Button to dismiss disabled updates alert")];
[alert runModal];
#else
[[SUUpdater sharedUpdater] checkForUpdates:sender];
[self.updater checkForUpdates];
#endif
}

Expand Down
11 changes: 8 additions & 3 deletions MacPass/MPUpdatePreferencesController.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
//

#import "MPUpdatePreferencesController.h"
#import "MPAppDelegate.h"

#import "NSApplication+MPAdditions.h"

#import <Sparkle/Sparkle.h>

@interface MPUpdatePreferencesController ()
Expand Down Expand Up @@ -53,9 +57,10 @@ - (void)awakeFromNib {
self.checkIntervallPopupButton.enabled = NO;
self.automaticallyCheckForUpdatesCheckButton.enabled = NO;
#else
[self.checkIntervallPopupButton bind:NSSelectedTagBinding toObject:[SUUpdater sharedUpdater] withKeyPath:NSStringFromSelector(@selector(updateCheckInterval)) options:nil];
[self.checkIntervallPopupButton bind:NSEnabledBinding toObject:[SUUpdater sharedUpdater] withKeyPath:NSStringFromSelector(@selector(automaticallyChecksForUpdates)) options:nil];
[self.automaticallyCheckForUpdatesCheckButton bind:NSValueBinding toObject:[SUUpdater sharedUpdater] withKeyPath:NSStringFromSelector(@selector(automaticallyChecksForUpdates)) options:nil];
SPUUpdater *updater = NSApplication.sharedApplication.mp_delegate.updater;
[self.checkIntervallPopupButton bind:NSSelectedTagBinding toObject:updater withKeyPath:NSStringFromSelector(@selector(updateCheckInterval)) options:nil];
[self.checkIntervallPopupButton bind:NSEnabledBinding toObject:updater withKeyPath:NSStringFromSelector(@selector(automaticallyChecksForUpdates)) options:nil];
[self.automaticallyCheckForUpdatesCheckButton bind:NSValueBinding toObject:updater withKeyPath:NSStringFromSelector(@selector(automaticallyChecksForUpdates)) options:nil];
#endif

}
Expand Down

0 comments on commit 45e2402

Please sign in to comment.