Skip to content

Commit 8f65765

Browse files
final 1.7 UI changes
1 parent 2aa05a3 commit 8f65765

File tree

10 files changed

+73
-16
lines changed

10 files changed

+73
-16
lines changed

Accord.xcodeproj/project.pbxproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
9EDD136627D5A55A000685E6 /* String++.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EDD136527D5A55A000685E6 /* String++.swift */; };
9696
9EDD136827D6F951000685E6 /* Regex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EDD136727D6F951000685E6 /* Regex.swift */; };
9797
9EDDB1B32831E4FC00510036 /* Reachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EDDB1B22831E4FC00510036 /* Reachability.swift */; };
98-
9EE107C429270F6D007A8426 /* Swizzling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EE107C329270F6D007A8426 /* Swizzling.swift */; };
9998
9EE2467E28F192DD004AB87B /* PlatformNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EE2467D28F192DD004AB87B /* PlatformNavigation.swift */; };
10099
9EE7E13628EA234D0021BE4F /* UserGuildSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EE7E13528EA234D0021BE4F /* UserGuildSettings.swift */; };
101100
9EEC6D6D2890429E0005DF30 /* MessageUpdate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EEC6D6C2890429E0005DF30 /* MessageUpdate.swift */; };
@@ -1298,7 +1297,7 @@
12981297
"@executable_path/../Frameworks",
12991298
);
13001299
MACOSX_DEPLOYMENT_TARGET = 11.0;
1301-
MARKETING_VERSION = 1.7;
1300+
MARKETING_VERSION = 1.7;
13021301
OTHER_LDFLAGS = "";
13031302
OTHER_SWIFT_FLAGS = "";
13041303
PRESERVE_DEAD_CODE_INITS_AND_TERMS = NO;
@@ -1349,7 +1348,7 @@
13491348
"@executable_path/../Frameworks",
13501349
);
13511350
MACOSX_DEPLOYMENT_TARGET = 11.0;
1352-
MARKETING_VERSION = 1.7;
1351+
MARKETING_VERSION = 1.7;
13531352
OTHER_LDFLAGS = "";
13541353
OTHER_SWIFT_FLAGS = "";
13551354
PRESERVE_DEAD_CODE_INITS_AND_TERMS = NO;

