Skip to content
This repository was archived by the owner on Feb 22, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Discord Classic/DCChannel.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ - (void)sendMessage:(NSString*)message {

[urlRequest setHTTPMethod:@"POST"];

[urlRequest setHTTPBody:[NSData dataWithBytes:[messageString UTF8String] length:[messageString length]]];
[urlRequest setHTTPBody:[NSData dataWithBytes:[messageString UTF8String] length:[messageString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]]];
[urlRequest addValue:DCServerCommunicator.sharedInstance.token forHTTPHeaderField:@"Authorization"];
[urlRequest addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];

Expand Down
2 changes: 1 addition & 1 deletion Discord Classic/DCChatViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ - (void)keyboardWillShow:(NSNotification *)notification {
//thx to Pierre Legrain
//http://pyl.io/2015/08/17/animating-in-sync-with-ios-keyboard/

int keyboardHeight = [[notification.userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size.height;
int keyboardHeight = UIDeviceOrientationIsPortrait([[UIDevice currentDevice] orientation]) ? [[notification.userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size.height : [[notification.userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size.width;
float keyboardAnimationDuration = [[notification.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
int keyboardAnimationCurve = [[notification.userInfo objectForKey: UIKeyboardAnimationCurveUserInfoKey] integerValue];

Expand Down
17 changes: 16 additions & 1 deletion Discord Classic/DCGuildListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ - (void)handleReady {
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Guild Cell"];

//Sort guild list
DCServerCommunicator.sharedInstance.guilds = [DCServerCommunicator.sharedInstance.guilds sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
NSString *first = [(DCGuild*)a name];
NSString *second = [(DCGuild*)b name];
if([first compare:@"Direct Messages"] == 0) return false; // DMs at the top
return [first compare:second];
}];

DCGuild* guildAtRowIndex = [DCServerCommunicator.sharedInstance.guilds objectAtIndex:indexPath.row];

//Show blue indicator if guild has any unread messages
Expand All @@ -72,7 +80,14 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
DCServerCommunicator.sharedInstance.selectedGuild = [DCServerCommunicator.sharedInstance.guilds objectAtIndex:indexPath.row];
}

//Transition to channel list
//Sort channel list
DCServerCommunicator.sharedInstance.selectedGuild.channels = [DCServerCommunicator.sharedInstance.selectedGuild.channels sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
NSString *first = [(DCChannel*)a name];
NSString *second = [(DCChannel*)b name];
return [first compare:second];
}];

//Transition to channel list
[self performSegueWithIdentifier:@"Guilds to Channels" sender:self];
}

Expand Down
2 changes: 2 additions & 0 deletions Discord Classic/Discord Classic-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
Expand Down