|
@@ -19,7 +19,7 @@ const NSInteger BLUR_STATUS_TAG = 78264801;
|
19
|
19
|
const NSInteger BLUR_NAVBAR_TAG = 78264802;
|
20
|
20
|
const NSInteger TRANSPARENT_NAVBAR_TAG = 78264803;
|
21
|
21
|
|
22
|
|
-@interface RCCViewController() <UIGestureRecognizerDelegate>
|
|
22
|
+@interface RCCViewController() <UIGestureRecognizerDelegate, UIViewControllerPreviewingDelegate>
|
23
|
23
|
@property (nonatomic) BOOL _hidesBottomBarWhenPushed;
|
24
|
24
|
@property (nonatomic) BOOL _statusBarHideWithNavBar;
|
25
|
25
|
@property (nonatomic) BOOL _statusBarHidden;
|
|
@@ -794,6 +794,37 @@ const NSInteger TRANSPARENT_NAVBAR_TAG = 78264803;
|
794
|
794
|
}
|
795
|
795
|
}
|
796
|
796
|
|
|
797
|
+#pragma mark - Preview Actions
|
|
798
|
+
|
|
799
|
+- (void)onActionPress:(NSString *)id {
|
|
800
|
+ if ([self.view isKindOfClass:[RCTRootView class]]) {
|
|
801
|
+ RCTRootView *rootView = (RCTRootView *)self.view;
|
|
802
|
+ if (rootView.appProperties && rootView.appProperties[@"navigatorEventID"]) {
|
|
803
|
+ [[[RCCManager sharedInstance] getBridge].eventDispatcher
|
|
804
|
+ sendAppEventWithName:rootView.appProperties[@"navigatorEventID"]
|
|
805
|
+ body:@{
|
|
806
|
+ @"type": @"PreviewActionPress",
|
|
807
|
+ @"id": id
|
|
808
|
+ }];
|
|
809
|
+ }
|
|
810
|
+ }
|
|
811
|
+}
|
|
812
|
+
|
|
813
|
+- (UIPreviewAction *) convertAction:(NSDictionary *)action {
|
|
814
|
+ NSString *actionId = action[@"id"];
|
|
815
|
+ NSString *actionTitle = action[@"title"];
|
|
816
|
+ UIPreviewActionStyle actionStyle = UIPreviewActionStyleDefault;
|
|
817
|
+ if ([action[@"style"] isEqualToString:@"selected"]) {
|
|
818
|
+ actionStyle = UIPreviewActionStyleSelected;
|
|
819
|
+ }
|
|
820
|
+ if ([action[@"style"] isEqualToString:@"destructive"]) {
|
|
821
|
+ actionStyle = UIPreviewActionStyleDestructive;
|
|
822
|
+ }
|
|
823
|
+ return [UIPreviewAction actionWithTitle:actionTitle style:actionStyle handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
|
|
824
|
+ [self onActionPress:actionId];
|
|
825
|
+ }];
|
|
826
|
+}
|
|
827
|
+
|
797
|
828
|
#pragma mark - NewRelic
|
798
|
829
|
|
799
|
830
|
- (NSString*) customNewRelicInteractionName
|
|
@@ -830,4 +861,36 @@ const NSInteger TRANSPARENT_NAVBAR_TAG = 78264803;
|
830
|
861
|
return !disabledSimultaneousGestureBool;
|
831
|
862
|
}
|
832
|
863
|
|
|
864
|
+#pragma mark - UIViewControllerPreviewingDelegate
|
|
865
|
+- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location {
|
|
866
|
+ return self.previewController;
|
|
867
|
+}
|
|
868
|
+
|
|
869
|
+- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit {
|
|
870
|
+ if (self.previewController.previewCommit == YES) {
|
|
871
|
+ [self.previewController sendGlobalScreenEvent:@"willCommitPreview" endTimestampString:[self.previewController getTimestampString] shouldReset:YES];
|
|
872
|
+ [self.previewController sendScreenChangedEvent:@"willCommitPreview"];
|
|
873
|
+ [self.navigationController pushViewController:self.previewController animated:false];
|
|
874
|
+ }
|
|
875
|
+}
|
|
876
|
+
|
|
877
|
+- (NSArray<id<UIPreviewActionItem>> *)previewActionItems {
|
|
878
|
+ NSMutableArray *actions = [[NSMutableArray alloc] init];
|
|
879
|
+ for (NSDictionary *previewAction in self.previewActions) {
|
|
880
|
+ UIPreviewAction *action = [self convertAction:previewAction];
|
|
881
|
+ NSDictionary *actionActions = previewAction[@"actions"];
|
|
882
|
+ if (actionActions.count > 0) {
|
|
883
|
+ NSMutableArray *group = [[NSMutableArray alloc] init];
|
|
884
|
+ for (NSDictionary *previewGroupAction in actionActions) {
|
|
885
|
+ [group addObject:[self convertAction:previewGroupAction]];
|
|
886
|
+ }
|
|
887
|
+ UIPreviewActionGroup *actionGroup = [UIPreviewActionGroup actionGroupWithTitle:action.title style:UIPreviewActionStyleDefault actions:group];
|
|
888
|
+ [actions addObject:actionGroup];
|
|
889
|
+ } else {
|
|
890
|
+ [actions addObject:action];
|
|
891
|
+ }
|
|
892
|
+ }
|
|
893
|
+ return actions;
|
|
894
|
+}
|
|
895
|
+
|
833
|
896
|
@end
|