Skip to content

Commit

Permalink
Show instance version
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf committed Jan 14, 2024
1 parent 5cf1c2b commit fe8c799
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Mlem/Models/Content/Instance/InstanceModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct InstanceModel {
var banner: URL?
var administrators: [UserModel]?
var url: URL!
var version: SiteVersion?

init(from response: SiteResponse) {
self.update(with: response)
Expand All @@ -30,6 +31,7 @@ struct InstanceModel {
user.isAdmin = true
return user
}
self.version = SiteVersion(response.version)
self.update(with: response.siteView.site)
}

Expand Down
14 changes: 11 additions & 3 deletions Mlem/Views/Shared/Instance/InstanceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ struct InstanceView: View {
_instance = State(wrappedValue: instance)
}

var subtitleText: String {
if let version = instance?.version {
"\(domainName)\(String(describing: version))"
} else {
domainName
}
}

var body: some View {
ScrollView {
ScrollToView(appeared: $scrollToTopAppeared)
Expand All @@ -60,10 +68,10 @@ struct InstanceView: View {
.fontWeight(.semibold)
.lineLimit(1)
.minimumScaleFactor(0.01)
Text(domainName)

Text(subtitleText)
.font(.footnote)
.foregroundStyle(.secondary)
.padding(.bottom, 5)
}
} else {
Text(domainName)
Expand All @@ -73,9 +81,9 @@ struct InstanceView: View {
.minimumScaleFactor(0.01)
.padding(.bottom, 5)
Divider()

}
}
.padding(.bottom, 5)
if let instance {
VStack(spacing: 0) {
VStack(spacing: 4) {
Expand Down

0 comments on commit fe8c799

Please sign in to comment.