From 7b453667dd79bf1e1df70db04111ef6491e23e8d Mon Sep 17 00:00:00 2001 From: Owen Ackner Date: Fri, 12 May 2023 09:02:00 -0400 Subject: [PATCH 1/4] Added a Username Copy Button A Button to directly copy user and discrim from the mini profile page. --- .../Views/User/Profile/MiniUserProfileView.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Swiftcord/Views/User/Profile/MiniUserProfileView.swift b/Swiftcord/Views/User/Profile/MiniUserProfileView.swift index bbfbf4c1..4ca83d9b 100644 --- a/Swiftcord/Views/User/Profile/MiniUserProfileView.swift +++ b/Swiftcord/Views/User/Profile/MiniUserProfileView.swift @@ -12,6 +12,9 @@ import CachedAsyncImage struct MiniUserProfileView: View { let user: User + + let pasteboard = NSPasteboard.general + @Binding var profile: UserProfile? var guildRoles: [Role]? var isWebhook: Bool = false @@ -90,6 +93,15 @@ struct MiniUserProfileView: View { NonUserBadge(flags: user.public_flags, isWebhook: isWebhook) } Spacer() + Button(action: { + pasteboard.declareTypes([.string], owner: nil) + pasteboard.setString("\(user.username)#\(user.discriminator)", forType: .string) + }, label: { + Image(systemName: "square.on.square") + }) + .buttonStyle(.plain) + .padding() + .frame(width: 20, height: 20) } // Custom status From c2cf8a0b561a6b223b442f9fde9e2f564f14a434 Mon Sep 17 00:00:00 2001 From: Owen Ackner Date: Fri, 12 May 2023 11:09:05 -0400 Subject: [PATCH 2/4] Removed Trailing Whitespace --- Swiftcord/Views/User/Profile/MiniUserProfileView.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Swiftcord/Views/User/Profile/MiniUserProfileView.swift b/Swiftcord/Views/User/Profile/MiniUserProfileView.swift index 4ca83d9b..b61c5f37 100644 --- a/Swiftcord/Views/User/Profile/MiniUserProfileView.swift +++ b/Swiftcord/Views/User/Profile/MiniUserProfileView.swift @@ -12,9 +12,7 @@ import CachedAsyncImage struct MiniUserProfileView: View { let user: User - let pasteboard = NSPasteboard.general - @Binding var profile: UserProfile? var guildRoles: [Role]? var isWebhook: Bool = false From 6f3ca90fa6aef71f045fe62df8f4d69ce718d1db Mon Sep 17 00:00:00 2001 From: Owen Ackner Date: Thu, 18 May 2023 11:55:51 -0400 Subject: [PATCH 3/4] Redid AccountOverview Added a more discord like profile page. --- .../Views/Settings/User/AccountOverview.swift | 107 +++++++++++++++--- 1 file changed, 94 insertions(+), 13 deletions(-) diff --git a/Swiftcord/Views/Settings/User/AccountOverview.swift b/Swiftcord/Views/Settings/User/AccountOverview.swift index 0d4be453..003c899e 100644 --- a/Swiftcord/Views/Settings/User/AccountOverview.swift +++ b/Swiftcord/Views/Settings/User/AccountOverview.swift @@ -25,27 +25,108 @@ struct AccountOverview: View { UserInfo() } } header: { - VStack(spacing: 0) { - CachedAsyncImage(url: user.avatarURL(size: 240)) { image in - image.resizable().scaledToFill() - } placeholder: { - ProgressView().progressViewStyle(.circular) + VStack { + HStack(spacing: 0) { + CachedAsyncImage(url: user.avatarURL(size: 240)) { image in + image.resizable().scaledToFill() + } placeholder: { + ProgressView().progressViewStyle(.circular) + } + .clipShape(Circle()) + .frame(width: 70, height: 70) + .padding(5) + .overlay { + Circle() + .strokeBorder(.white.opacity(0.5), lineWidth: 2) + } + .padding() + VStack(alignment: .leading) { + Text(user.username).font(.title)/*.padding(.top, 6)*/ + Text("#" + user.discriminator) + .font(.system(.title3, weight: .bold)) + } + Spacer() + Button(action: { + if let url = URL(string: "https://discord.com/channels/@me") { + NSWorkspace.shared.open(url) + } + }, label: { + HStack { + Text("Edit Profile") + Image(systemName: "link") + } + .frame(width: 131, height: 32) + .background(Color.accentColor) + .cornerRadius(5) + }) + .buttonStyle(.plain) } - .clipShape(Circle()) - .frame(width: 100, height: 100) - Text(user.username).font(.title2).padding(.top, 6) - Text(user.email).font(.system(.title3, weight: .regular)) - if let phone = user.phone { - Text(phone) - .textSelection(.enabled) + .padding() + //.background(Color.green.opacity(0.5)) + VStack { + List { + HStack { + VStack(alignment: .leading) { + Text("Display Name") + .font(.system(.title3, weight: .bold)) + Text(user.username) + .font(.system(.title3, weight: .regular)) + } + Spacer() +// Button(action: {}, label: { +// HStack { +// Text("Learn More") +// Image(systemName: "link") +// } +// .frame(height: 32) +// .padding(.leading, 20) +// .padding(.trailing, 20) +// .background(Color.accentColor) +// .cornerRadius(5) +// }) +// .buttonStyle(.plain) + } + HStack { + VStack(alignment: .leading) { + Text("Username") + .font(.system(.title3, weight: .bold)) + Text(user.username + "#" + user.discriminator) + .font(.system(.title3, weight: .regular)) + } + Spacer() + } + HStack { + VStack(alignment: .leading) { + Text("Email") + .font(.system(.title3, weight: .bold)) + Text(user.email) + .font(.system(.title3, weight: .regular)) + } + Spacer() + } + if let phone = user.phone { + HStack { + VStack(alignment: .leading) { + Text("Phone") + .font(.system(.title3, weight: .bold)) + Text(phone) + .font(.system(.title3, weight: .regular)) + } + Spacer() + } + } + } + .cornerRadius(15) + .padding() } } .foregroundColor(.primary) .frame(maxWidth: .infinity) .padding(.top, -10) .padding(.bottom, 10) + .background(Color.black.opacity(0.4)) + .cornerRadius(15) } - Section { HStack { Button("Disable Account", role: .destructive) { From 5940774e0b4fa7e3c5e4b2605ad1340df5814703 Mon Sep 17 00:00:00 2001 From: Owen Ackner Date: Thu, 18 May 2023 12:15:51 -0400 Subject: [PATCH 4/4] Edited Account Overview --- .../Views/Settings/User/AccountOverview.swift | 51 ++++++++----------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/Swiftcord/Views/Settings/User/AccountOverview.swift b/Swiftcord/Views/Settings/User/AccountOverview.swift index 003c899e..dbee2140 100644 --- a/Swiftcord/Views/Settings/User/AccountOverview.swift +++ b/Swiftcord/Views/Settings/User/AccountOverview.swift @@ -67,43 +67,13 @@ struct AccountOverview: View { List { HStack { VStack(alignment: .leading) { - Text("Display Name") - .font(.system(.title3, weight: .bold)) - Text(user.username) - .font(.system(.title3, weight: .regular)) - } - Spacer() -// Button(action: {}, label: { -// HStack { -// Text("Learn More") -// Image(systemName: "link") -// } -// .frame(height: 32) -// .padding(.leading, 20) -// .padding(.trailing, 20) -// .background(Color.accentColor) -// .cornerRadius(5) -// }) -// .buttonStyle(.plain) - } - HStack { - VStack(alignment: .leading) { - Text("Username") + Text("Name") .font(.system(.title3, weight: .bold)) Text(user.username + "#" + user.discriminator) .font(.system(.title3, weight: .regular)) } Spacer() } - HStack { - VStack(alignment: .leading) { - Text("Email") - .font(.system(.title3, weight: .bold)) - Text(user.email) - .font(.system(.title3, weight: .regular)) - } - Spacer() - } if let phone = user.phone { HStack { VStack(alignment: .leading) { @@ -114,6 +84,25 @@ struct AccountOverview: View { } Spacer() } + } else { + HStack { + VStack(alignment: .leading) { + Text("Phone") + .font(.system(.title3, weight: .bold)) + Text("No Phone Number Added") + .font(.system(.title3, weight: .regular)) + } + Spacer() + } + } + HStack { + VStack(alignment: .leading) { + Text("Email") + .font(.system(.title3, weight: .bold)) + Text(user.email) + .font(.system(.title3, weight: .regular)) + } + Spacer() } } .cornerRadius(15)