Add support for io.element.call:/?url=some-encoded-url uri
This commit is contained in:
parent
5e222d4865
commit
9541389519
3 changed files with 41 additions and 0 deletions
|
|
@ -53,6 +53,14 @@
|
||||||
<data android:scheme="element" />
|
<data android:scheme="element" />
|
||||||
<data android:host="call" />
|
<data android:host="call" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<!-- Custom scheme to handle urls from other domains in the format: io.element.call:/?url=https%3A%2F%2Felement.io -->
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data android:scheme="io.element.call" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
<service android:name=".CallForegroundService" android:enabled="true" android:foregroundServiceType="mediaPlayback" />
|
<service android:name=".CallForegroundService" android:enabled="true" android:foregroundServiceType="mediaPlayback" />
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,16 @@ object CallIntentDataParser {
|
||||||
internalUri.scheme in validHttpSchemes && !internalUri.host.isNullOrBlank()
|
internalUri.scheme in validHttpSchemes && !internalUri.host.isNullOrBlank()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
scheme == "io.element.call" && parsedUrl.host == null -> {
|
||||||
|
// We use this custom scheme to load arbitrary URLs for other instances of Element Call,
|
||||||
|
// so we can only verify it's an HTTP/HTTPs URL with a non-empty host
|
||||||
|
parsedUrl.getQueryParameter("url")
|
||||||
|
?.let { URLDecoder.decode(it, "utf-8") }
|
||||||
|
?.takeIf {
|
||||||
|
val internalUri = Uri.parse(it)
|
||||||
|
internalUri.scheme in validHttpSchemes && !internalUri.host.isNullOrBlank()
|
||||||
|
}
|
||||||
|
}
|
||||||
// This should never be possible, but we still need to take into account the possibility
|
// This should never be possible, but we still need to take into account the possibility
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
tools/adb/callLinkCustomScheme2.sh
Executable file
23
tools/adb/callLinkCustomScheme2.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#! /bin/bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 New Vector Ltd
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Format is:
|
||||||
|
# io.element.call:/?url=some-encoded-url
|
||||||
|
# For instance
|
||||||
|
# io.element.call:/?url=https%3A%2F%2Fcall.element.io%2FTestElementCall
|
||||||
|
|
||||||
|
adb shell am start -a android.intent.action.VIEW -d io.element.call:/?url=https%3A%2F%2Fcall.element.io%2FTestElementCall
|
||||||
Loading…
Add table
Add a link
Reference in a new issue