Merge pull request #5060 from vector-im/langleyd/4981_custom_baseurl_permalinks

Add clientPermalinkBaseUrl and set in matrix-sdk options.
This commit is contained in:
David Langley
2021-11-04 16:54:31 +00:00
committed by GitHub
4 changed files with 15 additions and 5 deletions
+11 -3
View File
@@ -118,9 +118,9 @@ final class BuildSettings: NSObject {
"https://element.io/help"
// MARk: - Matrix permalinks
// Paths for URLs that will considered as Matrix permalinks. Those permalinks are opened within the app
static let matrixPermalinkPaths: [String: [String]] = [
// MARK: - Permalinks
// Hosts/Paths for URLs that will considered as valid permalinks. Those permalinks are opened within the app.
static let permalinkSupportedHosts: [String: [String]] = [
"app.element.io": [],
"staging.element.io": [],
"develop.element.io": [],
@@ -133,8 +133,16 @@ final class BuildSettings: NSObject {
// Official Matrix ones
"matrix.to": ["/"],
"www.matrix.to": ["/"],
// Client Permalinks (for use with `BuildSettings.clientPermalinkBaseUrl`)
// "example.com": ["/"],
// "www.example.com": ["/"],
]
// For use in clients that use a custom base url for permalinks rather than matrix.to.
// This baseURL is used to generate permalinks within the app (E.g. timeline message permalinks).
// Optional String that when set is used as permalink base, when nil matrix.to format is used.
// Example value would be "https://www.example.com", note there is no trailing '/'.
static let clientPermalinkBaseUrl: String? = "https://app.element.io"
// MARK: - VoIP
static var allowVoIPUsage: Bool {
+1
View File
@@ -75,6 +75,7 @@ class CommonConfiguration: NSObject, Configurable {
// Disable key backup on common
sdkOptions.enableKeyBackupWhenStartingMXCrypto = false
sdkOptions.clientPermalinkBaseUrl = BuildSettings.clientPermalinkBaseUrl
// Configure key provider delegate
MXKeyProvider.sharedInstance().delegate = EncryptionKeyManager.shared
}
+2 -2
View File
@@ -66,11 +66,11 @@
{
BOOL isUniversalLink = NO;
for (NSString *matrixPermalinkHost in BuildSettings.matrixPermalinkPaths)
for (NSString *matrixPermalinkHost in BuildSettings.permalinkSupportedHosts)
{
if ([url.host isEqualToString:matrixPermalinkHost])
{
NSArray<NSString*> *hostPaths = BuildSettings.matrixPermalinkPaths[matrixPermalinkHost];
NSArray<NSString*> *hostPaths = BuildSettings.permalinkSupportedHosts[matrixPermalinkHost];
if (hostPaths.count)
{
// iOS Patch: fix urls before using it
+1
View File
@@ -0,0 +1 @@
Adds clientPermalinkBaseUrl for a custom permalink base url.