Skip to content

Commit

Permalink
Displays notification with trial days left.
Browse files Browse the repository at this point in the history
  • Loading branch information
meowjesty committed Feb 26, 2024
1 parent 8d929f8 commit 9a4cc16
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export class MirrordAPI {
}
}

/**
/**
* Runs the extension execute sequence, creating agent and gathering execution runtime while also
* setting env vars, both from system, and from `launch.json` (`configEnv`).
*
Expand Down Expand Up @@ -376,23 +376,40 @@ export class MirrordAPI {
}
}

if (message["type"] === "Warning") {
warningHandler.handle(message["message"]);
} else {
// If it is not last message, it is progress
let formattedMessage = message["name"];
if (message["message"]) {
formattedMessage += ": " + message["message"];
// TODO(alex) [high]: Move these "Warning | Info" to typed enum.
// Be very careful here, when showing messages, the notification is happy to take a json
// object, but it won't show anything! There is no json->string conversion, it just
// silently does nothing (no compiler warnings either).
switch (message["type"]) {
case "Warning": {
warningHandler.handle(message["message"]);
break;
}
case "Info": {
new NotificationBuilder()
.withMessage(message["message"])
.info();
break;
}
default: {
// If it is not last message, it is progress
let formattedMessage = message["name"];
if (message["message"]) {
formattedMessage += ": " + message["message"];
}
progress.report({ message: formattedMessage });
break;
}
progress.report({ message: formattedMessage });
}
}

});
});
});
}
}


class MirrordWarningHandler {
private filters: [(message: string) => boolean, string][];

Expand Down

0 comments on commit 9a4cc16

Please sign in to comment.