electron-141: added logic in the mac installer to prepend protocol for a url in case of absence of one

This commit is contained in:
Vishwas Shashidhar 2017-10-25 15:08:19 +05:30
parent a85d15e21d
commit 4beefbaed6
5 changed files with 40 additions and 75 deletions

52
.gitignore vendored
View File

@ -27,56 +27,4 @@ installer/mac/SymphonySettingsPlugin/SymphonySettingsPlugin.xcodeproj/xcuserdata
installer/mac/SymphonySettingsPlugin/SymphonySettingsPlugin.xcodeproj/project.xcworkspace/xcuserdata
installer/win/Symphony-x64-cache
installer/win/Symphony-x64-SetupFiles
# Dot Net and Visual Studio
*.suo
*.user
*.userosscache
*.sln.docstates
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
.vs/
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*.VisualState.xml
TestResult.xml
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
package-lock.json

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>17A365</string>
<string>17A405</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
@ -27,7 +27,7 @@
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>9A235</string>
<string>9A1004</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
@ -35,9 +35,9 @@
<key>DTSDKName</key>
<string>macosx10.13</string>
<key>DTXcode</key>
<string>0900</string>
<string>0901</string>
<key>DTXcodeBuild</key>
<string>9A235</string>
<string>9A1004</string>
<key>InstallerSectionTitle</key>
<string>Pod Settings</string>
<key>NSHumanReadableCopyright</key>

View File

@ -15,33 +15,38 @@
}
- (void)willEnterPane:(InstallerSectionDirection)dir {
// By default, set the value of the error message textbox to an empty string
[_podUrlAlertTextBox setTitleWithMnemonic:@""];
}
- (BOOL)shouldExitPane:(InstallerSectionDirection)dir {
NSString *regex = @"^((?:http:\/\/)|(?:https:\/\/))(www.)?((?:[a-zA-Z0-9]+\.[a-z]{3})|(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?::\d+)?))([\/a-zA-Z0-9\.]*)$";
NSString *podUrl = [_podUrlTextBox stringValue];
NSPredicate *podUrlTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
// Check if the url contains a protocol, if not, prepend https to it
NSString *prefix = @"https://";
if (![podUrl hasPrefix:prefix]) {
podUrl = [prefix stringByAppendingString:podUrl];
[_podUrlTextBox setStringValue:podUrl];
}
// Now, validate the url against a url regex
NSString *regex = @"^((?:http:\/\/)|(?:https:\/\/))(www.)?((?:[a-zA-Z0-9]+\.[a-z]{3})|(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?::\d+)?))([\/a-zA-Z0-9\.]*)$";
NSPredicate *podUrlTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
if ([podUrlTest evaluateWithObject:podUrl]) {
return YES;
}
// In case of an invalid url, display the message under the pod url text box
// and don't go to the next screen, hence return NO
[_podUrlAlertTextBox setTitleWithMnemonic:@"Please enter a valid Pod url."];
return NO;
}
- (void)willExitPane:(InstallerSectionDirection)dir {
NSString *podUrl = [_podUrlTextBox stringValue];
// If the pod url is empty, by default, set it to https://corporate.symphony.com
if ([podUrl length] == 0) {
podUrl = @"https://corporate.symphony.com";
}
NSString *podUrl = [_podUrlTextBox stringValue];
// By default, set autoLaunchOnStart to true
NSString *autoLaunchOnStart = @"true";

View File

@ -432,6 +432,12 @@
</dict>
<key>PAYLOAD_TYPE</key>
<integer>0</integer>
<key>SHOW_INVISIBLE</key>
<false/>
<key>SPLIT_FORKS</key>
<true/>
<key>TREAT_MISSING_FILES_AS_WARNING</key>
<false/>
<key>VERSION</key>
<integer>4</integer>
</dict>
@ -453,15 +459,27 @@
<integer>1</integer>
<key>CONCLUSION_ACTION</key>
<integer>0</integer>
<key>FOLLOW_SYMBOLIC_LINKS</key>
<false/>
<key>IDENTIFIER</key>
<string>com.symphony.symphony-desktop</string>
<key>LOCATION</key>
<integer>0</integer>
<key>NAME</key>
<string>Symphony</string>
<key>OVERWRITE_PERMISSIONS</key>
<false/>
<key>PAYLOAD_SIZE</key>
<integer>-1</integer>
<key>RELOCATABLE</key>
<false/>
<key>USE_HFS+_COMPRESSION</key>
<false/>
<key>VERSION</key>
<string>1.0.1</string>
</dict>
<key>TYPE</key>
<integer>0</integer>
<key>UUID</key>
<string>91776F5A-09FA-4631-A17C-BE8B5C83AF81</string>
</dict>
@ -499,7 +517,7 @@
<integer>3</integer>
</dict>
<key>CUSTOM</key>
<integer>1</integer>
<true/>
<key>SCALING</key>
<integer>1</integer>
</dict>
@ -537,8 +555,6 @@
<dict/>
</dict>
</dict>
<key>INSTALLATION TYPE</key>
<integer>0</integer>
<key>MODE</key>
<integer>1</integer>
</dict>
@ -631,8 +647,6 @@
</dict>
<key>LICENSE</key>
<dict>
<key>KEYWORDS</key>
<dict/>
<key>LOCALIZATIONS</key>
<array/>
<key>MODE</key>
@ -665,10 +679,6 @@
<dict>
<key>LIST</key>
<array/>
<key>POSTINSTALL_PATH</key>
<dict/>
<key>PREINSTALL_PATH</key>
<dict/>
<key>RESOURCES</key>
<array/>
<key>ROOT_VOLUME_ONLY</key>
@ -676,8 +686,6 @@
</dict>
<key>PROJECT_SETTINGS</key>
<dict>
<key>ADVANCED_OPTIONS</key>
<dict/>
<key>BUILD_FORMAT</key>
<integer>0</integer>
<key>BUILD_PATH</key>
@ -857,6 +865,10 @@
</array>
<key>NAME</key>
<string>Symphony</string>
<key>PAYLOAD_ONLY</key>
<false/>
<key>TREAT_MISSING_PRESENTATION_DOCUMENTS_AS_WARNING</key>
<false/>
</dict>
</dict>
<key>SHARED_GLOBAL_DATA</key>