diff --git a/Discord Classic/DCChannel.m b/Discord Classic/DCChannel.m
index 4c1bb99..c4293a1 100755
--- a/Discord Classic/DCChannel.m
+++ b/Discord Classic/DCChannel.m
@@ -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"];
diff --git a/Discord Classic/DCChatViewController.m b/Discord Classic/DCChatViewController.m
index c103e15..aaf1310 100755
--- a/Discord Classic/DCChatViewController.m
+++ b/Discord Classic/DCChatViewController.m
@@ -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];
diff --git a/Discord Classic/DCGuildListViewController.m b/Discord Classic/DCGuildListViewController.m
index bc0c9ff..f7264d8 100755
--- a/Discord Classic/DCGuildListViewController.m
+++ b/Discord Classic/DCGuildListViewController.m
@@ -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
@@ -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];
}
diff --git a/Discord Classic/Discord Classic-Info.plist b/Discord Classic/Discord Classic-Info.plist
index a35412c..0aff6aa 100755
--- a/Discord Classic/Discord Classic-Info.plist
+++ b/Discord Classic/Discord Classic-Info.plist
@@ -52,6 +52,8 @@
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
UISupportedInterfaceOrientations~ipad