<commit_before>import config from '../config/config'
import strings from '../resources/translations'
import {Alert} from 'react-native'

export const SEND_STOPREQUEST = 'SEND_STOPREQUEST'
export const RECEIVE_CONFIRM = 'RECEIVE_CONFIRM'
export const REQUEST_ERROR = 'REQUEST_ERROR'
export const SET_STOPREQUEST_REQUEST_ID_FROM = 'SET_STOPREQUEST_REQUEST_ID_FROM'
export const SET_STOPREQUEST_REQUEST_ID_DESTINATION = 'SET_STOPREQUEST_REQUEST_ID_DESTINATION'

const API_ENDPOINT = '/stoprequests'

export let requestStoprequest = function(tripId, stopId)
{
    return {
        type: SEND_STOPREQUEST,
        sentStoprequest: false,
        trip_id: tripId,
        stop_id: stopId
    }
}

export let receiveConfirm = function(vehicle, stop, fromVehicle)
{
    return {
        type: RECEIVE_CONFIRM,
        sentStoprequest: true,
        vehicle: vehicle,
        stop: stop,
        fromVehicle: fromVehicle,
        error: false
    }
}

export let requestError = function()
{
    Alert.alert(
        'Error',
        strings.stopRequestError,
        [
            {text: 'OK', onPress: () => console.log('confirmed server error')}
        ],
        {
        cancelable: false
        }
    )

    return {
        type: REQUEST_ERROR,
        error: true
    }
}

export let sendStoprequest = function(vehicle, stop, fcmToken, fromVehicle)
{
    return dispatch =>
    {
        dispatch(requestStoprequest(vehicle.trip_id, stop.stopId))<commit_msg>renamed sentStoprequest to stopRequestSent<commit_after>import config from '../config/config'
import strings from '../resources/translations'
import {Alert} from 'react-native'

export const SEND_STOPREQUEST = 'SEND_STOPREQUEST'
export const RECEIVE_CONFIRM = 'RECEIVE_CONFIRM'
export const REQUEST_ERROR = 'REQUEST_ERROR'
export const SET_STOPREQUEST_REQUEST_ID_FROM = 'SET_STOPREQUEST_REQUEST_ID_FROM'
export const SET_STOPREQUEST_REQUEST_ID_DESTINATION = 'SET_STOPREQUEST_REQUEST_ID_DESTINATION'

const API_ENDPOINT = '/stoprequests'

export let requestStoprequest = function(tripId, stopId)
{
    return {
        type: SEND_STOPREQUEST,
        stopRequestSent: false,
        trip_id: tripId,
        stop_id: stopId
    }
}

export let receiveConfirm = function(vehicle, stop, fromVehicle)
{
    return {
        type: RECEIVE_CONFIRM,
        stopRequestSent: true,
        vehicle: vehicle,
        stop: stop,
        fromVehicle: fromVehicle,
        error: false
    }
}

export let requestError = function()
{
    Alert.alert(
        'Error',
        strings.stopRequestError,
        [
            {text: 'OK', onPress: () => console.log('confirmed server error')}
        ],
        {
        cancelable: false
        }
    )

    return {
        type: REQUEST_ERROR,
        error: true
    }
}

export let sendStoprequest = function(vehicle, stop, fcmToken, fromVehicle)
{
    return dispatch =>
    {
        dispatch(requestStoprequest(vehicle.trip_id, stop.stopId))
{'fraction_non_alphanumeric': 0.08890397013912453, 'fraction_numerical': 0.0, 'mean_word_length': 3.0273224043715845, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7223561', 'n_tokens_mistral': 911, 'n_tokens_neox': 898, 'n_words': 200}