Merge branch 'dev'

This commit is contained in:
Yuya Ochiai
2016-02-16 21:17:44 +09:00
6 changed files with 34 additions and 12 deletions

View File

@@ -10,9 +10,12 @@ machine:
- docker - docker
dependencies: dependencies:
cache_directories:
- "~/.electron"
- "src/node_modules"
post: post:
- docker build -t yuya-oc/em-builder docker - mkdir -p ~/.electron
- docker run --rm -it -v `pwd`:/home/xclient/electron-mattermost yuya-oc/em-builder ./electron-mattermost/docker/package_in_docker.sh - docker run --rm -it -v `pwd`:/home/xclient/electron-mattermost -v ~/.electron:/home/xclient/.electron yuyaoc/em-builder:dev ./electron-mattermost/docker/package_in_docker.sh
- mv release/electron-mattermost-win32-ia32 release/electron-mattermost-win32 - mv release/electron-mattermost-win32-ia32 release/electron-mattermost-win32
- mv release/electron-mattermost-win32-x64 release/electron-mattermost-win64 - mv release/electron-mattermost-win32-x64 release/electron-mattermost-win64
- mv release/electron-mattermost-darwin-x64 release/electron-mattermost-osx - mv release/electron-mattermost-darwin-x64 release/electron-mattermost-osx

View File

@@ -13,7 +13,7 @@ var electron = require('electron-connect').server.create({
}); });
var packager = require('electron-packager'); var packager = require('electron-packager');
var sources = ['**/*.js', '**/*.css', '**/*.html', '!**/node_modules/**', '!**/build/**', '!release/**']; var sources = ['**/*.js', '**/*.css', '**/*.html', '!**/node_modules/**', '!dist/**', '!release/**'];
gulp.task('prettify', ['prettify:sources', 'prettify:jsx']); gulp.task('prettify', ['prettify:sources', 'prettify:jsx']);

View File

@@ -28,7 +28,7 @@
"del": "^2.2.0", "del": "^2.2.0",
"electron-connect": "^0.3.3", "electron-connect": "^0.3.3",
"electron-packager": "^5.1.0", "electron-packager": "^5.1.0",
"electron-prebuilt": "0.36.3", "electron-prebuilt": "0.36.7",
"esformatter": "^0.8.1", "esformatter": "^0.8.1",
"esformatter-jsx": "^4.0.6", "esformatter-jsx": "^4.0.6",
"gulp": "^3.9.0", "gulp": "^3.9.0",

View File

@@ -142,7 +142,7 @@ var MainPage = React.createClass({
var handleNotificationClick = function() { var handleNotificationClick = function() {
thisObj.handleSelect(index); thisObj.handleSelect(index);
} }
return (<MattermostView id={ 'mattermostView' + index } style={ thisObj.visibleStyle(thisObj.state.key === index) } src={ team.url } onUnreadCountChange={ handleUnreadCountChange } onNotificationClick={ handleNotificationClick } return (<MattermostView id={ 'mattermostView' + index } style={ thisObj.visibleStyle(thisObj.state.key === index) } src={ team.url } name={ team.name } onUnreadCountChange={ handleUnreadCountChange } onNotificationClick={ handleNotificationClick }
/>) />)
}); });
var views_row = (<Row> var views_row = (<Row>
@@ -268,12 +268,26 @@ var MattermostView = React.createClass({
case 'onNotificationClick': case 'onNotificationClick':
thisObj.props.onNotificationClick(); thisObj.props.onNotificationClick();
break; break;
case 'console':
console.log(event.args[0]);
break;
} }
}); });
webview.addEventListener('console-message', (e) => {
const message = `[${this.props.name}] ${e.message}`;
switch (e.level) {
case 0:
console.log(message);
break;
case 1:
console.warn(message);
break;
case 2:
console.error(message);
break;
default:
console.log(message);
break;
}
});
}, },
render: function() { render: function() {
// 'disablewebsecurity' is necessary to display external images. // 'disablewebsecurity' is necessary to display external images.

View File

@@ -42,13 +42,18 @@ var unreadCountTimer = setInterval(function() {
// find active post-list. // find active post-list.
var postLists = document.querySelectorAll('div.post-list__content'); var postLists = document.querySelectorAll('div.post-list__content');
var post; if (postLists.length === 0) {
return;
}
var post = null;
for (var i = 0; i < postLists.length; i++) { for (var i = 0; i < postLists.length; i++) {
if (isElementVisible(postLists[i])) { if (isElementVisible(postLists[i])) {
post = postLists[i].children[0]; post = postLists[i].children[0];
} }
} }
if (post === null) {
return;
}
// find latest post and save. // find latest post and save.
while (post = post.nextSibling) { while (post = post.nextSibling) {
if (post.nextSibling === null) { if (post.nextSibling === null) {

View File

@@ -111,10 +111,10 @@ app.on('ready', function() {
} }
// Create the browser window. // Create the browser window.
var bounds_info_path = app.getPath("userData") + "/bounds-info.json"; var bounds_info_path = path.resolve(app.getPath("userData"), "bounds-info.json");
var window_options; var window_options;
try { try {
window_options = require(bounds_info_path); window_options = JSON.parse(fs.readFileSync(bounds_info_path, 'utf-8'));
} }
catch (e) { catch (e) {
// follow Electron's defaults // follow Electron's defaults