Support room aliases in url bar and show them for rooms that have them
This commit is contained in:
parent
68d408bfff
commit
2771907573
3 changed files with 39 additions and 6 deletions
|
@ -24,6 +24,8 @@ var React = require("react");
|
|||
// maps cannot pass through two stages).
|
||||
var MatrixReactSdk = require("../../src/index");
|
||||
|
||||
var lastLocationHashSet = null;
|
||||
|
||||
// Here, we do some crude URL analysis to allow
|
||||
// deep-linking. We only support registration
|
||||
// deep-links in this example.
|
||||
|
@ -46,6 +48,10 @@ function routeUrl(location) {
|
|||
}
|
||||
|
||||
function onHashChange(ev) {
|
||||
if (decodeURIComponent(window.location.hash) == lastLocationHashSet) {
|
||||
// we just set this: no need to route it!
|
||||
return;
|
||||
}
|
||||
routeUrl(window.location);
|
||||
}
|
||||
|
||||
|
@ -55,7 +61,9 @@ var loaded = false;
|
|||
// so a web page can update the URL bar appropriately.
|
||||
var onNewScreen = function(screen) {
|
||||
if (!loaded) return;
|
||||
window.location.hash = '#/'+screen;
|
||||
var hash = '#/' + screen;
|
||||
lastLocationHashSet = hash;
|
||||
window.location.hash = hash;
|
||||
}
|
||||
|
||||
// We use this to work out what URL the SDK should
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue