Skip to content

Commit

Permalink
Added non-intrusive version check
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebukam committed May 16, 2022
1 parent e7822d7 commit 51cce58
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 9 deletions.
39 changes: 37 additions & 2 deletions app/js/views/welcome-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ class WelcomeView extends base {
super._Init();
this.cmdNewFromTTF = this._commands.Create(mkfCmds.StartNewFromTTF);
this.cmdNewFromSVGs = this._commands.Create(mkfCmds.StartNewFromSVGS);

nkm.io.Read(`https://api.github.com/repos/Nebukam/mkfont/tags`,
{
cl: nkm.io.resources.JSONResource,
},
{
io: nkm.io.IO_TYPE.REMOTE,
success: this._OnTagRead.bind(this),
}
);
}

static _Style() {
Expand Down Expand Up @@ -104,9 +114,19 @@ class WelcomeView extends base {
variant: ui.FLAGS.MINIMAL, flavor: nkm.com.FLAGS.LOADING
},
*/
{
label: `NEW VERSION : `, icon: `warning`,
variant: ui.FLAGS.FRAME, flavor: nkm.com.FLAGS.WARNING,
group: `mkfont`, member: { owner: this, id: `_newVersionBtn` },
trigger: {
fn: () => { shell.openExternal("https://nebukam.github.io/mkfont/downloads/") }
},
group: `update`
}
]
};


this._newVersionBtn.visible = false;

console.log(nkm.env.CONF);

Expand All @@ -122,7 +142,7 @@ class WelcomeView extends base {
{
label: `${nkm.env.CONF.version}`,
cl: nkm.uilib.widgets.Tag,
size: ui.FLAGS.SIZE_XS,
size: ui.FLAGS.SIZE_L,
group: `Version`
},
{
Expand Down Expand Up @@ -151,6 +171,21 @@ class WelcomeView extends base {
};
}

_OnTagRead(p_rsc) {
try {

let
latestTagName = p_rsc.content[0].name,
semVer = latestTagName.substring(1).split(`.`);

if(nkm.env.ENV.instance.VersionDiff(semVer) > 0){
this._newVersionBtn.label = `${semVer.join(`.`)} Available`;
this._newVersionBtn.visible = true;
}

} catch (e) { console.log(e);}
}

}

module.exports = WelcomeView;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "mkfont",
"version": "1.2.0",
"version": "1.2.1",
"author": {
"name": "Timothé Lapetite",
"email": "nebukam@gmail.com"
},
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@nkmjs/core": "^0.3.13",
"@nkmjs/core": "^0.3.14",
"svg-path-reverse": "^1.3.0",
"svg2ttf": "^6.0.3",
"svgo": "^2.8.0",
Expand All @@ -19,7 +19,7 @@
"processor": "node app/js-unicode/unicode-processor.js"
},
"devDependencies": {
"@nkmjs/core-dev": "^0.3.14",
"@nkmjs/core-dev": "^0.3.15",
"electron": "^17.1.0"
}
}
8 changes: 4 additions & 4 deletions pkg.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "mkfont",
"version": "1.2.0",
"version": "1.2.1",
"author": {
"name": "Timothé Lapetite",
"email": "nebukam@gmail.com"
},
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@nkmjs/core": "^0.3.13",
"@nkmjs/core": "^0.3.14",
"svg-path-reverse": "^1.3.0",
"svg2ttf": "^6.0.3",
"svgo": "^2.8.0",
Expand All @@ -19,14 +19,14 @@
"processor": "node app/js-unicode/unicode-processor.js"
},
"devDependencies": {
"@nkmjs/core-dev": "^0.3.14",
"@nkmjs/core-dev": "^0.3.15",
"electron": "^17.1.0"
}
}

{
"name": "mkfont",
"version": "1.2.0",
"version": "1.2.1",
"author": {
"name": "Timothé Lapetite",
"email": "nebukam@gmail.com"
Expand Down

0 comments on commit 51cce58

Please sign in to comment.