<commit_before>//
//  Copyright (c) 2014-2016 Actor LLC. <https://actor.im>
//

import Foundation
import JDStatusBarNotification
import PushKit
import SafariServices
import DZNWebViewController

@objc public class ActorSDK: NSObject, PKPushRegistryDelegate {

    //
    // Shared instance
    //
    
    private static let shared =  ActorSDK()
    
    public static func sharedActor() -> ActorSDK {
        return shared
    }
    
    //
    //  Root Objects
    //
    
    /// Main Messenger object
    public var messenger : ACCocoaMessenger!
    
    // Actor Style
    public let style = ActorStyle()
    
    /// SDK Delegate
    public var delegate: ActorSDKDelegate = ActorSDKDelegateDefault()
    
    /// SDK Analytics
    public var analyticsDelegate: ActorSDKAnalytics?
    
    //
    //  Configuration
    //

    /// Server Endpoints
    public var endpoints = [
        "tcp://front1-mtproto-api-rev3.actor.im:443",
        "tcp://front2-mtproto-api-rev3.actor.im:443"
    ] {
        didSet {
            trustedKeys = []
        }
    }
    
    /// Trusted Server Keys
    public var trustedKeys = [
        "d9d34ed487bd5b434eda2ef2c283db587c3ae7fb88405c3834d9d1a6d247145b",
        "<KEY>",
        "<KEY>",
        "<KEY>",
        "fc49f2f2465f5b4e038ec7c070975858a8b5542aa6ec1f927a57c4f646e1c143",
        "6709b8b733a9f20a96b9091767ac19fd6a2a978ba0dccc85a9ac8f6b6560ac1a"
    ]
    
    /// API ID
    public var apiId = 2
    
    /// API Key
    public var apiKey = "2ccdc3699149eac0a13926c77ca84e504afd68b4f399602e06d68002ace965a3"
    
    /// Push registration mode
    public var autoPushMode = AAAutoPush.AfterLogin
    
    /// Push token registration id. Required for sending push tokens
    public var apiPushId: Int? = nil
    
    /// Strategy about authentication
    public var authStrategy = AAAuthStrategy.PhoneOnly
    
    /// Enable phone book import
    public var enablePhoneBookImport = true
    
    /// Invitation URL for apps
    public var inviteUrl: String = "https://actor.im/dl"

    /// Privacy Policy URL
    public var privacyPolicyUrl: String? = nil

    /// Privacy Policy Text
    public var privacyPolicyText: String? = nil
    
    /// Terms of Service URL
    public var termsOfServiceUrl: String? = nil
    
    /// Terms of Service Text
    public var termsOfServiceText: String? = nil
    
    /// App name
    public var appName: String = "Actor"
    
    /// Use background on welcome screen
    public var useBackgroundOnWelcomeScreen: Bool? = false
    
    /// Support email
    public var supportEmail: String? = nil
    
    /// Support email
    public var supportActivationEmail: String? = nil
    
    /// Support account
    public var supportAccount: String? = nil
    
    /// Support home page
    public var supportHomepage: String? = "https://actor.im"

    /// Support account
    public var supportTwitter: String? = "actorapp"

    /// Invite url scheme
    public var inviteUrlScheme: String? = nil
    
    /// Web Invite Domain host
    public var inviteUrlHost: String? = nil

    /// Enable voice calls feature
    public var enableCalls: Bool = true
    
    
    /// Enable experimental features
    public var enableExperimentalFeatures: Bool = false
    
    //
    // User Onlines
    //
    
    /// Is User online
    private(set) public var isUserOnline = false
    
    /// Disable this if you want manually handle online states
    public var automaticOnlineHandling = true
    
    //
    // Internal State
    //
    
    /// Is Actor Started
    private(set) public var isStarted = false
    
    private var binder = AABinder()
    private var syncTask: UIBackgroundTaskIdentifier?
    private var completionHandler: ((UIBackgroundFetchResult) -> Void)?
    
    // View Binding info
    private(set) public var bindedToWindow: UIWindow!
    
    // Reachability
    private var reachability: Reachability!
    
    
    public init() {
        
        // Auto Loading Application name
        if let name = NSBundle.mainBundle().objectForInfoDictionaryKey(String(kCFBundleNameKey)) as? String {
            self.appName = name
        }
    }
    
