-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dd-87-ensure-name-in-bridge'
- Loading branch information
Showing
6 changed files
with
148 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,115 +75,122 @@ class TrayMenu { | |
const userFooter = [ | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
label: 'Change sync folder', | ||
click: function() { | ||
const newDir = dialog.showOpenDialogSync({ | ||
properties: ['openDirectory'] | ||
}) | ||
if (newDir && newDir.length > 0 && fs.existsSync(newDir[0])) { | ||
app.emit('new-folder-path', newDir[0]) | ||
} else { | ||
Logger.info('Sync folder change error or cancelled') | ||
} | ||
} | ||
} | ||
] | ||
if (userEmail) { | ||
userFooter.push( | ||
{ | ||
label: 'Change sync folder', | ||
click: function () { | ||
const newDir = dialog.showOpenDialogSync({ | ||
properties: ['openDirectory'] | ||
}) | ||
if (newDir && newDir.length > 0 && fs.existsSync(newDir[0])) { | ||
app.emit('new-folder-path', newDir[0]) | ||
} else { | ||
Logger.info('Sync folder change error or cancelled') | ||
} | ||
} | ||
}) | ||
} | ||
|
||
userMenu = Array.concat(userEmailDisplay, userUsage, userFooter) | ||
} | ||
|
||
const contextMenuTemplate = [ | ||
{ | ||
const contextMenuTemplate = [] | ||
if (userEmail) { | ||
contextMenuTemplate.push({ | ||
label: 'Open folder', | ||
click: function() { | ||
click: function () { | ||
app.emit('open-folder') | ||
} | ||
}, | ||
{ | ||
label: 'Sync options', | ||
enabled: true, | ||
submenu: [ | ||
{ | ||
label: 'Two Way Sync', | ||
type: 'radio', | ||
enabled: true, | ||
checked: ConfigStore.get('syncMode') === 'two-way', | ||
click: () => { | ||
Logger.info('User switched to two way sync mode') | ||
ConfigStore.set('syncMode', 'two-way') | ||
app.emit('sync-stop') | ||
app.emit('switch-mode') | ||
} | ||
}, | ||
{ | ||
label: 'Upload Only Mode', | ||
type: 'radio', | ||
enabled: true, | ||
checked: ConfigStore.get('syncMode') === 'one-way-upload', | ||
click: () => { | ||
Logger.info('User switched to one way upload mode') | ||
ConfigStore.set('syncMode', 'one-way-upload') | ||
app.emit('sync-stop') | ||
} | ||
}) | ||
} | ||
contextMenuTemplate.push({ | ||
label: 'Sync options', | ||
enabled: true, | ||
submenu: [ | ||
{ | ||
label: 'Two Way Sync', | ||
type: 'radio', | ||
enabled: true, | ||
checked: ConfigStore.get('syncMode') === 'two-way', | ||
click: () => { | ||
Logger.info('User switched to two way sync mode') | ||
ConfigStore.set('syncMode', 'two-way') | ||
app.emit('sync-stop') | ||
app.emit('switch-mode') | ||
} | ||
] | ||
}, | ||
{ | ||
label: 'Force sync', | ||
click: function() { | ||
app.emit('force-sync') | ||
} | ||
}, | ||
{ | ||
label: 'Open logs', | ||
click: function() { | ||
try { | ||
const logFile = electronLog.transports.file.getFile().path | ||
const logPath = path.dirname(logFile) | ||
shell.openItem(logPath) | ||
} catch (e) { | ||
Logger.error('Error opening log path: %s', e.message) | ||
}, | ||
{ | ||
label: 'Upload Only Mode', | ||
type: 'radio', | ||
enabled: true, | ||
checked: ConfigStore.get('syncMode') === 'one-way-upload', | ||
click: () => { | ||
Logger.info('User switched to one way upload mode') | ||
ConfigStore.set('syncMode', 'one-way-upload') | ||
app.emit('sync-stop') | ||
} | ||
} | ||
}, | ||
{ | ||
label: 'Billing', | ||
click: function() { | ||
shell.openExternal(`${process.env.API_URL}/storage`) | ||
} | ||
}, | ||
{ | ||
label: 'Launch at login', | ||
type: 'checkbox', | ||
checked: ConfigStore.get('autoLaunch'), | ||
click: function(check) { | ||
ConfigStore.set('autoLaunch', check.checked) | ||
console.log(check.checked) | ||
app.emit('change-auto-launch') | ||
] | ||
}) | ||
if (userEmail) { | ||
contextMenuTemplate.push({ | ||
label: 'Force sync', | ||
click: function () { | ||
app.emit('force-sync') | ||
} | ||
}, | ||
{ | ||
label: 'Contact Support', | ||
click: function() { | ||
shell.openExternal(`mailto:[email protected]?subject=Support Ticket&body=If you want to upload log files to our tech teams. Please, find them on the Open Logs option in the menu.`) | ||
}) | ||
} | ||
contextMenuTemplate.push({ | ||
label: 'Open logs', | ||
click: function () { | ||
try { | ||
const logFile = electronLog.transports.file.getFile().path | ||
const logPath = path.dirname(logFile) | ||
shell.openItem(logPath) | ||
} catch (e) { | ||
Logger.error('Error opening log path: %s', e.message) | ||
} | ||
}, | ||
{ | ||
type: 'separator' | ||
}, | ||
{ | ||
} | ||
}, { | ||
label: 'Billing', | ||
click: function () { | ||
shell.openExternal(`${process.env.API_URL}/storage`) | ||
} | ||
}, { | ||
label: 'Launch at login', | ||
type: 'checkbox', | ||
checked: ConfigStore.get('autoLaunch'), | ||
click: function (check) { | ||
ConfigStore.set('autoLaunch', check.checked) | ||
console.log(check.checked) | ||
app.emit('change-auto-launch') | ||
} | ||
}, { | ||
label: 'Contact Support', | ||
click: function () { | ||
shell.openExternal(`mailto:[email protected]?subject=Support Ticket&body=If you want to upload log files to our tech teams. Please, find them on the Open Logs option in the menu.`) | ||
} | ||
}, | ||
{ | ||
type: 'separator' | ||
}) | ||
|
||
if (userEmail) { | ||
contextMenuTemplate.push({ | ||
label: 'Log out', | ||
click: function() { | ||
click: function () { | ||
app.emit('user-logout') | ||
} | ||
}, | ||
{ | ||
label: 'Quit', | ||
click: this.appClose | ||
} | ||
] | ||
}) | ||
} | ||
contextMenuTemplate.push({ | ||
label: 'Quit', | ||
click: this.appClose | ||
}) | ||
|
||
return Menu.buildFromTemplate(Array.concat(userMenu, contextMenuTemplate)) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.