Electron-249 - Implemented a new feature that brings electron wrapper when a user receives a notification

This commit is contained in:
Kiran Niranjan 2018-01-05 17:42:43 +05:30 committed by kiranniranjan
parent 73dbd98f4e
commit 5ef535d88e
15 changed files with 127 additions and 25 deletions

View File

@ -3,6 +3,7 @@
"minimizeOnClose" : true,
"launchOnStartup" : true,
"alwaysOnTop" : false,
"bringToFront": false,
"whitelistUrl": "*",
"notificationSettings": {
"position": "upper-right",

View File

@ -6,7 +6,7 @@
<dict>
<key>Resources/Base.lproj/MyInstallerPane.nib</key>
<data>
GZWN47BPj6b6mD6MnSVH/Qn0m3s=
qzPzEQIBkVBOKJZjQazFQhY6cL0=
</data>
<key>Resources/InstallerSections.plist</key>
<data>
@ -37,11 +37,11 @@
<dict>
<key>hash</key>
<data>
GZWN47BPj6b6mD6MnSVH/Qn0m3s=
qzPzEQIBkVBOKJZjQazFQhY6cL0=
</data>
<key>hash2</key>
<data>
cJ/kr1HEozYL0YeZriWDtnOL1NEd22vHzH5WGp1T3hk=
U8Qd70O1wfq0unofGkUAwq7LBjJi+Q/zxHWn1qlSpTY=
</data>
</dict>
<key>Resources/InstallerSections.plist</key>

View File

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13529"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="InstallerSection">
<connections>
<outlet property="bringToFrontTextBox" destination="oWV-om-PWr" id="hlh-Zp-2Rb"/>
<outlet property="firstPane" destination="Qsn-FY-4qK" id="Dhh-1H-QYh"/>
<outlet property="podUrlAlertTextBox" destination="wzk-BB-itI" id="QhW-ay-Yma"/>
</connections>
@ -18,6 +19,8 @@
<connections>
<outlet property="alwaysOnTopCheckBox" destination="8EB-K5-hjN" id="hdp-QL-BzL"/>
<outlet property="autoLaunchCheckBox" destination="zJM-2d-YYz" id="YVL-Wi-qgG"/>
<outlet property="bringToFrontCheckBox" destination="U3w-pH-PqJ" id="sdD-Dp-GpD"/>
<outlet property="bringToFrontTextBox" destination="oWV-om-PWr" id="bc6-cj-Zmy"/>
<outlet property="contentView" destination="TUK-W2-vig" id="gTd-A7-dof"/>
<outlet property="minimizeOnCloseCheckBox" destination="XPe-yO-v9Y" id="ewr-3C-eNJ"/>
<outlet property="parentSection" destination="-2" id="FB7-UV-e8k"/>
@ -39,7 +42,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iAw-NP-Tbm">
<rect key="frame" x="8" y="75" width="188" height="28"/>
<rect key="frame" x="8" y="99" width="188" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Minimize Symphony on Close" id="z1k-Zj-Big">
<font key="font" metaFont="system"/>
@ -48,7 +51,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KOx-3P-dPz">
<rect key="frame" x="8" y="119" width="146" height="28"/>
<rect key="frame" x="8" y="135" width="146" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Auto-launch Symphony" id="9id-I6-Bxu">
<font key="font" metaFont="system"/>
@ -57,21 +60,13 @@
</textFieldCell>
</textField>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XPe-yO-v9Y">
<rect key="frame" x="194" y="85" width="22" height="18"/>
<rect key="frame" x="194" y="111" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="uvu-EE-3sp">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zJM-2d-YYz">
<rect key="frame" x="194" y="129" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="o5T-Og-ooq">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<textField toolTip="Ex: https://my.symphony.com" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uwa-xi-M5X">
<rect key="frame" x="196" y="197" width="207" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
@ -82,7 +77,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="UYr-oC-RgI">
<rect key="frame" x="8" y="31" width="168" height="28"/>
<rect key="frame" x="8" y="63" width="168" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Symphony is always on top" id="7pE-fR-PoD">
<font key="font" metaFont="system"/>
@ -91,7 +86,7 @@
</textFieldCell>
</textField>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8EB-K5-hjN">
<rect key="frame" x="194" y="41" width="22" height="18"/>
<rect key="frame" x="194" y="75" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" inset="2" id="chP-mD-3E9">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@ -107,6 +102,31 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oWV-om-PWr">
<rect key="frame" x="8" y="38" width="152" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Bring Symphony to front" id="BMb-Um-fNF">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zJM-2d-YYz">
<rect key="frame" x="194" y="147" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="o5T-Og-ooq">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="U3w-pH-PqJ">
<rect key="frame" x="194" y="37" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" inset="2" id="Q95-3i-cEO">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews>
</customView>
</objects>

View File

@ -14,5 +14,7 @@
@property (weak) IBOutlet NSTextField *podUrlTextBox;
@property (weak) IBOutlet NSButton *alwaysOnTopCheckBox;
@property (weak) IBOutlet NSTextField *podUrlAlertTextBox;
@property (weak) IBOutlet NSButton *bringToFrontCheckBox;
@property (weak) IBOutlet NSTextField *bringToFrontTextBox;
@end

View File

@ -63,16 +63,22 @@
minimizeOnClose = @"false";
}
// By default, set alwaysOnTop to false
// By default, set alwaysOnTop and bring to front to false
NSString *alwaysOnTop = @"false\n";
NSString *bringToFront = @"false\n";
// If the checkbox is changed, set the always on top value accordingly
if ([_alwaysOnTopCheckBox state] == 1) {
alwaysOnTop = @"true\n";
}
// If the checkbox is changed, set the bring to front value accordingly
if ([_bringToFrontCheckBox state] == 1) {
bringToFront = @"true\n";
}
// Create an array with the selected options
NSArray *symSettings = [[NSArray alloc] initWithObjects:podUrl, minimizeOnClose, autoLaunchOnStart, alwaysOnTop, nil];
NSArray *symSettings = [[NSArray alloc] initWithObjects:podUrl, minimizeOnClose, autoLaunchOnStart, alwaysOnTop, bringToFront, nil];
// Create a string from the array with new-line as the separator
NSString *symSettingsString = [symSettings componentsJoinedByString:@"\n"];

