iOS:DoricContext add vc
This commit is contained in:
parent
64d1153e93
commit
2541a13d74
@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface DoricContext : NSObject
|
||||
@property(nonatomic, weak) id <DoricNavigatorDelegate> navigator;
|
||||
@property(nonatomic, weak) id <DoricNavBarDelegate> navBar;
|
||||
@property(nonatomic, weak) UIViewController *vc;
|
||||
@property(nonatomic, strong) NSString *contextId;
|
||||
@property(nonatomic, strong) id <DoricDriverProtocol> driver;
|
||||
@property(nonatomic, strong) NSMutableDictionary *pluginInstanceMap;
|
||||
|
@ -112,5 +112,10 @@ - (void)onShow {
|
||||
- (void)onHidden {
|
||||
[self callEntity:DORIC_ENTITY_HIDDEN withArgumentsArray:@[]];
|
||||
}
|
||||
|
||||
- (UIViewController *)vc {
|
||||
if(!_vc) {
|
||||
return [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
}
|
||||
return _vc;
|
||||
}
|
||||
@end
|
||||
|
@ -181,6 +181,7 @@ - (void)loadJSBundle {
|
||||
[self.doricPanel config:result alias:self.alias extra:self.extra];
|
||||
self.doricPanel.doricContext.navigator = self;
|
||||
self.doricPanel.doricContext.navBar = self;
|
||||
self.doricPanel.doricContext.vc = self;
|
||||
});
|
||||
};
|
||||
result.exceptionCallback = ^(NSException *e) {
|
||||
|
@ -47,8 +47,7 @@ - (void)alert:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
|
||||
[promise resolve:nil];
|
||||
}];
|
||||
[alert addAction:action];
|
||||
UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
[vc presentViewController:alert animated:YES completion:nil];
|
||||
[self.doricContext.vc presentViewController:alert animated:YES completion:nil];
|
||||
});
|
||||
}
|
||||
|
||||
@ -70,8 +69,7 @@ - (void)confirm:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
|
||||
[promise reject:nil];
|
||||
}];
|
||||
[alert addAction:cancelAction];
|
||||
UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
[vc presentViewController:alert animated:YES completion:nil];
|
||||
[self.doricContext.vc presentViewController:alert animated:YES completion:nil];
|
||||
});
|
||||
}
|
||||
|
||||
@ -108,8 +106,7 @@ - (void)prompt:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
|
||||
[alert addAction:cancelAction];
|
||||
|
||||
|
||||
UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
[vc presentViewController:alert animated:YES completion:nil];
|
||||
[self.doricContext.vc presentViewController:alert animated:YES completion:nil];
|
||||
});
|
||||
}
|
||||
@end
|
||||
|
Reference in New Issue
Block a user