WatchOS keyboard allow emoji

This commit is contained in:
Kylmakalle 2025-05-02 10:27:20 +03:00
parent be7626f30b
commit 836ed086f4
4 changed files with 12 additions and 2 deletions

View File

@ -5,6 +5,7 @@
@interface TGInputController : NSObject
+ (void)presentPlainInputControllerForInterfaceController:(TGInterfaceController *)interfaceController completion:(void (^)(NSString *))completion;
+ (void)presentInputControllerWithEmojisForInterfaceController:(TGInterfaceController *)interfaceController completion:(void (^)(NSString *))completion;
+ (void)presentInputControllerForInterfaceController:(TGInterfaceController *)interfaceController suggestionsForText:(NSString *)text completion:(void (^)(NSString *))completion;
+ (void)presentAudioControllerForInterfaceController:(TGInterfaceController *)interfaceController completion:(void (^)(int64_t uniqueId, int32_t duration, NSURL *url))completion;

View File

@ -20,6 +20,15 @@
}];
}
+ (void)presentInputControllerWithEmojisForInterfaceController:(TGInterfaceController *)interfaceController completion:(void (^)(NSString *))completion;
{
[interfaceController presentTextInputControllerWithSuggestions:nil allowedInputMode:WKTextInputModeAllowEmoji completion:^(NSArray *results)
{
if (completion != nil && results.count > 0 && [results.firstObject isKindOfClass:[NSString class]])
completion(results.firstObject);
}];
}
+ (void)presentInputControllerForInterfaceController:(TGInterfaceController *)interfaceController suggestionsForText:(NSString *)text completion:(void (^)(NSString *))completion
{
[interfaceController presentTextInputControllerWithSuggestions:[self suggestionsForText:text] allowedInputMode:WKTextInputModeAllowEmoji completion:^(NSArray *results)

View File

@ -229,7 +229,7 @@ NSString *const TGMessageViewControllerIdentifier = @"TGMessageViewController";
if (strongSelf == nil)
return;
[TGInputController presentPlainInputControllerForInterfaceController:strongSelf completion:^(NSString *text)
[TGInputController presentInputControllerWithEmojisForInterfaceController:strongSelf completion:^(NSString *text)
{
[strongSelf->_sendMessageDisposable setDisposable:[[TGBridgeSendMessageSignals sendMessageWithPeerId:strongSelf->_context.peerId text:text replyToMid:strongSelf->_context.message.identifier] startWithNext:^(TGBridgeMessage *message)
{

View File

@ -1238,7 +1238,7 @@ const NSInteger TGNeoConversationControllerInitialRenderCount = 4 * 2;
if (strongSelf == nil)
return;
[TGInputController presentPlainInputControllerForInterfaceController:strongSelf completion:^(NSString *text)
[TGInputController presentInputControllerWithEmojisForInterfaceController:strongSelf completion:^(NSString *text)
{
[strongSelf sendMessageWithText:text];
}];