View File

@ -11,6 +11,7 @@ pod_url=$(sed -n '1p' ${tempFilePath});
minimize_on_close=$(sed -n '2p' '/tmp/sym_settings.txt');
launch_on_startup=$(sed -n '3p' '/tmp/sym_settings.txt');
always_on_top=$(sed -n '4p' '/tmp/sym_settings.txt');
bring_to_front=$(sed -n '5p' '/tmp/sym_settings.txt');
if [ "$pod_url" == "" ]; then
pod_url="https://corporate.symphony.com"
@ -28,11 +29,16 @@ if [ "$always_on_top" == "" ]; then
always_on_top=false;
fi
if [ "$bring_to_front" == "" ]; then
bring_to_front=false;
fi
## Replace the default settings with the user selected settings ##
sed -i "" -E "s#\"url\" ?: ?\".*\"#\"url\"\: \"$pod_url\"#g" ${newPath}
sed -i "" -E "s#\"minimizeOnClose\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"minimizeOnClose\":\ $minimize_on_close#g" ${newPath}
sed -i "" -E "s#\"alwaysOnTop\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"alwaysOnTop\":\ $always_on_top#g" ${newPath}
sed -i "" -E "s#\"launchOnStartup\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"launchOnStartup\":\ $launch_on_startup#g" ${newPath}
sed -i "" -E "s#\"bringToFront\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"bringToFront\":\ $bring_to_front#g" ${newPath}
## Remove the temp settings file created ##
rm -f ${tempFilePath}

