//
//  UINavigationControllerDelegateReceiver.m
//  DDBasicControlsKit_Private
//  Created by DDIsFriend on 2022/9/20.

#import "DDNavigationControllerDelegateReceiver.h"
#import <DDBasicControlsKit_Private/DDViewControllerAnimatedTransition.h>

@implementation DDNavigationControllerDelegateReceiver
// MARK: <UINavigationControllerDelegate>
- (nullable id <UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController
                                   interactionControllerForAnimationController:(id <UIViewControllerAnimatedTransitioning>) animationController{
    return self.percentDrivenInteractiveTransition;
}

- (nullable id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
                                   animationControllerForOperation:(UINavigationControllerOperation)operation
                                                fromViewController:(UIViewController *)fromVC
                                                           toViewController:(UIViewController *)toVC {
    
    if (operation == UINavigationControllerOperationNone) {
        return [[DDViewControllerAnimatedTransition alloc] initWithTransitionType:DDViewControllerAnimatedTransitionNone];
    }
    
    if (operation == UINavigationControllerOperationPush){
        return [[DDViewControllerAnimatedTransition alloc] initWithTransitionType:DDViewControllerAnimatedTransitionPush];
    }
    
    return [[DDViewControllerAnimatedTransition alloc] initWithTransitionType:DDViewControllerAnimatedTransitionPop];
}

@end
