Skip to content

Commit

Permalink
Merge pull request #371 from ganeshrvel/revert-370-release/3.2.22
Browse files Browse the repository at this point in the history
Revert "Temporarily removing usb hotplug detection feature Notarize issue."
  • Loading branch information
ganeshrvel committed Jun 12, 2024
2 parents 32080e9 + 76403dd commit 9ac253c
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 73 deletions.
29 changes: 15 additions & 14 deletions app/containers/HelpFaqsPage/components/HelpPhoneNotRecognized.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ListItemText from '@material-ui/core/ListItemText';
import DeleteIcon from '@material-ui/icons/Delete';
import CloseIcon from '@material-ui/icons/Close';
import FiberManualRecordIcon from '@material-ui/icons/FiberManualRecord';
import ToggleOffIcon from '@material-ui/icons/ToggleOff';
import CheckIcon from '@material-ui/icons/Check';
import ListAltIcon from '@material-ui/icons/ListAlt';
import SettingsIcon from '@material-ui/icons/Settings';
Expand Down Expand Up @@ -52,7 +53,7 @@ import { imgsrc } from '../../../utils/imgsrc';
import { helpPhoneNotConnecting } from '../../../templates/fileExplorer';
import { isKalamModeSupported } from '../../../helpers/binaries';

// const hotplugSettingText = `Check if 'Enable auto device detection (USB Hotplug)' is enabled under Settings > General Tab`;
const hotplugSettingText = `Check if 'Enable auto device detection (USB Hotplug)' is enabled under Settings > General Tab`;
const deviceLabel = DEVICES_LABEL[DEVICE_TYPE.mtp];

