Skip to content

Commit d4cab37

Browse files
committed
chore: drop AppDelegate support in RNTester
1 parent 6fa4f4b commit d4cab37

5 files changed

Lines changed: 1 addition & 518 deletions

File tree

packages/rn-tester/Podfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ target 'RNTester' do
5858
pods('RNTester')
5959
end
6060

61-
target 'RNTester (AppDelegate)' do
62-
pods('RNTester (AppDelegate)')
63-
end
64-
6561
target 'RNTesterUnitTests' do
6662
pods('RNTesterUnitTests')
6763
pod 'React-RCTTest', :path => "./RCTTest"

packages/rn-tester/RNTester/AppDelegate.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#if RNTESTER_USE_APPDELEGATE
9-
10-
#import <RCTDefaultReactNativeFactoryDelegate.h>
11-
#import <RCTReactNativeFactory.h>
12-
#import <UIKit/UIKit.h>
13-
14-
@interface AppDelegate : RCTDefaultReactNativeFactoryDelegate <UIApplicationDelegate>
15-
16-
@property (nonatomic, strong, nonnull) UIWindow *window;
17-
@property (nonatomic, strong, nonnull) RCTReactNativeFactory *reactNativeFactory;
18-
19-
@end
20-
21-
#else
22-
238
#import <UIKit/UIKit.h>
249

2510
@interface AppDelegate : UIResponder <UIApplicationDelegate>
2611

2712
@end
28-
29-
#endif

packages/rn-tester/RNTester/AppDelegate.mm

Lines changed: 0 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -7,114 +7,26 @@
77

88
#import "AppDelegate.h"
99

10-
#if RNTESTER_USE_APPDELEGATE
11-
1210
#if !TARGET_OS_TV
1311
#import <UserNotifications/UserNotifications.h>
14-
#endif
15-
16-
#import <React/RCTBundleURLProvider.h>
17-
#import <React/RCTDefines.h>
18-
#import <React/RCTLinkingManager.h>
19-
#import <ReactCommon/RCTSampleTurboModule.h>
20-
#import <ReactCommon/RCTTurboModuleManager.h>
21-
22-
#if !TARGET_OS_TV
2312
#import <React/RCTPushNotificationManager.h>
2413
#endif
2514

26-
#import <NativeCxxModuleExample/NativeCxxModuleExample.h>
27-
#ifndef RN_DISABLE_OSS_PLUGIN_HEADER
28-
#import <RNTMyNativeViewComponentView.h>
29-
#endif
30-
31-
#if __has_include(<ReactAppDependencyProvider/RCTAppDependencyProvider.h>)
32-
#define USE_OSS_CODEGEN 1
33-
#import <ReactAppDependencyProvider/RCTAppDependencyProvider.h>
34-
#else
35-
#define USE_OSS_CODEGEN 0
36-
#endif
37-
38-
#if RCT_DEV_MENU
39-
#import <React/RCTDevMenu.h>
40-
#endif
41-
42-
static NSString *kBundlePath = @"js/RNTesterApp.ios";
43-
4415
#if !TARGET_OS_TV
4516
@interface AppDelegate () <UNUserNotificationCenterDelegate>
4617
@end
47-
#else
48-
@interface AppDelegate ()
49-
@end
5018
#endif
5119

5220
@implementation AppDelegate
5321

