Skip to content

Commit

Permalink
[macOS] fix conflict with Adobe Photoshop and Illutrator
Browse files Browse the repository at this point in the history
  • Loading branch information
tuyenvm committed Oct 2, 2019
1 parent 0f04c37 commit 79054f5
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 47 deletions.
1 change: 1 addition & 0 deletions Sources/OpenKey/macOS/ModernKey/AboutViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 13 additions & 0 deletions Sources/OpenKey/macOS/ModernKey/AboutViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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...";
Expand Down
5 changes: 4 additions & 1 deletion Sources/OpenKey/macOS/ModernKey/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}


Expand Down
Loading

0 comments on commit 79054f5

Please sign in to comment.