@@ -433,43 +433,42 @@ - (void)setDefaultJSBundle
433433 [alert addButtonWithTitle: @" Cancel" ];
434434 [alert setAlertStyle: NSAlertStyleWarning];
435435
436- [alert beginSheetModalForWindow: [NSApp keyWindow ]
437- completionHandler: ^(NSModalResponse response) {
438- if (response == NSAlertFirstButtonReturn ) {
439- // Apply Changes
440- NSString *ipAddress = ipTextField.stringValue ;
441- NSString *port = portTextField.stringValue ;
442- NSString *bundleRoot = entrypointTextField.stringValue ;
443-
444- if (ipAddress.length == 0 && port.length == 0 ) {
445- [weakSelf setDefaultJSBundle ];
446- return ;
447- }
448-
449- NSNumberFormatter *formatter = [NSNumberFormatter new ];
450- formatter.numberStyle = NSNumberFormatterDecimalStyle;
451- NSNumber *portNumber = [formatter numberFromString: port];
452- if (portNumber == nil ) {
453- portNumber = [NSNumber numberWithInt: RCT_METRO_PORT];
454- }
455-
456- [RCTBundleURLProvider sharedSettings ].jsLocation =
457- [NSString stringWithFormat: @" %@ :%d " , ipAddress, portNumber.intValue];
458-
459- if (bundleRoot.length == 0 ) {
460- [bundleManager resetBundleURL ];
461- } else {
462- bundleManager.bundleURL = [[RCTBundleURLProvider sharedSettings ]
463- jsBundleURLForBundleRoot: bundleRoot];
464- }
465-
466- RCTTriggerReloadCommandListeners (@" Dev menu - apply changes" );
467- } else if (response == NSAlertSecondButtonReturn ) {
468- // Reset to Default
469- [weakSelf setDefaultJSBundle ];
470- }
471- // Cancel - do nothing
472- }];
436+ NSModalResponse response = [alert runModal ];
437+
438+ if (response == NSAlertFirstButtonReturn ) {
439+ // Apply Changes
440+ NSString *ipAddress = ipTextField.stringValue ;
441+ NSString *port = portTextField.stringValue ;
442+ NSString *bundleRoot = entrypointTextField.stringValue ;
443+
444+ if (ipAddress.length == 0 && port.length == 0 ) {
445+ [weakSelf setDefaultJSBundle ];
446+ return ;
447+ }
448+
449+ NSNumberFormatter *formatter = [NSNumberFormatter new ];
450+ formatter.numberStyle = NSNumberFormatterDecimalStyle;
451+ NSNumber *portNumber = [formatter numberFromString: port];
452+ if (portNumber == nil ) {
453+ portNumber = [NSNumber numberWithInt: RCT_METRO_PORT];
454+ }
455+
456+ [RCTBundleURLProvider sharedSettings ].jsLocation =
457+ [NSString stringWithFormat: @" %@ :%d " , ipAddress, portNumber.intValue];
458+
459+ if (bundleRoot.length == 0 ) {
460+ [bundleManager resetBundleURL ];
461+ } else {
462+ bundleManager.bundleURL = [[RCTBundleURLProvider sharedSettings ]
463+ jsBundleURLForBundleRoot: bundleRoot];
464+ }
465+
466+ RCTTriggerReloadCommandListeners (@" Dev menu - apply changes" );
467+ } else if (response == NSAlertSecondButtonReturn ) {
468+ // Reset to Default
469+ [weakSelf setDefaultJSBundle ];
470+ }
471+ // Cancel - do nothing
473472#endif // macOS]
474473 }]];
475474
@@ -572,7 +571,7 @@ - (RCTDevMenuAlertActionHandler)alertActionHandlerForDevItem:(RCTDevMenuItem *__
572571#else // [macOS
573572- (NSMenu *)menu
574573{
575- if ([_bridge.devSettings isSecondaryClickToShowDevMenuEnabled ]) {
574+ if ([((RCTDevSettings *)[_moduleRegistry moduleForName: " DevSettings " ]) isSecondaryClickToShowDevMenuEnabled ]) {
576575 NSMenu *menu = nil ;
577576 if (_bridge) {
578577 NSString *desc = _bridge.bridgeDescription ;
0 commit comments