Skip to content

Commit

Permalink
Merge pull request #372 from ganeshrvel/release/3.2.23
Browse files Browse the repository at this point in the history
Release/3.2.23
  • Loading branch information
ganeshrvel authored Jun 12, 2024
2 parents 5848704 + 31bd3c9 commit 7167c8d
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 76 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
4 changes: 2 additions & 2 deletions codemagic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ definitions:

mac_m1_env_versions: &mac_m1_env_versions
node: 16.19.0
npm: 8
npm: 8.16.0
xcode: 15.3

mac_intel_x64_env_versions: &mac_intel_x64_env_versions
node: 16.19.0
npm: 8
npm: 8.16.0
xcode: 14.2

mac_m1_arm64_artifacts: &mac_m1_arm64_artifacts
Expand Down
22 changes: 22 additions & 0 deletions internals/scripts/CheckYarn.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
const { execSync } = require('child_process');
const semver = require('semver');

const requiredVersionRange = '>=6.x <=8.16.0';

try {
const npmVersion = execSync('npm -v').toString().trim();

if (!semver.satisfies(npmVersion, requiredVersionRange)) {
console.error(
`Error: This project requires npm version ${requiredVersionRange}. You have version ${npmVersion}.\nPlease downgrade your npm, this is due to a bug in node-gyp. Github issue: https://github.com/ganeshrvel/openmtp/issues/367.\ncommand: npm install -g npm@8.16.0`
);
process.exit(1);
}

console.info(`Using compatible npm version: ${npmVersion}`);
} catch (error) {
console.error('Error checking npm version:', error);

process.exit(1);
}

if (!/yarn\.js$/.test(process.env.npm_execpath || '')) {
console.warn(
"\u001b[33mYou don't seem to be using yarn. This could produce unexpected results.\u001b[39m"
Expand Down
5 changes: 3 additions & 2 deletions 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 Expand Up @@ -234,7 +235,7 @@
},
"devEngines": {
"node": ">=16.x",
"npm": ">=6.x",
"npm": ">=6.x <=8.16.0",
"yarn": ">=0.21.3"
}
}
Loading

0 comments on commit 7167c8d

Please sign in to comment.