Skip to content

Commit

Permalink
Feature: screensaver options (#22)
Browse files Browse the repository at this point in the history
* add common screensaver start/stop times

* up timeout to 5 hrs

* reorder tools

* bump version

* add quality check workflow

* add build to quality check

* remove deprecated deps, use proper package.json for quality check
  • Loading branch information
AnthonyGress authored Jul 14, 2023
1 parent 8cf3d2a commit 6552f85
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .erb/scripts/electron-rebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (
fs.existsSync(webpackPaths.appNodeModulesPath)
) {
const electronRebuildCmd =
'../../node_modules/.bin/electron-rebuild --parallel --force --types prod,dev,optional --module-dir .';
'../../node_modules/.bin/@electron-rebuild --parallel --force --types prod,dev,optional --module-dir .';
const cmd =
process.platform === 'win32'
? electronRebuildCmd.replace(/\//g, '\\')
Expand Down
2 changes: 1 addition & 1 deletion .erb/scripts/notarize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { notarize } = require('electron-notarize');
const { notarize } = require('@electron/notarize');
const { build } = require('../../package.json');

exports.default = async function notarizeMacos(context) {
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
CSC_IDENTITY_AUTO_DISCOVERY: false
# This is used for uploading release assets to github
GITHUB_TOKEN: ${{ secrets.TOKEN }}
EP_RELEASE: true
run: |
npm run postinstall
npm run build
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/quality-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Code Quality Check

on:
pull_request:
branches: [ main ]

workflow_dispatch:

jobs:
run-quality-check:
runs-on: ubuntu-latest
env:
CI: false

steps:
- uses: actions/checkout@v2

- name: Install dependencies run Lint and Test
run: |
npm install
npm run lint
npm run build
npm test
- name: Get all git tags
run: git fetch --all --tags

- name: Version Check
uses: thebongy/version-check@v1
with:
file: release/app/package.json
tagFormat: v${version}
id: version_check
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@
"electron": "^25.2.0",
"electron-builder": "^24.4.0",
"electron-devtools-installer": "^3.2.0",
"electron-notarize": "^1.2.1",
"electron-rebuild": "^3.2.7",
"enzyme": "^3.11.0",
"enzyme-to-json": "^3.6.2",
"eslint": "^8.44.0",
Expand Down
2 changes: 1 addition & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "android-toolkit",
"version": "1.5.14",
"version": "1.5.15",
"description": "Universal app with gui for simple adb connection",
"main": "./dist/main/main.js",
"author": {
Expand Down
12 changes: 5 additions & 7 deletions src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ import { useRef, useState } from 'react';
import { Route, MemoryRouter as Router, Switch } from 'react-router-dom';
import { AccordionDropdown } from './components/AccordionDropwdown';
import { ConnectionActions } from './components/ConnectionActions';
import { FireStickActions } from './components/FireStickActions';
import { TvActions } from './components/TvActions';
import { ApkActions } from './components/ApkActions';
import { SystemActions } from './components/SystemActions';
import { ITerminalContext } from './context/TerminalContext';
import { TerminalProvider } from './context/TerminalProvider';
import { useTerminalContext } from './context/useTerminalContext';
import { UpdateBtn } from './components/UpdateBtn';
import { AdbCommand, ShellCommand } from './types';
import { adbCommand, shellCommand } from './api';
import { RevancedActions } from './components/RevancedActions';

declare global {
Expand Down Expand Up @@ -118,12 +116,12 @@ const Main = () => {
<ApkActions />
</AccordionDropdown>

<AccordionDropdown title='Revanced Tools'>
<RevancedActions />
<AccordionDropdown title='TV Tools'>
<TvActions />
</AccordionDropdown>

<AccordionDropdown title='FireTV Tools'>
<FireStickActions />
<AccordionDropdown title='Revanced Tools'>
<RevancedActions />
</AccordionDropdown>

<AccordionDropdown title='System Tools'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,49 @@ import { Box, Divider, Grid, Typography } from '@mui/material';
import { FixedWidthBtn } from './FixedWidthBtn';
import { DEBLOAT_CMDS } from '../constants/debloatCommands';
import { adbCommand } from '../api';
import { useTerminalContext } from '../context/useTerminalContext';

export const FireStickActions = () => {
export const TvActions = () => {
const terminal = useTerminalContext();

const setScreensaver = () => {
adbCommand(
'adb shell settings put secure screensaver_components uk.co.liamnewmarch.daydream/uk.co.liamnewmarch.daydream.WebsiteDaydreamService '
);

setTimeout(
() =>
adbCommand(
'adb shell settings get secure screensaver_components'
),
2000
);
const screensaverTimeOn = () => {
adbCommand('adb shell settings put system screen_off_timeout 120000');
terminal?.setTerminalOutput('Set screensaver to start after 2 mins');
};

const resetScreensaver = () => {
adbCommand(
'adb shell settings put secure screensaver_components com.amazon.bueller.photos/.daydream.ScreenSaverService'
);
setTimeout(
() =>
adbCommand(
'adb shell settings get secure screensaver_components'
),
1000
);
const screensaverTimeOff = () => {
adbCommand('adb shell settings put secure sleep_timeout 18000000');
terminal?.setTerminalOutput('Set screensaver to stop after 5 hrs');

};

// const setScreensaver = () => {
// adbCommand(
// 'adb shell settings put secure screensaver_components uk.co.liamnewmarch.daydream/uk.co.liamnewmarch.daydream.WebsiteDaydreamService '
// );

// setTimeout(
// () =>
// adbCommand(
// 'adb shell settings get secure screensaver_components'
// ),
// 2000
// );
// };

// const resetScreensaver = () => {
// adbCommand(
// 'adb shell settings put secure screensaver_components com.amazon.bueller.photos/.daydream.ScreenSaverService'
// );
// setTimeout(
// () =>
// adbCommand(
// 'adb shell settings get secure screensaver_components'
// ),
// 1000
// );
// };

const screensaverDemo = () => {
window.open('https://clients3.google.com/cast/chromecast/home/v/c9541b08');
};
Expand All @@ -58,8 +71,10 @@ export const FireStickActions = () => {

<Grid item sm={12} md={6} lg={6} mt={2} >
<Box className='vcenter' gap={2}>
<FixedWidthBtn customAction={setScreensaver} title='Set Screensaver'/>
<FixedWidthBtn customAction={resetScreensaver} title='Reset Screensaver'/>
<FixedWidthBtn customAction={screensaverTimeOn} title='Start after 2 Mins'/>
<FixedWidthBtn customAction={screensaverTimeOff} title='Stop after 5 Hrs'/>
{/* <FixedWidthBtn customAction={setScreensaver} title='Set Screensaver'/>
<FixedWidthBtn customAction={resetScreensaver} title='Reset Screensaver'/> */}
<FixedWidthBtn customAction={screensaverDemo} title='Google Screensaver Demo'/>
</Box>
</Grid>
Expand All @@ -68,7 +83,7 @@ export const FireStickActions = () => {
<Divider style={{ width:'100%', backgroundColor: 'white' }}/>

<Box className="vcenter" mt={2}>
<Typography fontSize={24} color='white'>Debloat Tools</Typography>
<Typography fontSize={24} color='white'>FireOS Debloat Tools</Typography>
<Box mt={4}>
<FixedWidthBtn customAction={debloat} title='Run Debloat Commands'/>
</Box>
Expand Down

0 comments on commit 6552f85

Please sign in to comment.