<commit_before>//
//  PushManager.swift
//  Rocket.Chat
//
//  Created by <NAME> on 2017. 1. 23..
//  Copyright © 2017 Rocket.Chat. All rights reserved.
//

import Foundation

class PushManager {

    static let kDeviceTokenKey = "deviceToken"
    static let kPushIdentifierKey = "pushIdentifier"

    static func updatePushToken() {
        guard let deviceToken = getDeviceToken() else { return }
        guard let userIdentifier = AuthManager.isAuthenticated()?.userId else { return }
        
        let request = [
            "msg": "method",
            "method": "raix:push-update",
            "params": [[
                "id": getOrCreatePushId(),
                "userId": userIdentifier,
                "token": ["apn": deviceToken],
                "appName": "main",
                "metadata": [:]
            ]]
        ] as [String : Any]

        SocketManager.send(request)
    }
    
    static func updateUser(_ userIdentifier: String) {
        let request = [
            "msg": "method",<commit_msg>Add final to PushManager, as suggested by <NAME><commit_after>//
//  PushManager.swift
//  Rocket.Chat
//
//  Created by <NAME> on 2017. 1. 23..
//  Copyright © 2017 Rocket.Chat. All rights reserved.
//

import Foundation

final class PushManager {

    static let kDeviceTokenKey = "deviceToken"
    static let kPushIdentifierKey = "pushIdentifier"

    static func updatePushToken() {
        guard let deviceToken = getDeviceToken() else { return }
        guard let userIdentifier = AuthManager.isAuthenticated()?.userId else { return }
        
        let request = [
            "msg": "method",
            "method": "raix:push-update",
            "params": [[
                "id": getOrCreatePushId(),
                "userId": userIdentifier,
                "token": ["apn": deviceToken],
                "appName": "main",
                "metadata": [:]
            ]]
        ] as [String : Any]

        SocketManager.send(request)
    }
    
    static func updateUser(_ userIdentifier: String) {
        let request = [
            "msg": "method",
{'fraction_non_alphanumeric': 0.12183468705207835, 'fraction_numerical': 0.01051122790253225, 'mean_word_length': 1.8882758620689655, 'pattern_counts': {'":': 20, '<': 6, '<?xml version=': 0, '>': 6, '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': '6186223', 'n_tokens_mistral': 609, 'n_tokens_neox': 561, 'n_words': 155}