Skip to content

Commit

Permalink
Merge branch 'release/1.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeleppan committed Nov 7, 2020
2 parents df1e397 + 4f32241 commit 5a32b7c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
9 changes: 0 additions & 9 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-discordrpc",
"name": "Discord Rich Presence",
"version": "1.0.1",
"version": "1.0.2",
"description": "Update your Discord Status to show your friends what you are working on in Obsidian. With Discord Rich Presence.",
"author": "Luke Leppan",
"authorUrl": "https://lukeleppan.com",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-discordrpc",
"version": "1.0.1",
"version": "1.0.2",
"description": "Update your Discord Status to show your friends what you are working on in Obsidian. With Discord Rich Presence.",
"main": "main.js",
"scripts": {
Expand Down
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 5a32b7c

Please # to comment.