Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor() {
this.isRead = true
this.mentions = 0
if (process.platform !== 'darwin') {
// Listen for new instances.
singleInstance.listen(this.activateApp.bind(this))
// Create tray icon.
this.trayIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'icon.png')))
this.attentionIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'attention.png')))
this.mentionIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'mention.png')))
this.tray = gui.Tray.createWithImage(this.trayIcon)
this.tray.onClick = this.activateApp.bind(this)
const menu = gui.Menu.create([
{
label: 'Show',
onClick: this.activateApp.bind(this)
},
{
label: 'Quit',
onClick() { windowManager.quit() }
},
])
this.tray.setMenu(menu)
constructor() {
this.isRead = true
this.mentions = 0
if (process.platform !== 'darwin') {
// Listen for new instances.
singleInstance.listen(this.activateApp.bind(this))
// Create tray icon.
this.trayIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'icon.png')))
this.attentionIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'attention.png')))
this.mentionIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'mention.png')))
this.tray = gui.Tray.createWithImage(this.trayIcon)
this.tray.onClick = this.activateApp.bind(this)
const menu = gui.Menu.create([
{
label: 'Show',
onClick: this.activateApp.bind(this)
},
{
label: 'Quit',
onClick() { windowManager.quit() }
},
])
this.tray.setMenu(menu)
}
this.replyEntry.setText('1')
this.minReplyEntryHeight = this.replyEntry.getTextBounds().height
this.replyEntry.setText('1\n2\n3\n4\n5')
this.maxReplyEntryHeight = this.replyEntry.getTextBounds().height
this.replyEntry.setText('')
this.replyEntry.setStyle({height: this.minReplyEntryHeight})
// Handle input events.
this.replyEntry.onTextChange = this._adjustEntryHeight.bind(this)
this.replyEntry.shouldInsertNewLine = this._handleEnter.bind(this)
this.replyBox.addChildView(this.replyEntry)
// Loading indicator.
this.loadingIndicator = gui.GifPlayer.create()
this.loadingIndicator.setStyle({width: 40, height: 40})
const gifPath = fs.realpathSync(path.join(__dirname, 'chat', 'loading@2x.gif'))
this.loadingIndicator.setImage(gui.Image.createFromPath(gifPath))
this.loadingIndicator.setAnimating(true)
this.loadingIndicatorWrapper = gui.Container.create()
this.loadingIndicatorWrapper.setBackgroundColor(theme.chatBox.backgroundColor)
this.loadingIndicatorWrapper.addChildView(this.loadingIndicator)
this.loadingIndicatorWrapper.setVisible(false)
this.loadingIndicatorWrapper.setStyle({
flex: 1,
alignItems: 'center',
justifyContent: 'center'
})
this.view.addChildView(this.loadingIndicatorWrapper)
mainWindow.window.onFocus = this._notifyDisplaying.bind(this)
mainWindow.window.onBlur = this._notifyNotDisplaying.bind(this)
}
createTestSuite(render => {
const title = 'hello'
const checked = true
const image = gui.Image.createFromBuffer(Buffer.alloc(0), 1)
const ele = (
<button checked="{checked}" title="{title}">
)
render(ele, container => {
const button = container.childAt(0)
expect(button instanceof gui.Button).toBeTruthy()
expect(button.getTitle()).toBe(title)
expect(button.isChecked()).toBe(checked)
expect(button.getImage()).toBe(image)</button>
async updateInfo() {
if (this.account.icon)
this.image = gui.Image.createFromPath(await imageStore.fetchImage(this.account.icon))
this.view.schedulePaint()
}