lint
This commit is contained in:
parent
f2076ea6c8
commit
aafa01c812
|
@ -27,7 +27,7 @@ export const FORGOT_PASSWORD = createRequestTypes('FORGOT_PASSWORD', [
|
||||||
'INIT'
|
'INIT'
|
||||||
]);
|
]);
|
||||||
export const ROOMS = createRequestTypes('ROOMS');
|
export const ROOMS = createRequestTypes('ROOMS');
|
||||||
export const ROOM = createRequestTypes('ROOM', ['ADD_USER_TYPING', 'REMOVE_USER_TYPING', 'USER_TYPING', 'OPEN', 'IM_TYPING']);
|
export const ROOM = createRequestTypes('ROOM', ['ADD_USER_TYPING', 'REMOVE_USER_TYPING', 'SOMEONE_TYPING', 'OPEN', 'USER_TYPING']);
|
||||||
export const APP = createRequestTypes('APP', ['READY', 'INIT']);
|
export const APP = createRequestTypes('APP', ['READY', 'INIT']);
|
||||||
export const MESSAGES = createRequestTypes('MESSAGES', [
|
export const MESSAGES = createRequestTypes('MESSAGES', [
|
||||||
...defaultTypes,
|
...defaultTypes,
|
||||||
|
|
|
@ -8,9 +8,9 @@ export function removeUserTyping(username) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function typing(data) {
|
export function someoneTyping(data) {
|
||||||
return {
|
return {
|
||||||
type: types.ROOM.USER_TYPING,
|
type: types.ROOM.SOMEONE_TYPING,
|
||||||
...data
|
...data
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@ export function openRoom(room) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function imTyping(status = true) {
|
export function userTyping(status = true) {
|
||||||
return {
|
return {
|
||||||
type: types.ROOM.IM_TYPING,
|
type: types.ROOM.USER_TYPING,
|
||||||
status
|
status
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { View, TextInput, StyleSheet, SafeAreaView } from 'react-native';
|
||||||
import Icon from 'react-native-vector-icons/MaterialIcons';
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
||||||
import ImagePicker from 'react-native-image-picker';
|
import ImagePicker from 'react-native-image-picker';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { imTyping } from '../actions/room';
|
import { userTyping } from '../actions/room';
|
||||||
import RocketChat from '../lib/rocketchat';
|
import RocketChat from '../lib/rocketchat';
|
||||||
import { editRequest } from '../actions/messages';
|
import { editRequest } from '../actions/messages';
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ const styles = StyleSheet.create({
|
||||||
editing: state.messages.editing
|
editing: state.messages.editing
|
||||||
}), dispatch => ({
|
}), dispatch => ({
|
||||||
editRequest: message => dispatch(editRequest(message)),
|
editRequest: message => dispatch(editRequest(message)),
|
||||||
typing: status => dispatch(imTyping(status))
|
typing: status => dispatch(userTyping(status))
|
||||||
}))
|
}))
|
||||||
export default class MessageBox extends React.Component {
|
export default class MessageBox extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -49,7 +49,8 @@ export default class MessageBox extends React.Component {
|
||||||
rid: PropTypes.string.isRequired,
|
rid: PropTypes.string.isRequired,
|
||||||
editRequest: PropTypes.func.isRequired,
|
editRequest: PropTypes.func.isRequired,
|
||||||
message: PropTypes.object,
|
message: PropTypes.object,
|
||||||
editing: PropTypes.bool
|
editing: PropTypes.bool,
|
||||||
|
typing: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import reduxStore from './createStore';
|
||||||
import settingsType from '../constants/settings';
|
import settingsType from '../constants/settings';
|
||||||
import realm from './realm';
|
import realm from './realm';
|
||||||
import * as actions from '../actions';
|
import * as actions from '../actions';
|
||||||
import { typing } from '../actions/room';
|
import { someoneTyping } from '../actions/room';
|
||||||
import { disconnect, connectSuccess } from '../actions/connect';
|
import { disconnect, connectSuccess } from '../actions/connect';
|
||||||
|
|
||||||
export { Accounts } from 'react-native-meteor';
|
export { Accounts } from 'react-native-meteor';
|
||||||
|
@ -79,7 +79,7 @@ const RocketChat = {
|
||||||
if (ev !== 'typing') {
|
if (ev !== 'typing') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return reduxStore.dispatch(typing({ _rid, username: ddpMessage.fields.args[0], typing: ddpMessage.fields.args[1] }));
|
return reduxStore.dispatch(someoneTyping({ _rid, username: ddpMessage.fields.args[0], typing: ddpMessage.fields.args[1] }));
|
||||||
}
|
}
|
||||||
if (ddpMessage.collection === 'stream-notify-user') {
|
if (ddpMessage.collection === 'stream-notify-user') {
|
||||||
const [type, data] = ddpMessage.fields.args;
|
const [type, data] = ddpMessage.fields.args;
|
||||||
|
|
|
@ -22,7 +22,7 @@ const watchRoomsRequest = function* watchRoomsRequest() {
|
||||||
const cancelTyping = function* cancelTyping(username) {
|
const cancelTyping = function* cancelTyping(username) {
|
||||||
while (true) {
|
while (true) {
|
||||||
const { typing, timeout } = yield race({
|
const { typing, timeout } = yield race({
|
||||||
typing: take(types.ROOM.USER_TYPING),
|
typing: take(types.ROOM.SOMEONE_TYPING),
|
||||||
timeout: yield call(delay, 5000)
|
timeout: yield call(delay, 5000)
|
||||||
});
|
});
|
||||||
if (timeout || (typing.username === username && !typing.typing)) {
|
if (timeout || (typing.username === username && !typing.typing)) {
|
||||||
|
@ -33,7 +33,7 @@ const cancelTyping = function* cancelTyping(username) {
|
||||||
|
|
||||||
const usersTyping = function* usersTyping({ rid }) {
|
const usersTyping = function* usersTyping({ rid }) {
|
||||||
while (true) {
|
while (true) {
|
||||||
const { _rid, username, typing } = yield take(types.ROOM.USER_TYPING);
|
const { _rid, username, typing } = yield take(types.ROOM.SOMEONE_TYPING);
|
||||||
if (_rid === rid) {
|
if (_rid === rid) {
|
||||||
yield (typing ? put(addUserTyping(username)) : put(removeUserTyping(username)));
|
yield (typing ? put(addUserTyping(username)) : put(removeUserTyping(username)));
|
||||||
if (typing) {
|
if (typing) {
|
||||||
|
@ -70,7 +70,7 @@ const watchRoomOpen = function* watchRoomOpen({ room }) {
|
||||||
subscriptions.forEach(sub => sub.stop());
|
subscriptions.forEach(sub => sub.stop());
|
||||||
};
|
};
|
||||||
|
|
||||||
const watchImTyping = function* watchImTyping({ status }) {
|
const watchuserTyping = function* watchuserTyping({ status }) {
|
||||||
const auth = yield select(state => state.login.isAuthenticated);
|
const auth = yield select(state => state.login.isAuthenticated);
|
||||||
if (!auth) {
|
if (!auth) {
|
||||||
yield take(types.LOGIN.SUCCESS);
|
yield take(types.LOGIN.SUCCESS);
|
||||||
|
@ -90,7 +90,7 @@ const watchImTyping = function* watchImTyping({ status }) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const root = function* root() {
|
const root = function* root() {
|
||||||
yield takeLatest(types.ROOM.IM_TYPING, watchImTyping);
|
yield takeLatest(types.ROOM.USER_TYPING, watchuserTyping);
|
||||||
yield takeLatest(types.LOGIN.SUCCESS, watchRoomsRequest);
|
yield takeLatest(types.LOGIN.SUCCESS, watchRoomsRequest);
|
||||||
yield takeLatest(types.ROOM.OPEN, watchRoomOpen);
|
yield takeLatest(types.ROOM.OPEN, watchRoomOpen);
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,7 +71,9 @@ export default class RoomView extends React.Component {
|
||||||
server: PropTypes.string,
|
server: PropTypes.string,
|
||||||
Site_Url: PropTypes.string,
|
Site_Url: PropTypes.string,
|
||||||
Message_TimeFormat: PropTypes.string,
|
Message_TimeFormat: PropTypes.string,
|
||||||
loading: PropTypes.bool
|
loading: PropTypes.bool,
|
||||||
|
usersTyping: PropTypes.array,
|
||||||
|
username: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
|
Loading…
Reference in New Issue