-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add new API endpoint to provider component to get Android and iOS clipboard/pasteboard * Add in the hub UI a new component for getting and displaying the clipboard/pasteboard value
- Loading branch information
Showing
5 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
hub/gads-ui/src/components/DeviceControl/Tabs/Actions/Clipboard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import {Box, Button, CircularProgress, Stack, TextField} from "@mui/material"; | ||
import InstallMobileIcon from "@mui/icons-material/InstallMobile"; | ||
import {api} from "../../../../services/api"; | ||
import {useState} from "react"; | ||
|
||
|
||
export default function Clipboard({ deviceData }) { | ||
const [isGettingCb, setIsGettingCb] = useState(false) | ||
const [cbValue, setCbValue] = useState("") | ||
|
||
function handleGetClipboard() { | ||
setIsGettingCb(true) | ||
const url = `/device/${deviceData.udid}/getClipboard` | ||
setCbValue("") | ||
api.get(url) | ||
.then((response) => { | ||
setCbValue(response.data) | ||
setIsGettingCb(false) | ||
}) | ||
.catch(() => { | ||
setIsGettingCb(false) | ||
}); | ||
} | ||
|
||
return ( | ||
<Box | ||
marginTop='10px' | ||
style={{ | ||
backgroundColor: "#9ba984", | ||
width: "600px" | ||
}} | ||
> | ||
<Stack | ||
style={{ | ||
marginLeft: "10px", | ||
marginBottom: "10px", | ||
marginRight: "10px" | ||
}} | ||
> | ||
<h3>Get clipboard value</h3> | ||
{deviceData.os === "ios" && | ||
<h5 style={{marginTop: "1px"}}>On iOS devices WebDriverAgent has to be the active app to get the pasteboard value, it will be activated and then you'll be navigated to Springboard</h5> | ||
} | ||
<Button | ||
onClick={handleGetClipboard} | ||
id='clipboard-button' | ||
variant='contained' | ||
disabled={isGettingCb} | ||
style={{ | ||
backgroundColor: isGettingCb ? "rgba(51,71,110,0.47)" : "#2f3b26", | ||
color: "#9ba984", | ||
fontWeight: "bold" | ||
}} | ||
>Get clipboard</Button> | ||
{isGettingCb && | ||
<CircularProgress id='progress-indicator' size={30} /> | ||
} | ||
<TextField | ||
id="outlined-basic" | ||
variant="outlined" | ||
value={cbValue} | ||
style={{ | ||
backgroundColor: '#9ba984', | ||
marginTop: '15px', | ||
width: '100%' | ||
}} | ||
/> | ||
</Stack> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters