Skip to content

Commit

Permalink
patch(user): hide server join date in DMs
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoAlgorithm committed Sep 28, 2023
1 parent 4f46c31 commit a2b13f9
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions Swiftcord/Views/User/Avatar/UserAvatarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,28 @@ struct UserAvatarView: View {
.tint(.blue)
}

Text("Member Since")
Text(ctx.guild?.id.isDM == true ? "Discord Member Since" : "Member Since")
.font(.headline)
.textCase(.uppercase)
HStack(spacing: 8) {
Image("DiscordIcon").resizable().aspectRatio(contentMode: .fit).frame(width: 16)
Text(user.id.createdAt?.formatted(.dateTime.day().month().year()) ?? "Unknown")

Circle().fill(Color(nsColor: .separatorColor)).frame(width: 4, height: 4)

if let iconURL = ctx.guild?.properties.iconURL(size: 32), let url = URL(string: iconURL) {
BetterImageView(url: url).frame(width: 16).clipShape(Circle())
} else {
Text("\(ctx.guild?.properties.name ?? "")")
.font(.caption)
.fixedSize()
.frame(width: 16, height: 16, alignment: .leading)
.background(.gray.opacity(0.5))
.clipShape(Circle())
if let guild = ctx.guild, !guild.id.isDM {
Circle().fill(Color(nsColor: .separatorColor)).frame(width: 4, height: 4)

if let iconURL = guild.properties.iconURL(size: 32), let url = URL(string: iconURL) {
BetterImageView(url: url).frame(width: 16).clipShape(Circle())
} else {
Text("\(guild.properties.name)")
.font(.caption)
.fixedSize()
.frame(width: 16, height: 16, alignment: .leading)
.background(.gray.opacity(0.5))
.clipShape(Circle())
}
Text(member?.joined_at.formatted(.dateTime.day().month().year()) ?? "Unknown")
}
Text(member?.joined_at.formatted(.dateTime.day().month().year()) ?? "Unknown")
}

if guildID != "@me" {
Expand Down

0 comments on commit a2b13f9

Please sign in to comment.