Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 10 additions & 34 deletions ios/NewExpensify/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ - (BOOL)application:(UIApplication *)application
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};
self.dependencyProvider = [RCTAppDependencyProvider new];

// Configure firebase
[FIRApp configure];

Expand All @@ -38,7 +38,7 @@ - (BOOL)application:(UIApplication *)application

[RCTBootSplash initWithStoryboard:@"BootSplash"
rootView:(RCTRootView *)self.window.rootViewController.view]; // <- initialization using the storyboard file name

// Define UNUserNotificationCenter
UNUserNotificationCenter *center =
[UNUserNotificationCenter currentNotificationCenter];
Expand All @@ -53,7 +53,7 @@ - (BOOL)application:(UIApplication *)application
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"isFirstRunComplete"];
}

[RNBackgroundTaskManager setup];

return YES;
Expand Down Expand Up @@ -85,37 +85,13 @@ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge

- (NSURL *)bundleURL
{
return [self getBundleURL];
}

- (NSURL *)getBundleURL
{
NSURL *jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#if DEBUG && !TARGET_OS_SIMULATOR
NSString *ipPath = [[NSBundle mainBundle] pathForResource:@"ip" ofType:@"txt"];

if (ipPath) {
NSError *error;
NSString *ip = [[NSString stringWithContentsOfFile:ipPath encoding:NSUTF8StringEncoding error:&error]
stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];

if (ip && !error) {
NSString *metroAddress = [NSString stringWithFormat:@"http://%@:8081/index.bundle?platform=ios", ip];
jsCodeLocation = [NSURL URLWithString:metroAddress];
NSLog(@"Using %@ as metro server address", metroAddress);
} else {
NSLog(@"Failed to get metro server ip from %@, error: %@", ipPath, error.localizedDescription);
}
} else {
NSLog(@"Could not locate ip.txt");
}
#endif

#if DEBUG && TARGET_OS_SIMULATOR
jsCodeLocation = [[NSURL alloc] initWithString:@"http://localhost:8081/index.bundle?platform=ios"];
#endif

return jsCodeLocation;
#if DEBUG
return
[[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main"
withExtension:@"jsbundle"];
#endif
}

// This methods is needed to support the hardware keyboard shortcuts
Expand Down
13 changes: 13 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ def __apply_Xcode_14_3_RC_post_install_workaround(installer)
end
end

def __modify_react_native_settings_for_debug_build(installer)
installer.pods_project.targets.each do |target|
if target.name.include?('React')
target.build_configurations.each do |config|
if config.name.downcase.include?("debug")
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= '$(inherited) DEBUG=1'
end
end
end
end
end

# Configure Mapbox before installing dependencies
pre_install do |installer|
$RNMapboxMaps.pre_install(installer)
Expand Down Expand Up @@ -101,6 +113,7 @@ target 'NewExpensify' do
# :ccache_enabled => true
)
__apply_Xcode_14_3_RC_post_install_workaround(installer)
__modify_react_native_settings_for_debug_build(installer)

installer.pods_project.targets.each do |target|
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3478,6 +3478,6 @@ SPEC CHECKSUMS:
VisionCamera: c95a8ad535f527562be1fb05fb2fd324578e769c
Yoga: 1fd059161b449018342943b095a6d4e69bcaa719

PODFILE CHECKSUM: e185ffe0937c6bc63c014c3164f1756b549b7af6
PODFILE CHECKSUM: 5b2f0a75a0848d964701b52fb6ab7e9602040f3e

COCOAPODS: 1.15.2