Skip to content
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 Composer/Classes/Addons/Editing/EditingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class EditingView: UIView, ComposerLocalizable {
clipsToBounds = true
isHidden = true

NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in
NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in
self?.setNeedsLayout()
})

Expand Down
4 changes: 2 additions & 2 deletions Composer/Classes/Addons/Hints/HintsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ public class HintsView: UITableView {
Shared initialization procedures.
*/
private func commonInit() {
NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in
NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in
self?.beginUpdates()
self?.endUpdates()
})

dataSource = self
delegate = self
rowHeight = UITableView.automaticDimension
rowHeight = UITableViewAutomaticDimension
estimatedRowHeight = 44
separatorInset = UIEdgeInsets(
top: 0,
Expand Down
2 changes: 1 addition & 1 deletion Composer/Classes/Addons/Reply/ReplyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public class ReplyView: UIView {
clipsToBounds = true
isHidden = true

NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in
NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in
self?.setNeedsLayout()
})

Expand Down
4 changes: 2 additions & 2 deletions Composer/Classes/Library/AudioRecorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class AudioRecorder: NSObject {
let session = AVAudioSession.sharedInstance()

do {
try session.setCategory(AVAudioSession.Category(rawValue: AVAudioSession.Category.playAndRecord.rawValue))
try session.setCategory(AVAudioSession.Category(string: AVAudioSessionCategoryPlayAndRecord) as String)
setUpRecorder()
} catch let error {
print("Set category error: \(error.localizedDescription).")
Expand Down Expand Up @@ -80,7 +80,7 @@ public class AudioRecorder: NSObject {
private func setSession(active: Bool) {
let session = AVAudioSession.sharedInstance()
do {
try session.setActive(active, options: [.notifyOthersOnDeactivation])
try session.setActive(active, with: [.notifyOthersOnDeactivation])
} catch let error {
print("Set active error: \(error.localizedDescription).")
}
Expand Down
4 changes: 2 additions & 2 deletions Composer/Classes/Overlays/PreviewAudioView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public class PreviewAudioView: UIView, ComposerLocalizable {
backgroundColor = .white
clipsToBounds = true

NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in
NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in
self?.setNeedsLayout()
})

Expand Down Expand Up @@ -284,7 +284,7 @@ public class AudioView: UIView {
layer.cornerRadius = Consts.layerCornerRadius
clipsToBounds = true

NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in
NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in
self?.setNeedsLayout()
})

Expand Down
4 changes: 2 additions & 2 deletions Composer/Classes/Overlays/RecordAudioView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public class RecordAudioView: UIView {
repeats: true
)

NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in
NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in
self?.setNeedsLayout()
})

Expand Down Expand Up @@ -317,7 +317,7 @@ public class SwipeIndicatorView: UIView, ComposerLocalizable {
private func commonInit() {
clipsToBounds = true

NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil, using: { [weak self] _ in
NotificationCenter.default.addObserver(forName: NSNotification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil, using: { [weak self] _ in
self?.setNeedsLayout()
})

Expand Down
4 changes: 2 additions & 2 deletions Composer/Classes/Views/ComposerTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class ComposerTextView: UITextView {

private func commonInit() {
let notificationCenter = NotificationCenter.default
notificationCenter.addObserver(self, selector: #selector(textDidChange), name: UITextView.textDidChangeNotification, object: nil)
notificationCenter.addObserver(self, selector: #selector(textDidChange), name: NSNotification.Name.UITextViewTextDidChange, object: nil)

placeholderLabel.addObserver(self, forKeyPath: "bounds", options: .new, context: nil)
self.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil)
Expand Down Expand Up @@ -130,7 +130,7 @@ public class ComposerTextView: UITextView {
}

deinit {
NotificationCenter.default.removeObserver(self, name: UITextView.textDidChangeNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UITextViewTextDidChange, object: nil)
}

}
Expand Down
12 changes: 6 additions & 6 deletions RocketChatViewController/Classes/RocketChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ open class RocketChatViewController: UICollectionViewController {
collectionView.scrollsToTop = false

if let flowLayout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout, isSelfSizing {
flowLayout.estimatedItemSize = UICollectionViewFlowLayout.automaticSize
flowLayout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize
}
}

Expand Down Expand Up @@ -418,15 +418,15 @@ extension RocketChatViewController {
NotificationCenter.default.addObserver(
self,
selector: #selector(_onKeyboardFrameWillChangeNotificationReceived(_:)),
name: UIResponder.keyboardWillChangeFrameNotification,
name: NSNotification.Name.UIKeyboardWillChangeFrame,
object: nil
)
}

func stopObservingKeyboard() {
NotificationCenter.default.removeObserver(
self,
name: UIResponder.keyboardWillChangeFrameNotification,
name: NSNotification.Name.UIKeyboardWillChangeFrame,
object: nil
)
}
Expand All @@ -438,7 +438,7 @@ extension RocketChatViewController {

guard
let userInfo = notification.userInfo,
let keyboardFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue,
let keyboardFrame = (userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue,
let collectionView = collectionView
else {
return
Expand All @@ -448,8 +448,8 @@ extension RocketChatViewController {
let safeAreaFrame = view.safeAreaLayoutGuide.layoutFrame.insetBy(dx: 0, dy: -additionalSafeAreaInsets.top)
let intersection = safeAreaFrame.intersection(keyboardFrameInView)

let animationDuration: TimeInterval = (notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0
let animationCurveRawNSN = notification.userInfo?[UIResponder.keyboardAnimationCurveUserInfoKey] as? NSNumber
let animationDuration: TimeInterval = (notification.userInfo?[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0
let animationCurveRawNSN = notification.userInfo?[UIKeyboardAnimationCurveUserInfoKey] as? NSNumber
let animationCurveRaw = animationCurveRawNSN?.uintValue ?? UIView.AnimationOptions.curveEaseInOut.rawValue
let animationCurve = UIView.AnimationOptions(rawValue: animationCurveRaw)

Expand Down