Skip to content

Commit

Permalink
feat(ios): add rootViewRunApplicationFinished delegate method
Browse files Browse the repository at this point in the history
for HippyRootViewDelegate
  • Loading branch information
wwwcg committed Mar 12, 2024
1 parent 2a17ef8 commit 2400602
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions renderer/native/ios/renderer/HippyRootView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#import "HippyUIManager.h"
#import "HippyDeviceBaseInfo.h"
#import "HippyTouchHandler.h"
#import "HippyJSExecutor.h"
#include <objc/runtime.h>

// Sent when the first subviews are added to the root view
Expand Down Expand Up @@ -231,7 +232,16 @@ - (void)runHippyApplication {

// Register RootView
[self.bridge setRootView:contentView];
// Run Application
[self.bridge loadInstanceForRootView:self.hippyTag withProperties:self.appProperties];
// Call callback if needed
if ([self.delegate respondsToSelector:@selector(rootViewRunApplicationFinished:)]) {
__weak __typeof(self)weakSelf = self;
[self.bridge.javaScriptExecutor executeBlockOnJavaScriptQueue:^{
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf.delegate rootViewRunApplicationFinished:strongSelf];
}];
}
self.contentView = contentView;
[self insertSubview:contentView atIndex:0];
HippyLogInfo(@"[Hippy_OC_Log][Life_Circle],Running application %@ (%@)", self.moduleName, self.appProperties);
Expand Down
5 changes: 5 additions & 0 deletions renderer/native/ios/renderer/HippyRootViewDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
*/
- (void)rootView:(HippyRootView *)rootView didLoadFinish:(BOOL)success;

/**
* Called after the JSAPI runApplication finished.
*/
- (void)rootViewRunApplicationFinished:(HippyRootView *)rootView;

/**
* Called when rootview dealloc.
*/
Expand Down

0 comments on commit 2400602

Please sign in to comment.