Skip to content

Commit

Permalink
2.3 released
Browse files Browse the repository at this point in the history
  • Loading branch information
lealife committed Jan 22, 2017
1 parent 405d6c6 commit 414a562
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 74 deletions.
23 changes: 12 additions & 11 deletions main.js
Expand Up @@ -116,7 +116,19 @@ function removeEvents (win) {
win.removeAllListeners('close');
}

function close (e, force) {
console.log('close:', force);
if (mainWindow) {
mainWindow.hide();
e && e.preventDefault();
mainWindow.webContents.send('closeWindow');
} else {
app.quit();
}
}

function bindEvents (win) {
mainWindow = win;

// Emitted when the window is closed.
win.on('closed', function() {
Expand All @@ -138,17 +150,6 @@ function bindEvents (win) {
if(win && win.webContents)
win.webContents.send('blurWindow');
});

function close (e, force) {
console.log('close:', force);
if (win) {
win.hide();
e && e.preventDefault();
win.webContents.send('closeWindow');
} else {
app.quit();
}
}

// 以前的关闭是真关闭, 现是是假关闭了
// 关闭,先保存数据
Expand Down
9 changes: 8 additions & 1 deletion node_modules/api.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 48 additions & 37 deletions node_modules/sync.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions node_modules/web.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 26 additions & 17 deletions public/js/app/note.js
Expand Up @@ -847,21 +847,22 @@ Note.renderChangedNote = function(changedNote) {
// 清空右侧note信息, 可能是共享的,
// 此时需要清空只读的, 且切换到note edit模式下
Note.clearNoteInfo = function() {
Note.clearCurNoteId();
Tag.input.clearTags();
$("#noteTitle").val("");
setEditorContent("");
Note.clearCurNoteId();
Tag.input.clearTags();
$("#noteTitle").val("");
setEditorContent("");

// markdown editor
/*
$("#wmd-input").val("");
$("#wmd-preview").html("");
*/
// markdown editor
/*
$("#wmd-input").val("");
$("#wmd-preview").html("");
*/

// 只隐藏即可
$("#noteRead").hide();
}
// 清除noteList导航
// 只隐藏即可
$("#noteRead").hide();
};

// 清除noteList导航
Note.clearNoteList = function() {
Note.noteItemListO.html(""); // 清空
}
Expand Down Expand Up @@ -1252,23 +1253,31 @@ Note.hideSyncProgress = function() {
Note.unConnected = function() {
var me = this;
me._syncWarningE.show();
SyncService.setSyncFinished();
SyncService.setSyncFinished(true);
me.hideSpin();
me._syncWarningE.data('reason', 'unConnected');
me._syncWarningE.attr('title', 'Network error');
};
// 网络已经连接好了
Note.connected = function() {
var me = this;
if (me._syncWarningE.data('reason') == 'unConnected') {
me._syncWarningE.data('reason', '-');
me._syncWarningE.hide();
}
};
Note.notLogin = function() {
var me = this;
me._syncWarningE.show();
me.hideSpin();
SyncService.setSyncFinished();
SyncService.setSyncFinished(true);
me._syncWarningE.data('reason', 'notLogin');
me._syncWarningE.attr('title', getMsg('You need to sign in Leanote'));
};
Note.needUpgradeAccount = function() {
var me = this;
me.hideSpin();
SyncService.setSyncFinished();
SyncService.setSyncFinished(true);
me._syncWarningE.show();
me._syncWarningE.data('reason', 'NEED-UPGRADE-ACCOUNT');
me._syncWarningE.attr('title', getMsg('You need to upgrade Leanote account'));
Expand All @@ -1284,7 +1293,7 @@ Note.fixNetOrAuthError = function() {
} else if (reason == 'notLogin') {
alert(getMsg('You need to sign in Leanote'));
// 弹出登录框登录之, 重新弹出
window.open('login.html?ref=needLogin');
toLogin();

// 需要升级Leanote
} else if (reason == 'NEED-UPGRADE-ACCOUNT') {
Expand Down
30 changes: 25 additions & 5 deletions public/js/app/page.js
Expand Up @@ -1216,8 +1216,8 @@ LeaAce = {
function fullSync(callback) {
log('full sync');
$('.loading-footer').show();
SyncService.fullSync(function(ret, ok) {
callback && callback(ok);
SyncService.fullSync(function(err, ret) {
callback && callback(err, ret);
});
}

Expand Down Expand Up @@ -1525,9 +1525,29 @@ function initPage(initedCallback) {
else if ('LastSyncUsn' in UserInfo && UserInfo['LastSyncUsn'] > 0) {
_init();
} else {
fullSync(function(ok) {
if (!ok) {
Notify.show({ title: 'Info', body: getMsg('Sync error, retry to sync after 3 seconds') });
fullSync(function(err, info) {
if (err) {
if (typeof err == 'object') {
if(err['Msg'] == 'NOTLOGIN') {
alert(getMsg('You need to sign in Leanote'));
toLogin();
return;
}
if(err['Msg'] == 'NEED-UPGRADE-ACCOUNT') {
alert(getMsg('You need to upgrade Leanote account'));
openExternal('https://leanote.com/pricing#buy');
setTimeout(function () {
toLogin();
}, 1000);
return;
}
}

if (isMac()) {
Notify.show({ title: 'Info', body: getMsg('Sync error, retry to sync after 3 seconds') });
} else {
alert(getMsg('Sync error, retry to sync after 3 seconds'));
}
setTimeout(function() {
reloadApp();
}, 3000);
Expand Down
4 changes: 2 additions & 2 deletions public/js/app/tag.js
Expand Up @@ -220,9 +220,9 @@ TagInput.prototype = {
// called by Note
setTags: function(tags) {
if(!Array.isArray(tags)) {
return;
tags = [];
}
this.$tags.html('');
this.clearTags();
for(var i = 0; i < tags.length; ++i) {
this._addTag(tags[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion public/js/common.js
Expand Up @@ -1524,7 +1524,7 @@ function toLogin() {
if(isMac()) {
ipc.send('openUrl', {html: 'login.html', width: 278, height: 370, show: true, frame: false, resizable: false })
} else {
ipc.send('openUrl', { width: 278, height: 400, show: true, frame: true, resizable: false })
ipc.send('openUrl', {html: 'login.html', width: 278, height: 400, show: true, frame: true, resizable: false })
}
// gui.getCurrentWindow().close();
}
Expand Down

0 comments on commit 414a562

Please sign in to comment.