electron-77: added support for alwaysOnTop in mac installer (#143)

This commit is contained in:
Vishwas Shashidhar 2017-06-16 21:53:35 +05:30 committed by Lynn
parent 0bb95f9509
commit d5f04ce152
8 changed files with 46 additions and 15 deletions

View File

@ -6,7 +6,7 @@
<dict>
<key>Resources/Base.lproj/MyInstallerPane.nib</key>
<data>
93+nbidqdulTAjRXAuOuZM0pFvA=
5MlJroM8UDQ/u/OkMCiK9J3aK/o=
</data>
<key>Resources/InstallerSections.plist</key>
<data>
@ -37,11 +37,11 @@
<dict>
<key>hash</key>
<data>
93+nbidqdulTAjRXAuOuZM0pFvA=
5MlJroM8UDQ/u/OkMCiK9J3aK/o=
</data>
<key>hash2</key>
<data>
2+SBG0Tj8EhV1JzFngJKFZv94RhkPBt7gIhs7h9vWgo=
KL0ObYrvW43xgEFaDXdRTINfN6qOdiK1EqrvpTusCao=
</data>
</dict>
<key>Resources/InstallerSections.plist</key>

View File

@ -15,6 +15,7 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="Qsn-FY-4qK" customClass="MyInstallerPane">
<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="contentView" destination="TUK-W2-vig" id="gTd-A7-dof"/>
<outlet property="minimizeOnCloseCheckBox" destination="XPe-yO-v9Y" id="ewr-3C-eNJ"/>
@ -36,7 +37,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iAw-NP-Tbm">
<rect key="frame" x="8" y="140" width="188" height="28"/>
<rect key="frame" x="8" y="95" 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"/>
@ -45,7 +46,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KOx-3P-dPz">
<rect key="frame" x="8" y="94" width="146" height="28"/>
<rect key="frame" x="8" y="139" 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"/>
@ -54,7 +55,7 @@
</textFieldCell>
</textField>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XPe-yO-v9Y">
<rect key="frame" x="209" y="150" width="22" height="18"/>
<rect key="frame" x="209" y="105" width="22" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" inset="2" id="uvu-EE-3sp">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@ -62,7 +63,7 @@
</buttonCell>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zJM-2d-YYz">
<rect key="frame" x="209" y="104" width="22" height="18"/>
<rect key="frame" x="209" y="149" 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"/>
@ -78,6 +79,23 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UYr-oC-RgI">
<rect key="frame" x="8" y="51" 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"/>
<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="8EB-K5-hjN">
<rect key="frame" x="209" y="61" 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"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews>
</customView>
</objects>

View File

@ -12,5 +12,6 @@
@property (weak) IBOutlet NSButton *minimizeOnCloseCheckBox;
@property (weak) IBOutlet NSButton *autoLaunchCheckBox;
@property (weak) IBOutlet NSTextField *podUrlTextBox;
@property (weak) IBOutlet NSButton *alwaysOnTopCheckBox;
@end

View File

@ -29,21 +29,32 @@
// Create the final url
NSString *finalUrl = [protocol stringByAppendingString: podUrl];
// By default, set minimizeOnClose and autoLaunchOnStart to true
// By default, set autoLaunchOnStart to true
NSString *autoLaunchOnStart = @"true";
// If the checkbox is changed, set the auto launch value accordingly
if ([_autoLaunchCheckBox state] == 0) {
autoLaunchOnStart = @"false";
}
// By default, set minimizeOnClose and alwaysOnTop to false
NSString *minimizeOnClose = @"false";
NSString *autoLaunchOnStart = @"true\n";
NSString *alwaysOnTop = @"false\n";
// If the checkbox is changed, set the minimize on close value accordingly
if ([_minimizeOnCloseCheckBox state] == 1) {
minimizeOnClose = @"true";
}
// If the checkbox is changed, set the auto launch value accordingly
if ([_autoLaunchCheckBox state] == 0) {
autoLaunchOnStart = @"false\n";
// If the checkbox is changed, set the always on top value accordingly
if ([_alwaysOnTopCheckBox state] == 1) {
alwaysOnTop = @"true\n";
}
NSArray *symSettings = [[NSArray alloc] initWithObjects:finalUrl, minimizeOnClose, autoLaunchOnStart, nil];
// Create an array with the selected options
NSArray *symSettings = [[NSArray alloc] initWithObjects:finalUrl, minimizeOnClose, autoLaunchOnStart, alwaysOnTop, nil];
// Create a string from the array with new-line as the separator
NSString *symSettingsString = [symSettings componentsJoinedByString:@"\n"];
// Write all the above settings to file
@ -51,5 +62,4 @@
}
@end

View File

@ -10,10 +10,12 @@ newPath=$installPath$configPath
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');
## 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
## Add app to login items

View File

@ -672,7 +672,7 @@
<key>RESOURCES</key>
<array/>
<key>ROOT_VOLUME_ONLY</key>
<false/>
<true/>
</dict>
<key>PROJECT_SETTINGS</key>
<dict>