Accord/App/ContentView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ struct ContentView: View {
8686
switch completion {
8787
case .finished: break
8888
case let .failure(error):
89+
AccordApp.error(error, text: "Gateway failed to connect", additionalDescription: String(describing: error), reconnectOption: true)
8990
failedToConnect(error)
9091
}
9192
}) { d in

Accord/UI/Base/Guild/GuildView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ extension ServerListView {
7878
)
7979
.onReceive(self.appModel.$selectedGuild, perform: { [weak appModel] guild in
8080
if let guild, let value = UserDefaults.standard.object(forKey: "AccordChannelIn\(guild.id)") as? String, channel.id == value {
81-
appModel?.selectedChannel = channel
81+
DispatchQueue.main.async {
82+
DispatchQueue.main.async {
83+
appModel?.selectedChannel = channel
84+
}
85+
}
8286
}
8387
})
8488
.foregroundColor({ () -> Color? in

Accord/UI/Base/Guild/PrivateChannelsView.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,17 @@ struct PrivateChannelsView: View {
6464
}
6565
}
6666
)
67+
.onReceive(self.appModel.$selectedGuild, perform: { [weak appModel] guild in
68+
if guild == nil,
69+
let value = UserDefaults.standard.object(forKey: "AccordChannelDMs") as? String,
70+
channel.id == value {
71+
DispatchQueue.main.async {
72+
DispatchQueue.main.async {
73+
appModel?.selectedChannel = channel
74+
}
75+
}
76+
}
77+
})
6778
.contextMenu {
6879
Button("Copy Channel ID") {
6980
NSPasteboard.general.clearContents()

Accord/UI/Base/Icons/DMButton.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ struct DMButton: View {
4040
appModel.selectedChannel = nil
4141
}
4242
}) {
43-
Image(systemName: "bubble.right.fill")
44-
.font(.system(size: 16))
43+
Image(systemName: "message.fill")
44+
.font(.system(size: 20))
4545
.padding()
4646
.frame(width: 50, height: 50)
4747
.background(selectedServer == "@me" || iconHovered ? Color.accentColor.opacity(0.5) : Color(NSColor.secondaryLabelColor).opacity(0.2))

Accord/UI/Chat/ChannelView/Accessories/EmotesView.swift

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,43 @@ struct EmotesView: View, Equatable {
5252
self.onSelect(DiscordEmote(id: "stock", name: self.search))
5353
self.presentationMode.wrappedValue.dismiss()
5454
}
55-
TabView(selection: self.$selection) {
55+
HStack {
56+
Button {
57+
withAnimation(.easeInOut) {
58+
self.selection = .emotes
59+
}
60+
} label: {
61+
Text("Emotes")
62+
.fontWeight(.medium)
63+
.padding(5)
64+
.padding(.horizontal, 3)
65+
.if(self.selection == .emotes, transform: {
66+
$0
67+
.background(RoundedRectangle(cornerRadius: 5).fill(Color.secondary.opacity(0.5)))
68+
})
69+
}
70+
.buttonStyle(.plain)
71+
.foregroundColor(.primary)
72+
Button {
73+
withAnimation(.easeInOut) {
74+
self.selection = .stickers
75+
}
76+
} label: {
77+
Text("Stickers")
78+
.fontWeight(.medium)
79+
.padding(5)
80+
.padding(.horizontal, 3)
81+
.if(self.selection == .stickers, transform: {
82+
$0
83+
.background(RoundedRectangle(cornerRadius: 5).fill(Color.secondary.opacity(0.5)))
84+
})
85+
}
86+
.buttonStyle(.plain)
87+
.foregroundColor(.primary)
88+
}
89+
.padding(1)
90+
.background(RoundedRectangle(cornerRadius: 10).fill(Color(NSColor.windowBackgroundColor)))
91+
if self.selection == .emotes {
5692
ScrollView {
5793
LazyVStack(alignment: .leading) {
5894
if search.isEmpty {
@@ -82,7 +118,7 @@ struct EmotesView: View, Equatable {
82118
}
83119
}
84120
}
85-
121+
86122
} else {
87123
LazyVGrid(columns: columns) {
88124
ForEach(Storage.emotes.values.flatMap { $0 }.filter { $0.name.contains(search) }, id: \.id) { emote in
@@ -104,10 +140,9 @@ struct EmotesView: View, Equatable {
104140
}
105141
}
106142
.padding()
107-
.tabItem({Text("Emotes")})
143+
} else {
108144
if #available(macOS 12.0, *) {
109145
StickersView()
110-
.tabItem({Text("Stickers")})
111146
}
112147
}
113148
}

Accord/UI/Chat/ChannelView/ChannelViewViewModel.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ final class ChannelViewViewModel: ObservableObject, Equatable {
253253

254254
wss.memberChunkSubject
255255
.receive(on: webSocketQueue)
256+
.debounce(for: .seconds(0.5), scheduler: RunLoop.main)
256257
.sink { [weak self] msg in
257258
guard let chunk = try? JSONDecoder().decode(GuildMemberChunkResponse.self, from: msg),
258259
let users = chunk.d?.members,

Accord/UI/Chat/ChannelView/MessageCell/Components/Reference/ReplyView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct ReplyView: View {
4949
})
5050
.buttonStyle(.borderless)
5151
}
52-
.padding(.bottom, -3)
52+
.padding(.bottom, -2)
5353
.padding(.leading, 15)
5454
}
5555
}

Accord/UI/Chat/ChannelView/MessageCell/MessageCellView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct MessageCellView: View, Equatable {
4242
@AppStorage("GifProfilePictures")
4343
var gifPfp: Bool = false
4444

45-
private let leftPadding: Double = 44.5
45+
private let leftPadding: Double = 47
4646

4747
@EnvironmentObject
4848
var appModel: AppGlobals
@@ -224,7 +224,7 @@ struct MessageCellView: View, Equatable {
224224
}
225225
}
226226
.if(self.message.content.isEmpty, transform: {
227-
$0.padding(.top, -10)
227+
$0.padding(.top, -8)
228228
})
229229
}
230230
.contextMenu {

Accord/UI/Profile/PopoverProfileView.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,15 @@ struct PopoverProfileView: View {
210210
Text(self.guildMember?.nick ?? user?.username ?? "")
211211
.font(.title2)
212212
.fontWeight(.bold)
213-
Text("\(user?.username ?? "")#\(user?.discriminator ?? "")")
214-
.font(.subheadline)
215-
.foregroundColor(Color.secondary)
213+
if user?.discriminator == "0" {
214+
Text(user?.username ?? "")
215+
.font(.subheadline)
216+
.foregroundColor(Color.secondary)
217+
} else {
218+
Text("\(user?.username ?? "")#\(user?.discriminator ?? "")")
219+
.font(.subheadline)
220+
.foregroundColor(Color.secondary)
221+
}
216222

217223
if let bio = self.fullUser?.bio, !bio.isEmpty {
218224
Divider()

0 commit comments

Comments
 (0)