This repository has been archived by the owner on Jun 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDonationWindowController.m
78 lines (63 loc) · 2.65 KB
/
DonationWindowController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//
// DonationWindowController.m
// MAL Updater OS X
//
// Created by 桐間紗路 on 2017/01/03.
// Copyright 2009-2017 MAL Updater OS X Group. All rights reserved. Code licensed under New BSD License
//
#import "DonationWindowController.h"
#import "Utility.h"
@interface DonationWindowController ()
@end
@implementation DonationWindowController
@synthesize name;
@synthesize key;
- (id)init{
self = [super initWithWindowNibName:@"DonationWindow"];
if (!self) {
return nil;
}
return self;
}
- (void)windowDidLoad {
[super windowDidLoad];
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
}
- (IBAction)validate:(id)sender{
if (name.stringValue.length > 0 && key.stringValue.length>0) {
// Check donation key
int success = [Utility checkDonationKey:key.stringValue name:name.stringValue];
if (success == 1) {
[Utility showsheetmessage:@"Registered" explaination:@"Thank you for donating. The donation reminder will no longer appear and exclusive features are unlocked." window:nil];
// Add to the preferences
[[NSUserDefaults standardUserDefaults] setObject:name.stringValue forKey:@"donor"];
[[NSUserDefaults standardUserDefaults] setObject:key.stringValue forKey:@"donatekey"];
[[NSUserDefaults standardUserDefaults] setObject:@YES forKey:@"donated"];
//Close Window
[self.window orderOut:self];
}
else if (success == 2) {
[Utility showsheetmessage:@"No Internet" explaination:@"Make sure you are connected to the internet and try again." window:self.window];
}
else {
[Utility showsheetmessage:@"Invalid Key" explaination:@"Please make sure you copied the name and key exactly from the email." window:self.window];
}
}
else {
[Utility showsheetmessage:@"Missing Information" explaination:@"Please type in the name and key exactly from the email and try again." window:self.window];
}
}
- (IBAction)cancel:(id)sender{
[self.window orderOut:self];
}
- (IBAction)donate:(id)sender{
// Show Donation Page
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://malupdaterosx.moe/donate/"]];
}
- (IBAction)purchasedonationlicense:(id)sender {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://softwareateliershiori.onfastspring.com/mal-library-mal-updater-os-x-donation-license"]];
}
- (IBAction)lookupkey:(id)sender {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://malupdaterosx.moe/lostkey.php"]];
}
@end