Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ab7c911
Create method to track user event to isolate the logic to improve fut…
youssef-md Jun 8, 2020
2f820ff
Track Onboarding view
youssef-md Jun 8, 2020
80d0d20
Track NewServer view
youssef-md Jun 8, 2020
e4fec18
Refactor track method due to firebase already send the current screen
youssef-md Jun 8, 2020
2671bd8
Track default login and all the oAuth options
youssef-md Jun 8, 2020
1b06f50
Track default sign up in RegisterView
youssef-md Jun 8, 2020
bde8994
Merge remote-tracking branch 'upstream/develop' into new.track-onboar…
youssef-md Jun 8, 2020
5d3c35c
Change trackUserEvent signature and update all the files
youssef-md Jun 8, 2020
3b9d7eb
Track the remaining login services
youssef-md Jun 8, 2020
65583f4
track add server, change server and search
youssef-md Jun 10, 2020
6fa5586
Track SidebarView and refactor to use react-navigation
youssef-md Jun 13, 2020
84bd44a
Track profile events and handle exceptions
youssef-md Jun 13, 2020
26a5947
Track create channel flux
youssef-md Jun 14, 2020
7caefb2
Track send message to user via NewMessageView
youssef-md Jun 15, 2020
3b52064
Track create direct message flux
youssef-md Jun 15, 2020
06dabb8
Handle failure of create channel and group in the saga
youssef-md Jun 15, 2020
1dbd7c1
Track create discussion flux
youssef-md Jun 15, 2020
e16ace4
Track navigate to directory and its actions
youssef-md Jun 15, 2020
d8cf749
Track read, favorite and hide a channel, handling its errors
youssef-md Jun 15, 2020
1c581cc
Track all channels sorting and grouping
youssef-md Jun 15, 2020
128098f
Merge remote-tracking branch 'upstream/develop' into new.track-roomsl…
youssef-md Jun 15, 2020
22f5b6c
Resolve requests to improve the importing logs and events
youssef-md Jun 18, 2020
eba9780
Merge remote-tracking branch 'upstream/develop' into new.track-onboar…
youssef-md Jun 18, 2020
f6e6039
Merge branch 'new.track-onboarding-workspaces-login' into new.track-r…
youssef-md Jun 21, 2020
f275833
Remove unused events file
youssef-md Jun 21, 2020
ab11b63
Merge branch 'develop' into new.track-onboarding-workspaces-login
diegolmello Jul 6, 2020
300914e
Merge remote-tracking branch 'upstream/develop' into new.track-onboar…
youssef-md Jul 9, 2020
a05dd58
Leave a bugsnag breadcrumb when logging an event
youssef-md Jul 9, 2020
a2ee740
Move all logEvent to the top of code block and log remaining fail events
youssef-md Jul 9, 2020
aa499da
Merge branch 'new.track-onboarding-workspaces-login' into new.track-r…
youssef-md Jul 9, 2020
066c27d
Move all the non-logic-dependent logEvent to the top of code block
youssef-md Jul 9, 2020
721f62c
Merge remote-tracking branch 'upstream/develop' into new.track-roomsl…
youssef-md Jul 23, 2020
e308df9
Improve the logging of sidebar events
youssef-md Jul 25, 2020
3eab466
Improve events from onboarding and newserver
youssef-md Jul 26, 2020
9d5280f
Improve events from login and register view, and log enter with apple
youssef-md Jul 26, 2020
bbbf83b
Improve NewMessageView events
youssef-md Jul 26, 2020
540691a
Improve CreateChannel events
youssef-md Jul 26, 2020
4578def
Improve CreateDiscussion and SelectedUsers create group events
youssef-md Jul 26, 2020
22f0fe2
Improve RoomsList events and log trivial events
youssef-md Jul 27, 2020
a3b57ea
Improve ProfileView events
youssef-md Jul 27, 2020
9e0e36f
Remove single line function body for the sidebarNavigate
youssef-md Jul 27, 2020
f3e099a
Merge remote-tracking branch 'upstream/develop' into new.track-roomsl…
youssef-md Jul 27, 2020
da335e8
Merge remote-tracking branch 'upstream/develop' into new.track-roomsl…
youssef-md Jul 29, 2020
214e49a
Navigate to Status and AdminPanel View using the defined sidebarNavig…
youssef-md Jul 30, 2020
dd0a108
Merge branch 'develop' into new.track-roomslist-sidedrawer-profile
diegolmello Jul 30, 2020
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
25 changes: 13 additions & 12 deletions app/containers/LoginServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class LoginServices extends React.PureComponent {
}

