diff --git a/Tusker/API/InstanceFeatures.swift b/Tusker/API/InstanceFeatures.swift index df18022b..6e0507c6 100644 --- a/Tusker/API/InstanceFeatures.swift +++ b/Tusker/API/InstanceFeatures.swift @@ -50,6 +50,10 @@ struct InstanceFeatures { || (instanceType == .pleroma && hasVersion(2, 0, 0)) } + var probablySupportsMarkdown: Bool { + instanceType == .pleroma || instanceType == .glitch || instanceType == .hometown + } + mutating func update(instance: Instance, nodeInfo: NodeInfo?) { let ver = instance.version.lowercased() if ver.contains("glitch") { diff --git a/Tusker/Screens/Preferences/AdvancedPrefsView.swift b/Tusker/Screens/Preferences/AdvancedPrefsView.swift index 6a68980d..4fc68ca1 100644 --- a/Tusker/Screens/Preferences/AdvancedPrefsView.swift +++ b/Tusker/Screens/Preferences/AdvancedPrefsView.swift @@ -23,7 +23,17 @@ struct AdvancedPrefsView : View { } var formattingFooter: some View { - Text("This option is only supported for Pleroma and Mastodon instances with formatting enabled. On all other instances, formatting symbols will remain in the unformatted plain text.").lineLimit(nil) + var s: AttributedString = "This option is only supported with Pleroma and some compatible Mastodon instances (such as Glitch or Hometown).\n" + if let account = LocalData.shared.getMostRecentAccount() { + let mastodonController = MastodonController.getForAccount(account) + // shouldn't need to load the instance here, because loading it is kicked off my the scene delegate + if !mastodonController.instanceFeatures.probablySupportsMarkdown { + var warning = AttributedString("\(account.instanceURL.host!) does not appear to support formatting. Using formatting symbols may not have an effect.") + warning[AttributeScopes.SwiftUIAttributes.FontAttribute.self] = .caption.bold() + s += warning + } + } + return Text(s).lineLimit(nil) } var formattingSection: some View {