support tracking URLs for settings, new & directory

This commit is contained in:
Matthew Hodgson 2015-11-11 02:01:48 +01:00
parent ab10f1d6b0
commit 6ad210cde3

View file

@ -253,16 +253,19 @@ module.exports = {
this.setState({ this.setState({
page_type: this.PageTypes.UserSettings, page_type: this.PageTypes.UserSettings,
}); });
this.notifyNewScreen('settings');
break; break;
case 'view_create_room': case 'view_create_room':
this.setState({ this.setState({
page_type: this.PageTypes.CreateRoom, page_type: this.PageTypes.CreateRoom,
}); });
this.notifyNewScreen('new');
break; break;
case 'view_room_directory': case 'view_room_directory':
this.setState({ this.setState({
page_type: this.PageTypes.RoomDirectory, page_type: this.PageTypes.RoomDirectory,
}); });
this.notifyNewScreen('directory');
break; break;
case 'notifier_enabled': case 'notifier_enabled':
this.forceUpdate(); this.forceUpdate();
@ -336,7 +339,7 @@ module.exports = {
var theAlias = MatrixTools.getCanonicalAliasForRoom(room); var theAlias = MatrixTools.getCanonicalAliasForRoom(room);
if (theAlias) presentedId = theAlias; if (theAlias) presentedId = theAlias;
} }
self.notifyNewScreen('room/'+presentedId); self.notifyNewScreen('room/'+presentedId, true);
dis.dispatch({action: 'focus_composer'}); dis.dispatch({action: 'focus_composer'});
} }
}); });
@ -401,6 +404,18 @@ module.exports = {
action: 'token_login', action: 'token_login',
params: params params: params
}); });
} else if (screen == 'new') {
dis.dispatch({
action: 'view_create_room',
});
} else if (screen == 'settings') {
dis.dispatch({
action: 'view_user_settings',
});
} else if (screen == 'directory') {
dis.dispatch({
action: 'view_room_directory',
});
} else if (screen.indexOf('room/') == 0) { } else if (screen.indexOf('room/') == 0) {
var roomString = screen.split('/')[1]; var roomString = screen.split('/')[1];
if (roomString[0] == '#') { if (roomString[0] == '#') {
@ -424,9 +439,9 @@ module.exports = {
} }
}, },
notifyNewScreen: function(screen) { notifyNewScreen: function(screen, onlyIfBlank) {
if (this.props.onNewScreen) { if (this.props.onNewScreen) {
this.props.onNewScreen(screen); this.props.onNewScreen(screen, onlyIfBlank);
} }
} }
}; };