<commit_before>//
//  PresentRouteSegmentPresenter.swift
//  IVGRouter
//
//  Created by <NAME> on 1/27/17.
//  Copyright © 2016 Ivy Gulch LLC. All rights reserved.
//

import UIKit

open class PresentRouteSegmentPresenter : BaseRouteSegmentPresenter, VisualRouteSegmentPresenterType, ReversibleRouteSegmentPresenterType {

    public static let autoDismissPresenterIdentifier = Identifier(name: String(describing: PresentRouteSegmentPresenter.self) + ".autoDismiss")
    public static let fromRootPresenterIdentifier = Identifier(name: String(describing: PresentRouteSegmentPresenter.self) + ".fromRoot")
    public static let defaultPresenterIdentifier = Identifier(name: String(describing: PresentRouteSegmentPresenter.self))

    private var isAutoDismiss: Bool { return presenterIdentifier == PresentRouteSegmentPresenter.autoDismissPresenterIdentifier }
    private var isFromRoot: Bool { return presenterIdentifier == PresentRouteSegmentPresenter.fromRootPresenterIdentifier }

    open func present(viewController presentedViewController : UIViewController, from presentingViewController: UIViewController?, options: RouteSequenceOptions, window: UIWindow?, completion: @escaping ((RoutingResult) -> Void)) {
        var usePresentingViewController = presentingViewController
        if isFromRoot {
            while usePresentingViewController?.parent != nil {
                usePresentingViewController = usePresentingViewController?.parent
            }
        }
        guard verify(checkNotNil(usePresentingViewController, "presentingViewController"), completion: completion),
            let parentViewController = usePresentingViewController else {
                return
        }

        presentedViewController.modalPresentationStyle = .overCurrentContext<commit_msg>Add options for PresentRouteSegmentPresenter<commit_after>//
//  PresentRouteSegmentPresenter.swift
//  IVGRouter
//
//  Created by <NAME> on 1/27/17.
//  Copyright © 2016 Ivy Gulch LLC. All rights reserved.
//

import UIKit

public struct PresentRouteSegmentPresenterOptions {
    public static let modalPresentationStyleKey = "modalPresentationStyle"
}

open class PresentRouteSegmentPresenter : BaseRouteSegmentPresenter, VisualRouteSegmentPresenterType, ReversibleRouteSegmentPresenterType {

    public static let autoDismissPresenterIdentifier = Identifier(name: String(describing: PresentRouteSegmentPresenter.self) + ".autoDismiss")
    public static let fromRootPresenterIdentifier = Identifier(name: String(describing: PresentRouteSegmentPresenter.self) + ".fromRoot")
    public static let defaultPresenterIdentifier = Identifier(name: String(describing: PresentRouteSegmentPresenter.self))

    private var isAutoDismiss: Bool { return presenterIdentifier == PresentRouteSegmentPresenter.autoDismissPresenterIdentifier }
    private var isFromRoot: Bool { return presenterIdentifier == PresentRouteSegmentPresenter.fromRootPresenterIdentifier }

    open func present(viewController presentedViewController : UIViewController, from presentingViewController: UIViewController?, options: RouteSequenceOptions, window: UIWindow?, completion: @escaping ((RoutingResult) -> Void)) {
        var usePresentingViewController = presentingViewController
        if isFromRoot {
            while usePresentingViewController?.parent != nil {
                usePresentingViewController = usePresentingViewController?.parent
            }
        }
        guard verify(checkNotNil(usePresentingViewController, "presentingViewController"), completion: completion),
            let parentViewController = usePresentingViewController else {
                return
        }

        var modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
        if let value = options[PresentRouteSegmentPresenterOptions.modalPresentationStyleKey] as? Int,
            let style = UIModalPresentationStyle(rawValue: value) {
            modalPresentationStyle = style
        }
        presentedViewController.modalPresentationStyle = modalPresentationStyle
{'fraction_non_alphanumeric': 0.06548060291574005, 'fraction_numerical': 0.004447739065974796, 'mean_word_length': 4.637883008356546, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3954846', 'n_tokens_mistral': 978, 'n_tokens_neox': 907, 'n_words': 225}