Skip to content

Commit

Permalink
Merge pull request #314 from ganeshrvel/release/3.2.10-beta.1
Browse files Browse the repository at this point in the history
Native crash fix
  • Loading branch information
ganeshrvel authored Jan 27, 2023
2 parents cfe9a96 + c429e4a commit 8a46dc9
Show file tree
Hide file tree
Showing 53 changed files with 1,177 additions and 688 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ mtp-mock-files/*
resources
tmp/*
*.prod.js
*.js.map
*.js.LICENSE.txt
*.prod.js.LICENSE.txt
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = {
},
],
'no-use-before-define': 'off',
'no-restricted-syntax': 'off',
'no-multi-assign': 'off',
'no-promise-executor-return': 'off',
'no-shadow': 'off',
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ name: CI

on:
push:
branches: [ master, development ]
branches: [ master ]
pull_request:
branches: [ master, development ]
branches: [ master ]

jobs:
build:
runs-on: macOS-10.15
runs-on: macOS-11.00
steps:
- name: Setup build environment
uses: actions/setup-node@v1
with:
node-version: '10.x'
node-version: '16.x'
- run: npm install -g cross-env create-dmg
- name: Cloning Git repository
uses: actions/checkout@v1
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Attempt to generate unsigned macOS app
run: |
export CSC_IDENTITY_AUTO_DISCOVERY=false
yarn package-mac 2>&1 || true
yarn package-mac-without-notarize 2>&1 || true
- name: Check if macOS app was generated
run: test -e dist/mac/OpenMTP.app
- name: Attempt to create disk image for generated macOS app
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ mtp-mock-files/*
resources
tmp/*
*.prod.js
*.js.map
*.js.LICENSE.txt
*.prod.js.LICENSE.txt
61 changes: 45 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- Author: [Ganesh Rathinavel](https://www.linkedin.com/in/ganeshrvel 'Ganesh Rathinavel')
- License: [MIT](https://github.com/ganeshrvel/openmtp/blob/master/LICENSE 'MIT')
- System Requirements: macOS 10.11 or higher
- System Requirements: macOS 11.0 (Big Sur) or higher
- Website URL: [https://openmtp.ganeshrvel.com](https://openmtp.ganeshrvel.com/ 'https://openmtp.ganeshrvel.com')
- Repo URL: [https://github.com/ganeshrvel/openmtp](https://github.com/ganeshrvel/openmtp/ 'https://github.com/ganeshrvel/openmtp')
- Contacts: [email protected]
Expand Down Expand Up @@ -34,9 +34,12 @@ OpenMTP 3.0 features a new MTP kernel and it was written from the scratch. It pr

Do checkout the Go package which I've written to build Kalam Kernel: [github.com/ganeshrvel/go-mtpx](https://github.com/ganeshrvel/go-mtpx 'https://github.com/ganeshrvel/go-mtpx'). Feel free to raise PRs.

### System Requirements
### System Requirements and Support

Although OpenMTP will continue working on a machine which has macOS 10.11 (OS X El Capitan) or higher installed, the `Kalam` Kernel will only get the latest updates for the past 3 versions of macOS. We will continue releasing the OpenMTP updates for both `Intel` and `ARM64` machines.
- To support macOS version below Big Sur the Kalam kernel needs to be compiled on an older macOS machine everytime there is an update, which is practically very difficult
- Only the latest 3 versions of macOS will receive the `Kalam` Kernel updates, which includes new device supports, fixes, stability improvements. macOS Big Sur (11.0) or above will receive the above said updates
- We have now officially retired the support for `Kalam` Kernel on macOS 10.13 (OS X El High Sierra) and lower. Only the "Legacy" MTP mode will continue working on these outdated machines.
- We will continue releasing the updates for both `Intel` and `ARM64` machines

### Installation

Expand Down Expand Up @@ -127,6 +130,18 @@ $ yarn start

```

### Debugging a Packaged app

```shell
# On terminal run
$ "/path/to/OpenMTP.app/Contents/MacOS/OpenMTP" --remote-debugging-port=6363
```

- Open a Chromium browser
- Input "about://inpsect" into the URL bar
- Add a new connection `localhost:6363`
- Inpect OpenMTP @ port `6363`

### Publishing using CI/CD:

- CodeMagic.io
Expand Down Expand Up @@ -165,19 +180,20 @@ $ yarn start
- `base64 -i CERTIFICATE_PRIVATE_KEY.p12 -o CERTIFICATE_PRIVATE_KEY.txt`
- Copy the whole content of the file `CERTIFICATE_PRIVATE_KEY.txt`
- Paste the content as the value for the field `CSC_LINK`
- `CSC_KEY_PASSWORD` is the password from the above step
- `CODEMAGIC_AUTH_TOKEN_ID`: `<CodeMagic API Token>`
- Find it from here: [Settings -> Integrations -> Codemagic API](https://codemagic.io/settings)
- `CODEMAGIC_INTEL_X64_WORKFLOW_ID_PROD`: `<Prod codeMagic workflow id>`
- Find the relevant workflow id from `codemagic.yaml`, (mostly `macos-intel-x64-build-prod`)
- `CODEMAGIC_INTEL_X64_WORKFLOW_ID_DEV`: `<Dev codeMagic workflow id>`
- Find the relevant workflow id from `codemagic.yaml`, (mostly `macos-intel-x64-build-dev`)
- `PUBLISH_PROD_REPOSITORY`: `<Repository to publish the production app>`
- `PUBLISH_DEV_REPOSITORY`: `<Repository to publish the dev app>`
- `PUBLISH_EMAIL`: `Email address to receive the updates on publish`
- References:
- [https://www.electron.build/code-signing.html](https://www.electron.build/code-signing.html)
- [https://docs.codemagic.io/yaml-code-signing/signing-macos/#saving-the-api-key-to-environment-variables](https://docs.codemagic.io/yaml-code-signing/signing-macos/#saving-the-api-key-to-environment-variables)
- `CSC_KEY_PASSWORD` is the password from the above step
- `CODEMAGIC_AUTH_TOKEN_ID`: `<CodeMagic API Token>`
- Find it from here: [Sidebar -> Teams -> Personal Account -> Integrations -> Codemagic API](https://codemagic.io/teams)
- `CODEMAGIC_INTEL_X64_WORKFLOW_ID_PROD`: `<Prod codeMagic workflow id>`
- Find the relevant workflow id from `codemagic.yaml`, (mostly `macos-intel-x64-build-prod`)
- `CODEMAGIC_INTEL_X64_WORKFLOW_ID_DEV`: `<Dev codeMagic workflow id>`
- Find the relevant workflow id from `codemagic.yaml`, (mostly `macos-intel-x64-build-dev`)
- `PUBLISH_PROD_REPOSITORY`: `<Repository to publish the production app>`
- `PUBLISH_DEV_REPOSITORY`: `<Repository to publish the dev app>`
- `CODEMAGIC_PUBLISH_PROJECT_ID`: `<Codemagic intel project id>`
- `PUBLISH_EMAIL`: `Email address to receive the updates on publish`
- References:
- [https://www.electron.build/code-signing.html](https://www.electron.build/code-signing.html)
- [https://docs.codemagic.io/yaml-code-signing/signing-macos/#saving-the-api-key-to-environment-variables](https://docs.codemagic.io/yaml-code-signing/signing-macos/#saving-the-api-key-to-environment-variables)

### Packaging (locally) and Publishing

Expand Down Expand Up @@ -274,6 +290,19 @@ $ set UPGRADE_EXTENSIONS=1 && npm run dev

#### Your device is not recognized

#### **node-mac-permissions** throws `Speech framework is not compatible with macOS < 10.15`

- On macOS <= 10.14.x (mojave) the `yarn install` will throw a npm-rebuild error
- To "test" or "debug" the app on macOS mojave:
- remove the `node-mac-permissions` dependency from `package.json`
- Add the ignorePlugin line to `default.plugins` in the file `webpack/config.base.js`
- `new webpack.IgnorePlugin({ resourceRegExp: /^(node-mac-permissions)$/u }),`
- WARNING: **DO NOT commit** these changes to the upstream!!
- The `NODE_MAC_PERMISSIONS_MIN_OS` constant defines the minimum os version that is required to show the macos usage access permission popup
- For distribution make sure to build the app on a machine which is at least 10.15 (Catalina)

[https://stackoverflow.com/questions/58358449/notarizing-electron-apps-throws-you-must-first-sign-the-relevant-contracts-on](https://stackoverflow.com/questions/58358449/notarizing-electron-apps-throws-you-must-first-sign-the-relevant-contracts-on 'https://stackoverflow.com/questions/58358449/notarizing-electron-apps-throws-you-must-first-sign-the-relevant-contracts-on')

- Raise an issue if your device is undetected: https://github.com/ganeshrvel/openmtp/issues/new?template=contribute.md

#### The app goes blank while trying to connect a Samsung device
Expand Down
1 change: 0 additions & 1 deletion app/844.main.prod.js.LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion app/844.main.prod.js.map

This file was deleted.

18 changes: 18 additions & 0 deletions app/classes/Storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class Storage {

if (
typeof _stream === 'undefined' ||
_stream === '' ||
_stream === null ||
Object.keys(_stream).length < 1
) {
Expand All @@ -37,6 +38,10 @@ export default class Storage {
const allItem = this.getAll();
const _return = {};

if (!allItem) {
return _return;
}

keys.map((a) => {
if (typeof allItem[a] === 'undefined' || allItem[a] === null) {
return null;
Expand All @@ -60,4 +65,17 @@ export default class Storage {
log.error(e, `Storage -> setAll`);
}
}

setItems({ ...data }) {
try {
const currentSettings = this.getAll();

writeFileSync(
this.filePath,
JSON.stringify({ ...currentSettings, ...data })
);
} catch (e) {
log.error(e, `Storage -> setAll`);
}
}
}
19 changes: 14 additions & 5 deletions app/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,22 @@ export const OS_ARCH_TYPE = {
arm64: 'arm64',
};

// this table holds the minimum macOS version which will get the latest kalam binaries.
// if the user's os version is lower than the one listed here then historic binaies will be used for backward compatibility
export const KALAM_MINIMUM_SUPPORTED_MACOS_VERSION = {
[OS_ARCH_TYPE.arm64]: '11.0.0',
[OS_ARCH_TYPE.amd64]: '10.14.0',
// To support macOS version below Big Sur the Kalam kernel needs to be compiled on an older macOS machine everytime there is an update, which is practically very difficult.
// So any version included in the [KALAM_HISTORIC_VERSION_TYPE] will not receive the latest Kalam Kernel updates
export const KALAM_HISTORIC_VERSION_TYPE = {
medieval: 'medieval', // macOS 10.14 (Mojave) and 10.15 (Catalina). libusb support is still available but since it requires Mojave or lower to compile the kernel, it is being deprecated.
};

// if the user's os version is higher than the ones listed here then latest kalam kernel binaies will be used
// reference: https://github.com/npm/node-semver#ranges
export const KALAM_HISTORIC_MACOS_VERSION_RANGE = {
[KALAM_HISTORIC_VERSION_TYPE.medieval]: `>=10.14 <=10.15.999`,
};

export const NODE_MAC_PERMISSIONS_MIN_OS = `11.0.0`;

export const KALAM_MODE_MIN_MACOS_VERSION = `>=10.14`;

export const DEVICES_DEFAULT_PATH = {
[DEVICE_TYPE.mtp]: '/',
[DEVICE_TYPE.local]: PATHS.homeDir,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Typography from '@material-ui/core/Typography';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import PowerIcon from '@material-ui/icons/Power';
import ReplayIcon from '@material-ui/icons/Replay';
import SystemUpdate from '@material-ui/icons/SystemUpdate';
import { styles } from '../styles/HelpPhoneNotRecognized';
import { openExternalUrl } from '../../../utils/url';
import {
Expand All @@ -42,14 +43,15 @@ import {
DEVICES_LABEL,
DONATE_PAYPAL_URL,
} from '../../../constants';
import { DEVICE_TYPE } from '../../../enums';
import { DEVICE_TYPE, MTP_MODE } from '../../../enums';
import {
localErrorDictionary,
mtpErrors,
} from '../../../helpers/processBufferOutput';
import { MTP_ERROR } from '../../../enums/mtpError';
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 deviceLabel = DEVICES_LABEL[DEVICE_TYPE.mtp];
Expand Down Expand Up @@ -254,6 +256,7 @@ class HelpPhoneNotRecognized extends PureComponent {
render() {
const { classes: styles, showPhoneNotRecognizedNote } = this.props;
const { RenderBasicConnection, RenderRefreshButtonIsStuck } = this;
const isKalamModeDisabled = !isKalamModeSupported();

return (
<div className={styles.root}>
Expand Down Expand Up @@ -329,6 +332,39 @@ class HelpPhoneNotRecognized extends PureComponent {
</>
)}

{isKalamModeDisabled && (
<Accordion className={styles.expansionRoot}>
{/* <----- Kalam Mode is disabed -----> */}

