Refactor handleIntentUri to work also with authorities

This commit is contained in:
Angela Mazzurco 2017-07-11 19:13:55 +02:00
parent c83ce86252
commit f6cd3b42ad

View File

@ -239,7 +239,7 @@ ApplicationWindow
function handleIntentUri(uriStr) function handleIntentUri(uriStr)
{ {
console.log("handleIntentUri(uriStr)") console.log("handleIntentUri(uriStr)", uriStr)
if(!Array.isArray(uriStr.match(/:\/\/[a-zA-Z.-]*\//g))) if(!Array.isArray(uriStr.match(/:\/\/[a-zA-Z.-]*\//g)))
{ {
@ -257,7 +257,10 @@ ApplicationWindow
var uri = new UriJs.URI(uriStr) var uri = new UriJs.URI(uriStr)
var hPath = uri.path() // no nesting ATM segmentCoded() var hPath = uri.path() // no nesting ATM segmentCoded()
console.log(hPath) console.log("hPath", hPath)
var authority = uri.authority()
console.log("authority", authority)
if(typeof uriHandlersRegister[hPath] == "function") if(typeof uriHandlersRegister[hPath] == "function")
{ {
@ -265,6 +268,13 @@ ApplicationWindow
hPath, uriHandlersRegister[hPath]) hPath, uriHandlersRegister[hPath])
uriHandlersRegister[hPath](uriStr) uriHandlersRegister[hPath](uriStr)
} }
else if (typeof uriHandlersRegister[authority] == "function" )
{
console.log("handleIntentUri(uriStr)", "found handler for path",
authority, uriHandlersRegister[authority])
uriHandlersRegister[authority](uriStr)
}
} }
function certificateLinkHandler(uriStr) function certificateLinkHandler(uriStr)