Skip to content

Commit

Permalink
package updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshrvel committed Nov 1, 2022
1 parent b32bc75 commit 0b66fb5
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 194 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ extras/*
mtp-mock-files/*
resources
tmp/*
*.prod.js
43 changes: 24 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,32 +142,37 @@ $ yarn start
- `GITHUB_TOKEN`: `Personal access token`
- Find it from here: [Personal access tokens](https://github.com/settings/tokens)
- Scopes: `admin:gpg_key, admin:public_key, repo, user, workflow`
- `BUNDLE_ID`: `io.ganeshrvel.openmtp`
- `CSC_LINK`:
- Keychain -> Login (Default Keychains)
- Keychain -> `Default Keychains` menu in the left -> Login -> My Certificates
- Search for `Developer ID Application` in the top search bar
- If there are no results for the `Developer ID Application`, for the organization, create one from here: [Apple Developer Certificates](https://developer.apple.com/account/resources/certificates/add)
- Follow these steps to get the Apple Developer certificated installed in the local machine [Obtaining-an-Apple-Developer-ID-Certificate-for-macOS-Provisioning](https://forums.ivanti.com/s/article/Obtaining-an-Apple-Developer-ID-Certificate-for-macOS-Provisioning?language=en_US&ui-force-components-controllers-recordGlobalValueProvider.RecordGvp.getRecord=1)
- Search for `Developer ID Application` in the top search bar
- Expand `Developer ID Application: <User Name> (XXXYYYZZZ)`
- Right Click -> `Mac Developer ID Application: <User Name>`
- See if the private key's name matches this: `Mac Developer ID Application: <User Name>`
- Else rename the private key as (right click -> get info) `Mac Developer ID Application: <User Name>`
- Close the window
- Right Click on the private key -> `Mac Developer ID Application: <User Name>`
- Export `Mac Developer ID Application: <User Name>`
- File name: `CERTIFICATE_PRIVATE_KEY.p12`
- Enter Password. This is the `CSC_KEY_PASSWORD`, note this down
- Run: `base64 -i CERTIFICATE_PRIVATE_KEY.p12 -o CERTIFICATE_PRIVATE_KEY.txt`
- Run (this step doesnt work if you are using fig or ohmyzsh, use raw terminal):
- `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_APP_ID`: `<CodeMagic App id>`
- Find it from here: [Apps](https://codemagic.io/apps)
- `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: [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)

### Packaging (locally) and Publishing

Expand Down
260 changes: 131 additions & 129 deletions app/containers/HomePage/components/ToolbarAreaPane.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,147 +422,149 @@ class ToolbarAreaPane extends PureComponent {
const mapDispatchToProps = (dispatch, _) =>
bindActionCreators(
{
actionCreateListDirectory: ({ ...args }, deviceType) => (_, getState) => {
dispatch(listDirectory({ ...args }, deviceType, getState));
},

actionCreateReloadDirList: ({ filePath, ignoreHidden, deviceType }) => (
_,
getState
) => {
checkIf(deviceType, 'string');

dispatch(
reloadDirList(
{
filePath,
ignoreHidden,
deviceType,
},
getState
)
);
},

actionCreateDelFiles: (
{ fileList, deviceType },
{ ...listDirectoryArgs }
) => async (_, getState) => {
try {
const { mtpMode } = getState().Settings;

switch (deviceType) {
case DEVICE_TYPE.local:
const {
error: localError,
stderr: localStderr,
data: localData,
} = await fileExplorerController.deleteFiles({
actionCreateListDirectory:
({ ...args }, deviceType) =>
(_, getState) => {
dispatch(listDirectory({ ...args }, deviceType, getState));
},

actionCreateReloadDirList:
({ filePath, ignoreHidden, deviceType }) =>
(_, getState) => {
checkIf(deviceType, 'string');

dispatch(
reloadDirList(
{
filePath,
ignoreHidden,
deviceType,
fileList,
storageId: null,
});

dispatch(
churnLocalBuffer({
deviceType,
},
getState
)
);
},

actionCreateDelFiles:
({ fileList, deviceType }, { ...listDirectoryArgs }) =>
async (_, getState) => {
try {
const { mtpMode } = getState().Settings;

switch (deviceType) {
case DEVICE_TYPE.local:
const {
error: localError,
stderr: localStderr,
data: localData,
onSuccess: () => {
dispatch(
listDirectory(
{ ...listDirectoryArgs },
deviceType,
getState
)
);
},
})
);
break;
case DEVICE_TYPE.mtp:
const storageId = getSelectedStorageIdFromState(getState().Home);
const {
error: mtpError,
stderr: mtpStderr,
data: mtpData,
} = await fileExplorerController.deleteFiles({
deviceType,
fileList,
storageId,
});

dispatch(
churnMtpBuffer({
} = await fileExplorerController.deleteFiles({
deviceType,
fileList,
storageId: null,
});

dispatch(
churnLocalBuffer({
deviceType,
error: localError,
stderr: localStderr,
data: localData,
onSuccess: () => {
dispatch(
listDirectory(
{ ...listDirectoryArgs },
deviceType,
getState
)
);
},
})
);
break;
case DEVICE_TYPE.mtp:
const storageId = getSelectedStorageIdFromState(
getState().Home
);
const {
error: mtpError,
stderr: mtpStderr,
data: mtpData,
mtpMode,
onSuccess: () => {
dispatch(
listDirectory(
{ ...listDirectoryArgs },
deviceType,
getState
)
);
},
})
);
break;
default:
break;
} = await fileExplorerController.deleteFiles({
deviceType,
fileList,
storageId,
});

dispatch(
churnMtpBuffer({
deviceType,
error: mtpError,
stderr: mtpStderr,
data: mtpData,
mtpMode,
onSuccess: () => {
dispatch(
listDirectory(
{ ...listDirectoryArgs },
deviceType,
getState
)
);
},
})
);
break;
default:
break;
}
} catch (e) {
log.error(e);
}
} catch (e) {
log.error(e);
}
},
},

actionCreateSetMtpStorage: (
{ selectedValue, mtpStoragesList },
{ ...listDirArgs },
deviceType
) => (_, getState) => {
if (Object.keys(mtpStoragesList).length < 1) {
return null;
}

let _mtpStoragesList = {};

Object.keys(mtpStoragesList).map((a) => {
const item = mtpStoragesList[a];
let _selectedValue = false;

if (selectedValue === a) {
_selectedValue = true;
actionCreateSetMtpStorage:
({ selectedValue, mtpStoragesList }, { ...listDirArgs }, deviceType) =>
(_, getState) => {
if (Object.keys(mtpStoragesList).length < 1) {
return null;
}

_mtpStoragesList = {
...mtpStoragesList,
..._mtpStoragesList,
[a]: {
...item,
selected: _selectedValue,
},
};

return null;
});

dispatch(actionChangeMtpStorage({ ..._mtpStoragesList }));
dispatch(listDirectory({ ...listDirArgs }, deviceType, getState));
},

actionCreateSelectMtpMode: ({ value }, deviceType) => (_, getState) => {
checkIf(value, 'string');
checkIf(deviceType, 'string');

dispatch(
selectMtpMode({ value, reportEvent: false }, deviceType, getState)
);
},
let _mtpStoragesList = {};

Object.keys(mtpStoragesList).map((a) => {
const item = mtpStoragesList[a];
let _selectedValue = false;

if (selectedValue === a) {
_selectedValue = true;
}

_mtpStoragesList = {
...mtpStoragesList,
..._mtpStoragesList,
[a]: {
...item,
selected: _selectedValue,
},
};

return null;
});

dispatch(actionChangeMtpStorage({ ..._mtpStoragesList }));
dispatch(listDirectory({ ...listDirArgs }, deviceType, getState));
},

actionCreateSelectMtpMode:
({ value }, deviceType) =>
(_, getState) => {
checkIf(value, 'string');
checkIf(deviceType, 'string');

dispatch(
selectMtpMode({ value, reportEvent: false }, deviceType, getState)
);
},
actionCreateToggleSettings: (data) => (_, __) => {
dispatch(toggleSettings(data));
},
Expand Down
Loading

0 comments on commit 0b66fb5

Please sign in to comment.