forked from mirrors/linphone-iphone
Add emoji picker
This commit is contained in:
parent
512ca5afe8
commit
3517cf69cd
1 changed files with 30 additions and 0 deletions
|
|
@ -625,6 +625,12 @@ struct ConversationFragment: View {
|
||||||
HStack(spacing: 0) {
|
HStack(spacing: 0) {
|
||||||
if !voiceRecordingInProgress {
|
if !voiceRecordingInProgress {
|
||||||
Button {
|
Button {
|
||||||
|
isMessageTextFocused = true
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
if let inputView = UIResponder.currentFirstResponder() as? UITextField {
|
||||||
|
inputView.inputView = inputView.inputView
|
||||||
|
}
|
||||||
|
}
|
||||||
} label: {
|
} label: {
|
||||||
Image("smiley")
|
Image("smiley")
|
||||||
.renderingMode(.template)
|
.renderingMode(.template)
|
||||||
|
|
@ -635,6 +641,15 @@ struct ConversationFragment: View {
|
||||||
.padding(.top, 4)
|
.padding(.top, 4)
|
||||||
}
|
}
|
||||||
.padding(.horizontal, isMessageTextFocused ? 0 : 2)
|
.padding(.horizontal, isMessageTextFocused ? 0 : 2)
|
||||||
|
.onChange(of: isMessageTextFocused) { focused in
|
||||||
|
if focused {
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||||
|
if let inputView = UIResponder.currentFirstResponder() as? UITextField {
|
||||||
|
inputView.inputView = UIInputView(frame: CGRect.zero, inputViewStyle: .keyboard)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
self.isShowPhotoLibrary = true
|
self.isShowPhotoLibrary = true
|
||||||
|
|
@ -1361,6 +1376,21 @@ struct VoiceRecorderPlayer: View {
|
||||||
timer = nil
|
timer = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension UIResponder {
|
||||||
|
private static weak var _currentFirstResponder: UIResponder?
|
||||||
|
|
||||||
|
static func currentFirstResponder() -> UIResponder? {
|
||||||
|
_currentFirstResponder = nil
|
||||||
|
UIApplication.shared.sendAction(#selector(findFirstResponder), to: nil, from: nil, for: nil)
|
||||||
|
return _currentFirstResponder
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc private func findFirstResponder() {
|
||||||
|
UIResponder._currentFirstResponder = self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#Preview {
|
#Preview {
|
||||||
ConversationFragment(conversationViewModel: ConversationViewModel(), conversationsListViewModel: ConversationsListViewModel(), sections: [MessagesSection], ids: [""])
|
ConversationFragment(conversationViewModel: ConversationViewModel(), conversationsListViewModel: ConversationsListViewModel(), sections: [MessagesSection], ids: [""])
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue