Przeglądaj źródła

remove old softkey hack.

Dan Walmsley 3 lat temu
rodzic
commit
ed19f5fc9a

+ 6 - 0
src/iOS/Avalonia.iOS/AvaloniaUIResponder.cs

@@ -0,0 +1,6 @@
+namespace Avalonia.iOS;
+
+public class AvaloniaUIResponder
+{
+    
+}

+ 0 - 32
src/iOS/Avalonia.iOS/AvaloniaView.Text.cs

@@ -1,32 +0,0 @@
-using Avalonia.Input;
-using Avalonia.Input.Raw;
-using Foundation;
-using ObjCRuntime;
-using UIKit;
-
-namespace Avalonia.iOS
-{
-    [Adopts("UIKeyInput")]
-    public partial class AvaloniaView
-    {
-        public override bool CanBecomeFirstResponder => true;
-
-        [Export("hasText")] public bool HasText => false;
-
-        [Export("insertText:")]
-        public void InsertText(string text) =>
-            _topLevelImpl.Input?.Invoke(new RawTextInputEventArgs(KeyboardDevice.Instance,
-                0, InputRoot, text));
-
-        [Export("deleteBackward")]
-        public void DeleteBackward()
-        {
-            // TODO: pass this through IME infrastructure instead of emulating a backspace press
-            _topLevelImpl.Input?.Invoke(new RawKeyEventArgs(KeyboardDevice.Instance,
-                0, InputRoot, RawKeyEventType.KeyDown, Key.Back, RawInputModifiers.None));
-            
-            _topLevelImpl.Input?.Invoke(new RawKeyEventArgs(KeyboardDevice.Instance,
-                0, InputRoot, RawKeyEventType.KeyUp, Key.Back, RawInputModifiers.None));
-        }
-    }
-}

+ 0 - 7
src/iOS/Avalonia.iOS/Platform.cs

@@ -44,7 +44,6 @@ namespace Avalonia.iOS
             GlFeature ??= new EaglFeature();
             Timer ??= new DisplayLinkTimer();
             var keyboard = new KeyboardDevice();
-            var softKeyboard = new SoftKeyboardHelper();
             
             AvaloniaLocator.CurrentMutable
                 .Bind<IPlatformOpenGlInterface>().ToConstant(GlFeature)
@@ -58,12 +57,6 @@ namespace Avalonia.iOS
                 .Bind<IRenderTimer>().ToConstant(Timer)
                 .Bind<IPlatformThreadingInterface>().ToConstant(new PlatformThreadingInterface())
                 .Bind<IKeyboardDevice>().ToConstant(keyboard);
-
-            keyboard.PropertyChanged += (_, changed) =>
-            {
-                if (changed.PropertyName == nameof(KeyboardDevice.FocusedElement))
-                    softKeyboard.UpdateKeyboard(keyboard.FocusedElement);
-            };
         }
 
 

+ 0 - 24
src/iOS/Avalonia.iOS/SoftKeyboardHelper.cs

@@ -1,24 +0,0 @@
-using Avalonia.Controls;
-using Avalonia.Input;
-
-namespace Avalonia.iOS
-{
-    public class SoftKeyboardHelper
-    {
-        private AvaloniaView _oldView;
-        
-        public void UpdateKeyboard(IInputElement focusedElement)
-        {
-            if (_oldView?.IsFirstResponder == true)
-                _oldView?.ResignFirstResponder();
-            _oldView = null;
-            
-            //TODO: Raise a routed event to determine if any control wants to become the text input handler 
-            if (focusedElement is TextBox)
-            {
-                var view = ((focusedElement.VisualRoot as TopLevel)?.PlatformImpl as AvaloniaView.TopLevelImpl)?.View;
-                view?.BecomeFirstResponder();
-            }
-        }
-    }
-}