| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if !defined(__has_feature) || !__has_feature(objc_arc) | 5 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 6 #error "This file requires ARC support." | 6 #error "This file requires ARC support." |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #import "remoting/ios/client_keyboard.h" | 9 #import "remoting/ios/client_keyboard.h" |
| 10 | 10 |
| 11 // TODO(nicholss): Look into inputAccessoryView to get the top bar for sending | 11 // TODO(nicholss): Look into inputAccessoryView to get the top bar for sending |
| 12 // special keys. | 12 // special keys. |
| 13 // TODO(nicholss): Look into inputView - The custom input view to display when | 13 // TODO(nicholss): Look into inputView - The custom input view to display when |
| 14 // the receiver becomes the first responder | 14 // the receiver becomes the first responder |
| 15 | 15 |
| 16 @implementation ClientKeyboard | 16 @implementation ClientKeyboard |
| 17 | 17 |
| 18 @synthesize autocapitalizationType = _autocapitalizationType; | 18 @synthesize autocapitalizationType = _autocapitalizationType; |
| 19 @synthesize autocorrectionType = _autocorrectionType; | 19 @synthesize autocorrectionType = _autocorrectionType; |
| 20 @synthesize keyboardAppearance = _keyboardAppearance; | 20 @synthesize keyboardAppearance = _keyboardAppearance; |
| 21 @synthesize keyboardType = _keyboardType; | 21 @synthesize keyboardType = _keyboardType; |
| 22 @synthesize spellCheckingType = _spellCheckingType; | 22 @synthesize spellCheckingType = _spellCheckingType; |
| 23 | 23 |
| 24 @synthesize delegate = _delegate; |
| 25 |
| 26 // TODO(nicholss): For physical keyboard, look at UIKeyCommand |
| 27 // https://developer.apple.com/reference/uikit/uikeycommand?language=objc |
| 28 |
| 24 - (instancetype)init { | 29 - (instancetype)init { |
| 25 self = [super init]; | 30 self = [super init]; |
| 26 if (self) { | 31 if (self) { |
| 27 _autocapitalizationType = UITextAutocapitalizationTypeNone; | 32 _autocapitalizationType = UITextAutocapitalizationTypeNone; |
| 28 _autocorrectionType = UITextAutocorrectionTypeNo; | 33 _autocorrectionType = UITextAutocorrectionTypeNo; |
| 29 _autocorrectionType = UITextAutocorrectionTypeNo; | 34 _autocorrectionType = UITextAutocorrectionTypeNo; |
| 30 _keyboardType = UIKeyboardTypeASCIICapable; | 35 _keyboardType = UIKeyboardTypeDefault; |
| 31 _spellCheckingType = UITextSpellCheckingTypeNo; | 36 _spellCheckingType = UITextSpellCheckingTypeNo; |
| 32 } | 37 } |
| 33 return self; | 38 return self; |
| 34 } | 39 } |
| 35 | 40 |
| 36 #pragma mark - UIKeyInput | 41 #pragma mark - UIKeyInput |
| 37 | 42 |
| 38 - (void)insertText:(NSString*)text { | 43 - (void)insertText:(NSString*)text { |
| 39 NSLog(@"insertText: %@", text); | 44 [_delegate clientKeyboardShouldSend:text]; |
| 40 } | 45 } |
| 41 | 46 |
| 42 - (void)deleteBackward { | 47 - (void)deleteBackward { |
| 43 NSLog(@"deleteBackward"); | 48 [_delegate clientKeyboardShouldDelete]; |
| 44 } | 49 } |
| 45 | 50 |
| 46 - (BOOL)hasText { | 51 - (BOOL)hasText { |
| 47 return NO; // not sure if this enables the back button. | 52 return NO; |
| 48 } | 53 } |
| 49 | 54 |
| 50 #pragma mark - UIResponder | 55 #pragma mark - UIResponder |
| 51 | 56 |
| 52 - (BOOL)canBecomeFirstResponder { | 57 - (BOOL)canBecomeFirstResponder { |
| 53 return YES; | 58 return YES; |
| 54 } | 59 } |
| 55 | 60 |
| 56 - (UIView*)inputAccessoryView { | 61 - (UIView*)inputAccessoryView { |
| 57 return nil; | 62 return nil; |
| 58 } | 63 } |
| 59 | 64 |
| 60 #pragma mark - UITextInputTraits | 65 #pragma mark - UITextInputTraits |
| 61 | 66 |
| 62 @end | 67 @end |
| OLD | NEW |