<AccordionSummary expandIcon={<ExpandMoreIcon />}>
<Typography className={styles.heading}>
{`Upgrade you mac's OS version for better app experience`}
</Typography>
</AccordionSummary>
<AccordionDetails>
<List component="div" disablePadding>
<ListItem>
<ListItemIcon>
<SystemUpdate />
</ListItemIcon>
<ListItemText
primary={`We have now officially retired the support for '${MTP_MODE.kalam}' Kernel on 'macOS 10.13' (OS X El High Sierra) and lower. Only the '${MTP_MODE.legacy}' MTP mode will continue working on these outdated machines.`}
/>
</ListItem>

<ListItem>
<ListItemIcon>
<SystemUpdate />
</ListItemIcon>
<ListItemText
primary={`Only the latest 3 versions of macOS will receive the '${MTP_MODE.kalam}' Kernel updates, which includes new devices support, fixes, stability improvements`}
/>
</ListItem>
</List>
</AccordionDetails>
</Accordion>
)}

<Accordion className={styles.expansionRoot}>
{/* <----- my device is not connecting -----> */}

Expand Down
25 changes: 17 additions & 8 deletions app/containers/HomePage/components/ToolbarBody.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import { DEVICE_TYPE, MTP_MODE } from '../../../enums';
import { capitalize, isEmpty } from '../../../utils/funcs';
import { imgsrc } from '../../../utils/imgsrc';
import { isKalamModeSupported } from '../../../helpers/binaries';

