Skip to content

Commit

Permalink
Merge branch 'feature/status-bar-styling' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeleppan committed Nov 7, 2020
2 parents df1e397 + 693fa16 commit a9166d3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export default class ObsidianDiscordRPC extends Plugin {
this.app.workspace.on("file-open", this.onFileOpen, this)
);

this.registerInterval(
window.setInterval(async () => {
await this.connectDiscord();
}, 60 * 1000)
);

this.registerDomEvent(statusBarEl, "click", async () => {
if (this.getState() == PluginState.disconnected) {
await this.connectDiscord();
Expand Down Expand Up @@ -154,17 +160,12 @@ class DiscordRPCSettingsTab extends PluginSettingTab {

class StatusBar {
private statusBarEl: HTMLElement;
private isDisplayingMessage: boolean = false;

constructor(statusBarEl: HTMLElement) {
this.statusBarEl = statusBarEl;
}

displayState(state: PluginState) {
if (this.isDisplayingMessage) {
return;
}

switch (state) {
case PluginState.connected:
this.displayConnected(2000);
Expand All @@ -179,7 +180,6 @@ class StatusBar {
}

displayConnected(timeout: number) {
this.isDisplayingMessage = true;
this.statusBarEl.setText(`\u{1F30D} Connected to Discord`);

if (timeout && timeout > 0) {
Expand Down

0 comments on commit a9166d3

Please # to comment.