[keyboard] remove deprecated code
Change-Id: Iaf2935520f0c45bc53a1767c96a6cdbd11e9fc6c
diff --git a/lib/keyboard_deprecated/OWNERS b/lib/keyboard_deprecated/OWNERS
deleted file mode 100644
index ee57af3..0000000
--- a/lib/keyboard_deprecated/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-iamjack@google.com
-*
diff --git a/lib/keyboard_deprecated/analysis_options.yaml b/lib/keyboard_deprecated/analysis_options.yaml
deleted file mode 100644
index 5ad6dd5..0000000
--- a/lib/keyboard_deprecated/analysis_options.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include: ../analysis_options.yaml
diff --git a/lib/keyboard_deprecated/dart/BUILD.gn b/lib/keyboard_deprecated/dart/BUILD.gn
deleted file mode 100644
index 613e0bb..0000000
--- a/lib/keyboard_deprecated/dart/BUILD.gn
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright 2017 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//build/dart/dart_library.gni")
-
-dart_library("dart") {
- infer_package_name = true
-
- sources = [
- "keyboard_display.dart",
- ]
-
- deps = [
- "//sdk/fidl/fuchsia.ui.input",
- "//topaz/lib/shell",
- "//topaz/public/dart/fidl",
- "//topaz/public/dart/fuchsia_logger",
- "//topaz/public/dart/fuchsia_services",
- "//topaz/public/dart/widgets:lib.widgets",
- ]
-}
diff --git a/lib/keyboard_deprecated/dart/analysis_options.yaml b/lib/keyboard_deprecated/dart/analysis_options.yaml
deleted file mode 100644
index 48e8ec9..0000000
--- a/lib/keyboard_deprecated/dart/analysis_options.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include: ../../analysis_options.yaml
diff --git a/lib/keyboard_deprecated/dart/lib/keyboard_display.dart b/lib/keyboard_deprecated/dart/lib/keyboard_display.dart
deleted file mode 100644
index c3ce7f8..0000000
--- a/lib/keyboard_deprecated/dart/lib/keyboard_display.dart
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-import 'dart:async';
-
-import 'package:fidl/fidl.dart';
-import 'package:fidl_fuchsia_sys/fidl.dart';
-import 'package:fidl_fuchsia_ui_input/fidl.dart'
- show
- ImeService,
- ImeServiceProxy,
- ImeVisibilityService,
- ImeVisibilityServiceProxy;
-import 'package:lib.app.dart/app.dart';
-import 'package:lib.app.dart/logging.dart';
-
-/// Handles connecting to [ImeVisibilityService] and [ImeService] to show
-/// and hide the keyboard.
-@Deprecated('use package:topaz.lib.keyboard.dart instead')
-class KeyboardDisplay {
- final ImeServiceProxy _imeProxy = ImeServiceProxy();
- final ImeVisibilityServiceProxy _imeVisibilityProxy =
- ImeVisibilityServiceProxy();
- final StreamController<bool> _keyboardStreamController =
- StreamController.broadcast();
-
- bool _keyboardVisible;
-
- KeyboardDisplay(ServiceProvider services) : assert(services != null) {
- connectToService(services, _imeProxy.ctrl);
- _imeProxy.ctrl.onConnectionError = _handleImeServiceError;
- _imeProxy.ctrl.error
- .then((ProxyError error) => _handleImeServiceError(error: error));
-
- connectToService(services, _imeVisibilityProxy.ctrl);
- _imeVisibilityProxy.ctrl.onConnectionError =
- _handleImeVisibilityServiceError;
- _imeVisibilityProxy.ctrl.error.then(
- (ProxyError error) => _handleImeVisibilityServiceError(error: error));
- _imeVisibilityProxy.onKeyboardVisibilityChanged = _onVisibilityChanged;
- }
-
- /// Adds a listener to [KeyboardDisplay] for changes in keyboard
- /// visibility.
- void addListener(void onEvent(bool showKeyboard)) {
- _keyboardStreamController.stream.listen(onEvent);
- }
-
- /// Cache the visibility so callers can retrieve it without reading the
- /// [ImeVisibilityService].
- bool get keyboardVisible => _keyboardVisible;
-
- /// Sets the visibility of the keyboard.
- ///
- /// Note: triggers [ImeVisibilityService].
- set keyboardVisible(bool visible) =>
- visible ? _imeProxy.showKeyboard() : _imeProxy.hideKeyboard();
-
- /// Called when keyboard should be shown or hidden.
- void _onVisibilityChanged(bool visible) {
- _log(Level.SEVERE, 'onVisibilityChanged: $visible');
- _keyboardVisible = visible;
- _notifyKeyboardVisibilityChange();
- }
-
- /// Handles connection error to the [ImeVisibilityService].
- void _handleImeVisibilityServiceError({ProxyError error}) =>
- _log(Level.SEVERE, 'Unable to connect to ImeVisibilityService', error);
-
- /// Handles connection error to the [ImeService].
- void _handleImeServiceError({ProxyError error}) =>
- _log(Level.SEVERE, 'Unable to connect to ImeService', error);
-
- /// Invoked internally to signal to any registered listener of a change
- /// in keyboard visibility.
- void _notifyKeyboardVisibilityChange() =>
- _keyboardStreamController.add(keyboardVisible);
-
- void _log(Level level, String message, [Object error]) {
- log.log(level, message, 'keyboard_display', error, null);
- }
-}
diff --git a/lib/keyboard_deprecated/dart/pubspec.yaml b/lib/keyboard_deprecated/dart/pubspec.yaml
deleted file mode 100644
index a53fec4..0000000
--- a/lib/keyboard_deprecated/dart/pubspec.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Dummy for Dart analysis server.
diff --git a/lib/keyboard_deprecated/flutter/BUILD.gn b/lib/keyboard_deprecated/flutter/BUILD.gn
deleted file mode 100644
index bbda2b4..0000000
--- a/lib/keyboard_deprecated/flutter/BUILD.gn
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2017 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//build/dart/dart_library.gni")
-import("//topaz/runtime/dart/flutter_test.gni")
-
-dart_library("flutter") {
- infer_package_name = true
-
- sources = [
- "keyboard.dart",
- ]
-
- deps = [
- "//third_party/dart-pkg/git/flutter/packages/flutter",
- "//topaz/lib/keyboard_deprecated/dart",
- "//topaz/lib/shell",
- "//topaz/public/dart/widgets:lib.widgets",
- "//topaz/shell/keyboard",
- ]
-}
-
-flutter_test("keyboard_test") {
- sources = [
- "keyboard_model_test.dart",
- ]
-
- deps = [
- ":flutter",
- "//third_party/dart-pkg/git/flutter/packages/flutter_test",
- "//third_party/dart-pkg/pub/mockito",
- "//third_party/dart-pkg/pub/test",
- "//topaz/lib/keyboard_deprecated/dart",
- "//topaz/lib/shell",
- ]
-}
diff --git a/lib/keyboard_deprecated/flutter/analysis_options.yaml b/lib/keyboard_deprecated/flutter/analysis_options.yaml
deleted file mode 100644
index 48e8ec9..0000000
--- a/lib/keyboard_deprecated/flutter/analysis_options.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include: ../../analysis_options.yaml
diff --git a/lib/keyboard_deprecated/flutter/lib/keyboard.dart b/lib/keyboard_deprecated/flutter/lib/keyboard.dart
deleted file mode 100644
index 1f124e5..0000000
--- a/lib/keyboard_deprecated/flutter/lib/keyboard.dart
+++ /dev/null
@@ -1,4 +0,0 @@
-// ignore_for_file: deprecated_member_use
-// ignore_for_file: deprecated_member_use_from_same_package
-export 'src/keyboard_container.dart' show KeyboardContainer;
-export 'src/keyboard_model.dart' show KeyboardModel, KeyboardDisplay;
diff --git a/lib/keyboard_deprecated/flutter/lib/src/keyboard_container.dart b/lib/keyboard_deprecated/flutter/lib/src/keyboard_container.dart
deleted file mode 100644
index 4f9aeac..0000000
--- a/lib/keyboard_deprecated/flutter/lib/src/keyboard_container.dart
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:ui' show lerpDouble;
-
-import 'package:flutter/material.dart';
-import 'package:keyboard/constants.dart'
- as keyboard; // Temporary solution for keyboard height.
-import 'package:lib.app.dart/app.dart';
-import 'package:lib.widgets/application_deprecated.dart';
-import 'package:lib.widgets/model.dart';
-
-import 'keyboard_model.dart';
-
-const double _kKeyboardOverlayHeight = keyboard.keyboardHeight;
-const double _kKeyboardCornerRadius = keyboard.cornerRadius;
-
-/// Defines the UX of the keyboard drawer.
-@Deprecated('use package:topaz.lib.keyboard.flutter/keyboard.dart instead')
-class KeyboardContainer extends StatelessWidget {
- const KeyboardContainer({this.model, this.elevation});
-
- final KeyboardModel model;
- final double elevation;
-
- @override
- Widget build(BuildContext context) {
- return model == null
- ? ScopedModelDescendant<KeyboardModel>(
- builder: (_, __, keyboardModel) => _buildKeyboard(keyboardModel),
- )
- : _buildKeyboard(model);
- }
-
- Widget _buildKeyboard(KeyboardModel model) {
- return AnimatedBuilder(
- animation: model.overlayPositionModel,
- builder: (BuildContext context, Widget child) {
- double yShift = lerpDouble(
- _kKeyboardOverlayHeight,
- 0.0,
- model.overlayPositionModel.value,
- );
- yShift += model.overlayPositionModel.overlayDragModel.offset;
- yShift = yShift.clamp(0.0, _kKeyboardOverlayHeight);
- return Offstage(
- offstage: yShift >= _kKeyboardOverlayHeight,
- child: Align(
- alignment: FractionalOffset.bottomCenter,
- child: Transform(
- transform: Matrix4.translationValues(
- 0.0,
- yShift,
- 0.0,
- ),
- child: child,
- ),
- ),
- );
- },
- child: SizedBox(
- height: _kKeyboardOverlayHeight,
- child: Material(
- borderRadius: BorderRadius.vertical(
- top: Radius.circular(_kKeyboardCornerRadius)),
- elevation: elevation ?? model.keyboardElevation,
- child: ApplicationWidget(
- url: 'fuchsia-pkg://fuchsia.com/latin-ime#meta/latin-ime.cmx',
- focusable: false,
- launcher: StartupContext.fromStartupInfo().launcher,
- ),
- ),
- ),
- );
- }
-}
diff --git a/lib/keyboard_deprecated/flutter/lib/src/keyboard_model.dart b/lib/keyboard_deprecated/flutter/lib/src/keyboard_model.dart
deleted file mode 100644
index 4d4cf77..0000000
--- a/lib/keyboard_deprecated/flutter/lib/src/keyboard_model.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'package:topaz.lib.keyboard_deprecated.dart/keyboard_display.dart';
-import 'package:topaz.lib.shell/models/overlay_position_model.dart';
-
-export 'package:topaz.lib.keyboard_deprecated.dart/keyboard_display.dart'
- show KeyboardDisplay; // ignore: deprecated_member_use
-
-/// Handles connecting to ImeVisibilityService and showing/hiding the keyboard.
-@Deprecated('use package:topaz.lib.keyboard.flutter/keyboard.dart instead')
-class KeyboardModel extends Model {
- final KeyboardDisplay _keyboardDisplay;
-
- /// Overlay model used to show and hide the keyboard.
- OverlayPositionModel _overlayPositionModel;
-
- /// The elevation at which the keyboard overlay is displayed.
- final double keyboardElevation;
-
- KeyboardModel(
- this._keyboardDisplay, {
- OverlayPositionModel overlayPositionModel,
- this.keyboardElevation = 0.0,
- }) : assert(_keyboardDisplay != null),
- _overlayPositionModel = overlayPositionModel {
- _keyboardDisplay.addListener((visible) => notifyListeners());
- }
-
- /// Returns whether the keyboard is visible or hidden.
- bool get keyboardVisible => _keyboardDisplay.keyboardVisible;
-
- /// Returns whether the keyboard is visible or hidden.
- OverlayPositionModel get overlayPositionModel =>
- _overlayPositionModel ??= OverlayPositionModel(
- traceName: 'Keyboard',
- noInteractionTimeout: null,
- );
-
- /// Shows or hides the keyboard.
- set keyboardVisible(bool visible) =>
- _keyboardDisplay.keyboardVisible = visible;
-
- @override
- void notifyListeners() {
- super.notifyListeners();
- keyboardVisible ? overlayPositionModel.show() : overlayPositionModel.hide();
- }
-}
diff --git a/lib/keyboard_deprecated/flutter/pubspec.yaml b/lib/keyboard_deprecated/flutter/pubspec.yaml
deleted file mode 100644
index 1433923..0000000
--- a/lib/keyboard_deprecated/flutter/pubspec.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Dummy for Dart analysis server.
-
-name: keyboard_deprecated
\ No newline at end of file
diff --git a/lib/keyboard_deprecated/flutter/test/BUILD.gn b/lib/keyboard_deprecated/flutter/test/BUILD.gn
deleted file mode 100644
index 4799ab8..0000000
--- a/lib/keyboard_deprecated/flutter/test/BUILD.gn
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright 2017 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//build/dart/dart_library.gni")
-import("//topaz/runtime/dart/flutter_test.gni")
-
-dart_library("dart") {
- package_name = "keyboard.dart"
-
- sources = [
- "keyboard_display.dart",
- ]
-
- source_dir = "dart"
-
- deps = [
- "//sdk/fidl/fuchsia.ui.input",
- "//topaz/lib/shell",
- "//topaz/public/dart/fidl",
- "//topaz/public/dart/widgets:lib.widgets",
- "//topaz/public/lib/app/dart",
- ]
-}
-
-dart_library("flutter") {
- package_name = "keyboard.flutter"
-
- source_dir = "flutter"
-
- sources = [
- "keyboard.dart",
- ]
-
- deps = [
- ":dart",
- "//third_party/dart-pkg/git/flutter/packages/flutter",
- "//topaz/lib/shell",
- "//topaz/public/dart/widgets:lib.widgets",
- "//topaz/shell/keyboard",
- ]
-}
-
-flutter_test("keyboard_test") {
- sources = [
- "keyboard_model_test.dart",
- ]
-
- deps = [
- ":dart",
- ":flutter",
- "//third_party/dart-pkg/git/flutter/packages/flutter_test",
- "//third_party/dart-pkg/pub/mockito",
- "//third_party/dart-pkg/pub/test",
- "//topaz/lib/shell",
- ]
-}
diff --git a/lib/keyboard_deprecated/flutter/test/keyboard_model_test.dart b/lib/keyboard_deprecated/flutter/test/keyboard_model_test.dart
deleted file mode 100644
index 952df06..0000000
--- a/lib/keyboard_deprecated/flutter/test/keyboard_model_test.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-import 'dart:async';
-import 'dart:math' show Random;
-
-import 'package:mockito/mockito.dart';
-import 'package:test/test.dart';
-import 'package:topaz.lib.keyboard_deprecated.dart/keyboard_display.dart';
-import 'package:topaz.lib.keyboard_deprecated.flutter/keyboard.dart';
-import 'package:topaz.lib.shell/models/overlay_position_model.dart';
-
-class MockKeyboardDisplay extends Mock implements KeyboardDisplay {}
-
-class MockOverlayPositionModel extends Mock implements OverlayPositionModel {}
-
-void main() {
- group('keyboardModel', () {
- MockKeyboardDisplay keyboardDisplay;
- KeyboardModel model;
-
- setUp(() {
- keyboardDisplay = MockKeyboardDisplay();
- model = KeyboardModel(
- keyboardDisplay,
- overlayPositionModel: MockOverlayPositionModel(),
- );
- });
-
- test('testGetVisible', () {
- final bool isVisible = Random().nextBool();
- // Make sure isVisible is passed through.
- when(keyboardDisplay.keyboardVisible).thenReturn(isVisible);
- expect(model.keyboardVisible, isVisible);
- });
-
- test('testPropagation', () async {
- const isVisible = true;
- when(keyboardDisplay.keyboardVisible).thenReturn(isVisible);
- void Function(bool val) listenMethod =
- verify(keyboardDisplay.addListener(captureAny)).captured.single;
-
- int notificationCount = 0;
-
- // Use a listener to keep track of when policy model notifies.
- model.addListener(() {
- notificationCount++;
- });
-
- // Invoke callback passed by model to display for events.
- listenMethod(isVisible);
-
- // Needed to make sure notification is propagated through
- // [Model#notifyListeners].
- await Future<Null>.delayed(const Duration(seconds: 0));
-
- // Verify notification occurred.
- expect(notificationCount, 1);
- });
- });
-}