android-emulator-webrtc 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  FROM debian:buster-slim
2
2
 
3
- ARG VERS=3.12.4
3
+ ARG VERS=23.1
4
4
  ARG ARCH=linux-x86_64
5
- ARG GRPC_WEB=1.2.1
5
+ ARG GRPC_WEB=1.4.2
6
6
 
7
7
  RUN echo "Building protoc Cloud Builder ${VERS}-${ARCH}" && \
8
8
  apt-get update -y && apt-get upgrade -y && \
@@ -38,7 +38,6 @@ var EmulatorPngView = function EmulatorPngView(_ref) {
38
38
  };
39
39
  }, [width, height]);
40
40
  (0, _react.useEffect)(function () {
41
- console.log("Png state changed to: " + connect);
42
41
  if (onStateChange) {
43
42
  onStateChange(connect);
44
43
  }
@@ -44,13 +44,11 @@ var EmulatorWebrtcView = function EmulatorWebrtcView(_ref) {
44
44
  connect = _useState4[0],
45
45
  setConnect = _useState4[1];
46
46
  (0, _react.useEffect)(function () {
47
- console.log("Webrtc state changed to: " + connect);
48
47
  if (onStateChange) {
49
48
  onStateChange(connect);
50
49
  }
51
50
  }, [connect]);
52
51
  (0, _react.useEffect)(function () {
53
- console.log("Webrtc audio state changed to: " + audio);
54
52
  if (onAudioStateChange) {
55
53
  onAudioStateChange(audio);
56
54
  }
@@ -134,9 +132,6 @@ EmulatorWebrtcView.defaultProps = {
134
132
  volume: 1.0,
135
133
  onError: function onError(e) {
136
134
  return console.error("WebRTC error: " + e);
137
- },
138
- onAudioStateChange: function onAudioStateChange(e) {
139
- return console.log("Webrtc audio became available: " + e);
140
135
  }
141
136
  };
142
137
  var _default = EmulatorWebrtcView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "android-emulator-webrtc",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Android Emulator WebRTC module",
5
5
  "scripts": {
6
6
  "build": "babel src -d dist",
@@ -22,7 +22,6 @@
22
22
  ]
23
23
  },
24
24
  "dependencies": {
25
- "@react-hook/resize-observer": "^1.2.6",
26
25
  "google-protobuf": "^3.21.2",
27
26
  "grpc-web": "^1.4.2",
28
27
  "prop-types": "^15.8.1"
@@ -1,5 +1,5 @@
1
1
  import PropTypes from "prop-types";
2
- import React, { useState, useEffect, useRef } from "react";
2
+ import React, { useState, useEffect } from "react";
3
3
  import * as Proto from "../../../proto/emulator_controller_pb";
4
4
 
5
5
  const EmulatorPngView = ({
@@ -25,7 +25,6 @@ const EmulatorPngView = ({
25
25
  }, [width, height]);
26
26
 
27
27
  useEffect(() => {
28
- console.log("Png state changed to: " + connect);
29
28
  if (onStateChange) {
30
29
  onStateChange(connect);
31
30
  }
@@ -30,7 +30,6 @@ const EmulatorWebrtcView = ({
30
30
 
31
31
 
32
32
  useEffect(() => {
33
- console.log("Webrtc state changed to: " + connect);
34
33
  if (onStateChange) {
35
34
  onStateChange(connect);
36
35
  }
@@ -38,7 +37,6 @@ const EmulatorWebrtcView = ({
38
37
 
39
38
 
40
39
  useEffect(() => {
41
- console.log("Webrtc audio state changed to: " + audio);
42
40
  if (onAudioStateChange) {
43
41
  onAudioStateChange(audio);
44
42
  }
@@ -138,8 +136,6 @@ EmulatorWebrtcView.defaultProps = {
138
136
  muted: true,
139
137
  volume: 1.0,
140
138
  onError: (e) => console.error("WebRTC error: " + e),
141
- onAudioStateChange: (e) =>
142
- console.log("Webrtc audio became available: " + e),
143
139
  };
144
140
 
145
141
  export default EmulatorWebrtcView;
@@ -1,86 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = void 0;
8
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _react = _interopRequireDefault(require("react"));
11
- var _resizeObserver = _interopRequireDefault(require("@react-hook/resize-observer"));
12
- /**
13
- * @jest-environment jsdom
14
- */
15
- /*
16
- * Copyright 2023 The Android Open Source Project
17
- *
18
- * Licensed under the Apache License, Version 2.0 (the "License")
19
- * you may not use this file except in compliance with the License.
20
- * You may obtain a copy of the License at
21
- *
22
- * http://www.apache.org/licenses/LICENSE-2.0
23
- *
24
- * Unless required by applicable law or agreed to in writing, software
25
- * distributed under the License is distributed on an "AS IS" BASIS,
26
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27
- * See the License for the specific language governing permissions and
28
- * limitations under the License.
29
- */
30
-
31
- function useSize(target, onResize) {
32
- var _React$useState = _react["default"].useState(),
33
- _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
34
- size = _React$useState2[0],
35
- setSize = _React$useState2[1];
36
- _react["default"].useLayoutEffect(function () {
37
- if (target) {
38
- var newSize = target.getBoundingClientRect();
39
- console.log("Resizing to ".concat(JSON.stringify(newSize)));
40
- setSize(newSize);
41
- if (onResize) {
42
- onResize(newSize);
43
- }
44
- }
45
- }, [target]);
46
-
47
- // Where the magic happens
48
- (0, _resizeObserver["default"])(target, function (entry) {
49
- setSize(entry.contentRect);
50
- if (onResize) {
51
- console.log("Resizing to ".concat(JSON.stringify(entry.contentRect)));
52
- onResize(entry.contentRect);
53
- }
54
- });
55
- return size;
56
- }
57
- function ResizingComponent(_ref) {
58
- var children = _ref.children,
59
- onResize = _ref.onResize,
60
- dataTestId = _ref["data-testid"];
61
- // const ref = useRef();
62
- var _React$useState3 = _react["default"].useState(),
63
- _React$useState4 = (0, _slicedToArray2["default"])(_React$useState3, 2),
64
- target = _React$useState4[0],
65
- setTarget = _React$useState4[1];
66
- var size = useSize(target, onResize);
67
- return /*#__PURE__*/_react["default"].createElement("div", {
68
- style: {
69
- width: "100%",
70
- height: "100%"
71
- },
72
- ref: setTarget,
73
- "data-testid": dataTestId
74
- }, /*#__PURE__*/_react["default"].createElement("div", {
75
- style: {
76
- width: size === null || size === void 0 ? void 0 : size.width,
77
- height: size === null || size === void 0 ? void 0 : size.height
78
- }
79
- }, children));
80
- }
81
- ResizingComponent.propTypes = {
82
- onResize: _propTypes["default"].func,
83
- "data-testid": _propTypes["default"].string
84
- };
85
- var _default = ResizingComponent;
86
- exports["default"] = _default;
@@ -1,65 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
- /*
5
- * Copyright 2023 The Android Open Source Project
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License")
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
- import PropTypes from "prop-types";
20
- import React from "react";
21
- import useResizeObserver from "@react-hook/resize-observer";
22
-
23
- function useSize(target, onResize) {
24
- const [size, setSize] = React.useState();
25
-
26
- React.useLayoutEffect(() => {
27
- if (target) {
28
- const newSize = target.getBoundingClientRect();
29
- console.log(`Resizing to ${JSON.stringify(newSize)}`)
30
- setSize(newSize);
31
- if (onResize) {
32
- onResize(newSize);
33
- }
34
- }
35
- }, [target]);
36
-
37
- // Where the magic happens
38
- useResizeObserver(target, (entry) => {
39
- setSize(entry.contentRect);
40
- if (onResize) {
41
- console.log(`Resizing to ${JSON.stringify(entry.contentRect)}`)
42
- onResize(entry.contentRect);
43
- }
44
- });
45
- return size;
46
- }
47
-
48
- function ResizingComponent({ children, onResize, "data-testid": dataTestId, }) {
49
- // const ref = useRef();
50
- const [target, setTarget] = React.useState();
51
- const size = useSize(target, onResize);
52
-
53
- return (
54
- <div style={{ width: "100%", height: "100%" }} ref={setTarget} data-testid={dataTestId}>
55
- <div style={{ width: size?.width, height: size?.height }}>{children}</div>
56
- </div>
57
- );
58
- }
59
-
60
- ResizingComponent.propTypes = {
61
- onResize: PropTypes.func,
62
- "data-testid": PropTypes.string,
63
- };
64
-
65
- export default ResizingComponent;
@@ -1,37 +0,0 @@
1
-
2
- /**
3
- * @jest-environment jsdom
4
- */
5
- /*
6
- * Copyright 2023 The Android Open Source Project
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License")
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- */
20
- import React from "react";
21
- import { render, act, waitFor, fireEvent, getByText } from "@testing-library/react";
22
- import ResizingComponent from "../src/components/emulator/views/resizing_component"
23
- import { toBeInTheDocument, toHaveBeenCalledWith } from '@testing-library/jest-dom';
24
-
25
-
26
-
27
- describe("ResizingComponent", () => {
28
- it("renders children", () => {
29
- const { getByText } = render(
30
- <ResizingComponent>
31
- <p>Hello, world!</p>
32
- </ResizingComponent>
33
- );
34
- expect(getByText("Hello, world!")).toBeInTheDocument();
35
- });
36
-
37
- });