Bookmarkable room URLs

pull/1/head
David Baker 2015-07-20 12:20:17 -07:00
parent dcecdc8260
commit 36b1280f0c
2 changed files with 16 additions and 0 deletions

View File

@ -40,9 +40,17 @@ function routeUrl(location) {
}
}
window.matrixChat.showScreen('register', params);
} else {
window.matrixChat.showScreen(location.hash.substring(2));
}
}
function onHashChange(ev) {
routeUrl(window.location);
}
window.addEventListener('hashchange', onHashChange);
var loaded = false;
window.onload = function() {

View File

@ -127,6 +127,7 @@ module.exports = {
currentRoom: payload.room_id,
page_type: this.PageTypes.RoomView,
});
this.notifyNewScreen('room/'+payload.room_id);
break;
case 'view_prev_room':
roomIndexDelta = -1;
@ -179,6 +180,7 @@ module.exports = {
)[0].roomId;
}
self.setState({ready: true, currentRoom: firstRoom});
self.notifyNewScreen('room/'+firstRoom);
dis.dispatch({action: 'focus_composer'});
});
cli.on('Call.incoming', function(call) {
@ -222,6 +224,12 @@ module.exports = {
action: 'start_login',
params: params
});
} else if (screen.indexOf('room/') == 0) {
var roomId = screen.split('/')[1];
dis.dispatch({
action: 'view_room',
room_id: roomId
});
}
},