Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
7a2ce56
[Desktop] Setup Electron + CRA from web project (without code duplica…
brunolemos Dec 23, 2018
87b1646
When app is on menubar mode, hide icon from dock
amorist Dec 24, 2018
dc5dd84
[Desktop] Auto reload Electron on change
brunolemos Dec 24, 2018
5bc863e
[Desktop] Change arrow color based on current theme
brunolemos Dec 24, 2018
62727b3
[Desktop] Rename electron.ts to index.ts
brunolemos Dec 25, 2018
81b7b93
[Desktop] Fix icons
brunolemos Dec 25, 2018
5a611e3
[Desktop] Run OAuth flow on user's browser using deep linking
brunolemos Dec 25, 2018
dfd27bc
[Desktop] Rewrote how Desktop/Menubar modes are handled
brunolemos Dec 27, 2018
f2a8274
[Desktop][Windows] Fix undefined app.dock
brunolemos Dec 28, 2018
2785c78
[Desktop] Use electron-is-dev instead of NODE_ENV
brunolemos Dec 28, 2018
212d448
[Windows] Fix pushd
brunolemos Dec 28, 2018
a4ac694
[Windows] Use cross-env to set env vars
brunolemos Dec 28, 2018
a9eddbf
[Desktop] Only create frameless window on macOS
brunolemos Dec 28, 2018
2d2a5d9
[Desktop] Only enable Menubar Mode on macOS
brunolemos Dec 28, 2018
8105f5f
[Desktop][Windows] Fix window max dimensions
brunolemos Dec 28, 2018
ab3cc38
Merge branch 'desktop' of github.com:devhubapp/devhub into desktop
brunolemos Dec 28, 2018
7c28376
[Desktop] Move mode switch from View menu to a new Options menu
brunolemos Dec 28, 2018
9466501
[Desktop][Windows] Remove Bring All to Front menu
brunolemos Dec 28, 2018
0c31d6a
Change title to only DevHub
brunolemos Dec 28, 2018
3a34096
Revert "[Desktop] Move mode switch from View menu to a new Options menu"
brunolemos Dec 28, 2018
cc51488
[Desktop] Enable lockOnCenter by default only on macOS
brunolemos Dec 28, 2018
439fb3d
[Desktop][Windows] Fix Menubar mode + Handle all possible taskbar pos…
brunolemos Dec 28, 2018
f0a788d
[Desktop][macOS] Small fix on tray click handler
brunolemos Dec 28, 2018
f2ca73f
[Desktop][Windows] Hide window on blur on Menubar mode
brunolemos Dec 28, 2018
ce79fce
Merge branch 'master' of github.com:devhubapp/devhub into desktop
brunolemos Dec 28, 2018
81404e1
Use shx instead of rimraf to support more commands
brunolemos Dec 29, 2018
688e636
[Desktop] Fix node_modules not being included
brunolemos Dec 29, 2018
814e7cc
[Desktop] Disable lockOnCenter by default
brunolemos Dec 29, 2018
dd6dd92
[Desktop] Persist window size, position and user preferences
brunolemos Dec 29, 2018
1c2c103
[Desktop] Move some code to a init function
brunolemos Dec 29, 2018
e5ff519
[Desktop] Prevent multiple instances of the app
brunolemos Dec 29, 2018
4c5c0f8
[Desktop][Windows] Fix oauth flow
brunolemos Dec 29, 2018
739746d
[Desktop] Maximize window on first launch
brunolemos Dec 29, 2018
b9758dd
[Desktop][Windows] Fix window losing maximized state on tray click
brunolemos Dec 29, 2018
856c101
[Desktop] Enable Linux target
brunolemos Dec 29, 2018
d2b21cb
[Desktop] Disable nodeIntegration as a security precaution
brunolemos Dec 29, 2018
aa15927
[Desktop] Trying to fix logo not showing on release build after login
brunolemos Dec 29, 2018
1d5e625
[Desktop] Setup React and Redux devtools extensions
brunolemos Dec 29, 2018
d7a95c8
[Desktop] Explicitly disable contextIsolation
brunolemos Dec 29, 2018
9a0d007
[Security] Disable window.eval
brunolemos Dec 29, 2018
3896e8d
[Desktop] Fix broken logo after login
brunolemos Dec 29, 2018
aa9dd12
[Desktop] Fix broken Reload after login
brunolemos Dec 29, 2018
af0969f
Revert "[Desktop] Trying to fix logo not showing on release build aft…
brunolemos Dec 29, 2018
74a6080
[Desktop] Open window on login
brunolemos Dec 30, 2018
5e8ae9b
[Desktop] Dev server is hardcoded on package.json, so lets hardcode i…
brunolemos Dec 30, 2018
3fde008
Change error background color
brunolemos Dec 30, 2018
f9bd3b6
[Desktop] Avoid flickering on setPosition and setSize when will maxim…
brunolemos Dec 30, 2018
940d62f
[Desktop] Run server sync every time Electron window is focused
brunolemos Dec 30, 2018
6ae5e0b
Add author, description and repository on package.json
brunolemos Dec 30, 2018
c8d9113
[Desktop] Add mac app category
brunolemos Dec 30, 2018
d783c00
[Desktop] Setup Travis for electron-builder
brunolemos Dec 30, 2018
e3e4fe2
[Desktop] Enable publish to GitHub
brunolemos Dec 30, 2018
3ff61d2
[Desktop] Moved About menu code + Show View on GitHub menu item on Wi…
brunolemos Dec 30, 2018
8bfd9b0
[Desktop] Setup Auto Updater
brunolemos Dec 30, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
matrix:
include:
- os: osx
osx_image: xcode9.4
language: node_js
node_js: "10"
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder

cache:
directories:
- node_modules
- $HOME/.cache/electron
- $HOME/.cache/electron-builder

script:
- yarn workspace @devhub/desktop build --mac --win --linux

before_cache:
- rm -rf $HOME/.cache/electron-builder/wine

branches:
only:
- master

if: tag IS present
16 changes: 16 additions & 0 deletions @types/electron/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference path="../../node_modules/electron/electron.d.ts" />

interface Window {
eval: never
ipc: Electron.IpcRenderer
process?: {
type?: string
}
require: NodeRequireFunction
}

declare namespace NodeJS {
interface ProcessVersions {
electron?: boolean
}
}
Binary file added assets/icon-desktop.psd
Binary file not shown.
Binary file added assets/icon-tray.psd
Binary file not shown.
Binary file added assets/logo-circle.psd
Binary file not shown.
Binary file added assets/logo-rounded.psd
Binary file not shown.
Binary file not shown.
Binary file added assets/logo.psd
Binary file not shown.
25 changes: 16 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
"name": "devhub",
"version": "0.40.0",
"private": true,
"author": {
"name": "Bruno Lemos",
"email": "[email protected]",
"url": "https://twitter.com/brunolemos"
},
"description": "TweetDeck for GitHub",
"repository": "https://github.com/devhubapp/devhub",
"workspaces": {
"packages": [
"packages/*"
Expand All @@ -11,16 +18,15 @@
]
},
"scripts": {
"build:desktop": "yarn compile && concurrently --kill-others \"yarn compile -w\" \"yarn workspace @devhub/desktop build\"",
"build:desktop": "yarn workspace @devhub/desktop compile && concurrently --kill-others \"yarn workspace @devhub/desktop compile -w\" \"yarn workspace @devhub/desktop build\"",
"clean": "yarn workspaces run clean",
"compile": "yarn workspace @devhub/components build",
"deploy": "yarn deploy:web",
"deploy:web": "yarn workspace @devhub/web build && yarn now && yarn now alias",
"deploy:www": "pushd packages/www; now && now alias; popd;",
"dev": "yarn compile && concurrently --kill-others \"yarn compile -w\" \"yarn workspace @devhub/web start\" \"yarn workspace @devhub/mobile start\" \"yarn workspace @devhub/desktop start\"",
"dev:desktop": "yarn compile && concurrently --kill-others \"yarn compile -w\" \"yarn workspace @devhub/desktop start\"",
"dev:mobile": "yarn compile && concurrently --kill-others \"yarn compile -w\" \"yarn workspace @devhub/mobile start\"",
"dev:web": "yarn compile && concurrently --kill-others \"yarn compile -w\" \"yarn workspace @devhub/web start\"",
"deploy:www": "pushd \"packages/www\"; now && now alias; popd;",
"dev": "yarn workspace @devhub/desktop compile && concurrently --kill-others \"yarn workspace @devhub/desktop compile -w\" \"yarn workspace @devhub/web start\" \"yarn workspace @devhub/mobile start\" \"wait-on http://localhost:3000 && yarn workspace @devhub/desktop start\"",
"dev:desktop": "cross-env BROWSER=none concurrently \"yarn dev:web\" \"yarn workspace @devhub/desktop compile -w\" \"wait-on http://localhost:3000 && yarn workspace @devhub/desktop start\"",
"dev:mobile": "yarn workspace @devhub/mobile compile && concurrently --kill-others \"yarn workspace @devhub/mobile compile -w\" \"yarn workspace @devhub/mobile start\"",
"dev:web": "yarn workspace @devhub/web compile && concurrently --kill-others \"yarn workspace @devhub/web compile -w\" \"yarn workspace @devhub/web start\"",
"format": "yarn workspaces run format",
"lint": "yarn workspaces run lint",
"now": "npx now",
Expand All @@ -32,16 +38,17 @@
"dependencies": {},
"devDependencies": {
"concurrently": "^4.1.0",
"cross-env": "^5.2.0",
"husky": "^1.2.0",
"lint-staged-offline": "^0.0.1",
"patch-package": "^5.1.1",
"postinstall-prepare": "^1.0.1",
"prettier": "^1.15.3",
"rimraf": "^2.6.2",
"shx": "0.3.2",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.17.0",
"tslint-react": "^3.6.0",
"typescript": "^3.2.1"
"typescript": "^3.2.2"
},
"resolutions": {
"scheduler": "0.12.0"
Expand Down
Binary file removed packages/components/assets/logo.png
Binary file not shown.
Binary file added packages/components/assets/logo_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/components/assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/components/assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/components/assets/logo_rounded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/components/assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/components/assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/components/assets/logo_square.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/components/assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/components/assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": false,
"main": "dist",
"scripts": {
"build": "tsc -b",
"clean": "rimraf dist/*",
"compile": "tsc -b",
"clean": "shx rm -rf dist/*",
"format": "prettier --write '{.,src/**}/*.{js,jsx,ts,tsx}'",
"lint": "tslint -p .",
"prepare": "cd .. && yarn patch-package"
Expand Down Expand Up @@ -66,7 +66,7 @@
"tslint-config-airbnb": "^5.11.1",
"tslint-config-prettier": "^1.17.0",
"tslint-react": "^3.6.0",
"typescript": "^3.2.1"
"typescript": "^3.2.2"
},
"resolutions": {
"scheduler": "0.12.0"
Expand Down
5 changes: 3 additions & 2 deletions packages/components/src/components/common/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { AnchorHTMLAttributes } from 'react'
import { Animated, Linking, View } from 'react-native'
import { Animated, View } from 'react-native'

import { Omit } from '@devhub/core'
import { Browser } from '../../libs/browser'
import { Linking } from '../../libs/linking'
import { Platform } from '../../libs/platform'
import { AnimatedTouchableOpacity } from '../animated/AnimatedTouchableOpacity'
import { TouchableOpacity, TouchableOpacityProps } from './TouchableOpacity'
Expand Down Expand Up @@ -65,7 +66,7 @@ export function Link(props: LinkProps) {
{...Platform.select({
default: {
onPress: href
? href.includes('http')
? href.startsWith('http')
? () => Browser.openURL(href)
: () => Linking.openURL(href)
: undefined,
Expand Down
3 changes: 1 addition & 2 deletions packages/components/src/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { Separator } from '../common/Separator'
import { TouchableOpacity } from '../common/TouchableOpacity'
import { useAppLayout } from '../context/LayoutContext'

const logo = require('@devhub/components/assets/logo.png') // tslint:disable-line
const logo = require('@devhub/components/assets/logo_circle.png') // tslint:disable-line

const styles = StyleSheet.create({
centerContainer: {
Expand Down Expand Up @@ -218,7 +218,6 @@ export const Sidebar = React.memo((props: SidebarProps) => {
style={{
width: sidebarSize / 2,
height: sidebarSize / 2,
borderRadius: sidebarSize / (2 * 2),
}}
/>
</Link>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash'
import React, { useState } from 'react'
import { Alert, Animated, Clipboard, Linking, View } from 'react-native'
import { Animated, Clipboard, View } from 'react-native'

import { useAnimatedTheme } from '../../hooks/use-animated-theme'
import { useReduxState } from '../../redux/hooks/use-redux-state'
Expand Down
26 changes: 26 additions & 0 deletions packages/components/src/hooks/use-app-visibility.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useState } from 'react'
import { AppState, AppStateStatus } from 'react-native'
import { Platform } from '../libs/platform'

export function useAppVisibility() {
const [isVisible, setIsVisible] = useState<boolean>(
Expand All @@ -20,5 +21,30 @@ export function useAppVisibility() {
[isVisible],
)

useEffect(
() => {
if (!Platform.isElectron) return

const focusHandler = () => {
if (isVisible) return
setIsVisible(true)
}

const blurHandler = () => {
if (!isVisible) return
setIsVisible(false)
}

window.addEventListener('focus', focusHandler)
window.addEventListener('blur', blurHandler)

return () => {
window.removeEventListener('focus', focusHandler)
window.removeEventListener('blur', blurHandler)
}
},
[isVisible],
)

return isVisible
}
15 changes: 15 additions & 0 deletions packages/components/src/libs/browser/index-native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { BrowserCrossPlatform } from '.'
import { Linking } from '../linking'

export const Browser: BrowserCrossPlatform = {
addEventListener: (e: any, handler: any) => {
if (e === 'url') return Linking.addEventListener(e, handler)
console.debug('[BROWSER] Ignoring addEventListener event', e) // tslint:disable-line no-console
},
removeEventListener: (e: any, handler: any) => {
if (e === 'url') return Linking.removeEventListener(e, handler)
console.debug('[BROWSER] Ignoring removeEventListener event', e) // tslint:disable-line no-console
},
dismiss: () => undefined,
openURL: Linking.openURL,
}
14 changes: 14 additions & 0 deletions packages/components/src/libs/browser/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export interface BrowserCrossPlatform {
addEventListener: {
(event: 'url', handler: ((payload: { url: string }) => void)): void
(event: 'onDismiss', handler: (() => void)): void
}
removeEventListener: {
(event: 'url', handler: ((payload: { url: string }) => void)): void
(event: 'onDismiss', handler: (() => void)): void
}
dismiss(): void
openURL(url: string): void
}

export const Browser: BrowserCrossPlatform
21 changes: 18 additions & 3 deletions packages/components/src/libs/browser/index.ios.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { Linking, StatusBar } from 'react-native'
import { StatusBar } from 'react-native'
import SafariView, { SafaryOptions } from 'react-native-safari-view'

import { BrowserCrossPlatform } from '.'
import { bugsnag } from '../bugsnag'
import { Linking } from '../linking'

export const Browser = {
...Linking,
export const Browser: BrowserCrossPlatform = {
...SafariView,
addEventListener: (e: any, handler: any) => {
if (e === 'url') return Linking.addEventListener(e, handler)
if (e === 'onShow') return SafariView.addEventListener(e, handler)
if (e === 'onDismiss') return SafariView.addEventListener(e, handler)
console.debug('[BROWSER] Unknown addEventListener event', e) // tslint:disable-line no-console
},
removeEventListener: (e: any, handler: any) => {
if (e === 'url') return Linking.removeEventListener(e, handler)
if (e === 'onShow') return SafariView.removeEventListener(e, handler)
if (e === 'onDismiss') return SafariView.removeEventListener(e, handler)
console.debug('[BROWSER] Unknown removeEventListener event', e) // tslint:disable-line no-console
},
dismiss: SafariView.dismiss,
openURL: (url: string, options?: SafaryOptions) => {
SafariView.isAvailable()
.then(isAvailable => {
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/libs/browser/index.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { BrowserCrossPlatform } from '.'

// tslint:disable-next-line no-var-requires
export const Browser: BrowserCrossPlatform = require('./index-native').Browser
5 changes: 0 additions & 5 deletions packages/components/src/libs/browser/index.ts

This file was deleted.

4 changes: 4 additions & 0 deletions packages/components/src/libs/browser/index.web.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { BrowserCrossPlatform } from '.'

// tslint:disable-next-line no-var-requires
export const Browser: BrowserCrossPlatform = require('./index-native').Browser
40 changes: 40 additions & 0 deletions packages/components/src/libs/linking/index-electron.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Source: https://github.com/PaulLeCam/react-native-electron/blob/master/src/apis/Linking.js

import _ from 'lodash'

import { LinkingCrossPlatform } from './index'
import { Linking as LinkingOriginal } from './index-native'

const eventHandlers = new Map()

export const Linking: LinkingCrossPlatform = {
addEventListener: (type: string, handler: any) => {
if (!(type === 'url' && typeof handler === 'function')) return

const wrapHandler = (_e: any, url: string) => {
handler({ type, url })
}

eventHandlers.set(handler, wrapHandler)
window.ipc.addListener('open-url', wrapHandler)
},
async canOpenURL(url: string) {
return LinkingOriginal.canOpenURL(url)
},
async getInitialURL() {
return ''
},
openURL: (url: string): Promise<void> => {
return LinkingOriginal.openURL(url)
},
removeEventListener: (type: string, handler: any) => {
if (!(type === 'url' && typeof handler === 'function')) return

const wrapHandler = eventHandlers.get(handler)
if (wrapHandler) {
window.ipc.removeListener('open-url', wrapHandler)
}

eventHandlers.delete(handler)
},
}
3 changes: 3 additions & 0 deletions packages/components/src/libs/linking/index-native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import _ from 'lodash'

export { Linking } from 'react-native'
15 changes: 15 additions & 0 deletions packages/components/src/libs/linking/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export interface LinkingCrossPlatform {
addEventListener: (
event: 'url',
handler: (payload: { url: string }) => void,
) => void
removeEventListener: (
event: 'url',
handler: (payload: { url: string }) => void,
) => void
canOpenURL(url: string): Promise<boolean>
getInitialURL(): Promise<string>
openURL(url: string): void
}

export const Linking: LinkingCrossPlatform
5 changes: 5 additions & 0 deletions packages/components/src/libs/linking/index.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import _ from 'lodash'

import { LinkingCrossPlatform } from './index'

export const Linking: LinkingCrossPlatform = require('./index-native').Linking // tslint:disable-line no-var-requires
8 changes: 8 additions & 0 deletions packages/components/src/libs/linking/index.web.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import _ from 'lodash'

import { Platform } from '../platform'
import { LinkingCrossPlatform } from './index'

export const Linking: LinkingCrossPlatform = Platform.isElectron
? require('./index-electron').Linking // tslint:disable-line no-var-requires
: require('./index-native').Linking // tslint:disable-line no-var-requires
Loading