<commit_before>import SpriteKit

extension ControllerGame
{
    func showMenu()
    {
        pause()
        stopTimer()
        
        DispatchQueue.main.async
        { [weak self] in
            
            self?.asyncShowMenu()
        }
    }
    
    func pause()
    {
        guard
            
            let view:SKView = self.view as? SKView
            
        else
        {
            return
        }
        
        view.isPaused = true
    }
    
    func resume()
    {
        guard
            
            let view:SKView = self.view as? SKView
            
        else
        {
            return
        }
        
        view.isPaused = false
    }
    
    func exitGame()
    {
        DispatchQueue.main.async
        { [weak self] in
            
            guard
                
                let parent:ControllerParent = self?.parent as? ControllerParent
                
            else
            {
                return
            }
            
            parent.pop(vertical:ControllerParent.Vertical.bottom)
        }
    }
    
    func exitGameAndPostScore()
    {
        postScore()
        exitGame()
    }
    
    //MARK: private
    
    private func asyncShowMenu()
    {
        let alert:UIAlertController = UIAlertController(
            title:nil,
            message:nil,
            preferredStyle:UIAlertControllerStyle.actionSheet)
        
        let actionResume:UIAlertAction = UIAlertAction(
            title:
            String.localized(key:"ControllerGame_menuResume"),
            style:
            UIAlertActionStyle.cancel)
        { [weak self] (action:UIAlertAction) in
            
            self?.resume()
        }
        
        let actionExit:UIAlertAction = UIAlertAction(
            title:
            String.localized(key:"ControllerGame_menuExit"),
            style:
            UIAlertActionStyle.destructive)
        { [weak self] (action:UIAlertAction) in
            
            self?.exitGameAndPostScore()
        }
        
        alert.addAction(actionResume)
        alert.addAction(actionExit)
        
        if let popover:UIPopoverPresentationController = alert.popoverPresentationController
        {
            popover.sourceView = view
            popover.sourceRect = CGRect.zero
            popover.permittedArrowDirections = UIPopoverArrowDirection.up
        }
        
        present(alert, animated:true, completion:nil)
    }
}
<commit_msg>Action resume popover<commit_after>import SpriteKit

extension ControllerGame
{
    func showMenu()
    {
        pause()
        stopTimer()
        
        DispatchQueue.main.async
        { [weak self] in
            
            self?.asyncShowMenu()
        }
    }
    
    func pause()
    {
        guard
            
            let view:SKView = self.view as? SKView
            
        else
        {
            return
        }
        
        view.isPaused = true
    }
    
    func resume()
    {
        guard
            
            let view:SKView = self.view as? SKView
            
        else
        {
            return
        }
        
        view.isPaused = false
    }
    
    func exitGame()
    {
        DispatchQueue.main.async
        { [weak self] in
            
            guard
                
                let parent:ControllerParent = self?.parent as? ControllerParent
                
            else
            {
                return
            }
            
            parent.pop(vertical:ControllerParent.Vertical.bottom)
        }
    }
    
    func exitGameAndPostScore()
    {
        postScore()
        exitGame()
    }
    
    //MARK: private
    
    private func asyncShowMenu()
    {
        let alert:UIAlertController = UIAlertController(
            title:nil,
            message:nil,
            preferredStyle:UIAlertControllerStyle.actionSheet)
        
        let actionResume:UIAlertAction = UIAlertAction(
            title:
            String.localized(key:"ControllerGame_menuResume"),
            style:
            UIAlertActionStyle.cancel)
        { [weak self] (action:UIAlertAction) in
            
            self?.resume()
        }
        
        let actionExit:UIAlertAction = UIAlertAction(
            title:
            String.localized(key:"ControllerGame_menuExit"),
            style:
            UIAlertActionStyle.destructive)
        { [weak self] (action:UIAlertAction) in
            
            self?.exitGameAndPostScore()
        }
        
        alert.addAction(actionResume)
        alert.addAction(actionExit)
        
        if let popover:UIPopoverPresentationController = alert.popoverPresentationController
        {
            let actionResumePopOver:UIAlertAction = UIAlertAction(
                title:
                String.localized(key:"ControllerGame_menuResume"),
                style:
                UIAlertActionStyle.default)
            { [weak self] (action:UIAlertAction) in
                
                self?.resume()
            }
            
            alert.addAction(actionResumePopOver)
            
            let rect:CGRect = CGRect(
                x:view.frame.midX,
                y:0,
                width:1,
                height:1)
            
            popover.sourceView = view
            popover.sourceRect = rect
            popover.permittedArrowDirections = UIPopoverArrowDirection.up
        }
        
        present(alert, animated:true, completion:nil)
    }
}

{'fraction_non_alphanumeric': 0.06889050036258158, 'fraction_numerical': 0.0005438723712835388, 'mean_word_length': 1.1858161648177497, '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': '6984010', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1402, 'n_words': 234}