export default class ToolbarAreaPane extends PureComponent {
activeToolbarList = ({ ...args }) => {
Expand Down Expand Up @@ -173,6 +174,9 @@ export default class ToolbarAreaPane extends PureComponent {
},
];

// We have now officially retired the support for `Kalam` Kernel on macOS 10.13 (OS X El High Sierra) and lower. Only the "Legacy" MTP mode will continue working on these outdated machines.
const showMtpModeSelection = isKalamModeSupported();

return (
<div className={styles.root}>
<ConfirmDialog
Expand All @@ -192,14 +196,19 @@ export default class ToolbarAreaPane extends PureComponent {
}
onClose={onMtpStoragesListClick}
/>
<SelectionDialog
titleText="Select MTP Mode"
list={mtpModeList}
id="selectionDialog"
showAvatar
open={deviceType === DEVICE_TYPE.mtp && toggleMtpModeSelectionDialog}
onClose={onMtpModeSelectionDialogClick}
/>

{showMtpModeSelection && (
<SelectionDialog
titleText="Select MTP Mode"
list={mtpModeList}
id="selectionDialog"
showAvatar
open={
deviceType === DEVICE_TYPE.mtp && toggleMtpModeSelectionDialog
}
onClose={onMtpModeSelectionDialogClick}
/>
)}
<Drawer
open={toggleDrawer}
onClose={onToggleDrawer(false)}
Expand Down
3 changes: 2 additions & 1 deletion app/containers/HomePage/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
buyMeACoffeeText,
donateUsingPayPal,
} from '../../templates/fileExplorer';
import { isKalamModeSupported } from '../../helpers/binaries';

export const initialState = {
focussedFileExplorerDeviceType: {
Expand Down Expand Up @@ -118,7 +119,7 @@ export const initialState = {
icon: faSdCard,
},
mtpMode: {
enabled: true,
enabled: isKalamModeSupported(),
label: 'MTP Mode',
icon: faPlug,
},
Expand Down
16 changes: 16 additions & 0 deletions app/containers/Onboarding/components/WhatsNew.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ import BuildIcon from '@material-ui/icons/Build';
import SmartphoneIcon from '@material-ui/icons/Smartphone';
import CameraRollIcon from '@material-ui/icons/CameraRoll';
import MemoryIcon from '@material-ui/icons/Memory';
import SystemUpdate from '@material-ui/icons/SystemUpdate';
import { styles } from '../styles/WhatsNew';
import { APP_NAME, APP_VERSION } from '../../../constants/meta';
import { isKalamModeSupported } from '../../../helpers/binaries';
import { MTP_MODE } from '../../../enums';

class WhatsNew extends PureComponent {
render() {
const isKalamModeDisabled = !isKalamModeSupported();
const { classes: styles, hideTitle } = this.props;

return (
Expand All @@ -29,6 +33,18 @@ class WhatsNew extends PureComponent {
)}

<List>
{isKalamModeDisabled && (
<ListItem>
<ListItemIcon>
<SystemUpdate htmlColor="#fa4d0a" />
</ListItemIcon>
<ListItemText
primary={`We have now officially retired the support for '${MTP_MODE.kalam}' Kernel on macOS 10.13 (OS X El High Sierra) and lower`}
secondary={`However the '${MTP_MODE.legacy}' MTP mode will continue working on these outdated machines`}
/>
</ListItem>
)}

<ListItem>
<ListItemIcon>
<MemoryIcon htmlColor="#fa4d0a" />
Expand Down
Loading

0 comments on commit 8a46dc9

Please sign in to comment.