View File

@ -20,6 +20,7 @@
<ROW Property="ARPURLINFOABOUT" Value="http://www.symphony.com"/>
<ROW Property="AUTO_START" Value="CheckBox"/>
<ROW Property="AUTO_START_LABEL" Value="true" Type="4"/>
<ROW Property="BRING_TO_FRONT_LABEL" Value="false" Type="4"/>
<ROW Property="BannerBitmap" Value="banner" MultiBuildValue="DefaultBuild:Banner.jpg" Type="1" MsiKey="BannerBitmap"/>
<ROW Property="CTRLS" Value="2"/>
<ROW Property="DialogBitmap" Value="dialog" MultiBuildValue="DefaultBuild:Tabloid.jpg" Type="1" MsiKey="DialogBitmap"/>
@ -346,6 +347,7 @@
<ROW Property="MINIMIZE_ON_CLOSE" Value="true"/>
<ROW Property="AUTO_START" Value="true"/>
<ROW Property="ALWAYS_ON_TOP" Value="true"/>
<ROW Property="BRING_TO_FRONT" Value="true"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiControlComponent">
<ROW Dialog_="AdminBrowseDlg" Control="Logo" Type="Text" X="4" Y="228" Width="38" Height="12" Attributes="1" Text="Symphony" Order="300" TextLocId="Control.Text.AdminBrowseDlg#Logo" MsiKey="AdminBrowseDlg#Logo"/>
@ -388,6 +390,7 @@
<ROW Dialog_="FolderDlg" Control="LaunchOnStartupCheckBox" Type="CheckBox" X="172" Y="174" Width="98" Height="13" Attributes="3" Property="AUTO_START" Text="Launch On Startup" Order="1600"/>
<ROW Dialog_="FolderDlg" Control="AlwaysOnTopCheckBox" Type="CheckBox" X="20" Y="174" Width="98" Height="13" Attributes="3" Property="ALWAYS_ON_TOP" Text="Always On Top" Order="1700"/>
<ROW Dialog_="FolderDlg" Control="Edit_1" Type="Edit" X="360" Y="143" Width="2" Height="9" Attributes="2" Property="INVALID_POD_URL" Text="{260}" Order="1800"/>
<ROW Dialog_="FolderDlg" Control="BringToFrontCheckBox" Type="CheckBox" X="172" Y="199" Width="98" Height="13" Attributes="3" Property="BRING_TO_FRONT" Text="Bring To Front" Order="1900"/>
<ROW Dialog_="InstallTypeDlg" Control="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" Attributes="1048576" Text="[DialogBitmap]" Order="100" MsiKey="InstallTypeDlg#BannerBitmap"/>
<ROW Dialog_="InstallTypeDlg" Control="Bitmap_background" Type="Bitmap" X="0" Y="0" Width="370" Height="234" Attributes="1" Text="[DialogBitmap]" Order="200"/>
<ROW Dialog_="InstallTypeDlg" Control="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Attributes="3" Text="[ButtonText_Next]" Order="300" TextLocId="-" MsiKey="InstallTypeDlg#Next" Options="1"/>
@ -462,6 +465,8 @@
<ROW Dialog_="VerifyDlg" Control="Text_7" Type="Text" X="25" Y="164" Width="76" Height="13" Attributes="65539" Property="TEXT_3_PROP_1_1" Text="Minimize on Close : " Order="1600"/>
<ROW Dialog_="VerifyDlg" Control="Text_8" Type="Text" X="110" Y="164" Width="145" Height="10" Attributes="65539" Property="MINIMIZE_ON_CLOSE_LABEL" Text="[MINIMIZE_ON_CLOSE_LABEL]" Order="1700"/>
<ROW Dialog_="VerifyDlg" Control="Text_9" Type="Text" X="25" Y="67" Width="321" Height="25" Attributes="65539" Property="TEXT_9_PROP" Text="You seem to have entered an invalid pod url. Please go back to the previous screen and rectify it." Order="1800"/>
<ROW Dialog_="VerifyDlg" Control="Text_10" Type="Text" X="25" Y="188" Width="76" Height="13" Attributes="65539" Property="TEXT_3_PROP_1_1_1" Text="Bring to front : " Order="1900"/>
<ROW Dialog_="VerifyDlg" Control="Text_11" Type="Text" X="110" Y="188" Width="145" Height="10" Attributes="65539" Property="BRING_TO_FRONT_LABEL" Text="[BRING_TO_FRONT_LABEL]" Order="2000"/>
<ROW Dialog_="VerifyReadyDlg" Control="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" Attributes="1048577" Text="[BannerBitmap]" Order="300" MsiKey="VerifyReadyDlg#BannerBitmap"/>
<ROW Dialog_="VerifyReadyDlg" Control="Logo" Type="Text" X="5" Y="228" Width="39" Height="12" Attributes="1" Text="Symphony" Order="500" TextLocId="Control.Text.VerifyReadyDlg#Logo" MsiKey="VerifyReadyDlg#Logo"/>
<ROW Dialog_="VerifyReadyDlg" Control="Text" Type="Text" X="25" Y="70" Width="320" Height="21" Attributes="196611" Text="Click &quot;Install&quot; to begin the installation. If you want to review or change any of your installation settings, click &quot;Back&quot;. Click &quot;Cancel&quot; to exit the wizard." Order="700" TextLocId="Control.Text.VerifyReadyDlg#Text" MsiKey="VerifyReadyDlg#Text"/>
@ -484,6 +489,8 @@
<ROW Dialog_="VerifyDlg" Control_="Text_7" Action="Hide" Condition="INVALID_POD_URL = &quot;invalid&quot;"/>
<ROW Dialog_="VerifyDlg" Control_="Text_8" Action="Hide" Condition="INVALID_POD_URL = &quot;invalid&quot;"/>
<ROW Dialog_="VerifyDlg" Control_="Text_9" Action="Hide" Condition="INVALID_POD_URL = &quot;valid&quot;"/>
<ROW Dialog_="VerifyDlg" Control_="Text_10" Action="Hide" Condition="INVALID_POD_URL = &quot;invalid&quot;"/>
<ROW Dialog_="VerifyDlg" Control_="Text_11" Action="Hide" Condition="INVALID_POD_URL = &quot;invalid&quot;"/>
<ATTRIBUTE name="DeletedRows" value="ExitDialog#ViewReadmeText#Hide#((NOT AI_INSTALL) AND (NOT AI_PATCH)) OR ((CTRLS &lt;&gt; 1) AND (CTRLS &lt;&gt; 3))"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiControlEventComponent">
@ -553,11 +560,11 @@
<ROW Action="AI_TxtUpdaterRollback" Type="11521" Source="TxtUpdater.dll" Target="OnTxtUpdaterRollback" WithoutSeq="true"/>
<ROW Action="KillParagon" Type="1" Source="aicustact.dll" Target="StopProcess" Options="1" AdditionalSeq="AI_DATA_SETTER_2"/>
<ROW Action="KillRenderer" Type="1" Source="aicustact.dll" Target="StopProcess" Options="1" AdditionalSeq="AI_DATA_SETTER"/>
<ROW Action="PodUrlValidation" Type="37" Target="Script Text" TargetUnformatted="// First, check if the protocol is part of the url, if not, prepend it&#13;&#10;var prefix1 = &quot;https://&quot;;&#13;&#10;var prefix2 = &quot;http://&quot;;&#13;&#10;if (Session.Property(&quot;POD_URL&quot;).substr(0, prefix1.length) !== prefix1 &amp;&amp; Session.Property(&quot;POD_URL&quot;).substr(0, prefix2.length) !== prefix2) {&#13;&#10; Session.Property(&quot;POD_URL&quot;) = prefix1 + Session.Property(&quot;POD_URL&quot;);&#13;&#10;}&#13;&#10;&#13;&#10;// Check if the entered pod url is valid&#13;&#10;var podUrlRE = /^(https:\/\/|http:\/\/)(www.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,}(:[0-9]{1,5})?(\/[a-zA-Z0-9-_.+!*&apos;(),;/?:@=&amp;$]*)?$/;&#13;&#10;var podUrlTest = podUrlRE.test(Session.Property(&quot;POD_URL&quot;));&#13;&#10;if (!podUrlTest) {&#13;&#10;&#9;Session.Property(&quot;INVALID_POD_URL&quot;) = &quot;invalid&quot;;&#13;&#10;} else {&#13;&#10;&#9;Session.Property(&quot;INVALID_POD_URL&quot;) = &quot;valid&quot;;&#13;&#10;}&#13;&#10;&#13;&#10;// By default, we set all the values to false and change based on conditions&#13;&#10;Session.Property(&quot;ALWAYS_ON_TOP_LABEL&quot;) = &quot;false&quot;; &#13;&#10;Session.Property(&quot;AUTO_START_LABEL&quot;) = &quot;false&quot;;&#13;&#10;Session.Property(&quot;MINIMIZE_ON_CLOSE_LABEL&quot;) = &quot;false&quot;;&#13;&#10;&#13;&#10;// If always on top is checked in the checkbox, set the label value to true&#13;&#10;if (Session.Property(&quot;ALWAYS_ON_TOP&quot;) &amp;&amp; Session.Property(&quot;ALWAYS_ON_TOP&quot;) === &quot;true&quot;)&#13;&#10;{&#13;&#10; Session.Property(&quot;ALWAYS_ON_TOP_LABEL&quot;) = &quot;true&quot;;&#13;&#10;}&#13;&#10;&#13;&#10;// If launch on startup is checked in the checkbox, set the label value to true&#13;&#10;if (Session.Property(&quot;MINIMIZE_ON_CLOSE&quot;) &amp;&amp; Session.Property(&quot;MINIMIZE_ON_CLOSE&quot;) === &quot;true&quot;)&#13;&#10;{&#13;&#10; Session.Property(&quot;MINIMIZE_ON_CLOSE_LABEL&quot;) = &quot;true&quot;;&#13;&#10;}&#13;&#10;&#13;&#10;// If minimise on close is checked in the checkbox, set the label value to true&#13;&#10;if (Session.Property(&quot;AUTO_START&quot;) &amp;&amp; Session.Property(&quot;AUTO_START&quot;) === &quot;true&quot;)&#13;&#10;{&#13;&#10; Session.Property(&quot;AUTO_START_LABEL&quot;) = &quot;true&quot;;&#13;&#10;}" WithoutSeq="true"/>
<ROW Action="PodUrlValidation" Type="37" Target="Script Text" TargetUnformatted="// First, check if the protocol is part of the url, if not, prepend it&#13;&#10;var prefix1 = &quot;https://&quot;;&#13;&#10;var prefix2 = &quot;http://&quot;;&#13;&#10;if (Session.Property(&quot;POD_URL&quot;).substr(0, prefix1.length) !== prefix1 &amp;&amp; Session.Property(&quot;POD_URL&quot;).substr(0, prefix2.length) !== prefix2) {&#13;&#10; Session.Property(&quot;POD_URL&quot;) = prefix1 + Session.Property(&quot;POD_URL&quot;);&#13;&#10;}&#13;&#10;&#13;&#10;// Check if the entered pod url is valid&#13;&#10;var podUrlRE = /^(https:\/\/|http:\/\/)(www.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,}(:[0-9]{1,5})?(\/[a-zA-Z0-9-_.+!*&apos;(),;/?:@=&amp;$]*)?$/;&#13;&#10;var podUrlTest = podUrlRE.test(Session.Property(&quot;POD_URL&quot;));&#13;&#10;if (!podUrlTest) {&#13;&#10;&#9;Session.Property(&quot;INVALID_POD_URL&quot;) = &quot;invalid&quot;;&#13;&#10;} else {&#13;&#10;&#9;Session.Property(&quot;INVALID_POD_URL&quot;) = &quot;valid&quot;;&#13;&#10;}&#13;&#10;&#13;&#10;// By default, we set all the values to false and change based on conditions&#13;&#10;Session.Property(&quot;ALWAYS_ON_TOP_LABEL&quot;) = &quot;false&quot;; &#13;&#10;Session.Property(&quot;AUTO_START_LABEL&quot;) = &quot;false&quot;;&#13;&#10;Session.Property(&quot;MINIMIZE_ON_CLOSE_LABEL&quot;) = &quot;false&quot;;&#13;&#10;Session.Property(&quot;BRING_TO_FRONT_LABEL&quot;) = &quot;false&quot;;&#13;&#10;&#13;&#10;// If always on top is checked in the checkbox, set the label value to true&#13;&#10;if (Session.Property(&quot;ALWAYS_ON_TOP&quot;) &amp;&amp; Session.Property(&quot;ALWAYS_ON_TOP&quot;) === &quot;true&quot;)&#13;&#10;{&#13;&#10; Session.Property(&quot;ALWAYS_ON_TOP_LABEL&quot;) = &quot;true&quot;;&#13;&#10;}&#13;&#10;&#13;&#10;// If launch on startup is checked in the checkbox, set the label value to true&#13;&#10;if (Session.Property(&quot;MINIMIZE_ON_CLOSE&quot;) &amp;&amp; Session.Property(&quot;MINIMIZE_ON_CLOSE&quot;) === &quot;true&quot;)&#13;&#10;{&#13;&#10; Session.Property(&quot;MINIMIZE_ON_CLOSE_LABEL&quot;) = &quot;true&quot;;&#13;&#10;}&#13;&#10;&#13;&#10;// If minimise on close is checked in the checkbox, set the label value to true&#13;&#10;if (Session.Property(&quot;AUTO_START&quot;) &amp;&amp; Session.Property(&quot;AUTO_START&quot;) === &quot;true&quot;)&#13;&#10;{&#13;&#10; Session.Property(&quot;AUTO_START_LABEL&quot;) = &quot;true&quot;;&#13;&#10;}&#13;&#10;&#13;&#10;// If bring to front is checked in the checkbox, set the label value to true&#13;&#10;if (Session.Property(&quot;BRING_TO_FRONT&quot;) &amp;&amp; Session.Property(&quot;BRING_TO_FRONT&quot;) === &quot;true&quot;)&#13;&#10;{&#13;&#10; Session.Property(&quot;BRING_TO_FRONT_LABEL&quot;) = &quot;true&quot;;&#13;&#10;}" WithoutSeq="true"/>
<ROW Action="SET_APPDIR" Type="307" Source="APPDIR" Target="[ProgramFilesFolder][Manufacturer]\[ProductName]" MultiBuildTarget="DefaultBuild:[AI_UserProgramFiles][Manufacturer]\[ProductName]"/>
<ROW Action="SET_SHORTCUTDIR" Type="307" Source="SHORTCUTDIR" Target="[ProgramMenuFolder][ProductName]"/>
<ROW Action="SET_TARGETDIR_TO_APPDIR" Type="51" Source="TARGETDIR" Target="[APPDIR]"/>
<ROW Action="SetCheckboxValues" Type="37" Target="Script Text" TargetUnformatted="// Pick the values from the selected checkboxes and set it against the session variables&#13;&#10;Session.Property(&quot;AUTO_START&quot;) = (Session.Property(&quot;AUTO_START&quot;) === &quot;true&quot; ? &quot;true&quot; : &quot;false&quot;);&#13;&#10;Session.Property(&quot;MINIMIZE_ON_CLOSE&quot;) = (Session.Property(&quot;MINIMIZE_ON_CLOSE&quot;) === &quot;true&quot; ? &quot;true&quot; : &quot;false&quot;);&#13;&#10;Session.Property(&quot;ALWAYS_ON_TOP&quot;) = (Session.Property(&quot;ALWAYS_ON_TOP&quot;) === &quot;true&quot; ? &quot;true&quot; : &quot;false&quot;);" WithoutSeq="true"/>
<ROW Action="SetCheckboxValues" Type="37" Target="Script Text" TargetUnformatted="// Pick the values from the selected checkboxes and set it against the session variables&#13;&#10;Session.Property(&quot;AUTO_START&quot;) = (Session.Property(&quot;AUTO_START&quot;) === &quot;true&quot; ? &quot;true&quot; : &quot;false&quot;);&#13;&#10;Session.Property(&quot;MINIMIZE_ON_CLOSE&quot;) = (Session.Property(&quot;MINIMIZE_ON_CLOSE&quot;) === &quot;true&quot; ? &quot;true&quot; : &quot;false&quot;);&#13;&#10;Session.Property(&quot;ALWAYS_ON_TOP&quot;) = (Session.Property(&quot;ALWAYS_ON_TOP&quot;) === &quot;true&quot; ? &quot;true&quot; : &quot;false&quot;);&#13;&#10;Session.Property(&quot;BRING_TO_FRONT&quot;) = (Session.Property(&quot;BRING_TO_FRONT&quot;) === &quot;true&quot; ? &quot;true&quot; : &quot;false&quot;);" WithoutSeq="true"/>
<ROW Action="Symphony.exe" Type="1042" Source="Symphony.exe" Target="--install --peruser"/>
<ROW Action="Symphony.exe_All_User" Type="1042" Source="Symphony.exe" Target="--install"/>
<ROW Action="UninstallPreviousVersions" Type="1" Source="aicustact.dll" Target="UninstallPreviousVersions" Options="1"/>
@ -645,6 +652,7 @@
<ROW Name="MinimizeOnClose" TxtUpdateSet="Symphony.config" FindPattern="&quot;minimizeOnClose&quot;\s*:\s*true," ReplacePattern="&quot;minimizeOnClose&quot; : [MINIMIZE_ON_CLOSE]," Options="19" Order="1" FileEncoding="-1"/>
<ROW Name="AlwaysOnTop" TxtUpdateSet="Symphony.config" FindPattern="&quot;alwaysOnTop&quot;\s*:\s*false" ReplacePattern="&quot;alwaysOnTop&quot; : [ALWAYS_ON_TOP]" Options="19" Order="2" FileEncoding="-1"/>
<ROW Name="LaunchOnStartup" TxtUpdateSet="Symphony.config" FindPattern="&quot;launchOnStartup&quot;\s*:\s*true," ReplacePattern="&quot;launchOnStartup&quot; : [AUTO_START]," Options="19" Order="3" FileEncoding="-1"/>
<ROW Name="BringToFront" TxtUpdateSet="Symphony.config" FindPattern="&quot;bringToFront&quot;\s*:\s*false," ReplacePattern="&quot;bringToFront&quot; : [BRING_TO_FRONT]," Options="19" Order="4" FileEncoding="-1"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.TxtUpdateSetComponent">
<ROW Key="Symphony.config" Component="am.pak" FileName="Symphony.config" Directory="config_Dir" Options="17"/>