class HelpPhoneNotRecognized extends PureComponent {
Expand Down Expand Up @@ -168,7 +169,7 @@ class HelpPhoneNotRecognized extends PureComponent {
</ListItemIcon>
<ListItemText
primary="It should connect automatically"
// secondary={hotplugSettingText}
secondary={hotplugSettingText}
/>
</ListItem>
<ListItem>
Expand All @@ -177,7 +178,7 @@ class HelpPhoneNotRecognized extends PureComponent {
</ListItemIcon>
<ListItemText
primary={`Tap on the 'Refresh' button in the app if the ${deviceLabel.toLowerCase()} doesn't get connected automatically`}
// secondary={hotplugSettingText}
secondary={hotplugSettingText}
/>
</ListItem>

Expand Down Expand Up @@ -236,7 +237,7 @@ class HelpPhoneNotRecognized extends PureComponent {
</ListItemIcon>
<ListItemText
primary="It should connect automatically"
// secondary={hotplugSettingText}
secondary={hotplugSettingText}
/>
</ListItem>
<ListItem>
Expand All @@ -245,7 +246,7 @@ class HelpPhoneNotRecognized extends PureComponent {
</ListItemIcon>
<ListItemText
primary={`Tap on the 'Refresh' button in the app if the ${deviceLabel.toLowerCase()} doesn't get connected automatically`}
// secondary={hotplugSettingText}
secondary={hotplugSettingText}
/>
</ListItem>
</>
Expand Down Expand Up @@ -402,15 +403,15 @@ class HelpPhoneNotRecognized extends PureComponent {
/>
</ListItem>

{/* <ListItem> */}
{/* <ListItemIcon> */}
{/* <ToggleOffIcon /> */}
{/* </ListItemIcon> */}
{/* <ListItemText */}
{/* primary={`If you face frequent device disconnections, turn off 'USB Hotplug'`} */}
{/* secondary={`Settings > General Tab`} */}
{/* /> */}
{/* </ListItem> */}
<ListItem>
<ListItemIcon>
<ToggleOffIcon />
</ListItemIcon>
<ListItemText
primary={`If you face frequent device disconnections, turn off 'USB Hotplug'`}
secondary={`Settings > General Tab`}
/>
</ListItem>

<RenderBasicConnection />
</List>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import TableRow from '@material-ui/core/TableRow';
import Collapse from '@material-ui/core/Collapse';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ToggleOffIcon from '@material-ui/icons/ToggleOff';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import Divider from '@material-ui/core/Divider';
Expand Down Expand Up @@ -162,15 +163,15 @@ class FileExplorerTableBodyEmptyRender extends PureComponent {
/>
</ListItem>

{/* <ListItem>
<ListItem>
<ListItemIcon>
<ToggleOffIcon />
</ListItemIcon>
<ListItemText
primary={`If you face frequent device disconnections, turn off 'USB Hotplug'`}
secondary={`Settings > General Tab`}
/>
</ListItem> */}
</ListItem>

<ListItem>
<ListItemIcon>
Expand Down
13 changes: 7 additions & 6 deletions app/containers/Onboarding/components/Features.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ListItemText from '@material-ui/core/ListItemText';
import UsbIcon from '@material-ui/icons/Usb';
import FileCopyIcon from '@material-ui/icons/FileCopy';
import Brightness4Icon from '@material-ui/icons/Brightness4';
import FlashOnIcon from '@material-ui/icons/FlashOn';
import ViewListIcon from '@material-ui/icons/ViewList';
import SdStorageIcon from '@material-ui/icons/SdStorage';
import FlipToBackIcon from '@material-ui/icons/FlipToBack';
Expand Down Expand Up @@ -166,12 +167,12 @@ class Features extends PureComponent {
<ListItemText primary="Choose between Internal Memory and SD Card" />
</ListItem>

{/* <ListItem> */}
{/* <ListItemIcon> */}
{/* <FlashOnIcon /> */}
{/* </ListItemIcon> */}
{/* <ListItemText primary="Auto device detection (USB Hotplug)" /> */}
{/* </ListItem> */}
<ListItem>
<ListItemIcon>
<FlashOnIcon />
</ListItemIcon>
<ListItemText primary="Auto device detection (USB Hotplug)" />
</ListItem>

<ListItem>
<ListItemIcon>
Expand Down
38 changes: 20 additions & 18 deletions app/containers/Settings/components/SettingsDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ export default class SettingsDialog extends PureComponent {
onShowDirectoriesFirstChange,
onMtpModeChange,
onFilesPreprocessingBeforeTransferChange,
onEnableUsbHotplug,
enableUsbHotplug,
} = this.props;

const { tabIndex } = this.state;
Expand Down Expand Up @@ -213,24 +215,24 @@ export default class SettingsDialog extends PureComponent {
</>
)}

{/* <Typography */}
{/* variant="subtitle2" */}
{/* className={`${styles.subtitle} ${styles.fmSettingsStylesFix}`} */}
{/* > */}
{/* Enable auto device detection (USB Hotplug) */}
{/* </Typography> */}
{/* <FormControlLabel */}
{/* className={styles.switch} */}
{/* control={ */}
{/* <Switch */}
{/* checked={enableUsbHotplug} */}
{/* onChange={(e) => */}
{/* onEnableUsbHotplug(e, !enableUsbHotplug) */}
{/* } */}
{/* /> */}
{/* } */}
{/* label={enableUsbHotplug ? `Enabled` : `Disabled`} */}
{/* /> */}
<Typography
variant="subtitle2"
className={`${styles.subtitle} ${styles.fmSettingsStylesFix}`}
>
Enable auto device detection (USB Hotplug)
</Typography>
<FormControlLabel
className={styles.switch}
control={
<Switch
checked={enableUsbHotplug}
onChange={(e) =>
onEnableUsbHotplug(e, !enableUsbHotplug)
}
/>
}
label={enableUsbHotplug ? `Enabled` : `Disabled`}
/>
</FormGroup>
</div>
</SettingsDialogTabContainer>
Expand Down
57 changes: 32 additions & 25 deletions app/main.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import './services/sentry/index';

import { app, BrowserWindow, ipcMain, nativeTheme } from 'electron';
import electronIs from 'electron-is';
import usbDetect from 'usb-detection';
import process from 'process';
import MenuBuilder from './menu';
import { log } from './utils/log';
Expand All @@ -18,10 +19,16 @@ import { nonBootableDeviceWindow } from './helpers/createWindows';
import { APP_TITLE } from './constants/meta';
import { isPackaged } from './utils/isPackaged';
import { getWindowBackgroundColor } from './helpers/windowHelper';
import { APP_THEME_MODE_TYPE, DEVICE_TYPE, MTP_MODE } from './enums';
import {
APP_THEME_MODE_TYPE,
DEVICE_TYPE,
MTP_MODE,
USB_HOTPLUG_EVENTS,
} from './enums';
import fileExplorerController from './data/file-explorer/controllers/FileExplorerController';
import { getEnablePrereleaseUpdatesSetting } from './helpers/settings';
import { getRemoteWindow } from './helpers/remoteWindowHelpers';
import { IpcEvents } from './services/ipc-events/IpcEventType';
import IpcEventService from './services/ipc-events/IpcEventHandler';
import { isKalamModeSupported } from './helpers/binaries';
import { fileExistsSync } from './helpers/fileOps';
Expand Down Expand Up @@ -289,29 +296,29 @@ if (!isDeviceBootable) {
}

// send attach and detach events to the renderer
// usbDetect.startMonitoring();

// usbDetect.on('add', (device) => {
// if (!mainWindow) {
// return;
// }
//
// mainWindow?.webContents?.send(IpcEvents.USB_HOTPLUG, {
// device: JSON.stringify(device),
// eventName: USB_HOTPLUG_EVENTS.attach,
// });
// });

// usbDetect.on('remove', (device) => {
// if (!mainWindow) {
// return;
// }
//
// mainWindow?.webContents?.send(IpcEvents.USB_HOTPLUG, {
// device: JSON.stringify(device),
// eventName: USB_HOTPLUG_EVENTS.detach,
// });
// });
usbDetect.startMonitoring();

usbDetect.on('add', (device) => {
if (!mainWindow) {
return;
}

mainWindow?.webContents?.send(IpcEvents.USB_HOTPLUG, {
device: JSON.stringify(device),
eventName: USB_HOTPLUG_EVENTS.attach,
});
});

usbDetect.on('remove', (device) => {
if (!mainWindow) {
return;
}

mainWindow?.webContents?.send(IpcEvents.USB_HOTPLUG, {
device: JSON.stringify(device),
eventName: USB_HOTPLUG_EVENTS.detach,
});
});

process.stdout.on('error', (err) => {
if (err.code === 'EPIPE') {
Expand Down Expand Up @@ -347,7 +354,7 @@ if (!isDeviceBootable) {
log.error(e, `main.dev -> before-quit`);
});

// usbDetect.stopMonitoring();
usbDetect.stopMonitoring();

app.quitting = true;
});
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "openmtp",
"productName": "OpenMTP",
"version": "3.2.22",
"version": "3.2.21",
"description": "OpenMTP | Android File Transfer for macOS",
"scripts": {
"build": "yarn lint && concurrently \"yarn build-main\" \"yarn build-renderer\"",
Expand Down Expand Up @@ -124,6 +124,7 @@
"source-map-support": "^0.5.21",
"styled-components": "^4.4.1",
"url": "^0.11.0",
"usb-detection": "^4.14.1",
"util": "^0.12.4",
"zlib": "^1.0.5"
},
Expand Down
Loading

0 comments on commit 9ac253c

Please sign in to comment.