Skip to content

Commit 1d6d2b2

Browse files
committed
Add DOWNLOAD_URL to 3rd Party -> Link Prefix Message
Allow to specify DOWNLOAD_URL keyword in Webhooks for more flexible message formatting. If DOWNLOAD_URL keyword is not specified, link will be appended.
1 parent de0234f commit 1d6d2b2

5 files changed

Lines changed: 15 additions & 10 deletions

File tree

AppBox/Common/MailHandler/MailHandler.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,18 @@ + (NSString *)parseMessage:(NSString *)message forProject:(XCProject *)project {
3333
messageCopy = [messageCopy stringByReplacingOccurrencesOfString:@"{PROJECT_NAME}" withString:project.name];
3434
messageCopy = [messageCopy stringByReplacingOccurrencesOfString:@"{BUILD_NUMBER}" withString:project.build];
3535
messageCopy = [messageCopy stringByReplacingOccurrencesOfString:@"{BUILD_VERSION}" withString:project.version];
36+
messageCopy = [messageCopy stringByReplacingOccurrencesOfString:@"{DOWNLOAD_URL}" withString: project.appShortShareableURL.absoluteString];
3637
if (project.selectedSchemes) {
3738
messageCopy = [messageCopy stringByReplacingOccurrencesOfString:@"{PROJECT_SCHEME}" withString:project.selectedSchemes];
3839
} else {
3940
messageCopy = [messageCopy stringByReplacingOccurrencesOfString:@"{PROJECT_SCHEME}" withString:@"Default"];
4041
}
42+
43+
// If DOWNLOAD_URL keyword was not used, append it for compatibility
44+
if (![[UserData userSlackMessage] containsString: @"{DOWNLOAD_URL}"]) {
45+
messageCopy = [messageCopy stringByAppendingFormat:@" - %@", project.appShortShareableURL];
46+
}
47+
4148
return messageCopy;
4249
}
4350

AppBox/Common/ServiceIntegrations/HangoutClient/HangoutClient.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ + (void)sendMessageForProject:(XCProject *)project completion:(void (^) (BOOL su
1919
NSString *hangoutMessage;
2020
if ([UserData userSlackMessage].length > 0) {
2121
hangoutMessage = [MailHandler parseMessage:[UserData userSlackMessage] forProject:project];
22-
hangoutMessage = [hangoutMessage stringByAppendingFormat:@" - %@", project.appShortShareableURL];
2322
} else {
2423
hangoutMessage = [NSString stringWithFormat:@"%@ - %@ (%@) link - %@", project.name, project.version, project.build, project.appShortShareableURL];
2524
}

AppBox/Common/ServiceIntegrations/MSTeamsClient/MSTeamsClient.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ + (void)sendMessageForProject:(XCProject *)project completion:(void (^) (BOOL su
1919
NSString *hangoutMessage;
2020
if ([UserData userSlackMessage].length > 0) {
2121
hangoutMessage = [MailHandler parseMessage:[UserData userSlackMessage] forProject:project];
22-
hangoutMessage = [hangoutMessage stringByAppendingFormat:@" - %@", project.appShortShareableURL];
2322
} else {
2423
hangoutMessage = [NSString stringWithFormat:@"%@ - %@ (%@) link - %@", project.name, project.version, project.build, project.appShortShareableURL];
2524
}

AppBox/Common/ServiceIntegrations/SlackClient/SlackClient.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ + (void)sendMessageForProject:(XCProject *)project completion:(void (^) (BOOL su
2020
NSString *slackMessage;
2121
if ([UserData userSlackMessage].length > 0) {
2222
slackMessage = [MailHandler parseMessage:[UserData userSlackMessage] forProject:project];
23-
slackMessage = [slackMessage stringByAppendingFormat:@" - %@", project.appShortShareableURL];
2423
} else {
2524
slackMessage = [NSString stringWithFormat:@"%@ - %@ (%@) link - %@", project.name, project.version, project.build, project.appShortShareableURL];
2625
}

AppBox/ViewController/PreferencesViewController/SlackPreferencesViewController/SlackPreferencesViewController.xib

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.18"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
66
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
77
</dependencies>
88
<objects>
@@ -18,7 +18,7 @@
1818
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
1919
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
2020
<customView id="Hz6-mo-xeY">
21-
<rect key="frame" x="0.0" y="0.0" width="892" height="317"/>
21+
<rect key="frame" x="0.0" y="0.0" width="892" height="330"/>
2222
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
2323
<subviews>
2424
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Mjn-bT-CIG">
@@ -57,7 +57,7 @@
5757
</textFieldCell>
5858
</textField>
5959
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="UIS-te-x1g">
60-
<rect key="frame" x="13" y="278" width="204" height="19"/>
60+
<rect key="frame" x="13" y="291" width="204" height="19"/>
6161
<constraints>
6262
<constraint firstAttribute="width" constant="200" id="Apo-90-Dsy"/>
6363
</constraints>
@@ -68,22 +68,23 @@
6868
</textFieldCell>
6969
</textField>
7070
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TBN-E3-vOT">
71-
<rect key="frame" x="230" y="275" width="647" height="24"/>
71+
<rect key="frame" x="230" y="288" width="647" height="24"/>
7272
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Add Link Prefix Message" drawsBackground="YES" id="2Hv-ni-fmB">
7373
<font key="font" metaFont="systemLight" size="16"/>
7474
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
7575
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
7676
</textFieldCell>
7777
</textField>
7878
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dNt-JQ-OEn">
79-
<rect key="frame" x="228" y="205" width="651" height="65"/>
79+
<rect key="frame" x="228" y="205" width="651" height="78"/>
8080
<textFieldCell key="cell" selectable="YES" sendsActionOnEndEditing="YES" id="jnf-oH-zV9">
8181
<font key="font" metaFont="system" size="10"/>
8282
<string key="title">Supported Keywords: The
8383
{PROJECT_NAME} - For Project Name
8484
{BUILD_VERSION} - For Build Version
8585
{BUILD_NUMBER} - For Build Number
86-
{PROJECT_SCHEME} - For Project Scheme</string>
86+
{PROJECT_SCHEME} - For Project Scheme
87+
{DOWNLOAD_URL} - For Download URL</string>
8788
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
8889
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
8990
</textFieldCell>

0 commit comments

Comments
 (0)