Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#145, #111): force set instance to true when sending activity #150

Merged
merged 1 commit into from
Nov 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,20 @@ export class RPCController {
if (config.get(CONFIG_KEYS.Status.Idle.Check)) this.listeners.push(changeWindowState);

this.listeners.push(fileSwitch, fileEdit, fileSelectionChanged, debugStart, debugEnd, gitListener);

}
private checkCanSend(): boolean {
const config = getConfig();
let userId = this.client.user?.id;
if(!userId) return false;
if (!userId) return false;
let whitelistEnabled = config.get(CONFIG_KEYS.App.WhitelistEnabled);
if(whitelistEnabled) {
if (whitelistEnabled) {
let whitelist = config.get(CONFIG_KEYS.App.Whitelist);
if(config.get(CONFIG_KEYS.App.whitelistIsBlacklist))
if(whitelist!.includes(userId)) return this.canSendActivity = false;
else return this.canSendActivity = true;
else
if(!whitelist!.includes(userId)) return this.canSendActivity = false;
if (config.get(CONFIG_KEYS.App.whitelistIsBlacklist))
if (whitelist!.includes(userId)) return (this.canSendActivity = false);
else return (this.canSendActivity = true);
else if (!whitelist!.includes(userId)) return (this.canSendActivity = false);
}
return this.canSendActivity = true;
return (this.canSendActivity = true);
}

private async checkIdle(windowState: WindowState) {
Expand Down Expand Up @@ -176,6 +174,7 @@ export class RPCController {
if (!this.enabled) return;
this.checkCanSend();
this.state = await activity(this.state, isViewing, isIdling);
this.state.instance = true;
if (!this.state || Object.keys(this.state).length === 0 || !this.canSendActivity)
return void this.client.user?.clearActivity(process.pid);
return this.client.user?.setActivity(this.state, process.pid);
Expand Down
2 changes: 1 addition & 1 deletion src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
workspace
} from "vscode";

const ALLOWED_SCHEME = ["file", "vscode-remote"];
const ALLOWED_SCHEME = ["file", "vscode-remote", "untitled"];

interface DisposableLike {
dispose: () => unknown;
Expand Down