View File

@ -12,6 +12,7 @@ const aboutApp = require('../aboutApp');
let minimizeOnClose = false;
let launchOnStartup = false;
let isAlwaysOnTop = false;
let bringToFront = false;
let symphonyAutoLauncher;
@ -254,6 +255,17 @@ function getTemplate(app) {
}
});
// Window menu -> bringToFront
template[index].submenu.push({
label: 'Bring to Front',
type: 'checkbox',
checked: bringToFront,
click: function(item) {
bringToFront = item.checked;
updateConfigField('bringToFront', bringToFront);
}
});
if (!isMac) {
template[index].submenu.push({
label: 'Quit Symphony',
@ -284,7 +296,7 @@ function setCheckboxValues() {
/**
* Method that reads multiple config fields
*/
getMultipleConfigField(['minimizeOnClose', 'launchOnStartup', 'alwaysOnTop', 'notificationSettings'])
getMultipleConfigField(['minimizeOnClose', 'launchOnStartup', 'alwaysOnTop', 'notificationSettings', 'bringToFront'])
.then(function (configData) {
for (let key in configData) {
if (configData.hasOwnProperty(key)) { // eslint-disable-line no-prototype-builtins
@ -302,6 +314,9 @@ function setCheckboxValues() {
case 'notificationSettings':
eventEmitter.emit('notificationSettings', configData[key]);
break;
case 'bringToFront':
bringToFront = configData[key];
break;
default:
break;
}

28
js/notify/bringToFront.js Normal file
View File

@ -0,0 +1,28 @@
'use strict';
const windowMgr = require('../windowMgr.js');
const { getConfigField } = require('../config.js');
const log = require('../log.js');
const logLevels = require('../enums/logLevels.js');
/**
* Method that checks if user has enabled the bring to front feature
* if so then activates the main window
*/
function bringToFront() {
getConfigField('bringToFront')
.then((bool) => {
if (bool) {
windowMgr.activate('main');
}
})
.catch((error) => {
log.send(logLevels.ERROR, 'Could not read bringToFront field from config error= ' + error);
});
}
module.exports = {
bringToFront: bringToFront
};

View File

@ -294,6 +294,10 @@ function setupConfig() {
function notify(notification) {
// Is it an object and only one argument?
if (arguments.length === 1 && typeof notification === 'object') {
if (typeof notification.onBringToFrontFunc === 'function') {
notification.onBringToFrontFunc({id: notification.id });
}
let notf = Object.assign({}, notification);
// Use object instead of supplied parameters
notf.id = latestID;

View File

@ -2,6 +2,7 @@
const EventEmitter = require('events');
const { notify } = require('./electron-notify.js');
const { bringToFront } = require('./bringToFront.js');
const log = require('../log.js');
const logLevels = require('../enums/logLevels.js');
/**
@ -45,7 +46,8 @@ class Notify {
onShowFunc: onShow.bind(this),
onClickFunc: onClick.bind(this),
onCloseFunc: onClose.bind(this),
onErrorFunc: onError.bind(this)
onErrorFunc: onError.bind(this),
onBringToFrontFunc: onBringToFront.bind(this)
});
log.send(logLevels.INFO, 'created notification, id=' + this._id + ', text=' + options.body);
@ -109,6 +111,15 @@ class Notify {
this.destroy();
}
}
/**
* activates/focuses the main window
*/
function onBringToFront(arg) {
if (arg.id === this._id) {
bringToFront();
}
}
}
/**

View File

@ -589,6 +589,7 @@ function activate(windowName) {
if (window && !window.isDestroyed() && window.winName === windowName) {
if (window.isMinimized()) {
window.restore();
window.focus();
} else {
window.show();
}

View File

@ -12,7 +12,7 @@
"demo-mac": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file://$(pwd)/demo/index.html",
"search-win": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file:///demo/search.html",
"search-mac": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file://$(pwd)/demo/search.html",
"unpacked-mac": "npm run prebuild && npm run test && build --mac --dir",
"unpacked-mac": "npm run prebuild && build --mac --dir",
"packed-mac": "npm run unpacked-mac && packagesbuild -v installer/mac/symphony-mac-packager.pkgproj",
"unpacked-win": "npm run prebuild && npm run test && build --win --x64 --dir",
"unpacked-win-x86": "npm run prebuild && npm run test && build --win --ia32 --dir",