Displaying dialog when Sparkle is disabled

This commit is contained in:
michael starke
2016-03-17 17:37:40 +01:00
parent dc57628c81
commit 2af98ef3d6
4 changed files with 24 additions and 7 deletions

View File

@@ -25,6 +25,9 @@
</menuItem>
<menuItem title="Check for Updates…" id="zMO-8r-g5v">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="checkForUpdates:" target="494" id="5dV-gw-yHT"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="236">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>

View File

@@ -34,6 +34,7 @@ APPKIT_EXTERN NSString *const MPDidChangeStoredKeyFilesSettings;
@property (nonatomic, assign) BOOL isAllowedToStoreKeyFile;
- (IBAction)checkForUpdates:(id)sender;
- (IBAction)showPreferences:(id)sender;
- (IBAction)showPasswordCreator:(id)sender;
- (IBAction)createNewDatabase:(id)sender;

View File

@@ -36,6 +36,8 @@
#import "MPTemporaryFileStorageCenter.h"
#import "MPValueTransformerHelper.h"
#import "NSApplication+MPAdditions.h"
#import "KeePassKit/KeePassKit.h"
#import <Sparkle/Sparkle.h>
@@ -95,7 +97,7 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
- (void)awakeFromNib {
_isAllowedToStoreKeyFile = NO;
/* Update the at the save menu */
[[self.saveMenuItem menu] setDelegate:self];
self.saveMenuItem.menu.delegate = self;
/* We want to inform anyone about the changes to keyFile remembering */
[self bind:NSStringFromSelector(@selector(isAllowedToStoreKeyFile))
@@ -160,8 +162,8 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
[MPAutotypeDaemon defaultDaemon];
/* Create Plugin Manager */
[MPPluginManager sharedManager];
#ifdef RELEASE
/* Only enabel updater in Release */
#ifndef DEBUG
/* Only enable updater in Release */
[SUUpdater sharedUpdater];
#endif
}
@@ -227,9 +229,19 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
}
- (void)showHelp:(id)sender {
/* TODO: use Info.plist for URL */
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://github.com/mstarke/MacPass"]];
}
- (void)checkForUpdates:(id)sender {
#ifdef DEBUG
NSAlert *alert = [NSAlert alertWithMessageText:@"Updates are disabled!" defaultButton:@"Ok" alternateButton:nil otherButton:nil informativeTextWithFormat:@"Sparkle updates are only available in offical releases of %@!", NSApp.applicationName];
[alert runModal];
#else
[[SUUpdater sharedUpdater] checkForUpdates:sender];
#endif
}
#pragma mark -
#pragma mark Private Helper
- (void)_applicationDidFinishRestoringWindows:(NSNotification *)notification {

View File

@@ -34,13 +34,14 @@
}
- (void)awakeFromNib {
#ifdef RELEASE
/* only enable bindings to settings in release mode */
#ifdef DEBUG
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];
#else
self.checkIntervallPopupButton.enabled = NO;
self.automaticallyCheckForUpdatesCheckButton.enabled = NO;
#endif
}