    public func createActor() {
        
        if isStarted {
            return
        }
        isStarted = true
        
        AAActorRuntime.configureRuntime()
        
        let builder = ACConfigurationBuilder()
        
        // Api Connections
        let deviceKey = NSUUID().UUIDString
        let deviceName = UIDevice.currentDevice().name
        let appTitle = "Actor iOS"<commit_msg>fix(iOS): Fixing SDK init<commit_after>//
//  Copyright (c) 2014-2016 Actor LLC. <https://actor.im>
//

import Foundation
import JDStatusBarNotification
import PushKit
import SafariServices
import DZNWebViewController

@objc public class ActorSDK: NSObject, PKPushRegistryDelegate {

    //
    // Shared instance
    //
    
    private static let shared =  ActorSDK()
    
    public static func sharedActor() -> ActorSDK {
        return shared
    }
    
    //
    //  Root Objects
    //
    
    /// Main Messenger object
    public var messenger : ACCocoaMessenger!
    
    // Actor Style
    public let style = ActorStyle()
    
    /// SDK Delegate
    public var delegate: ActorSDKDelegate = ActorSDKDelegateDefault()
    
    /// SDK Analytics
    public var analyticsDelegate: ActorSDKAnalytics?
    
    //
    //  Configuration
    //

    /// Server Endpoints
    public var endpoints = [
        "tcp://front1-mtproto-api-rev3.actor.im:443",
        "tcp://front2-mtproto-api-rev3.actor.im:443"
    ] {
        didSet {
            trustedKeys = []
        }
    }
    
    /// Trusted Server Keys
    public var trustedKeys = [
        "d9d34ed487bd5b434eda2ef2c283db587c3ae7fb88405c3834d9d1a6d247145b",
        "<KEY>",
        "<KEY>",
        "<KEY>",
        "fc49f2f2465f5b4e038ec7c070975858a8b5542aa6ec1f927a57c4f646e1c143",
        "6709b8b733a9f20a96b9091767ac19fd6a2a978ba0dccc85a9ac8f6b6560ac1a"
    ]
    
    /// API ID
    public var apiId = 2
    
    /// API Key
    public var apiKey = "2ccdc3699149eac0a13926c77ca84e504afd68b4f399602e06d68002ace965a3"
    
    /// Push registration mode
    public var autoPushMode = AAAutoPush.AfterLogin
    
    /// Push token registration id. Required for sending push tokens
    public var apiPushId: Int? = nil
    
    /// Strategy about authentication
    public var authStrategy = AAAuthStrategy.PhoneOnly
    
    /// Enable phone book import
    public var enablePhoneBookImport = true
    
    /// Invitation URL for apps
    public var inviteUrl: String = "https://actor.im/dl"

    /// Privacy Policy URL
    public var privacyPolicyUrl: String? = nil

    /// Privacy Policy Text
    public var privacyPolicyText: String? = nil
    
    /// Terms of Service URL
    public var termsOfServiceUrl: String? = nil
    
    /// Terms of Service Text
    public var termsOfServiceText: String? = nil
    
    /// App name
    public var appName: String = "Actor"
    
    /// Use background on welcome screen
    public var useBackgroundOnWelcomeScreen: Bool? = false
    
    /// Support email
    public var supportEmail: String? = nil
    
    /// Support email
    public var supportActivationEmail: String? = nil
    
    /// Support account
    public var supportAccount: String? = nil
    
    /// Support home page
    public var supportHomepage: String? = "https://actor.im"

    /// Support account
    public var supportTwitter: String? = "actorapp"

    /// Invite url scheme
    public var inviteUrlScheme: String? = nil
    
    /// Web Invite Domain host
    public var inviteUrlHost: String? = nil

    /// Enable voice calls feature
    public var enableCalls: Bool = true
    
    
    /// Enable experimental features
    public var enableExperimentalFeatures: Bool = false
    
    //
    // User Onlines
    //
    
    /// Is User online
    private(set) public var isUserOnline = false
    
    /// Disable this if you want manually handle online states
    public var automaticOnlineHandling = true
    
    //
    // Internal State
    //
    
    /// Is Actor Started
    private(set) public var isStarted = false
    
    private var binder = AABinder()
    private var syncTask: UIBackgroundTaskIdentifier?
    private var completionHandler: ((UIBackgroundFetchResult) -> Void)?
    
    // View Binding info
    private(set) public var bindedToWindow: UIWindow!
    
    // Reachability
    private var reachability: Reachability!
    
    
    public override init() {
        
        // Auto Loading Application name
        if let name = NSBundle.mainBundle().objectForInfoDictionaryKey(String(kCFBundleNameKey)) as? String {
            self.appName = name
        }
    }
    
    public func createActor() {
        
        if isStarted {
            return
        }
        isStarted = true
        
        AAActorRuntime.configureRuntime()
        
        let builder = ACConfigurationBuilder()
        
        // Api Connections
        let deviceKey = NSUUID().UUIDString
        let deviceName = UIDevice.currentDevice().name
        let appTitle = "Actor iOS"
{'fraction_non_alphanumeric': 0.08208547382227566, 'fraction_numerical': 0.03891135643239698, 'mean_word_length': 2.069439785306944, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 6, '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': '4436961', 'n_tokens_mistral': 2895, 'n_tokens_neox': 2626, 'n_words': 727}