Do not send 'hot' parameter when requesting a bundle from iOS

Reviewed By: fromcelticpark

Differential Revision: D5631050

fbshipit-source-id: 1f587f3af68da4d94b5d24afabf7659abb697747
This commit is contained in:
Rafael Oleza 2017-08-16 11:04:17 -07:00 committed by Facebook Github Bot
parent aaae99e7cd
commit 6ad7e8281b
3 changed files with 7 additions and 15 deletions

View File

@ -23,6 +23,7 @@
#import "RCTPerformanceLogger.h"
#import "RCTUtils.h"
#import <React/RCTDevSettings.h>
#import <React/RCTProfile.h>
#import <React/RCTRedBox.h>
@ -549,7 +550,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
}];
#if RCT_DEV
if ([RCTGetURLQueryParam(self.bundleURL, @"hot") boolValue]) {
if (_parentBridge.devSettings.isHotLoadingEnabled) {
NSString *path = [self.bundleURL.path substringFromIndex:1]; // strip initial slash
NSString *host = self.bundleURL.host;
NSNumber *port = self.bundleURL.port;

View File

@ -775,7 +775,7 @@ struct RCTInstanceCallback : public InstanceCallback {
}
#if RCT_DEV
if ([RCTGetURLQueryParam(self.bundleURL, @"hot") boolValue]) {
if (self.devSettings.isHotLoadingEnabled) {
NSString *path = [self.bundleURL.path substringFromIndex:1]; // strip initial slash
NSString *host = self.bundleURL.host;
NSNumber *port = self.bundleURL.port;

View File

@ -316,8 +316,10 @@ RCT_EXPORT_METHOD(setLiveReloadEnabled:(BOOL)enabled)
RCT_EXPORT_METHOD(setHotLoadingEnabled:(BOOL)enabled)
{
[self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingHotLoadingEnabled];
[self _hotLoadingSettingDidChange];
if (self.isHotLoadingEnabled != enabled) {
[self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingHotLoadingEnabled];
[_bridge reload];
}
}
- (BOOL)isHotLoadingEnabled
@ -325,16 +327,6 @@ RCT_EXPORT_METHOD(setHotLoadingEnabled:(BOOL)enabled)
return [[self settingForKey:kRCTDevSettingHotLoadingEnabled] boolValue];
}
- (void)_hotLoadingSettingDidChange
{
BOOL hotLoadingEnabled = self.isHotLoadingAvailable && self.isHotLoadingEnabled;
if (RCTGetURLQueryParam(_bridge.bundleURL, @"hot").boolValue != hotLoadingEnabled) {
_bridge.bundleURL = RCTURLByReplacingQueryParam(_bridge.bundleURL, @"hot",
hotLoadingEnabled ? @"true" : nil);
[_bridge reload];
}
}
RCT_EXPORT_METHOD(toggleElementInspector)
{
BOOL value = [[self settingForKey:kRCTDevSettingIsInspectorShown] boolValue];
@ -439,7 +431,6 @@ RCT_EXPORT_METHOD(toggleElementInspector)
*/
- (void)_synchronizeAllSettings
{
[self _hotLoadingSettingDidChange];
[self _liveReloadSettingDidChange];
[self _remoteDebugSettingDidChange];
[self _profilingSettingDidChange];