//
//  AuthenticationFailedController.m
//  KKCivilAd
//
//  Created by 雷俊博 on 2019/11/28.
//  Copyright © 2019 雷俊博. All rights reserved.
//

#import "AuthenticationFailedController.h"
#import "AuthB1ViewController.h"
@interface AuthenticationFailedController ()

@end

@implementation AuthenticationFailedController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationItem.hidesBackButton = YES;
    
    //禁止手势返回
       id traget = self.navigationController.interactivePopGestureRecognizer.delegate;
       UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc]initWithTarget:traget action:nil];
       [self.view addGestureRecognizer:pan];
    
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
    
    if ([self.type isEqualToString:@"butie"]) {
        [GTCountSDK trackCountEvent:@"home_BTAuth_failurePage" withArgs:@{}];
    }else{
        [GTCountSDK trackCountEvent:@"home_YFAuth_failurePage" withArgs:@{}];
    }
    
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    // 开启返回手势
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    }
    
}

- (IBAction)ReAuthBtnClick:(UIButton *)sender {
    
    if(self.type!=nil&&[self.type isEqualToString:@"newAuth"]){
        for (UIViewController*vc in self.navigationController.viewControllers) {
            if ([vc isKindOfClass:[AuthB1ViewController class]]) {
                AuthB1ViewController*currentVC  = (AuthB1ViewController *)vc;
                [currentVC clearText];
                [self.navigationController popToViewController:currentVC animated:YES];
                break;
            }
        }
        
     self.navigationController.navigationBar.translucent = YES;
            [self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:27/255.0 green:132/255.0 blue:208/255.0 alpha:1.0]];
        if ([UIScreen mainScreen].bounds.size.height == 480) {
        
            [self.navigationController setNavigationBarHidden:NO animated:YES];
            
        }
    }else{
        [self.navigationController popViewControllerAnimated:YES];
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
