Skip to content

Commit bdf204d

Browse files
Fix Slack webhook trigger issue when running from CLI
1 parent 2783e25 commit bdf204d

4 files changed

Lines changed: 68 additions & 68 deletions

File tree

AppBox.xcodeproj/project.pbxproj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
E18186DC1E8A47C10002509F /* AccountPreferencesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E18186DB1E8A47C10002509F /* AccountPreferencesViewController.m */; };
7171
E18186DF1E8A47CD0002509F /* EmailPreferencesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E18186DE1E8A47CD0002509F /* EmailPreferencesViewController.m */; };
7272
E18186E21E8A47D60002509F /* HelpPreferencesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E18186E11E8A47D60002509F /* HelpPreferencesViewController.m */; };
73-
E1902B481E16423200C3E0F6 /* ProjectAdvancedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1902B471E16423200C3E0F6 /* ProjectAdvancedViewController.m */; };
73+
E1902B481E16423200C3E0F6 /* UploadAdvancedSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1902B471E16423200C3E0F6 /* UploadAdvancedSettingViewController.m */; };
7474
E1902B531E16617B00C3E0F6 /* NetworkHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = E1902B4E1E16617B00C3E0F6 /* NetworkHandler.m */; };
7575
E1902B541E16617B00C3E0F6 /* UserData.m in Sources */ = {isa = PBXBuildFile; fileRef = E1902B521E16617B00C3E0F6 /* UserData.m */; };
7676
E1902B5D1E1661B300C3E0F6 /* MailHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = E1902B5C1E1661B300C3E0F6 /* MailHandler.m */; };
@@ -238,8 +238,8 @@
238238
E18186DE1E8A47CD0002509F /* EmailPreferencesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EmailPreferencesViewController.m; sourceTree = "<group>"; };
239239
E18186E01E8A47D60002509F /* HelpPreferencesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelpPreferencesViewController.h; sourceTree = "<group>"; };
240240
E18186E11E8A47D60002509F /* HelpPreferencesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HelpPreferencesViewController.m; sourceTree = "<group>"; };
241-
E1902B461E16423200C3E0F6 /* ProjectAdvancedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectAdvancedViewController.h; sourceTree = "<group>"; };
242-
E1902B471E16423200C3E0F6 /* ProjectAdvancedViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProjectAdvancedViewController.m; sourceTree = "<group>"; };
241+
E1902B461E16423200C3E0F6 /* UploadAdvancedSettingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UploadAdvancedSettingViewController.h; sourceTree = "<group>"; };
242+
E1902B471E16423200C3E0F6 /* UploadAdvancedSettingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UploadAdvancedSettingViewController.m; sourceTree = "<group>"; };
243243
E1902B4D1E16617B00C3E0F6 /* NetworkHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkHandler.h; sourceTree = "<group>"; };
244244
E1902B4E1E16617B00C3E0F6 /* NetworkHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetworkHandler.m; sourceTree = "<group>"; };
245245
E1902B511E16617B00C3E0F6 /* UserData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserData.h; sourceTree = "<group>"; };
@@ -599,7 +599,7 @@
599599
E15C26671D7FD5A9004243B9 /* ShowLinkViewController */,
600600
E1AA0F411E2F325F00BA81A1 /* QRCodeViewController */,
601601
E12E6D061D8FC6E20054814D /* DashboardViewController */,
602-
E1902B451E16420C00C3E0F6 /* ProjectAdvancedViewController */,
602+
E1902B451E16420C00C3E0F6 /* UploadAdvancedSettingViewController */,
603603
E16D72E61E8935060031FB7C /* PreferencesViewController */,
604604
);
605605
path = ViewController;
@@ -737,13 +737,13 @@
737737
path = HelpPreferencesViewController;
738738
sourceTree = "<group>";
739739
};
740-
E1902B451E16420C00C3E0F6 /* ProjectAdvancedViewController */ = {
740+
E1902B451E16420C00C3E0F6 /* UploadAdvancedSettingViewController */ = {
741741
isa = PBXGroup;
742742
children = (
743-
E1902B461E16423200C3E0F6 /* ProjectAdvancedViewController.h */,
744-
E1902B471E16423200C3E0F6 /* ProjectAdvancedViewController.m */,
743+
E1902B461E16423200C3E0F6 /* UploadAdvancedSettingViewController.h */,
744+
E1902B471E16423200C3E0F6 /* UploadAdvancedSettingViewController.m */,
745745
);
746-
path = ProjectAdvancedViewController;
746+
path = UploadAdvancedSettingViewController;
747747
sourceTree = "<group>";
748748
};
749749
E1902B4B1E16617B00C3E0F6 /* MailHandler */ = {
@@ -1063,7 +1063,7 @@
10631063
E16437DD1D743A4E00CE8B7E /* AppBox.xcdatamodeld in Sources */,
10641064
E16437D71D743A4E00CE8B7E /* main.m in Sources */,
10651065
DB831BCB1FF6B5780065B646 /* ABHudViewController.m in Sources */,
1066-
E1902B481E16423200C3E0F6 /* ProjectAdvancedViewController.m in Sources */,
1066+
E1902B481E16423200C3E0F6 /* UploadAdvancedSettingViewController.m in Sources */,
10671067
DBF290D71FA64A590046D5CE /* ProvisioningDetailsViewController.m in Sources */,
10681068
DB358B66216FB1AC0080CAC0 /* UploadRecord+CoreDataClass.m in Sources */,
10691069
E16018F01DEC0BC200E3A377 /* DropboxViewController.m in Sources */,

AppBox/Common/CLIIPAUpload/CLIIPAUpload.m

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,44 @@ +(void)setCommonArgumentsToIPAUploadInfo:(IPAUploadInfo *)ipaUploadInfo {
2626
NSArray *arguments = [[NSProcessInfo processInfo] arguments];
2727
for (NSString *argument in arguments) {
2828

29+
//Webhook Message
30+
if ([argument containsString:abArgsWebHookMessage]) {
31+
NSArray *components = [argument componentsSeparatedByString:abArgsWebHookMessage];
32+
if (components.count == 2) {
33+
DDLogInfo(@"Set Webhook message to \"%@\"", [components lastObject]);
34+
ipaUploadInfo.webhookMessage = [components lastObject];
35+
} else {
36+
DDLogInfo(@"Invalid Webhook Message Argument \"%@\"",arguments);
37+
exit(abExitCodeForInvalidCommand);
38+
}
39+
}
40+
41+
//Slack Webhook
42+
else if ([argument containsString:abArgsSlackWebHook]) {
43+
NSArray *components = [argument componentsSeparatedByString:abArgsSlackWebHook];
44+
if (components.count == 2) {
45+
DDLogInfo(@"Set Slack Webhook to \"%@\"", [components lastObject]);
46+
ipaUploadInfo.slackWebhook = [components lastObject];
47+
} else {
48+
DDLogInfo(@"Invalid Slack Webhook Argument \"%@\"",arguments);
49+
exit(abExitCodeForInvalidCommand);
50+
}
51+
}
52+
53+
//MS Teams Webhook
54+
else if ([argument containsString:abArgsMSTeamsWebHook]) {
55+
NSArray *components = [argument componentsSeparatedByString:abArgsMSTeamsWebHook];
56+
if (components.count == 2) {
57+
DDLogInfo(@"Set MS Teams Webhook to \"%@\"", [components lastObject]);
58+
ipaUploadInfo.msTeamsWebhook = [components lastObject];
59+
} else {
60+
DDLogInfo(@"Invalid MS Teams Webhook Argument \"%@\"",arguments);
61+
exit(abExitCodeForInvalidCommand);
62+
}
63+
}
64+
2965
//Emails
30-
if ([argument containsString:abArgsEmails]) {
66+
else if ([argument containsString:abArgsEmails]) {
3167
NSArray *components = [argument componentsSeparatedByString:abArgsEmails];
3268
if (components.count == 2) {
3369
DDLogInfo(@"Changing Emails to \"%@\" from \"%@\"", [components lastObject], ipaUploadInfo.emails);
@@ -76,42 +112,6 @@ +(void)setCommonArgumentsToIPAUploadInfo:(IPAUploadInfo *)ipaUploadInfo {
76112
}
77113
}
78114

79-
//Message
80-
else if ([argument containsString:abArgsWebHookMessage]) {
81-
NSArray *components = [argument componentsSeparatedByString:abArgsWebHookMessage];
82-
if (components.count == 2) {
83-
DDLogInfo(@"Set Webhook message to \"%@\"", [components lastObject]);
84-
ipaUploadInfo.webhookMessage = [components lastObject];
85-
} else {
86-
DDLogInfo(@"Invalid Webhook Message Argument \"%@\"",arguments);
87-
exit(abExitCodeForInvalidCommand);
88-
}
89-
}
90-
91-
//Webhook
92-
else if ([argument containsString:abArgsSlackWebHook]) {
93-
NSArray *components = [argument componentsSeparatedByString:abArgsSlackWebHook];
94-
if (components.count == 2) {
95-
DDLogInfo(@"Set Slack Webhook to \"%@\"", [components lastObject]);
96-
ipaUploadInfo.slackWebhook = [components lastObject];
97-
} else {
98-
DDLogInfo(@"Invalid Slack Webhook Argument \"%@\"",arguments);
99-
exit(abExitCodeForInvalidCommand);
100-
}
101-
}
102-
103-
//MS Teams Webhook
104-
else if ([argument containsString:abArgsMSTeamsWebHook]) {
105-
NSArray *components = [argument componentsSeparatedByString:abArgsMSTeamsWebHook];
106-
if (components.count == 2) {
107-
DDLogInfo(@"Set MS Teams Webhook to \"%@\"", [components lastObject]);
108-
ipaUploadInfo.msTeamsWebhook = [components lastObject];
109-
} else {
110-
DDLogInfo(@"Invalid MS Teams Webhook Argument \"%@\"",arguments);
111-
exit(abExitCodeForInvalidCommand);
112-
}
113-
}
114-
115115
//Email and Email Subject Prefix
116116
NSMutableSet *emails = [[NSMutableSet alloc] init];
117117

AppBox/Model/IPAInfoModel/IPAUploadInfo.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
@property(nonatomic, retain) NSURL *uniquelinkShareableURL;
3737
@property(nonatomic, retain) DBFILESFileMetadata *uniqueLinkJsonMetaData;
3838

39+
//Share Settings
40+
@property(nonatomic, retain) NSString *emails;
41+
@property(nonatomic, retain) NSNumber *keepSameLink;
42+
@property(nonatomic, retain) NSString *personalMessage;
43+
@property(nonatomic, retain) NSString *webhookMessage;
44+
@property(nonatomic, retain) NSString *slackWebhook;
45+
@property(nonatomic, retain) NSString *msTeamsWebhook;
46+
3947
//Shareable URL DropBox or Google Shortern
4048
@property(nonatomic, retain) NSURL *dbDirectory;
4149
@property(nonatomic, retain) NSURL *dbIPAFullPath;
@@ -48,14 +56,6 @@
4856
@property(nonatomic, retain) NSURL *appLongShareableURL;
4957
@property(nonatomic, retain) NSURL *appShortShareableURL;
5058

51-
//CI Settings
52-
@property(nonatomic, retain) NSString *emails;
53-
@property(nonatomic, retain) NSNumber *keepSameLink;
54-
@property(nonatomic, retain) NSString *personalMessage;
55-
@property(nonatomic, retain) NSString *webhookMessage;
56-
@property(nonatomic, retain) NSString *slackWebhook;
57-
@property(nonatomic, retain) NSString *msTeamsWebhook;
58-
5959
- (instancetype)initEmpty;
6060
- (BOOL)isValidInfoPlist;
6161
- (BOOL)exportSharedURLInSystemFile;

AppBox/ViewController/HomeViewController/HomeViewController.m

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ -(void)setupUploadManager{
138138
//MARK: - Build Repo / Open Files Notification
139139
- (void)initCLIUpload:(NSNotification *)notification {
140140
if ([notification.object isKindOfClass:[IPAUploadInfo class]]) {
141-
self.isCLIActive = YES;
142-
self.ipaUploadInfo = notification.object;
143-
[self initCLIUploadProcessWithIPAUploadInfo:self.ipaUploadInfo];
141+
[self initCLIUploadProcessWithIPAUploadInfo:[notification object]];
144142
}
145143
}
146144

@@ -179,22 +177,24 @@ - (IBAction)selectedFilePathHandler:(NSPathControl *)sender {
179177
}
180178
}
181179

182-
- (void)initCLIUploadProcessWithIPAUploadInfo:(IPAUploadInfo *)ciProject {
183-
NSURL *ipaURL = ciProject.ipaFullPath;
180+
- (void)initCLIUploadProcessWithIPAUploadInfo:(IPAUploadInfo *)ipaUploadInfo {
181+
NSURL *ipaURL = ipaUploadInfo.ipaFullPath;
184182
if (ipaURL == nil) {
185183
return;
186184
}
187185

188-
[self viewStateForProgressFinish:YES];
186+
self.isCLIActive = YES;
187+
self.ipaUploadInfo = ipaUploadInfo;
189188
[self.ipaUploadInfo setIpaFullPath:ipaURL];
189+
[self.uploadManager setIpaUploadInfo:self.ipaUploadInfo];
190190
[selectedFilePath setURL:ipaURL];
191-
if (ciProject.emails.length != 0) {
192-
[textFieldEmail setStringValue:ciProject.emails];
191+
if (ipaUploadInfo.emails.length != 0) {
192+
[textFieldEmail setStringValue:ipaUploadInfo.emails];
193193
}
194-
if (ciProject.personalMessage.length != 0) {
195-
[textFieldMessage setStringValue:ciProject.personalMessage];
194+
if (ipaUploadInfo.personalMessage.length != 0) {
195+
[textFieldMessage setStringValue:ipaUploadInfo.personalMessage];
196196
}
197-
[buttonUniqueLink setState:ciProject.keepSameLink.boolValue ? NSControlStateValueOn : NSControlStateValueOff];
197+
[buttonUniqueLink setState:ipaUploadInfo.keepSameLink.boolValue ? NSControlStateValueOn : NSControlStateValueOff];
198198
[self buttonUniqueLinkTapped:buttonUniqueLink];
199199
[self actionButtonTapped:buttonAction];
200200
}
@@ -433,9 +433,9 @@ -(void)shareURLOnSlackMSTeamChannel {
433433
if (slackWebhook.length > 0){
434434
[self showStatus:@"Sending Message on Slack..." andShowProgressBar:YES withProgress:-1];
435435
[SlackClient sendMessage:self.ipaUploadInfo
436-
webhook:slackWebhook
437-
message:message
438-
completion:^(BOOL success) {}];
436+
webhook:slackWebhook
437+
message:message
438+
completion:^(BOOL success) {}];
439439
}
440440

441441
NSString *msTeamWebhook;

0 commit comments

Comments
 (0)