Skip to content

Commit

Permalink
Apple notarization support
Browse files Browse the repository at this point in the history
  • Loading branch information
lteague committed Nov 12, 2020
1 parent 1cc3dfa commit 9a81cff
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 35 deletions.
8 changes: 8 additions & 0 deletions build/entitlements.mac.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
</dict>
</plist>
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@
},
"build": {
"appId": "com.psddev.shot-check",
"asar": false,
"asar": true,
"afterSign": "scripts/notarize.js",
"mac": {
"category": "public.app-category.developer-tools"
"category": "public.app-category.developer-tools",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"entitlements": "build/entitlements.mac.plist",
"entitlementsInherit": "build/entitlements.mac.plist"
},
"dmg": {
"sign": false
},
"publish": {
"provider": "github",
Expand Down
19 changes: 19 additions & 0 deletions scripts/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { notarize } = require('electron-notarize');

exports.default = async function notarizing(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== 'darwin') {
return;
}

const appName = context.packager.appInfo.productFilename;

console.log(`Notarizing ${appOutDir}/${appName}.app . . .`)

return await notarize({
appBundleId: 'com.psddev.shot-check',
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLEID,
appleIdPassword: process.env.APPLEIDPASS,
});
};
2 changes: 1 addition & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function createMainWindow() {
window.webContents.session.loadExtension(
path.join(
os.homedir(),
'/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.8.2_0'
'/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.9.0_45'
)
)
window.webContents.openDevTools()
Expand Down
18 changes: 12 additions & 6 deletions src/renderer/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,14 @@ const PreviousJob = ({ jobId, projectId }) => {
const ProgressBar = ({ index, total, detail }) => {
const classes = useStyles()

const progress = Math.round((index / total) * 100)
const label = `${index} / ${total}`
let progress, label
if (index == null && total == null) {
progress = 0
label = '...'
} else {
progress = Math.round((index / total) * 100)
label = `${index} / ${total}`
}

return (
<Box
Expand Down Expand Up @@ -190,10 +196,10 @@ export default ({ children }) => {
const previousJobId = runningJobContext.state.previousJobId
const previousProjectId = runningJobContext.state.previousProjectId
const status = runningJobContext.state.status
const progressIndex = runningJobContext.state.progressIndex || 0
const progressTotal = runningJobContext.state.progressTotal
const progressDetail = runningJobContext.state.progressDetail
const showProgress = progressTotal && progressTotal > 0
const progressIndex = runningJobContext.state.progressIndex != null ? runningJobContext.state.progressIndex : null
const progressTotal = runningJobContext.state.progressTotal != null ? runningJobContext.state.progressTotal : null
const progressDetail = runningJobContext.state.progressDetail != null ? runningJobContext.state.progressDetail : null
const showProgress = (progressTotal != null && progressTotal != null) || progressDetail != null
const showPreviousJob = previousJobId && !showProgress

return (
Expand Down
14 changes: 3 additions & 11 deletions src/renderer/components/RunningJobContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,11 @@ const reducer = (state, action) => {
...state,
status: action.payload.status
}
case 'SET_PROGRESS_DETAIL':
return {
...state,
progressDetail: action.payload.progressDetail
}
case 'SET_PROGRESS_INDEX':
return {
...state,
progressIndex: action.payload.progressIndex
}
case 'SET_PROGRESS_TOTAL':
case 'SET_PROGRESS':
return {
...state,
progressDetail: action.payload.progressDetail,
progressIndex: action.payload.progressIndex,
progressTotal: action.payload.progressTotal
}
case 'CLEAR':
Expand Down
22 changes: 7 additions & 15 deletions src/renderer/ipc/startComparisonJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,14 @@ export default (runningJobContext, enqueueSnackbar, job, continuingJobId) => {
payload: { message: response.data }
})
}
if (response.data.progressDetail) {
if ('progressDetail' in response.data || 'progressTotal' in response.data || 'progressIndex' in response.data) {
runningJobContext.dispatch({
type: 'SET_PROGRESS_DETAIL',
payload: { progressDetail: response.data.progressDetail }
})
}
if (response.data.progressTotal) {
runningJobContext.dispatch({
type: 'SET_PROGRESS_TOTAL',
payload: { progressTotal: response.data.progressTotal }
})
}
if (response.data.progressIndex) {
runningJobContext.dispatch({
type: 'SET_PROGRESS_INDEX',
payload: { progressIndex: response.data.progressIndex }
type: 'SET_PROGRESS',
payload: {
progressDetail: response.data.progressDetail,
progressIndex: response.data.progressIndex,
progressTotal: response.data.progressTotal
}
})
}
}
Expand Down

0 comments on commit 9a81cff

Please sign in to comment.