-
Notifications
You must be signed in to change notification settings - Fork 4k
[NoQA] [Post RN 0.77] Migrate AppDelegate to swift
#59898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mountiny
merged 8 commits into
Expensify:main
from
software-mansion-labs:war-in/migrate-app-delegate-to-swift
Apr 14, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
72d033f
migrate AppDelegate to swift
war-in 392a533
migrate AppDelegate to swift
war-in 6f2723a
Merge branch 'main' into war-in/migrate-app-delegate-to-swift
war-in d9103fe
set DEBUG for DebugDevelopment flavour
war-in 5e2712c
fix surface issue: https://github.com/facebook/react-native/pull/48213
war-in e652d43
Merge branch 'main' into war-in/migrate-app-delegate-to-swift
war-in a088f35
remove unnecessary defines module changes
war-in 0b98e25
add return statement
war-in File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| // | ||
| // AppDelegate.swift | ||
| // NewExpensify | ||
| // | ||
| // Created by Marcin Warchoł on 08/04/2025. | ||
| // | ||
|
|
||
| import UIKit | ||
| import React | ||
| import React_RCTAppDelegate | ||
| import ReactAppDependencyProvider | ||
| import ExpoModulesCore | ||
| import Firebase | ||
|
|
||
|
|
||
| @main | ||
| class AppDelegate: ExpoAppDelegate, UNUserNotificationCenterDelegate { | ||
| override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { | ||
| self.moduleName = "NewExpensify" | ||
| self.dependencyProvider = RCTAppDependencyProvider() | ||
| self.initialProps = [:] | ||
|
|
||
| // Configure firebase | ||
| FirebaseApp.configure() | ||
|
|
||
| // Force the app to LTR mode. | ||
| RCTI18nUtil.sharedInstance().allowRTL(false) | ||
| RCTI18nUtil.sharedInstance().forceRTL(false) | ||
|
|
||
| _ = super.application(application, didFinishLaunchingWithOptions: launchOptions) | ||
|
|
||
| if let rootView = self.window.rootViewController?.view as? RCTRootView { | ||
| RCTBootSplash.initWithStoryboard("BootSplash", rootView: rootView) // <- initialization using the storyboard file name | ||
| } | ||
|
|
||
| // Define UNUserNotificationCenter | ||
| let center = UNUserNotificationCenter.current() | ||
| center.delegate = self | ||
|
|
||
| // Start the "js_load" custom performance tracing metric. This timer is | ||
| // stopped by a native module in the JS so we can measure total time starting | ||
| // in the native layer and ending in the JS layer. | ||
| RCTStartupTimer.start() | ||
|
|
||
| if !UserDefaults.standard.bool(forKey: "isFirstRunComplete") { | ||
| UIApplication.shared.applicationIconBadgeNumber = 0 | ||
| UserDefaults.standard.set(true, forKey: "isFirstRunComplete") | ||
| } | ||
|
|
||
| RNBackgroundTaskManager.setup() | ||
|
|
||
| return true | ||
| } | ||
|
|
||
|
|
||
| override func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { | ||
| return RCTLinkingManager.application(application, open: url, options: options) | ||
| } | ||
|
|
||
| override func application(_ application: UIApplication, | ||
| continue userActivity: NSUserActivity, | ||
| restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { | ||
| return RCTLinkingManager.application(application, | ||
| continue: userActivity, | ||
| restorationHandler: restorationHandler) | ||
| } | ||
|
|
||
| override func sourceURL(for bridge: RCTBridge) -> URL? { | ||
| return self.bundleURL() | ||
| } | ||
|
|
||
| override func bundleURL() -> URL? { | ||
| #if DEBUG | ||
| return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index") | ||
| #else | ||
| return Bundle.main.url(forResource: "main", withExtension: "jsbundle") | ||
| #endif | ||
| } | ||
|
|
||
| // This methods is needed to support the hardware keyboard shortcuts | ||
| func keyCommands() -> [Any]? { | ||
| return HardwareShortcuts.sharedInstance().keyCommands() | ||
| } | ||
|
|
||
| func handleKeyCommand(_ keyCommand: UIKeyCommand) { | ||
| HardwareShortcuts.sharedInstance().handleKeyCommand(keyCommand) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // | ||
| // NewExpensify-Bridging-Header.h | ||
| // NewExpensify | ||
| // | ||
| // Created by Marcin Warchoł on 08/04/2025. | ||
| // | ||
|
|
||
| #import "RCTBootSplash.h" | ||
| #import "RCTStartupTimer.h" | ||
| #import <HardwareShortcuts.h> | ||
| #import <BackgroundTasks/BackgroundTasks.h> | ||
| #import <expensify-react-native-background-task/RNBackgroundTaskManager.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.