<commit_before>//
//  FriendsDayViewController.swift
//  Yona
//
//  Created by <NAME> on 07/07/2016.
//  Copyright © 2016 Yona. All rights reserved.
//

import Foundation

class FriendsDayViewController: MeDashBoardMainViewController {
    
    var buddyToShow :Buddies?
    var navbarColor1 : UIColor?
    var navbarColor : UIColor?
    
    @IBOutlet weak var rightNavBarItem : UIBarButtonItem!
    override func viewDidLoad() {
        super.viewDidLoad()
        navigationItem.title = NSLocalizedString("", comment: "")
    }
    
    override func viewWillDisappear(animated: Bool) {
        super.viewWillDisappear(animated)
        if let navbarColor1 = navbarColor1,
            let navbarColor = navbarColor {
            self.navigationController?.navigationBar.backgroundColor = UIColor.yiWindowsBlueColor()
            let navbar = navigationController?.navigationBar as! GradientNavBar
            navbar.gradientColor = UIColor.yiMidBlueColor()
        }
        
        

    }

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        let tracker = GAI.sharedInstance().defaultTracker
        tracker.set(kGAIScreenName, value: "FriendsDayViewController")
        
        let builder = GAIDictionaryBuilder.createScreenView()
        tracker.send(builder.build() as [NSObject : AnyObject])
        
        navigationItem.title = NSLocalizedString("friends", comment: "")
        
        
        if buddyToShow != nil {
            navbarColor1 = self.navigationController?.navigationBar.backgroundColor
            self.navigationController?.navigationBar.backgroundColor = UIColor.yiWindowsBlueColor()
            let navbar = self.navigationController?.navigationBar as! GradientNavBar
            
            navbarColor = navbar.gradientColor
            navbar.gradientColor = UIColor.yiMidBlueColor()
            
            
        }
        navigationItem.rightBarButtonItems = nil
        navigationItem.rightBarButtonItem = nil

    }
    
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        configurProfileBarItem()
        //navigationItem.rightBarButtonItems = nil
        //configurProfileBarItem()
    }
    
    //MARK: - implementations metods
    override func actionsAfterLeftButtonPush() {
        loadActivitiesForDay()
        // The subController must override this to have any action after the tabe selection
        
    }
    //MARK: - week delegate methods
    override func didSelectDayInWeek(goal: SingleDayActivityGoal, aDate : NSDate) {
        
        weekDayDetailLink = goal.yonadayDetails
        performSegueWithIdentifier(R.segue.friendsDayViewController.showFriendsDetailDay, sender: self)
    }

    override func actionsAfterRightButtonPush() {
        // The subController must override this to have any action after the tabe selection
        loadActivitiesForWeek()
    }

    override func configurProfileBarItem () {
        if let name = buddyToShow?.UserRequestfirstName {
            
            if name.characters.count > 0 {//&& user?.characters.count > 0{
                let btnName = UIButton()
                let txt = "\(name.capitalizedString.characters.first!)"
                btnName.setTitle(txt, forState: .Normal)
                btnName.frame = CGRectMake(0, 0, 32, 32)
                btnName.addTarget(self, action: #selector(self.didChooseUserProfile(_:)), forControlEvents: .TouchUpInside)
                
                btnName.backgroundColor = UIColor.clearColor()
                btnName.layer.cornerRadius = btnName.frame.size.width/2
                btnName.layer.borderWidth = 1
                btnName.layer.borderColor = UIColor.whiteColor().CGColor
                
                let rightBarButton = UIBarButtonItem()
                rightBarButton.customView = btnName
                navigationItem.rightBarButtonItems = [rightBarButton]
            }
<commit_msg>[APPDEV-978] - Friends Day view not correct<commit_after>//
//  FriendsDayViewController.swift
//  Yona
//
//  Created by <NAME> on 07/07/2016.
//  Copyright © 2016 Yona. All rights reserved.
//

import Foundation

class FriendsDayViewController: MeDashBoardMainViewController {
    
    var buddyToShow :Buddies?
    var navbarColor1 : UIColor?
    var navbarColor : UIColor?
    
    @IBOutlet weak var rightNavBarItem : UIBarButtonItem!
    override func viewDidLoad() {
        super.viewDidLoad()
        navigationItem.title = NSLocalizedString("", comment: "")
    }
    
    override func viewWillDisappear(animated: Bool) {
        super.viewWillDisappear(animated)
        if let navbarColor1 = navbarColor1,
            let navbarColor = navbarColor {
            self.navigationController?.navigationBar.backgroundColor = UIColor.yiWindowsBlueColor()
            let navbar = navigationController?.navigationBar as! GradientNavBar
            navbar.gradientColor = UIColor.yiMidBlueColor()
        }
        
        

    }

    override func viewWillAppear(animated: Bool) {
        let tracker = GAI.sharedInstance().defaultTracker
        tracker.set(kGAIScreenName, value: "FriendsDayViewController")
        
        let builder = GAIDictionaryBuilder.createScreenView()
        tracker.send(builder.build() as [NSObject : AnyObject])
        
        
        
        if buddyToShow != nil {
            navbarColor1 = self.navigationController?.navigationBar.backgroundColor
            self.navigationController?.navigationBar.backgroundColor = UIColor.yiWindowsBlueColor()
            let navbar = self.navigationController?.navigationBar as! GradientNavBar
            
            navbarColor = navbar.gradientColor
            navbar.gradientColor = UIColor.yiMidBlueColor()
            
            
        }
        navigationItem.rightBarButtonItems = nil
        navigationItem.rightBarButtonItem = nil

    }
    
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        configurProfileBarItem()
        //navigationItem.rightBarButtonItems = nil
        //configurProfileBarItem()
    }
    
    //MARK: - implementations metods
    override func actionsAfterLeftButtonPush() {
        loadActivitiesForDay()
        // The subController must override this to have any action after the tabe selection
        
    }
    //MARK: - week delegate methods
    override func didSelectDayInWeek(goal: SingleDayActivityGoal, aDate : NSDate) {
        
        weekDayDetailLink = goal.yonadayDetails
        performSegueWithIdentifier(R.segue.friendsDayViewController.showFriendsDetailDay, sender: self)
    }

    override func actionsAfterRightButtonPush() {
        // The subController must override this to have any action after the tabe selection
        loadActivitiesForWeek()
    }

    override func configurProfileBarItem () {
        if let name = buddyToShow?.UserRequestfirstName {
            
            navigationItem.title = name
            
            if name.characters.count > 0 {//&& user?.characters.count > 0{
                let btnName = UIButton()
                let txt = "\(name.capitalizedString.characters.first!)"
                btnName.setTitle(txt, forState: .Normal)
                btnName.frame = CGRectMake(0, 0, 32, 32)
                btnName.addTarget(self, action: #selector(self.didChooseUserProfile(_:)), forControlEvents: .TouchUpInside)
                
                btnName.backgroundColor = UIColor.clearColor()
                btnName.layer.cornerRadius = btnName.frame.size.width/2
                btnName.layer.borderWidth = 1
                btnName.layer.borderColor = UIColor.whiteColor().CGColor
                
                let rightBarButton = UIBarButtonItem()
                rightBarButton.customView = btnName
                navigationItem.rightBarButtonItems = [rightBarButton]
            }

{'fraction_non_alphanumeric': 0.077897403419886, 'fraction_numerical': 0.006966434452184927, 'mean_word_length': 2.2763485477178422, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7313236', 'n_tokens_mistral': 2158, 'n_tokens_neox': 2033, 'n_words': 423}