Skip to content
This repository was archived by the owner on Apr 12, 2020. It is now read-only.

Commit 09f5c7b

Browse files
committed
v1.1
1 parent b06ccfa commit 09f5c7b

7 files changed

Lines changed: 46 additions & 22 deletions

File tree

AltDeploy.xcodeproj/xcshareddata/xcschemes/AltDeploy.xcscheme

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
</Testables>
3232
</TestAction>
3333
<LaunchAction
34-
buildConfiguration = "Debug"
35-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
34+
buildConfiguration = "Release"
35+
selectedDebuggerIdentifier = ""
36+
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
3737
launchStyle = "0"
3838
useCustomWorkingDirectory = "NO"
3939
ignoresPersistentStateOnLaunch = "NO"

AltDeploy/ALTAppleIDManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
1717
- (BOOL)getLastAppleID:(NSString *_Nullable*_Nullable)usernamePt;
1818
- (NSString *)passwordOfAppleID:(NSString *)username;
1919
- (BOOL)addAppleID:(NSString *)username password:(NSString *)password;
20+
- (void)removeAppleID:(NSString *)username;
2021

2122
@end
2223

AltDeploy/ALTAppleIDManager.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,8 @@ - (NSString *)passwordOfAppleID:(NSString *)username {
4545
return [SAMKeychain passwordForService:NSBundle.mainBundle.bundleIdentifier account:username];
4646
}
4747

48+
- (void)removeAppleID:(NSString *)username {
49+
[SAMKeychain deletePasswordForService:NSBundle.mainBundle.bundleIdentifier account:username];
50+
}
51+
4852
@end

AltDeploy/ALTMainViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(NSProgress *)object
5252
- (void)didClickPreferences:(id)sender {
5353
ALTPreferencesViewController *vc = (ALTPreferencesViewController *)[[NSStoryboard storyboardWithName:@"Main" bundle:NSBundle.mainBundle] instantiateControllerWithIdentifier:@"prefs"];
5454
[self presentViewControllerAsModalWindow:vc];
55+
[self refreshAppleIDs];
5556
}
5657

