<commit_before>module ProMotion
  module SplitScreen
    def split_screen_controller(master, detail)
      master_main = master.navigationController ? master.navigationController : master
      detail_main = detail.navigationController ? detail.navigationController : detail
      
      split = SplitViewController.alloc.init
      split.viewControllers = [ master_main, detail_main ]
      split.delegate = self
      
      split
    end
    
    def create_split_screen(master, detail, args={})
      master = master.new if master.respond_to?(:new)
      detail = detail.new if detail.respond_to?(:new)
      
      split = split_screen_controller(master, detail)
      
      [master, detail].each do |s|
        s.split_screen = split if s.respond_to?("split_screen=")
        s.on_load if s.respond_to?(:on_load)
      end

      split
    end
    
    def open_split_screen(master, detail, args={})
      split = create_split_screen(master, detail, args)
      open split, args
      split
    end
    
    # UISplitViewControllerDelegate methods
    
    def splitViewController(svc, willHideViewController: vc, withBarButtonItem: button, forPopoverController: pc)
      button.title = vc.title
      svc.viewControllers.last.navigationItem.leftBarButtonItem = button;
    end

    def splitViewController(svc, willShowViewController: vc, invalidatingBarButtonItem: barButtonItem)
      svc.viewControllers.last.navigationItem.leftBarButtonItem = nil
    end
  end
end<commit_msg>Navigation item set properly<commit_after>module ProMotion
  module SplitScreen
    def split_screen_controller(master, detail)
      master_main = master.navigationController ? master.navigationController : master
      detail_main = detail.navigationController ? detail.navigationController : detail
      
      split = SplitViewController.alloc.init
      split.viewControllers = [ master_main, detail_main ]
      split.delegate = self
      
      split
    end
    
    def create_split_screen(master, detail, args={})
      master = master.new if master.respond_to?(:new)
      detail = detail.new if detail.respond_to?(:new)
      
      split = split_screen_controller(master, detail)
      
      [master, detail].each do |s|
        s.split_screen = split if s.respond_to?("split_screen=")
        s.on_load if s.respond_to?(:on_load)
      end

      split
    end
    
    def open_split_screen(master, detail, args={})
      split = create_split_screen(master, detail, args)
      open split, args
      split
    end
    
    # UISplitViewControllerDelegate methods
    
    def splitViewController(svc, willHideViewController: vc, withBarButtonItem: button, forPopoverController: pc)
      button.title = vc.title
      svc.detail_screen.navigationItem.leftBarButtonItem = button;
    end

    def splitViewController(svc, willShowViewController: vc, invalidatingBarButtonItem: barButtonItem)
      svc.detail_screen.navigationItem.leftBarButtonItem = nil
    end
  end
end
{'fraction_non_alphanumeric': 0.07586438402148372, 'fraction_numerical': 0.0, 'mean_word_length': 3.1274238227146816, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5821290', 'n_tokens_mistral': 854, 'n_tokens_neox': 835, 'n_words': 186}