From 8921e6c8df46669b9e53e57ab252154a6b8f2e3f Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Wed, 18 Jan 2023 19:10:45 +0100 Subject: [PATCH] Support more instances --- IceCubesApp/App/Tabs/Settings/InstanceInfoView.swift | 10 ++++++---- Packages/Models/Sources/Models/Instance.swift | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/IceCubesApp/App/Tabs/Settings/InstanceInfoView.swift b/IceCubesApp/App/Tabs/Settings/InstanceInfoView.swift index 52fe91a0..18d51777 100644 --- a/IceCubesApp/App/Tabs/Settings/InstanceInfoView.swift +++ b/IceCubesApp/App/Tabs/Settings/InstanceInfoView.swift @@ -35,11 +35,13 @@ public struct InstanceInfoSection: View { } .listRowBackground(theme.primaryBackgroundColor) - Section("Instance rules") { - ForEach(instance.rules) { rule in - Text(rule.text) + if let rules = instance.rules { + Section("Instance rules") { + ForEach(rules) { rule in + Text(rule.text) + } } + .listRowBackground(theme.primaryBackgroundColor) } - .listRowBackground(theme.primaryBackgroundColor) } } diff --git a/Packages/Models/Sources/Models/Instance.swift b/Packages/Models/Sources/Models/Instance.swift index 9b89060e..c8e9f7f7 100644 --- a/Packages/Models/Sources/Models/Instance.swift +++ b/Packages/Models/Sources/Models/Instance.swift @@ -34,9 +34,9 @@ public struct Instance: Codable { public let email: String public let version: String public let stats: Stats - public let languages: [String] + public let languages: [String]? public let registrations: Bool public let thumbnail: URL? - public let configuration: Configuration - public let rules: [Rule] + public let configuration: Configuration? + public let rules: [Rule]? }