Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/containers/MessageBox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,13 +738,15 @@ class MessageBox extends Component {
Q.where('id', Q.like(`${ Q.sanitizeLikeString(command) }%`))
).fetch();
if (slashCommand.length > 0) {
logEvent(events.COMMAND_RUN);
try {
const messageWithoutCommand = message.replace(/([^\s]+)/, '').trim();
const [{ appId }] = slashCommand;
const triggerId = generateTriggerId(appId);
RocketChat.runSlashCommand(command, roomId, messageWithoutCommand, triggerId, tmid || messageTmid);
replyCancel();
} catch (e) {
logEvent(events.COMMAND_RUN_F);
log(e);
}
this.clearInput();
Expand Down
2 changes: 2 additions & 0 deletions app/containers/markdown/AtMention.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Text } from 'react-native';
import { themes } from '../../constants/colors';

import styles from './styles';
import { logEvent, events } from '../../utils/log';

const AtMention = React.memo(({
mention, mentions, username, navToRoomInfo, style = [], useRealName, theme
Expand Down Expand Up @@ -41,6 +42,7 @@ const AtMention = React.memo(({
const user = mentions && mentions.length && mentions.find(m => m.username === mention);

const handlePress = () => {
logEvent(events.ROOM_MENTION_GO_USER_INFO);
const navParam = {
t: 'd',
rid: user && user._id
Expand Down
4 changes: 3 additions & 1 deletion app/lib/methods/callJitsi.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import reduxStore from '../createStore';
import Navigation from '../Navigation';
import { logEvent, events } from '../../utils/log';

async function jitsiURL({ rid }) {
const { settings } = reduxStore.getState();
Expand All @@ -24,14 +25,15 @@ async function jitsiURL({ rid }) {
const accessToken = await this.methodCallWrapper('jitsi:generateAccessToken', rid);
queryString = `?jwt=${ accessToken }`;
} catch {
// do nothing
logEvent(events.RA_JITSI_F);
}
}

return `${ protocol }${ domain }${ prefix }${ uniqueIdentifier }${ rid }${ queryString }`;
}

async function callJitsi(rid, onlyAudio = false) {
logEvent(onlyAudio ? events.RA_JITSI_AUDIO : events.RA_JITSI_VIDEO);
const url = await jitsiURL.call(this, { rid });
Navigation.navigate('JitsiMeetView', { url, onlyAudio, rid });
}
Expand Down
6 changes: 5 additions & 1 deletion app/sagas/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Navigation from '../lib/Navigation';
import * as types from '../actions/actionsTypes';
import { removedRoom } from '../actions/room';
import RocketChat from '../lib/rocketchat';
import log from '../utils/log';
import log, { logEvent, events } from '../utils/log';
import I18n from '../i18n';
import { showErrorAlert } from '../utils/info';

Expand Down Expand Up @@ -48,12 +48,14 @@ const handleRemovedRoom = function* handleRemovedRoom() {
};

const handleLeaveRoom = function* handleLeaveRoom({ rid, t }) {
logEvent(events.RA_LEAVE);
try {
const result = yield RocketChat.leaveRoom(rid, t);
if (result.success) {
yield handleRemovedRoom();
}
} catch (e) {
logEvent(events.RA_LEAVE_F);
if (e.data && e.data.errorType === 'error-you-are-last-owner') {
Alert.alert(I18n.t('Oops'), I18n.t(e.data.errorType));
} else {
Expand All @@ -63,12 +65,14 @@ const handleLeaveRoom = function* handleLeaveRoom({ rid, t }) {
};

const handleDeleteRoom = function* handleDeleteRoom({ rid, t }) {
logEvent(events.RI_EDIT_DELETE);
try {
const result = yield RocketChat.deleteRoom(rid, t);
if (result.success) {
yield handleRemovedRoom();
}
} catch (e) {
logEvent(events.RI_EDIT_DELETE_F);
Alert.alert(I18n.t('Oops'), I18n.t('There_was_an_error_while_action', { action: I18n.t('deleting_room') }));
}
};
Expand Down
117 changes: 103 additions & 14 deletions app/utils/log/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ export default {
ENTER_WITH_APPLE_F: 'enter_with_apple_f',

// SIDEBAR VIEW
SIDEBAR_NAVIGATE_TO_STATUS: 'sidebar_navigate_to_status',
SIDEBAR_NAVIGATE_TO_CHATS: 'sidebar_navigate_to_chats',
SIDEBAR_NAVIGATE_TO_PROFILE: 'sidebar_navigate_to_profile',
SIDEBAR_NAVIGATE_TO_SETTINGS: 'sidebar_navigate_to_settings',
SIDEBAR_NAVIGATE_TO_ADMINPANEL: 'sidebar_navigate_to_admin_panel',
SIDEBAR_GO_STATUS: 'sidebar_go_status',
SIDEBAR_GO_CHATS: 'sidebar_go_chats',
SIDEBAR_GO_PROFILE: 'sidebar_go_profile',
SIDEBAR_GO_SETTINGS: 'sidebar_go_settings',
SIDEBAR_GO_ADMINPANEL: 'sidebar_go_admin_panel',

// STATUS VIEW
STATUS_DONE: 'status_done',
Expand All @@ -57,11 +57,11 @@ export default {
RL_TOGGLE_SERVER_DROPDOWN: 'rl_toggle_server_dropdown',
RL_ADD_SERVER: 'rl_add_server',
RL_CHANGE_SERVER: 'rl_change_server',
RL_NAVIGATE_TO_NEW_MSG: 'rl_navigate_to_new_msg',
RL_GO_NEW_MSG: 'rl_go_new_msg',
RL_SEARCH: 'rl_search',
RL_NAVIGATE_TO_DIRECTORY: 'rl_navigate_to_directory',
RL_GO_DIRECTORY: 'rl_go_directory',
RL_GO_QUEUE: 'rl_go_queue',
RL_GO_TO_ROOM: 'rl_go_to_room',
RL_GO_ROOM: 'rl_go_room',
RL_FAVORITE_CHANNEL: 'rl_favorite_channel',
RL_UNFAVORITE_CHANNEL: 'rl_unfavorite_channel',
RL_TOGGLE_FAVORITE_F: 'rl_toggle_favorite_f',
Expand All @@ -78,6 +78,7 @@ export default {
RL_GROUP_CHANNELS_BY_FAVORITE: 'rl_group_channels_by_favorite',
RL_GROUP_CHANNELS_BY_UNREAD: 'rl_group_channels_by_unread',

// QUEUE LIST VIEW
QL_GO_ROOM: 'ql_go_room',

// DIRECTORY VIEW
Expand Down Expand Up @@ -122,14 +123,14 @@ export default {
// SETTINGS VIEW
SE_CONTACT_US: 'se_contact_us',
SE_CONTACT_US_F: 'se_contact_us_f',
SE_NAVIGATE_TO_LANGUAGE: 'se_navigate_to_language',
SE_GO_LANGUAGE: 'se_go_language',
SE_REVIEW_THIS_APP: 'se_review_this_app',
SE_REVIEW_THIS_APP_F: 'se_review_this_app_f',
SE_SHARE_THIS_APP: 'se_share_this_app',
SE_NAVIGATE_TO_DEFAULTBROWSER: 'se_navigate_to_default_browser',
SE_NAVIGATE_TO_THEME: 'se_navigate_to_theme',
SE_NAVIGATE_TO_SCREENLOCKCONFIG: 'se_navigate_to_screen_lock_cfg',
SE_NAVIGATE_TO_PROFILE: 'se_navigate_to_profile',
SE_GO_DEFAULTBROWSER: 'se_go_default_browser',
SE_GO_THEME: 'se_go_theme',
SE_GO_SCREENLOCKCONFIG: 'se_go_screen_lock_cfg',
SE_GO_PROFILE: 'se_go_profile',
SE_READ_LICENSE: 'se_read_license',
SE_COPY_APP_VERSION: 'se_copy_app_version',
SE_COPY_SERVER_VERSION: 'se_copy_server_version',
Expand Down Expand Up @@ -197,5 +198,93 @@ export default {
ROOM_MSG_ACTION_REACTION: 'room_msg_action_reaction',
ROOM_MSG_ACTION_REPORT: 'room_msg_action_report',
ROOM_MSG_ACTION_REPORT_F: 'room_msg_action_report_f',
ROOM_JOIN: 'room_join'
ROOM_JOIN: 'room_join',
ROOM_GO_RA: 'room_go_ra',
ROOM_TOGGLE_FOLLOW_THREADS: 'room_toggle_follow_threads',
ROOM_GO_SEARCH: 'room_go_search',
ROOM_GO_THREADS: 'room_go_threads',
ROOM_GO_ROOM_INFO: 'room_go_room_info',
ROOM_GO_USER_INFO: 'room_go_user_info',
ROOM_MENTION_GO_USER_INFO: 'room_mention_go_user_info',
COMMAND_RUN: 'command_run',
COMMAND_RUN_F: 'command_run_f',

// ROOM ACTIONS VIEW
RA_JITSI_VIDEO: 'ra_jitsi_video',
RA_JITSI_AUDIO: 'ra_jitsi_audio',
RA_JITSI_F: 'ra_jitsi_f',
RA_GO_ROOMINFO: 'ra_go_room_info',
RA_GO_ROOMMEMBERS: 'ra_go_room_members',
RA_GO_SELECTEDUSERS: 'ra_go_selected_users',
RA_GO_INVITEUSERS: 'ra_go_invite_users',
RA_GO_MESSAGESFILES: 'ra_go_messages_files',
RA_GO_MESSAGESMENTIONS: 'ra_go_messages_mentions',
RA_GO_MESSAGESSTARRED: 'ra_go_messages_starred',
RA_GO_SEARCHMESSAGES: 'ra_go_search_messages',
RA_GO_MESSAGESPINNED: 'ra_go_messages_pinned',
RA_GO_AUTOTRANSLATE: 'ra_go_autotranslate',
RA_GO_NOTIFICATIONPREF: 'ra_go_notification_pref',
RA_GO_FORWARDLIVECHAT: 'ra_go_forward_livechat',
RA_GO_VISITORNAVIGATION: 'ra_go_visitor_navigation',
RA_SHARE: 'ra_share',
RA_LEAVE: 'ra_leave',
RA_LEAVE_F: 'ra_leave_f',
RA_TOGGLE_BLOCK_USER: 'ra_toggle_block_user',
RA_TOGGLE_BLOCK_USER_F: 'ra_toggle_block_user_f',

// ROOM INFO VIEW
RI_GO_RI_EDIT: 'ri_go_ri_edit',
RI_GO_LIVECHAT_EDIT: 'ri_go_livechat_edit',
RI_GO_ROOM_USER: 'ri_go_room_user',

// ROOM INFO EDIT VIEW
RI_EDIT_TOGGLE_ROOM_TYPE: 'ri_edit_toggle_room_type',
RI_EDIT_TOGGLE_READ_ONLY: 'ri_edit_toggle_read_only',
RI_EDIT_TOGGLE_REACTIONS: 'ri_edit_toggle_reactions',
RI_EDIT_TOGGLE_SYSTEM_MSG: 'ri_edit_toggle_system_msg',
RI_EDIT_SAVE: 'ri_edit_save',
RI_EDIT_SAVE_F: 'ri_edit_save_f',
RI_EDIT_RESET: 'ri_edit_reset',
RI_EDIT_TOGGLE_ARCHIVE: 'ri_edit_toggle_archive',
RI_EDIT_TOGGLE_ARCHIVE_F: 'ri_edit_toggle_archive_f',
RI_EDIT_DELETE: 'ri_edit_delete',
RI_EDIT_DELETE_F: 'ri_edit_delete_f',

// JITSI MEET VIEW
JM_CONFERENCE_JOIN: 'jm_conference_join',
JM_CONFERENCE_TERMINATE: 'jm_conference_terminate',

// INVITE USERS VIEW
IU_SHARE: 'iu_share',
IU_GO_IU_EDIT: 'iu_go_iu_edit',

// INVITE USERS EDIT VIEW
IU_EDIT_SET_LINK_PARAM: 'iu_edit_set_link_param',
IU_EDIT_CREATE_LINK: 'iu_edit_create_link',

// AUTO TRANSLATE VIEW
AT_TOGGLE_TRANSLATE: 'at_toggle_translate',
AT_TOGGLE_TRANSLATE_F: 'at_toggle_translate_f',
AT_SET_LANG: 'at_set_lang',
AT_SET_LANG_F: 'at_set_lang_f',

// NOTIFICATION PREFERENCES VIEW
NP_DISABLENOTIFICATIONS: 'np_disable_notification',
NP_DISABLENOTIFICATIONS_F: 'np_disable_notification_f',
NP_MUTEGROUPMENTIONS: 'np_mute_group_mentions',
NP_MUTEGROUPMENTIONS_F: 'np_mute_group_mentions_f',
NP_HIDEUNREADSTATUS: 'np_hide_unread_status',
NP_HIDEUNREADSTATUS_F: 'np_hide_unread_status_f',
NP_DESKTOPNOTIFICATIONS: 'np_desktop_notifications',
NP_DESKTOPNOTIFICATIONS_F: 'np_desktop_notifications_f',
NP_MOBILEPUSHNOTIFICATIONS: 'np_mobile_push_notifications',
NP_MOBILEPUSHNOTIFICATIONS_F: 'np_mobile_push_notifications_f',
NP_AUDIONOTIFICATIONS: 'np_audio_notifications',
NP_AUDIONOTIFICATIONS_F: 'np_audio_notifications_f',
NP_AUDIONOTIFICATIONVALUE: 'np_audio_notification_value',
NP_AUDIONOTIFICATIONVALUE_F: 'np_audio_notification_value_f',
NP_DESKTOPNOTIFICATIONDURATION: 'np_desktopnotificationduration',
NP_DESKTOPNOTIFICATIONDURATION_F: 'np_desktopnotificationduration_f',
NP_EMAILNOTIFICATIONS: 'np_email_notifications',
NP_EMAILNOTIFICATIONS_F: 'np_email_notifications_f'
};
5 changes: 5 additions & 0 deletions app/views/AutoTranslateView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors';
import scrollPersistTaps from '../../utils/scrollPersistTaps';
import { withTheme } from '../../theme';
import SafeAreaView from '../../containers/SafeAreaView';
import { logEvent, events } from '../../utils/log';

const styles = StyleSheet.create({
contentContainerStyle: {
Expand Down Expand Up @@ -103,6 +104,7 @@ class AutoTranslateView extends React.Component {
}

toggleAutoTranslate = async() => {
logEvent(events.AT_TOGGLE_TRANSLATE);
const { enableAutoTranslate } = this.state;
try {
await RocketChat.saveAutoTranslate({
Expand All @@ -113,11 +115,13 @@ class AutoTranslateView extends React.Component {
});
this.setState({ enableAutoTranslate: !enableAutoTranslate });
} catch (error) {
logEvent(events.AT_TOGGLE_TRANSLATE_F);
console.log(error);
}
}

saveAutoTranslateLanguage = async(language) => {
logEvent(events.AT_SET_LANG);
try {
await RocketChat.saveAutoTranslate({
rid: this.rid,
Expand All @@ -126,6 +130,7 @@ class AutoTranslateView extends React.Component {
});
this.setState({ selectedLanguage: language });
} catch (error) {
logEvent(events.AT_SET_LANG_F);
console.log(error);
}
}
Expand Down
3 changes: 3 additions & 0 deletions app/views/InviteUsersEditView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { themes } from '../../constants/colors';
import { withTheme } from '../../theme';
import Separator from '../../containers/Separator';
import SafeAreaView from '../../containers/SafeAreaView';
import { logEvent, events } from '../../utils/log';

const OPTIONS = {
days: [{
Expand Down Expand Up @@ -72,6 +73,7 @@ class InviteUsersView extends React.Component {
}

onValueChangePicker = (key, value) => {
logEvent(events.IU_EDIT_SET_LINK_PARAM);
const { inviteLinksSetParams } = this.props;
const params = {
[key]: value
Expand All @@ -80,6 +82,7 @@ class InviteUsersView extends React.Component {
}

createInviteLink = () => {
logEvent(events.IU_EDIT_CREATE_LINK);
const { createInviteLink, navigation } = this.props;
createInviteLink(this.rid);
navigation.pop();
Expand Down
3 changes: 3 additions & 0 deletions app/views/InviteUsersView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import StatusBar from '../../containers/StatusBar';
import { themes } from '../../constants/colors';
import { withTheme } from '../../theme';
import SafeAreaView from '../../containers/SafeAreaView';
import { logEvent, events } from '../../utils/log';

class InviteUsersView extends React.Component {
static navigationOptions = () => ({
Expand Down Expand Up @@ -50,6 +51,7 @@ class InviteUsersView extends React.Component {
}

share = () => {
logEvent(events.IU_SHARE);
const { invite } = this.props;
if (!invite || !invite.url) {
return;
Expand All @@ -58,6 +60,7 @@ class InviteUsersView extends React.Component {
}

edit = () => {
logEvent(events.IU_GO_IU_EDIT);
const { navigation } = this.props;
navigation.navigate('InviteUsersEditView', { rid: this.rid });
}
Expand Down
4 changes: 4 additions & 0 deletions app/views/JitsiMeetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import RocketChat from '../lib/rocketchat';
import { getUserSelector } from '../selectors/login';

import sharedStyles from './Styles';
import { logEvent, events } from '../utils/log';

const formatUrl = (url, baseUrl, uriSize, avatarAuthURLFragment) => (
`${ baseUrl }/avatar/${ url }?format=png&width=${ uriSize }&height=${ uriSize }${ avatarAuthURLFragment }`
Expand Down Expand Up @@ -59,6 +60,7 @@ class JitsiMeetView extends React.Component {
}

componentWillUnmount() {
logEvent(events.JM_CONFERENCE_TERMINATE);
if (this.jitsiTimeout) {
BackgroundTimer.clearInterval(this.jitsiTimeout);
}
Expand All @@ -68,6 +70,7 @@ class JitsiMeetView extends React.Component {
// Jitsi Update Timeout needs to be called every 10 seconds to make sure
// call is not ended and is available to web users.
onConferenceJoined = () => {
logEvent(events.JM_CONFERENCE_JOIN);
RocketChat.updateJitsiTimeout(this.rid).catch(e => console.log(e));
if (this.jitsiTimeout) {
BackgroundTimer.clearInterval(this.jitsiTimeout);
Expand All @@ -78,6 +81,7 @@ class JitsiMeetView extends React.Component {
}

onConferenceTerminated = () => {
logEvent(events.JM_CONFERENCE_TERMINATE);
const { navigation } = this.props;
if (this.jitsiTimeout) {
BackgroundTimer.clearInterval(this.jitsiTimeout);
Expand Down
4 changes: 3 additions & 1 deletion app/views/NotificationPreferencesView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import RocketChat from '../../lib/rocketchat';
import { withTheme } from '../../theme';
import protectedFunction from '../../lib/methods/helpers/protectedFunction';
import SafeAreaView from '../../containers/SafeAreaView';
import log from '../../utils/log';
import log, { events, logEvent } from '../../utils/log';

const SectionTitle = React.memo(({ title, theme }) => (
<Text
Expand Down Expand Up @@ -181,6 +181,7 @@ class NotificationPreferencesView extends React.Component {
}

saveNotificationSettings = async(key, value, params) => {
logEvent(events[`NP_${ key.toUpperCase() }`]);
const { room } = this.state;
const db = database.active;

Expand All @@ -206,6 +207,7 @@ class NotificationPreferencesView extends React.Component {
}));
});
} catch (e) {
logEvent(events[`NP_${ key.toUpperCase() }_F`]);
log(e);
}
}
Expand Down
Loading