mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 11:34:23 +00:00
Replaced CTLSettings with RCTBundleURLProvider internally
Reviewed By: javache Differential Revision: D3398803 fbshipit-source-id: 1c5610a1e59f3fad4c57b0b280559f2ff2acf05a
This commit is contained in:
parent
be09cccb1f
commit
5ef3b47ede
@ -18,6 +18,11 @@ extern NSString *const RCTBundleURLProviderUpdatedNotification;
|
||||
*/
|
||||
- (void)setDefaults;
|
||||
|
||||
/**
|
||||
* Reset every settings to default.
|
||||
*/
|
||||
- (void)resetToDefaults;
|
||||
|
||||
/**
|
||||
* Returns the jsBundleURL for a given bundle entrypoint and
|
||||
* the fallback offline JS bundle if the packager is not running.
|
||||
@ -25,6 +30,11 @@ extern NSString *const RCTBundleURLProviderUpdatedNotification;
|
||||
- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
|
||||
fallbackResource:(NSString *)resourceName;
|
||||
|
||||
/**
|
||||
* Returns the URL of the packager server.
|
||||
*/
|
||||
- (NSURL *)packagerServerURL;
|
||||
|
||||
/**
|
||||
* The IP address or hostname of the packager.
|
||||
*/
|
||||
|
@ -47,6 +47,14 @@ static NSString *const kDefaultPort = @"8081";
|
||||
[self settingsUpdated];
|
||||
}
|
||||
|
||||
- (void)resetToDefaults
|
||||
{
|
||||
for (NSString *key in [[self defaults] allKeys]) {
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
|
||||
}
|
||||
[self setDefaults];
|
||||
}
|
||||
|
||||
- (BOOL)isPackagerRunning:(NSString *)host
|
||||
{
|
||||
if (RCT_DEV) {
|
||||
@ -75,7 +83,6 @@ static NSString *serverRootWithHost(NSString *host)
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)packagerServerRoot
|
||||
{
|
||||
NSString *location = [self jsLocation];
|
||||
@ -91,6 +98,12 @@ static NSString *serverRootWithHost(NSString *host)
|
||||
}
|
||||
}
|
||||
|
||||
- (NSURL *)packagerServerURL
|
||||
{
|
||||
NSString *root = [self packagerServerRoot];
|
||||
return root ? [NSURL URLWithString:root] : nil;
|
||||
}
|
||||
|
||||
- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot fallbackResource:(NSString *)resourceName
|
||||
{
|
||||
resourceName = resourceName ?: @"main";
|
||||
|
Loading…
x
Reference in New Issue
Block a user