5758
#pragma mark - Life Cycle
@@ -320,7 +321,7 @@ - (void)chooseIPA {
320321
- (void)fetchUtilities {
321322
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
322323
NSArray<NSMenuItem *> * __block menuItems = nil;
323-
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://api.pixelomer.com/ALTImpactor/v1/utilities"]];
324+
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://api.pixelomer.com/ALTImpactor/v0/utilities"]];
324325
if (data) {
325326
NSError *error;
326327
NSArray *array = [NSJSONSerialization

AltDeploy/ALTPreferencesViewController.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010

1111
NS_ASSUME_NONNULL_BEGIN
1212

13-
@interface ALTPreferencesViewController : NSViewController<NSTableViewDelegate, NSTableViewDataSource> {
13+
@protocol ALTAddAppleIDDelegate;
14+
15+
@interface ALTPreferencesViewController : NSViewController<NSTableViewDelegate, NSTableViewDataSource, ALTAddAppleIDDelegate> {
1416
NSArray<NSDictionary<NSString *, id> *> *accounts;
15-
NSArray<NSArray<NSTextFieldCell *> *> *cells;
1617
NSDateFormatter *dateFormatter;
1718
}
1819
@property (weak) IBOutlet NSButton *modifyButton;

AltDeploy/ALTPreferencesViewController.m

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
#import "ALTPreferencesViewController.h"
1010
#import <SAMKeychain/SAMKeychain.h>
11+
#import "ALTAppleIDManager.h"
1112
#import "ALTMainViewController.h"
13+
#import "ALTAddAppleIDViewController.h"
1214

1315
@implementation ALTPreferencesViewController
1416

@@ -31,6 +33,9 @@ - (void)viewDidLoad {
3133
- (void)refreshAccounts {
3234
accounts = [SAMKeychain accountsForService:NSBundle.mainBundle.bundleIdentifier];
3335
[_tableView reloadData];
36+
if ([self.presentingViewController conformsToProtocol:@protocol(ALTAddAppleIDDelegate)]) {
37+
[(id<ALTAddAppleIDDelegate>)self.presentingViewController didAddAppleID];
38+
}
3439
}
3540

3641
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
@@ -59,4 +64,23 @@ - (void)tableViewSelectionDidChange:(NSNotification *)notification {
5964
_setAsDefaultButton.enabled = enableButtons;
6065
}
6166

67+
- (IBAction)didPressRemove:(id)sender {
68+
[[ALTAppleIDManager sharedManager] removeAppleID:accounts[_tableView.selectedRow][kSAMKeychainAccountKey]];
69+
[self refreshAccounts];
70+
}
71+
72+
- (void)didAddAppleID {
73+
[self refreshAccounts];
74+
}
75+
76+
- (IBAction)didPressModify:(id)sender {
77+
ALTAddAppleIDViewController *vc = (ALTAddAppleIDViewController *)[[NSStoryboard storyboardWithName:@"Main" bundle:NSBundle.mainBundle] instantiateControllerWithIdentifier:@"appleid"];
78+
[vc loadView];
79+
vc.title = @"Modify Apple ID";
80+
vc.usernameField.enabled = NO;
81+
vc.usernameField.stringValue = accounts[_tableView.selectedRow][kSAMKeychainAccountKey];
82+
vc.delegate = self;
83+
[self presentViewControllerAsModalWindow:vc];
84+
}
85+
6286
@end

AltDeploy/Base.lproj/Main.storyboard

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -450,23 +450,19 @@
450450
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
451451
<font key="font" metaFont="system"/>
452452
</buttonCell>
453+
<connections>
454+
<action selector="didPressModify:" target="WEI-QT-mNg" id="fLr-TM-ays"/>
455+
</connections>
453456
</button>
454457
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UGW-6C-vlA">
455458
<rect key="frame" x="276" y="13" width="89" height="32"/>
456459
<buttonCell key="cell" type="push" title="Remove" bezelStyle="rounded" alignment="center" enabled="NO" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="A67-xf-zXv">
457460
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
458461
<font key="font" metaFont="system"/>
459462
</buttonCell>
460-
</button>
461-
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jb3-6a-a3d">
462-
<rect key="frame" x="14" y="13" width="125" height="32"/>
463-
<constraints>
464-
<constraint firstAttribute="width" constant="113" id="NjQ-PE-dpE"/>
465-
</constraints>
466-
<buttonCell key="cell" type="push" title="Set as Default" bezelStyle="rounded" alignment="center" enabled="NO" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="yGd-NX-mZM">
467-
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
468-
<font key="font" metaFont="system"/>
469-
</buttonCell>
463+
<connections>
464+
<action selector="didPressRemove:" target="WEI-QT-mNg" id="cwD-YY-Jcq"/>
465+
</connections>
470466
</button>
471467
<scrollView autohidesScrollers="YES" horizontalLineScroll="18" horizontalPageScroll="10" verticalLineScroll="18" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="Y08-t2-UqR">
472468
<rect key="frame" x="20" y="46" width="428" height="178"/>
@@ -493,7 +489,7 @@
493489
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
494490
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
495491
</textFieldCell>
496-
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
492+
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
497493
</tableColumn>
498494
<tableColumn editable="NO" width="181" minWidth="40" maxWidth="1000" id="JF0-6y-Y9q">
499495
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Last Modified">
@@ -506,7 +502,7 @@
506502
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
507503
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
508504
</textFieldCell>
509-
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
505+
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
510506
</tableColumn>
511507
</tableColumns>
512508
</tableView>
@@ -535,21 +531,18 @@
535531
<constraint firstItem="Y08-t2-UqR" firstAttribute="top" secondItem="MMb-x9-C2I" secondAttribute="top" constant="20" id="5O5-4V-dI6"/>
536532
<constraint firstAttribute="trailing" secondItem="OHM-Ti-bbE" secondAttribute="trailing" constant="20" id="BJI-Ue-jHF"/>
537533
<constraint firstAttribute="bottom" secondItem="UGW-6C-vlA" secondAttribute="bottom" constant="20" id="CJ5-pc-b5z"/>
538-
<constraint firstItem="jb3-6a-a3d" firstAttribute="top" secondItem="UGW-6C-vlA" secondAttribute="top" id="EZ0-Dm-bje"/>
539534
<constraint firstItem="UGW-6C-vlA" firstAttribute="top" secondItem="Y08-t2-UqR" secondAttribute="bottom" constant="5" id="HXO-E5-kZs"/>
535+
<constraint firstItem="UGW-6C-vlA" firstAttribute="leading" secondItem="MMb-x9-C2I" secondAttribute="leading" constant="282" id="K7c-BW-74l"/>
540536
<constraint firstItem="Y08-t2-UqR" firstAttribute="leading" secondItem="MMb-x9-C2I" secondAttribute="leading" constant="20" id="LnI-ig-4s8"/>
541537
<constraint firstAttribute="trailing" secondItem="Y08-t2-UqR" secondAttribute="trailing" constant="20" id="OQM-eb-7QR"/>
542538
<constraint firstItem="UGW-6C-vlA" firstAttribute="width" secondItem="OHM-Ti-bbE" secondAttribute="width" id="cJb-95-EjJ"/>
543539
<constraint firstItem="OHM-Ti-bbE" firstAttribute="top" secondItem="UGW-6C-vlA" secondAttribute="top" id="gBr-gZ-iPd"/>
544-
<constraint firstItem="UGW-6C-vlA" firstAttribute="leading" secondItem="jb3-6a-a3d" secondAttribute="trailing" constant="149" id="iaY-PG-InM"/>
545540
</constraints>
546541
</view>
547542
<connections>
548543
<outlet property="modifyButton" destination="OHM-Ti-bbE" id="2LA-KR-7vo"/>
549544
<outlet property="removeButton" destination="UGW-6C-vlA" id="578-I9-WVc"/>
550545
<outlet property="scrollView" destination="Y08-t2-UqR" id="i0K-PF-IaW"/>
551-
<outlet property="setAsDefault" destination="jb3-6a-a3d" id="r4U-h9-QT4"/>
552-
<outlet property="setAsDefaultButton" destination="jb3-6a-a3d" id="yac-5o-a5K"/>
553546
<outlet property="tableView" destination="mOE-Zm-JQd" id="6nS-lg-BLB"/>
554547
</connections>
555548
</viewController>

0 commit comments

Comments
 (0)