Skip to content

Commit

Permalink
fix: rename param
Browse files Browse the repository at this point in the history
  • Loading branch information
maliroteh-sf committed May 22, 2024
1 parent 18846e6 commit f423bf0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/common/PreviewUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class PreviewUtils {
* @param port the port number that the local dev server is configured to use.
* @returns A string representing a web socket url to be used by the local dev server.
*/
public static generateWebSocketUrlForLocalDevServer(platform: string, portNumber: string): string {
public static generateWebSocketUrlForLocalDevServer(platform: string, port: string): string {
/*
- For desktop browsers other than Safari, local development use cases will target ws://localhost:<port> connections to the local dev server
- For the Safari desktop browser, target wss://localhost:<port>
Expand All @@ -151,15 +151,15 @@ export class PreviewUtils {
*/

if (CommandLineUtils.platformFlagIsIOS(platform)) {
return `wss://${os.hostname()}:${portNumber}`;
return `wss://${os.hostname()}:${port}`;
}

if (CommandLineUtils.platformFlagIsAndroid(platform)) {
return `wss://10.0.2.2:${portNumber}`;
return `wss://10.0.2.2:${port}`;
}

if (process.platform !== 'darwin') {
return `ws://localhost:${portNumber}`; // cannot be Safari since it is only available on Mac
return `ws://localhost:${port}`; // cannot be Safari since it is only available on Mac
}

// Check to see if the default browser is Safari
Expand All @@ -168,6 +168,6 @@ export class PreviewUtils {
"defaults read ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure | awk -F'\"' '/http;/{print window[(NR)-1]}{window[NR]=$2}'";
const result = CommonUtils.executeCommandSync(cmd).trim().toLowerCase();
const isSafari = result.includes('safari') || result === '';
return isSafari ? `wss://localhost:${portNumber}` : `ws://localhost:${portNumber}`;
return isSafari ? `wss://localhost:${port}` : `ws://localhost:${port}`;
}
}

0 comments on commit f423bf0

Please sign in to comment.