onPressFacebook = () => {
logEvent(events.LOGIN_WITH_FACEBOOK);
logEvent(events.ENTER_WITH_FACEBOOK);
const { services, server } = this.props;
const { clientId } = services.facebook;
const endpoint = 'https://m.facebook.com/v2.9/dialog/oauth';
Expand All @@ -90,7 +90,7 @@ class LoginServices extends React.PureComponent {
}

onPressGithub = () => {
logEvent(events.LOGIN_WITH_GITHUB);
logEvent(events.ENTER_WITH_GITHUB);
const { services, server } = this.props;
const { clientId } = services.github;
const endpoint = `https://github.com/login?client_id=${ clientId }&return_to=${ encodeURIComponent('/login/oauth/authorize') }`;
Expand All @@ -102,7 +102,7 @@ class LoginServices extends React.PureComponent {
}

onPressGitlab = () => {
logEvent(events.LOGIN_WITH_GITLAB);
logEvent(events.ENTER_WITH_GITLAB);
const { services, server, Gitlab_URL } = this.props;
const { clientId } = services.gitlab;
const baseURL = Gitlab_URL ? Gitlab_URL.trim().replace(/\/*$/, '') : 'https://gitlab.com';
Expand All @@ -115,7 +115,7 @@ class LoginServices extends React.PureComponent {
}

onPressGoogle = () => {
logEvent(events.LOGIN_WITH_GOOGLE);
logEvent(events.ENTER_WITH_GOOGLE);
const { services, server } = this.props;
const { clientId } = services.google;
const endpoint = 'https://accounts.google.com/o/oauth2/auth';
Expand All @@ -127,7 +127,7 @@ class LoginServices extends React.PureComponent {
}

onPressLinkedin = () => {
logEvent(events.LOGIN_WITH_LINKEDIN);
logEvent(events.ENTER_WITH_LINKEDIN);
const { services, server } = this.props;
const { clientId } = services.linkedin;
const endpoint = 'https://www.linkedin.com/oauth/v2/authorization';
Expand All @@ -139,7 +139,7 @@ class LoginServices extends React.PureComponent {
}

onPressMeteor = () => {
logEvent(events.LOGIN_WITH_METEOR);
logEvent(events.ENTER_WITH_METEOR);
const { services, server } = this.props;
const { clientId } = services['meteor-developer'];
const endpoint = 'https://www.meteor.com/oauth2/authorize';
Expand All @@ -150,15 +150,15 @@ class LoginServices extends React.PureComponent {
}

onPressTwitter = () => {
logEvent(events.LOGIN_WITH_TWITTER);
logEvent(events.ENTER_WITH_TWITTER);
const { server } = this.props;
const state = this.getOAuthState();
const url = `${ server }/_oauth/twitter/?requestTokenAndRedirect=true&state=${ state }`;
this.openOAuth({ url });
}

onPressWordpress = () => {
logEvent(events.LOGIN_WITH_WORDPRESS);
logEvent(events.ENTER_WITH_WORDPRESS);
const { services, server } = this.props;
const { clientId, serverURL } = services.wordpress;
const endpoint = `${ serverURL }/oauth/authorize`;
Expand All @@ -170,7 +170,7 @@ class LoginServices extends React.PureComponent {
}

onPressCustomOAuth = (loginService) => {
logEvent(events.LOGIN_WITH_CUSTOM_OAUTH);
logEvent(events.ENTER_WITH_CUSTOM_OAUTH);
const { server } = this.props;
const {
serverURL, authorizePath, clientId, scope, service
Expand All @@ -185,7 +185,7 @@ class LoginServices extends React.PureComponent {
}

onPressSaml = (loginService) => {
logEvent(events.LOGIN_WITH_SAML);
logEvent(events.ENTER_WITH_SAML);
const { server } = this.props;
const { clientConfig } = loginService;
const { provider } = clientConfig;
Expand All @@ -195,14 +195,15 @@ class LoginServices extends React.PureComponent {
}

onPressCas = () => {
logEvent(events.LOGIN_WITH_CAS);
logEvent(events.ENTER_WITH_CAS);
const { server, CAS_login_url } = this.props;
const ssoToken = random(17);
const url = `${ CAS_login_url }?service=${ server }/_cas/${ ssoToken }`;
this.openOAuth({ url, ssoToken, authType: 'cas' });
}

onPressAppleLogin = async() => {
logEvent(events.ENTER_WITH_APPLE);
try {
const { fullName, email, identityToken } = await AppleAuthentication.signInAsync({
requestedScopes: [
Expand All @@ -213,7 +214,7 @@ class LoginServices extends React.PureComponent {

await RocketChat.loginOAuthOrSso({ fullName, email, identityToken });
} catch {
// Do nothing
logEvent(events.ENTER_WITH_APPLE_F);
}
}

Expand Down
5 changes: 5 additions & 0 deletions app/sagas/createChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import RocketChat from '../lib/rocketchat';
import Navigation from '../lib/Navigation';
import database from '../lib/database';
import I18n from '../i18n';
import { logEvent, events } from '../utils/log';
import { goRoom } from '../utils/goRoom';

const createChannel = function createChannel(data) {
Expand All @@ -29,11 +30,14 @@ const handleRequest = function* handleRequest({ data }) {

let sub;
if (data.group) {
logEvent(events.SELECTED_USERS_CREATE_GROUP);
const result = yield call(createGroupChat);
if (result.success) {
({ room: sub } = result);
}
} else {
const { type, readOnly, broadcast } = data;
logEvent(events.CREATE_CHANNEL_CREATE, { type: type ? 'private' : 'public', readOnly, broadcast });
sub = yield call(createChannel, data);
}

Expand All @@ -52,6 +56,7 @@ const handleRequest = function* handleRequest({ data }) {

yield put(createChannelSuccess(sub));
} catch (err) {
logEvent(events[data.group ? 'SELECTED_USERS_CREATE_GROUP_F' : 'CREATE_CHANNEL_CREATE_F']);
yield put(createChannelFailure(err));
}
};
Expand Down
5 changes: 4 additions & 1 deletion app/sagas/createDiscussion.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import { CREATE_DISCUSSION, LOGIN } from '../actions/actionsTypes';
import { createDiscussionSuccess, createDiscussionFailure } from '../actions/createDiscussion';
import RocketChat from '../lib/rocketchat';
import database from '../lib/database';
import { logEvent, events } from '../utils/log';

const create = function* create(data) {
return yield RocketChat.createDiscussion(data);
};

const handleRequest = function* handleRequest({ data }) {
logEvent(events.CREATE_DISCUSSION_CREATE);
try {
const auth = yield select(state => state.login.isAuthenticated);
if (!auth) {
Expand All @@ -35,12 +37,13 @@ const handleRequest = function* handleRequest({ data }) {
} catch {
// do nothing
}

yield put(createDiscussionSuccess(sub));
} else {
logEvent(events.CREATE_DISCUSSION_CREATE_F);
yield put(createDiscussionFailure(result));
}
} catch (err) {
logEvent(events.CREATE_DISCUSSION_CREATE_F);
yield put(createDiscussionFailure(err));
}
};
Expand Down
4 changes: 2 additions & 2 deletions app/sagas/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const loginCall = args => RocketChat.login(args);
const logoutCall = args => RocketChat.logout(args);

const handleLoginRequest = function* handleLoginRequest({ credentials, logoutOnError = false }) {
logEvent(events.DEFAULT_LOGIN);
logEvent(events.LOGIN_DEFAULT_LOGIN);
try {
let result;
if (credentials.resume) {
Expand All @@ -53,7 +53,7 @@ const handleLoginRequest = function* handleLoginRequest({ credentials, logoutOnE
if (logoutOnError && (e.data && e.data.message && /you've been logged out by the server/i.test(e.data.message))) {
yield put(logout(true));
} else {
logEvent(events.DEFAULT_LOGIN_FAIL);
logEvent(events.LOGIN_DEFAULT_LOGIN_F);
yield put(loginFailure(e));
}
}
Expand Down
128 changes: 106 additions & 22 deletions app/utils/log/events.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,108 @@
export default {
JOIN_A_WORKSPACE: 'join_a_workspace',
CREATE_NEW_WORKSPACE: 'create_new_workspace',
CREATE_NEW_WORKSPACE_FAIL: 'create_new_workspace_fail',
CONNECT_TO_WORKSPACE: 'connect_to_workspace',
CONNECT_TO_WORKSPACE_FAIL: 'connect_to_workspace_fail',
JOIN_OPEN_WORKSPACE: 'join_open_workspace',
DEFAULT_LOGIN: 'default_login',
DEFAULT_LOGIN_FAIL: 'default_login_fail',
DEFAULT_SIGN_UP: 'default_sign_up',
DEFAULT_SIGN_UP_FAIL: 'default_sign_up_fail',
FORGOT_PASSWORD: 'forgot_password',
LOGIN_WITH_FACEBOOK: 'login_with_facebook',
LOGIN_WITH_GITHUB: 'login_with_github',
LOGIN_WITH_GITLAB: 'login_with_gitlab',
LOGIN_WITH_LINKEDIN: 'login_with_linkedin',
LOGIN_WITH_GOOGLE: 'login_with_google',
LOGIN_WITH_METEOR: 'login_with_meteor',
LOGIN_WITH_TWITTER: 'login_with_twitter',
LOGIN_WITH_WORDPRESS: 'login_with_wordpress',
LOGIN_WITH_CUSTOM_OAUTH: 'login_with_custom_oauth',
LOGIN_WITH_SAML: 'login_with_saml',
LOGIN_WITH_CAS: 'login_with_cas'
// ONBOARDING VIEW
ONBOARD_JOIN_A_WORKSPACE: 'onboard_join_a_workspace',
ONBOARD_CREATE_NEW_WORKSPACE: 'onboard_create_new_workspace',
ONBOARD_CREATE_NEW_WORKSPACE_F: 'onboard_create_new_workspace_f',

// NEW SERVER VIEW
NEWSERVER_CONNECT_TO_WORKSPACE: 'newserver_connect_to_workspace',
NEWSERVER_CONNECT_TO_WORKSPACE_F: 'newserver_connect_to_workspace_f',
NEWSERVER_JOIN_OPEN_WORKSPACE: 'newserver_join_open_workspace',

// LOGIN VIEW
LOGIN_DEFAULT_LOGIN: 'login_default_login',
LOGIN_DEFAULT_LOGIN_F: 'login_default_login_f',

// FORGOT PASSWORD VIEW
FP_FORGOT_PASSWORD: 'fp_forgot_password',
FP_FORGOT_PASSWORD_F: 'fp_forgot_password_f',

// REGISTER VIEW
REGISTER_DEFAULT_SIGN_UP: 'register_default_sign_up',
REGISTER_DEFAULT_SIGN_UP_F: 'register_default_sign_up_f',

// LOGIN AND REGISTER VIEW
ENTER_WITH_FACEBOOK: 'enter_with_facebook',
ENTER_WITH_GITHUB: 'enter_with_github',
ENTER_WITH_GITLAB: 'enter_with_gitlab',
ENTER_WITH_LINKEDIN: 'enter_with_linkedin',
ENTER_WITH_GOOGLE: 'enter_with_google',
ENTER_WITH_METEOR: 'enter_with_meteor',
ENTER_WITH_TWITTER: 'enter_with_twitter',
ENTER_WITH_WORDPRESS: 'enter_with_wordpress',
ENTER_WITH_CUSTOM_OAUTH: 'enter_with_custom_oauth',
ENTER_WITH_SAML: 'enter_with_saml',
ENTER_WITH_CAS: 'enter_with_cas',
ENTER_WITH_APPLE: 'enter_with_apple',
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',

// ROOMS LIST VIEW
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_SEARCH: 'rl_search',
RL_NAVIGATE_TO_DIRECTORY: 'rl_navigate_to_directory',
RL_GO_TO_ROOM: 'rl_go_to_room',
RL_FAVORITE_CHANNEL: 'rl_favorite_channel',
RL_UNFAVORITE_CHANNEL: 'rl_unfavorite_channel',
RL_TOGGLE_FAVORITE_F: 'rl_toggle_favorite_f',
RL_READ_CHANNEL: 'rl_read_channel',
RL_UNREAD_CHANNEL: 'rl_unread_channel',
RL_TOGGLE_READ_F: 'rl_toggle_read_f',
RL_HIDE_CHANNEL: 'rl_hide_channel',
RL_HIDE_CHANNEL_F: 'rl_hide_channel_f',
RL_TOGGLE_SORT_DROPDOWN: 'rl_toggle_sort_dropdown',
RL_SORT_CHANNELS_BY_NAME: 'rl_sort_channels_by_name',
RL_SORT_CHANNELS_BY_ACTIVITY: 'rl_sort_channels_by_activity',
RL_SORT_CHANNELS_FAIL: 'rl_sort_channels_fail',
RL_GROUP_CHANNELS_BY_TYPE: 'rl_group_channels_by_type',
RL_GROUP_CHANNELS_BY_FAVORITE: 'rl_group_channels_by_favorite',
RL_GROUP_CHANNELS_BY_UNREAD: 'rl_group_channels_by_unread',

// DIRECTORY VIEW
DIRECTORY_SEARCH_USERS: 'directory_search_users',
DIRECTORY_SEARCH_CHANNELS: 'directory_search_channels',

// NEW MESSAGE VIEW
NEW_MSG_CREATE_CHANNEL: 'new_msg_create_channel',
NEW_MSG_CREATE_GROUP_CHAT: 'new_msg_create_group_chat',
NEW_MSG_CREATE_DISCUSSION: 'new_msg_create_discussion',
NEW_MSG_CHAT_WITH_USER: 'new_msg_chat_with_user',

// SELECTED USERS VIEW
SELECTED_USERS_ADD_USER: 'selected_users_add_user',
SELECTED_USERS_REMOVE_USER: 'selected_users_remove_user',
SELECTED_USERS_CREATE_GROUP: 'selected_users_create_group',
SELECTED_USERS_CREATE_GROUP_F: 'selected_users_create_group_f',

// CREATE CHANNEL VIEW
CREATE_CHANNEL_CREATE: 'create_channel_create',
CREATE_CHANNEL_CREATE_F: 'create_channel_create_f',
CREATE_CHANNEL_TOGGLE_TYPE: 'create_channel_toggle_type',
CREATE_CHANNEL_TOGGLE_READ_ONLY: 'create_channel_toggle_read_only',
CREATE_CHANNEL_TOGGLE_BROADCAST: 'create_channel_toggle_broadcast',
CREATE_CHANNEL_REMOVE_USER: 'create_channel_remove_user',

// CREATE DISCUSSION VIEW
CREATE_DISCUSSION_CREATE: 'create_discussion_create',
CREATE_DISCUSSION_CREATE_F: 'create_discussion_create_f',
CREATE_DISCUSSION_SELECT_CHANNEL: 'create_discussion_select_channel',
CREATE_DISCUSSION_SELECT_USERS: 'create_discussion_select_users',

// PROFILE VIEW
PROFILE_PICK_AVATAR: 'profile_pick_avatar',
PROFILE_PICK_AVATAR_F: 'profile_pick_avatar_f',
PROFILE_PICK_AVATAR_WITH_URL: 'profile_pick_avatar_with_url',
PROFILE_SAVE_AVATAR: 'profile_save_avatar',
PROFILE_SAVE_AVATAR_F: 'profile_save_avatar_f',
PROFILE_SAVE_CHANGES: 'profile_save_changes',
PROFILE_SAVE_CHANGES_F: 'profile_save_changes_f'
};
13 changes: 11 additions & 2 deletions app/views/CreateChannelView.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { SWITCH_TRACK_COLOR, themes } from '../constants/colors';
import { withTheme } from '../theme';
import { Review } from '../utils/review';
import { getUserSelector } from '../selectors/login';
import { logEvent, events } from '../utils/log';
import SafeAreaView from '../containers/SafeAreaView';

const styles = StyleSheet.create({
Expand Down Expand Up @@ -166,6 +167,7 @@ class CreateChannelView extends React.Component {
}

removeUser = (user) => {
logEvent(events.CREATE_CHANNEL_REMOVE_USER);
const { removeUser } = this.props;
removeUser(user);
}
Expand Down Expand Up @@ -194,7 +196,10 @@ class CreateChannelView extends React.Component {
id: 'type',
value: type,
label: 'Private_Channel',
onValueChange: value => this.setState({ type: value })
onValueChange: (value) => {
logEvent(events.CREATE_CHANNEL_TOGGLE_TYPE);
this.setState({ type: value });
}
});
}

Expand All @@ -204,7 +209,10 @@ class CreateChannelView extends React.Component {
id: 'readonly',
value: readOnly,
label: 'Read_Only_Channel',
onValueChange: value => this.setState({ readOnly: value }),
onValueChange: (value) => {
logEvent(events.CREATE_CHANNEL_TOGGLE_READ_ONLY);
this.setState({ readOnly: value });
},
disabled: broadcast
});
}
Expand All @@ -216,6 +224,7 @@ class CreateChannelView extends React.Component {
value: broadcast,
label: 'Broadcast_Channel',
onValueChange: (value) => {
logEvent(events.CREATE_CHANNEL_TOGGLE_BROADCAST);
this.setState({
broadcast: value,
readOnly: value ? true : readOnly
Expand Down
Loading