Skip to content

Commit

Permalink
refactor(iOS): chaged project structure to separate abstractions
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadzim Filipovich committed May 2, 2024
1 parent 23d9bc9 commit 57f0930
Show file tree
Hide file tree
Showing 461 changed files with 90 additions and 248 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#import "RNNModalHostViewManagerHandler.h"
#import "RNNReactComponentRegistry.h"
#import "RNNReactRootViewCreator.h"
#import "RNNSplashScreen.h"
#import <React/RCTBridge.h>
#import <React/RCTUIManager.h>

Expand Down Expand Up @@ -75,21 +74,21 @@ - (void)registerExternalComponent:(NSString *)name callback:(RNNExternalViewCrea
id<RNNComponentViewCreator> rootViewCreator =
[[RNNReactRootViewCreator alloc] initWithBridge:bridge eventEmitter:eventEmitter];
_componentRegistry = [[RNNReactComponentRegistry alloc] initWithCreator:rootViewCreator];
RNNControllerFactory *controllerFactory =
[[RNNControllerFactory alloc] initWithRootViewCreator:rootViewCreator
RNNViewControllerFactory *controllerFactory =
[[RNNViewControllerFactory alloc] initWithRootViewCreator:rootViewCreator
eventEmitter:eventEmitter
store:_store
componentRegistry:_componentRegistry
andBridge:bridge
bottomTabsAttachModeFactory:[BottomTabsAttachModeFactory new]];
RNNSetRootAnimator *setRootAnimator = [RNNSetRootAnimator new];
_commandsHandler = [[RNNCommandsHandler alloc] initWithControllerFactory:controllerFactory
layoutManager:_layoutManager
eventEmitter:eventEmitter
modalManager:_modalManager
overlayManager:_overlayManager
setRootAnimator:setRootAnimator
mainWindow:_mainWindow];
_commandsHandler = [[RNNCommandsHandler alloc] initWithViewControllerFactory:controllerFactory
layoutManager:_layoutManager
eventEmitter:eventEmitter
modalManager:_modalManager
overlayManager:_overlayManager
setRootAnimator:setRootAnimator
mainWindow:_mainWindow];
RNNBridgeModule *bridgeModule =
[[RNNBridgeModule alloc] initWithCommandsHandler:_commandsHandler];

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "RNNControllerFactory.h"
#import "RNNViewControllerFactory.h"
#import "RNNLayoutManager.h"
#import "RNNModalManager.h"
#import "RNNOverlayManager.h"
Expand All @@ -14,7 +14,7 @@

@interface RNNCommandsHandler : NSObject

- (instancetype)initWithControllerFactory:(RNNControllerFactory *)controllerFactory
- (instancetype)initWithViewControllerFactory:(RNNViewControllerFactory *)controllerFactory
layoutManager:(RNNLayoutManager *)layoutManager
eventEmitter:(RNNEventEmitter *)eventEmitter
modalManager:(RNNModalManager *)modalManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ @interface RNNCommandsHandler ()
@end

@implementation RNNCommandsHandler {
RNNControllerFactory *_controllerFactory;
RNNViewControllerFactory *_controllerFactory;
RNNLayoutManager *_layoutManager;
RNNModalManager *_modalManager;
RNNOverlayManager *_overlayManager;
Expand All @@ -39,13 +39,13 @@ @implementation RNNCommandsHandler {
RNNSetRootAnimator *_setRootAnimator;
}

- (instancetype)initWithControllerFactory:(RNNControllerFactory *)controllerFactory
layoutManager:(RNNLayoutManager *)layoutManager
eventEmitter:(RNNEventEmitter *)eventEmitter
modalManager:(RNNModalManager *)modalManager
overlayManager:(RNNOverlayManager *)overlayManager
setRootAnimator:(RNNSetRootAnimator *)setRootAnimator
mainWindow:(UIWindow *)mainWindow {
- (instancetype)initWithViewControllerFactory:(RNNViewControllerFactory *)controllerFactory
layoutManager:(RNNLayoutManager *)layoutManager
eventEmitter:(RNNEventEmitter *)eventEmitter
modalManager:(RNNModalManager *)modalManager
overlayManager:(RNNOverlayManager *)overlayManager
setRootAnimator:(RNNSetRootAnimator *)setRootAnimator
mainWindow:(UIWindow *)mainWindow {
self = [super init];
_controllerFactory = controllerFactory;
_layoutManager = layoutManager;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#import "UIViewController+SideMenuViewController.h"

@implementation UIViewController (SideMenuController)

- (RNNSideMenuViewController *)sideMenuController {
UIViewController *vc = self;
while (vc) {
if ([vc isKindOfClass:[RNNSideMenuViewController class]]) {
return (RNNSideMenuViewController *)vc;
}

vc = vc.parentViewController;
}

return nil;
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#import "RNNSideMenuViewController.h"
#import <UIKit/UIKit.h>

@interface UIViewController (RNNSideMenuViewController)

- (RNNSideMenuViewController *)sideMenuController;

@end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#import "RNNControllerFactory.h"
#import "RNNViewControllerFactory.h"
#import "BottomTabPresenterCreator.h"
#import "BottomTabsPresenterCreator.h"
#import "RNNBottomTabsController.h"
#import "RNNComponentViewController.h"
#import "RNNExternalViewController.h"
#import "RNNSideMenuController.h"
#import "RNNSideMenuViewController.h"
#import "RNNSplitViewController.h"
#import "RNNStackController.h"
#import "RNNTopTabsViewController.h"

@implementation RNNControllerFactory {
@implementation RNNViewControllerFactory {
id<RNNComponentViewCreator> _creator;
RNNExternalComponentStore *_store;
RCTBridge *_bridge;
Expand Down Expand Up @@ -267,8 +267,8 @@ - (UIViewController *)createSideMenu:(RNNLayoutNode *)node {

NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];

RNNSideMenuController *sideMenu =
[[RNNSideMenuController alloc] initWithLayoutInfo:layoutInfo
RNNSideMenuViewController *sideMenu =
[[RNNSideMenuViewController alloc] initWithLayoutInfo:layoutInfo
creator:_creator
childViewControllers:childViewControllers
options:options
Expand All @@ -285,7 +285,7 @@ - (UIViewController *)createSideMenuChild:(RNNLayoutNode *)node type:(RNNSideMen
RNNNavigationOptions *options =
[[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];

RNNSideMenuChildVC *sideMenuChild = [[RNNSideMenuChildVC alloc]
RNNSideMenuChildViewController *sideMenuChild = [[RNNSideMenuChildViewController alloc]
initWithLayoutInfo:layoutInfo
creator:_creator
options:options
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface RNNControllerFactory : NSObject
@interface RNNViewControllerFactory : NSObject

- (instancetype)initWithRootViewCreator:(id<RNNComponentViewCreator>)creator
eventEmitter:(RNNEventEmitter *)eventEmitter
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#import "RNNNavigationOptions.h"
#import "RNNBottomTabsController.h"
#import "RNNComponentViewController.h"
#import "RNNSideMenuController.h"
#import "RNNSideMenuViewController.h"
#import "RNNSplitViewController.h"
#import "RNNSplitViewOptions.h"
#import "RNNStackController.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import "RNNSideMenuPresenter.h"
#import "RNNSideMenuController.h"
#import "RNNSideMenuViewController.h"

@implementation RNNSideMenuPresenter

Expand Down Expand Up @@ -130,8 +130,8 @@ - (void)mergeOptions:(RNNNavigationOptions *)options
}
}

- (RNNSideMenuController *)sideMenuController {
return (RNNSideMenuController *)self.boundViewController;
- (RNNSideMenuViewController *)sideMenuController {
return (RNNSideMenuViewController *)self.boundViewController;
}

@end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions lib/ios/RNNElement.h

This file was deleted.

25 changes: 0 additions & 25 deletions lib/ios/RNNElement.mm

This file was deleted.

5 changes: 0 additions & 5 deletions lib/ios/RNNElementView.h

This file was deleted.

5 changes: 0 additions & 5 deletions lib/ios/RNNElementView.mm

This file was deleted.

6 changes: 0 additions & 6 deletions lib/ios/RNNLeafProtocol.h

This file was deleted.

13 changes: 0 additions & 13 deletions lib/ios/RNNSwizzles.h

This file was deleted.

97 changes: 0 additions & 97 deletions lib/ios/RNNSwizzles.m

This file was deleted.

6 changes: 3 additions & 3 deletions lib/ios/ReactNativeNavigation.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#import "RNNBridgeManager.h"
#import "RNNLayoutManager.h"
#import "RNNSplashScreen.h"
#import "RNNSplashScreenViewController.h"

@interface ReactNativeNavigation ()

Expand Down Expand Up @@ -47,7 +47,7 @@ + (void)registerExternalHostComponent:(NSString *)name callback:(RNNExternalHost

- (void)bootstrapWithHost:(RCTHost *)host {
self.turboManager = [[RNNTurboManager alloc] initWithHost:host mainWindow:[self mainWindow]];
[RNNSplashScreen showOnWindow:[self mainWindow]];
[RNNSplashScreenViewController showOnWindow:[self mainWindow]];
}

+ (RCTHost *)getHost {
Expand Down Expand Up @@ -84,7 +84,7 @@ - (RNNBridgeManager *)getBridgeManagerForBridge:(RCTBridge *)bridge {
}

- (void)bootstrapWithBridge:(RCTBridge *)bridge {
[RNNSplashScreen showOnWindow:[self mainWindow]];
[RNNSplashScreenViewController showOnWindow:[self mainWindow]];
}

#pragma mark - instance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "Number.h"
#import "ReactNativeNavigation/Number.h"

@interface SideMenuOpenMode : Number

Expand Down
Loading

0 comments on commit 57f0930

Please sign in to comment.