From 416d55ee98b0c649e9289fe287c582fe747b2817 Mon Sep 17 00:00:00 2001
From: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
Date: Wed, 3 Jan 2018 14:12:30 -0500
Subject: [PATCH] UI: fix keyboard appearance.

This patch fixes two problems:
- during creation an account a screen could become not scrollable and
keyboard overly button "Create Account"
- keyboard shortly overly messages when appearing on a conversation
screen.

Change-Id: Ibcea9e1b6e933739cae9c2d2ae27337a3228ed45
Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
---
 Ring/Ring/Extensions/NotificationCenter+Ring.swift            | 2 +-
 .../Conversation/ConversationViewController.swift             | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Ring/Ring/Extensions/NotificationCenter+Ring.swift b/Ring/Ring/Extensions/NotificationCenter+Ring.swift
index fbaf310b1..086818bfc 100644
--- a/Ring/Ring/Extensions/NotificationCenter+Ring.swift
+++ b/Ring/Ring/Extensions/NotificationCenter+Ring.swift
@@ -27,7 +27,7 @@ extension NotificationCenter {
             .from([
                 NotificationCenter.default.rx.notification(NSNotification.Name.UIKeyboardWillShow)
                     .map { notification -> CGFloat in
-                        (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue.height ?? 0
+                        return (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.height ?? 0
                 },
                 NotificationCenter.default.rx.notification(NSNotification.Name.UIKeyboardWillHide)
                     .map { _ -> CGFloat in
diff --git a/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift b/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift
index e50222d62..29119f927 100644
--- a/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift
+++ b/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift
@@ -64,7 +64,7 @@ class ConversationViewController: UIViewController, UITextFieldDelegate, Storybo
          Register to keyboard notifications to adjust tableView insets when the keybaord appears
          or disappears
          */
-        NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(withNotification:)), name: NSNotification.Name.UIKeyboardDidShow, object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(withNotification:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(withNotification:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
     }
 
@@ -79,7 +79,7 @@ class ConversationViewController: UIViewController, UITextFieldDelegate, Storybo
         self.tableView.contentInset.bottom = keyboardHeight
         self.tableView.scrollIndicatorInsets.bottom = keyboardHeight
 
-        self.scrollToBottom(animated: true)
+        self.scrollToBottom(animated: false)
         self.updateBottomOffset()
     }
 
-- 
GitLab