Processed some earlier review comments
Summary: Per title, processed some pending review comments made earlier in this stack Reviewed By: aigoncharov Differential Revision: D32916920 fbshipit-source-id: 01db85883596b5c85b77efc9cddadeac23cc4ef5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3c6668a8b9
commit
92a743cc59
@@ -10,12 +10,14 @@
|
||||
import os from 'os';
|
||||
import {UserNotSignedInError} from 'flipper-common';
|
||||
|
||||
export class KeytarManager {
|
||||
keytar: any;
|
||||
export type KeytarModule = {
|
||||
getPassword(service: string, username: string): string;
|
||||
deletePassword(service: string, username: string): void;
|
||||
setPassword(service: string, username: string, password: string): void;
|
||||
};
|
||||
|
||||
constructor(keytarModule: any) {
|
||||
this.keytar = keytarModule;
|
||||
}
|
||||
export class KeytarManager {
|
||||
constructor(private keytar: KeytarModule | undefined) {}
|
||||
|
||||
public async writeKeychain(service: string, password: string): Promise<void> {
|
||||
if (this.keytar == null) {
|
||||
@@ -27,7 +29,7 @@ export class KeytarManager {
|
||||
}
|
||||
|
||||
public async unsetKeychain(service: string): Promise<void> {
|
||||
await this.keytar.deletePassword(service, os.userInfo().username);
|
||||
await this.keytar?.deletePassword(service, os.userInfo().username);
|
||||
}
|
||||
|
||||
public async retrieveToken(service: string): Promise<string> {
|
||||
|
||||
@@ -14,6 +14,9 @@ import fs from 'fs-extra';
|
||||
import TOML, {JsonMap} from '@iarna/toml';
|
||||
import {LauncherSettings, ReleaseChannel} from 'flipper-common';
|
||||
|
||||
// There is some disagreement among the XDG Base Directory implementations
|
||||
// whether to use ~/Library/Preferences or ~/.config on MacOS. The Launcher
|
||||
// expects the former, whereas `xdg-basedir` implements the latter.
|
||||
export function xdgConfigDir() {
|
||||
return os.platform() === 'darwin'
|
||||
? path.join(os.homedir(), 'Library', 'Preferences')
|
||||
@@ -28,9 +31,6 @@ export function launcherConfigDir() {
|
||||
}
|
||||
|
||||
function getLauncherSettingsFile(): string {
|
||||
// There is some disagreement among the XDG Base Directory implementations
|
||||
// whether to use ~/Library/Preferences or ~/.config on MacOS. The Launcher
|
||||
// expects the former, whereas `xdg-basedir` implements the latter.
|
||||
return path.resolve(launcherConfigDir(), 'flipper-launcher.toml');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user