<commit_before>let React = require('react-native')

let {
    NativeModules,
    NativeAppEventEmitter,
    Platform
} = React

let {
    TwilioIPMessagingClient,
    TwilioIPMessagingChannels,
    TwilioIPMessagingMessages,
    TwilioIPMessagingMembers
} = NativeModules

let Message = require('./Message')

class Channel {
    constructor(props) {
        this.sid = props.sid
        this.friendlyName = props.friendlyName
        this.uniqueName = props.uniqueName
        this.synchronizationStatus = props.synchronizationStatus
        this.status = props.status
        this.type = props.type
        this.attributes = props.attributes
                
        this.onSynchronizationStatusChanged = null
        this.onChanged = null
        this.onDeleted = null
        this.onMemberJoined = null
        this.onMemberChanged = null
        this.onMemberLeft = null
        this.onMessageAdded = null
        this.onMessageChanged = null
        this.onMessageDeleted = null
        this.onTypingStarted = null
        this.onTypingEnded = null
        this.onToastReceived = null
        
        // event handlers
        this._channelSynchronizationStatusChangedSubscription = NativeAppEventEmitter.addListener(
            'ipMessagingClient:channel:synchronizationStatusChanged',
            ({channelSid, status}) => {
                if (channelSid == this.sid && this.onSynchronizationStatusChanged) this.onSynchronizationStatusChanged(status)
            }
        )
        
        this._channelChangedSubscription = NativeAppEventEmitter.addListener(
            'ipMessagingClient:channelChanged',
            (channel) => {
                if (channel.sid == this.sid && this.onChanged) {
                    this.sid = channel.sid
                    this.friendlyName = channel.friendlyName
                    this.uniqueName = channel.uniqueName
                    this.synchronizationStatus = channel.synchronizationStatus
                    this.status = channel.status
                    this.type = channel.type
                    this.attributes = channel.attributes
                    this.dateCreated = channel.dateCreated
                    this.dateUpdated = channel.dateUpdated
                    this.onChanged()
                }
            }
        )
        
        this._channelDeletedSubscription = NativeAppEventEmitter.addListener(
            'ipMessagingClient:channelDeleted',
            (channel) => {
                if (channel.sid == this.sid && this.onDeleted) this.onDeleted()
            }
        )
        <commit_msg>Initiating the dates as Date types<commit_after>let React = require('react-native')

let {
    NativeModules,
    NativeAppEventEmitter,
    Platform
} = React

let {
    TwilioIPMessagingClient,
    TwilioIPMessagingChannels,
    TwilioIPMessagingMessages,
    TwilioIPMessagingMembers
} = NativeModules

let Message = require('./Message')

class Channel {
    constructor(props) {
        this.sid = props.sid
        this.friendlyName = props.friendlyName
        this.uniqueName = props.uniqueName
        this.synchronizationStatus = props.synchronizationStatus
        this.status = props.status
        this.type = props.type
        this.attributes = props.attributes
                
        this.onSynchronizationStatusChanged = null
        this.onChanged = null
        this.onDeleted = null
        this.onMemberJoined = null
        this.onMemberChanged = null
        this.onMemberLeft = null
        this.onMessageAdded = null
        this.onMessageChanged = null
        this.onMessageDeleted = null
        this.onTypingStarted = null
        this.onTypingEnded = null
        this.onToastReceived = null
        
        // event handlers
        this._channelSynchronizationStatusChangedSubscription = NativeAppEventEmitter.addListener(
            'ipMessagingClient:channel:synchronizationStatusChanged',
            ({channelSid, status}) => {
                if (channelSid == this.sid && this.onSynchronizationStatusChanged) this.onSynchronizationStatusChanged(status)
            }
        )
        
        this._channelChangedSubscription = NativeAppEventEmitter.addListener(
            'ipMessagingClient:channelChanged',
            (channel) => {
                if (channel.sid == this.sid && this.onChanged) {
                    this.sid = channel.sid
                    this.friendlyName = channel.friendlyName
                    this.uniqueName = channel.uniqueName
                    this.synchronizationStatus = channel.synchronizationStatus
                    this.status = channel.status
                    this.type = channel.type
                    this.attributes = channel.attributes
                    this.dateCreated = new Date(channel.dateCreated)
                    this.dateUpdated = new Date(channel.dateUpdated)
                    this.onChanged()
                }
            }
        )
        
        this._channelDeletedSubscription = NativeAppEventEmitter.addListener(
            'ipMessagingClient:channelDeleted',
            (channel) => {
                if (channel.sid == this.sid && this.onDeleted) this.onDeleted()
            }
        )
        
{'fraction_non_alphanumeric': 0.07404565509303664, 'fraction_numerical': 0.0, 'mean_word_length': 1.8774834437086092, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4688758', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1282, 'n_words': 219}