Skip to content

Commit be372f6

Browse files
committed
Fixed issue with bk business ; Fixed issue with VersionHelper
1 parent 6aea739 commit be372f6

File tree

4 files changed

+50
-18
lines changed

4 files changed

+50
-18
lines changed

Gruntfile.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = function (grunt) {
77
grunt.loadNpmTasks("grunt-mkdir");
88
grunt.loadNpmTasks("grunt-zip");
99
grunt.loadNpmTasks("grunt-node-webkit-builder");
10+
grunt.loadNpmTasks("grunt-contrib-uglify");
1011

1112
// Configure grunt here
1213
grunt.initConfig({
@@ -166,7 +167,19 @@ module.exports = function (grunt) {
166167
mac_icns : 'release/src/logo.icns'
167168
},
168169
src : ['release/src/**/*']
169-
}
170+
},
171+
uglify: {
172+
release: {
173+
options : {
174+
compress : true,
175+
mangle : false,
176+
preserveComments : false
177+
},
178+
files: {
179+
'release/src/app/ui/js/output.js' : ['release/src/app/ui/js/output.js']
180+
}
181+
}
182+
}
170183
});
171184

172185
grunt.registerTask('build', ['ts:build']);
@@ -178,6 +191,7 @@ module.exports = function (grunt) {
178191
'ts:release',
179192
'mkdir:release',
180193
'copy:release',
194+
'uglify:release',
181195
'nodewebkit',
182196
'zip:releaseWin',
183197
'zip:releaseMac',

app/helpers/VersionHelper.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class VersionHelper {
55
//region Fields
66

77
private static _target : string = 'http://yimello.adriencadet.com/version';
8-
private static _version : string = '0.1.2';
8+
private static _version : string = '0.2.0';
99

1010
//endregion Fields
1111

@@ -21,16 +21,29 @@ class VersionHelper {
2121

2222
//region Public Methods
2323

24-
static isUpToDate(callback : Action<boolean>) : void {
24+
static isUpToDate(callback : Action<boolean>, errorHandler : Action<string> = null) : void {
2525
var get : GetRequest;
2626

27-
get = new GetRequest(VersionHelper._target);
28-
get.setDataType(AjaxRequestDataType.Text);
29-
get.execute(
30-
(data, status, xhr) => {
31-
callback(data === VersionHelper._version);
27+
if (Environment.isOnline()) {
28+
get = new GetRequest(VersionHelper._target);
29+
get.setDataType(AjaxRequestDataType.Text);
30+
get.setErrorHandler(
31+
(xhr, status, error) => {
32+
if (TSObject.exists(errorHandler)) {
33+
errorHandler(error);
34+
}
35+
}
36+
);
37+
get.execute(
38+
(data, status, xhr) => {
39+
callback(data === VersionHelper._version);
40+
}
41+
);
42+
} else {
43+
if (TSObject.exists(errorHandler)) {
44+
errorHandler('Unable to check version: no connection was spotted');
3245
}
33-
);
46+
}
3447
}
3548

3649
//endregion Public Methods

app/models/business/impl/BookmarkBusiness.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,16 @@ class BookmarkBusiness implements IBookmarkBusiness {
7575
bookmark.setURL(url);
7676

7777
title = bookmark.getTitle();
78-
title = StringHelper.trim(title);
79-
title = SecurityHelper.disarm(title);
80-
if (title === '') {
78+
if (!TSObject.exists(title) || title === '') {
8179
bookmark.setTitle(bookmark.getURL());
8280
} else {
83-
bookmark.setTitle(title);
81+
title = StringHelper.trim(title);
82+
title = SecurityHelper.disarm(title);
83+
if (title === '') {
84+
bookmark.setTitle(bookmark.getURL());
85+
} else {
86+
bookmark.setTitle(title);
87+
}
8488
}
8589

8690
description = bookmark.getDescription();

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88
"height": 527,
99
"resizable": false,
1010
"position": "center",
11-
"icon" : "app/ui/assets/img/logo.png"
11+
"icon": "app/ui/assets/img/logo.png"
1212
},
1313
"devDependencies": {
1414
"grunt": "~0.4.1",
1515
"grunt-ts": "~1.9.2",
1616
"typescript": "0.9.7",
1717
"grunt-contrib-copy": "~0.5.0",
18-
"grunt-remove" : "0.1.0",
19-
"grunt-mkdir" : "0.1.1",
20-
"grunt-node-webkit-builder" : "0.1.21",
21-
"grunt-zip" : "0.15.0"
18+
"grunt-remove": "0.1.0",
19+
"grunt-mkdir": "0.1.1",
20+
"grunt-node-webkit-builder": "0.1.21",
21+
"grunt-zip": "0.15.0",
22+
"grunt-contrib-uglify": "~0.5.1"
2223
}
2324
}

0 commit comments

Comments
 (0)