diff --git a/Sources/OpenKey/macOS/ModernKey/AboutViewController.h b/Sources/OpenKey/macOS/ModernKey/AboutViewController.h index d2d9630..0ff3274 100644 --- a/Sources/OpenKey/macOS/ModernKey/AboutViewController.h +++ b/Sources/OpenKey/macOS/ModernKey/AboutViewController.h @@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN @interface AboutViewController : NSViewController @property (weak) IBOutlet NSTextField *VersionInfo; @property (weak) IBOutlet NSButton *CheckNewVersionButton; +@property (weak) IBOutlet NSButton *CheckUpdateOnStatus; @end diff --git a/Sources/OpenKey/macOS/ModernKey/AboutViewController.m b/Sources/OpenKey/macOS/ModernKey/AboutViewController.m index 38e4f56..b05190f 100644 --- a/Sources/OpenKey/macOS/ModernKey/AboutViewController.m +++ b/Sources/OpenKey/macOS/ModernKey/AboutViewController.m @@ -23,6 +23,9 @@ - (void)viewDidLoad { [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleShortVersionString"], [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleVersion"], [OpenKeyManager getBuildDate]] ; + + NSInteger dontCheckUpdate = [[NSUserDefaults standardUserDefaults] integerForKey:@"DontCheckUpdate"]; + self.CheckUpdateOnStatus.state = dontCheckUpdate ? NSControlStateValueOff :NSControlStateValueOn; } - (IBAction)onHomePage:(id)sender { @@ -37,6 +40,16 @@ - (IBAction)onLatestReleaseVersion:(id)sender { [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:@"https://github.com/tuyenvm/OpenKey/releases"]]; } +- (IBAction)onCheckUpdateOnStartup:(NSButton *)sender { + NSInteger val = 0; + if (sender.state == NSControlStateValueOn) { + val = 0; + } else { + val = 1; + } + [[NSUserDefaults standardUserDefaults] setInteger:val forKey:@"DontCheckUpdate"]; +} + - (IBAction)onCheckNewVersion:(id)sender { self.CheckNewVersionButton.title = @"Đang kiểm tra..."; diff --git a/Sources/OpenKey/macOS/ModernKey/AppDelegate.m b/Sources/OpenKey/macOS/ModernKey/AppDelegate.m index 2c64e59..325f459 100644 --- a/Sources/OpenKey/macOS/ModernKey/AppDelegate.m +++ b/Sources/OpenKey/macOS/ModernKey/AppDelegate.m @@ -142,7 +142,10 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { } [[NSUserDefaults standardUserDefaults] setInteger:1 forKey:@"NonFirstTime"]; - [OpenKeyManager checkNewVersion:nil]; + //check update if enable + NSInteger dontCheckUpdate = [[NSUserDefaults standardUserDefaults] integerForKey:@"DontCheckUpdate"]; + if (!dontCheckUpdate) + [OpenKeyManager checkNewVersion:nil]; } diff --git a/Sources/OpenKey/macOS/ModernKey/Base.lproj/Main.storyboard b/Sources/OpenKey/macOS/ModernKey/Base.lproj/Main.storyboard index 5336dcc..54a3c70 100644 --- a/Sources/OpenKey/macOS/ModernKey/Base.lproj/Main.storyboard +++ b/Sources/OpenKey/macOS/ModernKey/Base.lproj/Main.storyboard @@ -707,11 +707,11 @@ - + - + @@ -720,7 +720,7 @@ - + @@ -729,7 +729,7 @@ - + @@ -738,12 +738,12 @@ - + - + @@ -759,7 +759,7 @@ - + @@ -768,7 +768,7 @@ - + @@ -784,7 +784,7 @@ - + @@ -793,7 +793,7 @@ - + @@ -809,7 +809,7 @@ - + @@ -827,7 +827,7 @@ + + - + @@ -873,11 +885,11 @@ - + - + @@ -886,7 +898,7 @@ - + @@ -953,7 +965,7 @@ - + @@ -962,7 +974,7 @@ - + @@ -971,7 +983,7 @@ - + @@ -980,7 +992,7 @@ - + @@ -998,7 +1010,7 @@ - + @@ -1016,7 +1028,7 @@ - + @@ -1025,7 +1037,7 @@ - + @@ -1213,7 +1225,7 @@ - + @@ -1222,7 +1234,7 @@