Conform URL to ExpressibleByStringLiteral (#1214)

This commit is contained in:
Alfonso Grillo
2023-06-29 15:47:04 +02:00
committed by GitHub
parent 3b114c28d6
commit 3a6876f385
10 changed files with 34 additions and 34 deletions
+12 -12
View File
@@ -91,19 +91,19 @@ final class AppSettings {
// MARK: - Authentication
/// The URL that is opened when tapping the Learn more button on the sliding sync alert during authentication.
let slidingSyncLearnMoreURL = URL(staticString: "https://github.com/matrix-org/sliding-sync/blob/main/docs/Landing.md")
let slidingSyncLearnMoreURL: URL = "https://github.com/matrix-org/sliding-sync/blob/main/docs/Landing.md"
/// The redirect URL used for OIDC.
let oidcRedirectURL = URL(staticString: "io.element:/callback")
let oidcRedirectURL: URL = "io.element:/callback"
/// The app's main URL shown when using OIDC.
let oidcClientURL = URL(staticString: "https://element.io")
let oidcClientURL: URL = "https://element.io"
/// The app's Terms of Service URL shown when using OIDC.
let oidcTermsURL = URL(staticString: "https://element.io/user-terms-of-service")
let oidcTermsURL: URL = "https://element.io/user-terms-of-service"
/// The app's Privacy Policy URL shown when using OIDC.
let oidcPolicyURL = URL(staticString: "https://element.io/privacy")
let oidcPolicyURL: URL = "https://element.io/privacy"
/// Any pre-defined static client registrations for OIDC issuers.
let oidcStaticRegistrations = [URL(staticString: "https://id.thirdroom.io/realms/thirdroom"): "elementx"]
let oidcStaticRegistrations: [URL: String] = ["https://id.thirdroom.io/realms/thirdroom": "elementx"]
// MARK: - Notifications
var pusherAppId: String {
@@ -114,12 +114,12 @@ final class AppSettings {
#endif
}
let pushGatewayBaseURL = URL(staticString: "https://matrix.org/_matrix/push/v1/notify")
let pushGatewayBaseURL: URL = "https://matrix.org/_matrix/push/v1/notify"
// MARK: - Bug report
let bugReportServiceBaseURL = URL(staticString: "https://riot.im/bugreports")
let bugReportSentryURL = URL(staticString: "https://f39ac49e97714316965b777d9f3d6cd8@sentry.tools.element.io/44")
let bugReportServiceBaseURL: URL = "https://riot.im/bugreports"
let bugReportSentryURL: URL = "https://f39ac49e97714316965b777d9f3d6cd8@sentry.tools.element.io/44"
// Use the name allocated by the bug report server
let bugReportApplicationId = "element-x-ios"
let bugReportUISIId = "element-auto-uisi"
@@ -134,7 +134,7 @@ final class AppSettings {
let analyticsConfiguration = AnalyticsConfiguration(isEnabled: InfoPlistReader.main.bundleIdentifier.starts(with: "io.element.elementx"),
host: "https://posthog.element.dev",
apiKey: "phc_VtA1L35nw3aeAtHIx1ayrGdzGkss7k1xINeXcoIQzXN",
termsURL: URL(staticString: "https://element.io/cookie-policy"))
termsURL: "https://element.io/cookie-policy")
#else
/// The configuration to use for analytics. Set `isEnabled` to false to disable analytics.
/// **Note:** Analytics are disabled by default for forks. If you are maintaining a fork, set custom configurations.
@@ -171,7 +171,7 @@ final class AppSettings {
// MARK: - Other
let permalinkBaseURL = URL(staticString: "https://matrix.to")
let permalinkBaseURL: URL = "https://matrix.to"
// MARK: - Maps
@@ -19,7 +19,7 @@ import Foundation
extension UserProfileProxy {
// Mocks
static var mockAlice: UserProfileProxy {
.init(userID: "@alice:matrix.org", displayName: "Alice", avatarURL: URL(staticString: "mxc://matrix.org/UcCimidcvpFvWkPzvjXMQPHA"))
.init(userID: "@alice:matrix.org", displayName: "Alice", avatarURL: "mxc://matrix.org/UcCimidcvpFvWkPzvjXMQPHA")
}
static var mockBob: UserProfileProxy {
+4 -4
View File
@@ -16,12 +16,12 @@
import Foundation
extension URL {
init(staticString: StaticString) {
guard let url = URL(string: "\(staticString)") else {
extension URL: ExpressibleByStringLiteral {
public init(stringLiteral value: StaticString) {
guard let url = URL(string: "\(value)") else {
fatalError("The static string used to create this URL is invalid")
}
self = url
}
@@ -120,7 +120,7 @@ class MediaPreviewItem: NSObject, QLPreviewItem {
// MARK: - Previews
struct PreviewView_Previews: PreviewProvider {
static let previewURL = URL(staticString: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf")
static let previewURL: URL = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
static let previewItem = MediaPreviewItem(file: .unmanaged(url: previewURL),
title: "Important Document")
@@ -213,7 +213,7 @@ struct TimelineReplyView_Previews: PreviewProvider {
thumbnailSource: nil,
contentType: nil))))
let imageSource = MediaSourceProxy(url: .init(staticString: "https://mock.com"), mimeType: "image/png")
let imageSource = MediaSourceProxy(url: "https://mock.com", mimeType: "image/png")
TimelineReplyView(placement: .timeline,
timelineItemReplyDetails: .loaded(sender: .init(id: "", displayName: "Alice"),
@@ -24,13 +24,13 @@ struct LegalInformationScreen: View {
Form {
Section {
Button(L10n.commonCopyright) {
openURL(URL(staticString: "https://element.io/copyright"))
openURL("https://element.io/copyright")
}
Button(L10n.commonAcceptableUsePolicy) {
openURL(URL(staticString: "https://element.io/acceptable-use-policy-terms"))
openURL("https://element.io/acceptable-use-policy-terms")
}
Button(L10n.commonPrivacyPolicy) {
openURL(URL(staticString: "https://element.io/privacy"))
openURL("https://element.io/privacy")
}
}
.buttonStyle(.compoundForm(accessory: .navigationLink))
@@ -71,7 +71,7 @@ struct OIDCAuthenticationDataProxy: Equatable {
// var url: URL {
// URL(string: underlyingData.loginUrl())!
// }
let url = URL(staticString: "https://theroadtonowhere")
let url: URL = "https://theroadtonowhere"
}
// extension OidcAuthenticationData: Equatable {