5422
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
5523
{
56-
self.reactNativeFactory = [[RCTReactNativeFactory alloc] initWithDelegate:self];
57-
#if USE_OSS_CODEGEN
58-
self.dependencyProvider = [RCTAppDependencyProvider new];
59-
#endif
60-
61-
#if RCT_DEV_MENU
62-
63-
RCTDevMenuConfiguration *devMenuConfiguration = [[RCTDevMenuConfiguration alloc] initWithDevMenuEnabled:true
64-
shakeGestureEnabled:true
65-
keyboardShortcutsEnabled:true];
66-
[self.reactNativeFactory setDevMenuConfiguration:devMenuConfiguration];
67-
68-
#endif
69-
70-
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
71-
72-
[self.reactNativeFactory startReactNativeWithModuleName:@"RNTesterApp"
73-
inWindow:self.window
74-
initialProperties:[self prepareInitialProps]
75-
launchOptions:launchOptions];
76-
7724
#if !TARGET_OS_TV
7825
[[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
7926
#endif
80-
8127
return YES;
8228
}
8329

84-
- (NSDictionary *)prepareInitialProps
85-
{
86-
NSMutableDictionary *initProps = [NSMutableDictionary new];
87-
88-
NSString *_routeUri = [[NSUserDefaults standardUserDefaults] stringForKey:@"route"];
89-
if (_routeUri) {
90-
initProps[@"exampleFromAppetizeParams"] = [NSString stringWithFormat:@"rntester://example/%@Example", _routeUri];
91-
}
92-
93-
return initProps;
94-
}
95-
96-
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
97-
{
98-
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:kBundlePath];
99-
}
100-
101-
- (BOOL)application:(UIApplication *)app
102-
openURL:(NSURL *)url
103-
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
104-
{
105-
return [RCTLinkingManager application:app openURL:url options:options];
106-
}
107-
108-
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
109-
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
110-
{
111-
if (name == facebook::react::NativeCxxModuleExample::kModuleName) {
112-
return std::make_shared<facebook::react::NativeCxxModuleExample>(jsInvoker);
113-
}
114-
115-
return [super getTurboModule:name jsInvoker:jsInvoker];
116-
}
117-
11830
#if !TARGET_OS_TV
11931
// Required for the remoteNotificationsRegistered event.
12032
- (void)application:(__unused UIApplication *)application
@@ -161,85 +73,4 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
16173
}
16274
#endif
16375

164-
#pragma mark - RCTComponentViewFactoryComponentProvider
165-
166-
#ifndef RN_DISABLE_OSS_PLUGIN_HEADER
167-
- (nonnull NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
168-
{
169-
NSMutableDictionary *dict = [super thirdPartyFabricComponents].mutableCopy;
170-
if (!dict[@"RNTMyNativeView"]) {
171-
dict[@"RNTMyNativeView"] = NSClassFromString(@"RNTMyNativeViewComponentView");
172-
}
173-
if (!dict[@"SampleNativeComponent"]) {
174-
dict[@"SampleNativeComponent"] = NSClassFromString(@"RCTSampleNativeComponentComponentView");
175-
}
176-
return dict;
177-
}
178-
#endif
179-
180-
- (NSURL *)bundleURL
181-
{
182-
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:kBundlePath];
183-
}
184-
185-
@end
186-
#else
187-
188-
#if !TARGET_OS_TV
189-
#import <UserNotifications/UserNotifications.h>
190-
#import <React/RCTPushNotificationManager.h>
191-
#endif
192-
193-
#if !TARGET_OS_TV
194-
@interface AppDelegate () <UNUserNotificationCenterDelegate>
195-
@end
196-
#endif
197-
198-
@implementation AppDelegate
199-
200-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
201-
{
202-
#if !TARGET_OS_TV
203-
[[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
204-
#endif
205-
return YES;
206-
}
207-
208-
#if !TARGET_OS_TV
209-
- (void)application:(__unused UIApplication *)application
210-
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
211-
{
212-
[RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
213-
}
214-
215-
- (void)application:(__unused UIApplication *)application
216-
didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
217-
{
218-
[RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error];
219-
}
220-
221-
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
222-
willPresentNotification:(UNNotification *)notification
223-
withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
224-
{
225-
[RCTPushNotificationManager didReceiveNotification:notification];
226-
completionHandler(UNNotificationPresentationOptionNone);
227-
}
228-
229-
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
230-
didReceiveNotificationResponse:(UNNotificationResponse *)response
231-
withCompletionHandler:(void (^)(void))completionHandler
232-
{
233-
UNNotification *notification = response.notification;
234-
235-
if ([response.actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier]) {
236-
[RCTPushNotificationManager setInitialNotification:notification];
237-
}
238-
239-
[RCTPushNotificationManager didReceiveNotification:notification];
240-
completionHandler();
241-
}
242-
#endif
243-
24476
@end
245-
#endif

packages/rn-tester/RNTester/Info-AppDelegate.plist

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)