Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
PhaserEditor2D committed Dec 1, 2020
2 parents 2327f91 + 73807f2 commit 6439fd8
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 88 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## Version 3.9.1 - Nov 30, 2020

* Check if a new version is available at startup.
* *Check For Updates* is a new option in the main menu. It shows a message if there is a new version.

## Version 3.9.0 - Nov 24, 2020

### Added
Expand Down
76 changes: 0 additions & 76 deletions source/editor/plugins/colibri/ColibriPlugin.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ namespace colibri.ui.controls.dialogs {
});
}

setMessage(text: string) {

this._messageElement.innerHTML = text;
}

static replaceConsoleAlert() {
window["__alert"] = window.alert;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ namespace colibri.ui.controls.dialogs {
}
}

isClosed() {

return !this.getElement().isConnected;
}

protected goFront() {
// nothing
}
Expand Down
21 changes: 21 additions & 0 deletions source/editor/plugins/colibri/src/ui/ide/Workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,27 @@ namespace colibri.ui.ide {
return this._projectPreferences;
}

showNotification(text: string) {

const element = document.createElement("div");
element.classList.add("Notification");
element.innerHTML = text;

document.body.appendChild(element);

element.classList.add("FadeInEffect");

element.addEventListener("click", () => element.remove());

setTimeout(() => {

element.classList.add("FadeOutEffect");

setTimeout(() => element.remove(), 4000);

}, 4000);
}

async launch() {

console.log("Workbench: starting.");
Expand Down
64 changes: 54 additions & 10 deletions source/editor/plugins/colibri/styles/controls.css
Original file line number Diff line number Diff line change
Expand Up @@ -336,20 +336,19 @@ div.TabPaneTitleBar::-webkit-scrollbar {
height: 10px;
}

/* Dialog */
/* Dialog & Notification */

.DialogContainer {
.Notification {
z-index: 10000;
position: absolute;
z-index: 1000;
left: 0px;
right: 0px;
width: 100%;
height: 100%;
bottom: 30px;
right: 30px;
padding: 20px;
border-radius: 3px;
}

.Dialog {
position: absolute;
z-index: 1001;
.Dialog,
.Notification {
border-radius: 5px;
border-width: 1px;
border-color: rgba(0, 0, 0, 0.5);
Expand All @@ -361,6 +360,20 @@ div.TabPaneTitleBar::-webkit-scrollbar {

}

.DialogContainer {
position: absolute;
z-index: 1000;
left: 0px;
right: 0px;
width: 100%;
height: 100%;
}

.Dialog {
position: absolute;
z-index: 1001;
}

.Dialog {
display: grid;
grid-template-columns: 5px 1fr 5px;
Expand Down Expand Up @@ -523,4 +536,35 @@ div.TabPaneTitleBar::-webkit-scrollbar {

.MenuItemSeparator {
height: 1px;
}

/* Effects */

.FadeInEffect {
animation: fadein 2s;
}

.FadeOutEffect {
animation: fadeout 2s;
opacity: 0;
}


@keyframes fadein {
from {
opacity: 0;
}

to {
opacity: 1;
}
}
@keyframes fadeout {
from {
opacity: 1;
}

to {
opacity: 0;
}
}
23 changes: 21 additions & 2 deletions source/editor/plugins/phasereditor2d.ide/src/IDEPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,24 @@ namespace phasereditor2d.ide {
this._licenseActivated = data.unlocked === true;
}

async requestUpdateAvailable() {

if (this.isDesktopMode()) {

if (await this.isNewUpdateAvailable()) {

colibri.Platform.getWorkbench().showNotification("A new version is available!");
}
}
}

async isNewUpdateAvailable() {

const data = await colibri.core.io.apiRequest("GetNewVersionAvailable");

return data.available;
}

isLicenseActivated() {

return this._licenseActivated;
Expand Down Expand Up @@ -317,7 +335,7 @@ namespace phasereditor2d.ide {

/* program entry point */

export const VER = "3.9.0";
export const VER = "3.9.1";

async function main() {

Expand All @@ -331,13 +349,14 @@ namespace phasereditor2d.ide {
"background-color:silver",
);

colibri.ui.controls.dialogs.AlertDialog.replaceConsoleAlert();

await IDEPlugin.getInstance().requestServerMode();

await colibri.Platform.start();

await IDEPlugin.getInstance().openFirstWindow();

await IDEPlugin.getInstance().requestUpdateAvailable();
}

window.addEventListener("load", main);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ namespace phasereditor2d.ide.ui.actions {
}
}));

menu.add(new controls.Action({
text: "Check For Updates",
callback: async () => {

const dlg = new controls.dialogs.AlertDialog();
dlg.create();
dlg.setTitle("Updates");
dlg.setMessage("Checking for updates...");

const available = await IDEPlugin.getInstance().isNewUpdateAvailable();

dlg.setMessage(available ? "A new version is available!" : "Updates not found.");
}
}));
}

menu.add(new controls.Action({
Expand Down

0 comments on commit 6439fd8

Please sign in to comment.