mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-06 03:50:18 +02:00
chore: format code with prettier
This commit is contained in:
parent
6f1be248fb
commit
6ada4a7a06
77 changed files with 459 additions and 283 deletions
|
@ -1,49 +1,78 @@
|
|||
import { AdbCommandBase } from "@yume-chan/adb";
|
||||
|
||||
export type SettingsNamespace = 'system' | 'secure' | 'global';
|
||||
export type SettingsNamespace = "system" | "secure" | "global";
|
||||
|
||||
export type SettingsResetMode = 'untrusted_defaults' | 'untrusted_clear' | 'trusted_defaults';
|
||||
export type SettingsResetMode =
|
||||
| "untrusted_defaults"
|
||||
| "untrusted_clear"
|
||||
| "trusted_defaults";
|
||||
|
||||
// frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsService.java
|
||||
export class Settings extends AdbCommandBase {
|
||||
// TODO: `--user <user>` argument
|
||||
|
||||
public base(command: string, namespace: SettingsNamespace, ...args: string[]) {
|
||||
return this.adb.subprocess.spawnAndWaitLegacy(['settings', command, namespace, ...args]);
|
||||
public base(
|
||||
command: string,
|
||||
namespace: SettingsNamespace,
|
||||
...args: string[]
|
||||
) {
|
||||
return this.adb.subprocess.spawnAndWaitLegacy([
|
||||
"settings",
|
||||
command,
|
||||
namespace,
|
||||
...args,
|
||||
]);
|
||||
}
|
||||
|
||||
public get(namespace: SettingsNamespace, key: string) {
|
||||
return this.base('get', namespace, key);
|
||||
return this.base("get", namespace, key);
|
||||
}
|
||||
|
||||
public delete(namespace: SettingsNamespace, key: string) {
|
||||
return this.base('delete', namespace, key);
|
||||
return this.base("delete", namespace, key);
|
||||
}
|
||||
|
||||
public put(namespace: SettingsNamespace, key: string, value: string, tag?: string, makeDefault?: boolean) {
|
||||
public put(
|
||||
namespace: SettingsNamespace,
|
||||
key: string,
|
||||
value: string,
|
||||
tag?: string,
|
||||
makeDefault?: boolean
|
||||
) {
|
||||
return this.base(
|
||||
'put',
|
||||
"put",
|
||||
namespace,
|
||||
key,
|
||||
value,
|
||||
...(tag ? [tag] : []),
|
||||
...(makeDefault ? ['default'] : []),
|
||||
...(makeDefault ? ["default"] : [])
|
||||
);
|
||||
}
|
||||
|
||||
public reset(namespace: SettingsNamespace, mode: SettingsResetMode): Promise<string>;
|
||||
public reset(namespace: SettingsNamespace, packageName: string, tag?: string): Promise<string>;
|
||||
public reset(namespace: SettingsNamespace, modeOrPackageName: string, tag?: string): Promise<string> {
|
||||
public reset(
|
||||
namespace: SettingsNamespace,
|
||||
mode: SettingsResetMode
|
||||
): Promise<string>;
|
||||
public reset(
|
||||
namespace: SettingsNamespace,
|
||||
packageName: string,
|
||||
tag?: string
|
||||
): Promise<string>;
|
||||
public reset(
|
||||
namespace: SettingsNamespace,
|
||||
modeOrPackageName: string,
|
||||
tag?: string
|
||||
): Promise<string> {
|
||||
return this.base(
|
||||
'reset',
|
||||
"reset",
|
||||
namespace,
|
||||
modeOrPackageName,
|
||||
...(tag ? [tag] : []),
|
||||
...(tag ? [tag] : [])
|
||||
);
|
||||
}
|
||||
|
||||
public async list(namespace: SettingsNamespace): Promise<string[]> {
|
||||
const output = await this.base('list', namespace);
|
||||
return output.split('\n');
|
||||
const output = await this.base("list", namespace);
|
||||
return output.split("\n");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue