add rest api

This commit is contained in:
2024-09-11 19:27:24 +08:00
parent ed6cbec7c9
commit 3a4338c99a
10 changed files with 217 additions and 56 deletions

View File

@@ -34,12 +34,12 @@ export class BaseLocalStorage {
let options: dataPreferences.Options = { name: BaseLocalStorage.XY_DP_Name };
this.preferences = dataPreferences.getPreferencesSync(this.context, options);
} else {
Log.i("LocalStorage is already init.")
Log.info("LocalStorage is already init.")
}
}
public putData(key: string, value: dataPreferences.ValueType) {
Log.i(`put sp data, key:${key}, value:${value}`)
Log.info(`put sp data, key:${key}, value:${value}`)
this.preferences?.putSync(key, value);
this.preferences?.flush();
}
@@ -51,7 +51,7 @@ export class BaseLocalStorage {
public getData(key: string, defaultValue: dataPreferences.ValueType): dataPreferences.ValueType | undefined {
let value = this.preferences?.getSync(key, defaultValue);
Log.i(`get sp data, key:${key}, value:${value}`)
Log.info(`get sp data, key:${key}, value:${value}`)
return value;
}

View File

@@ -7,23 +7,23 @@ let format: string = `%{public}s, %{public}s`;
export class Log {
static d(...args: string[]) {
static debug(...args: string[]) {
hilog.debug(domain, prefix, format, args);
}
static i(...args: string[]) {
static info(...args: string[]) {
hilog.info(domain, prefix, format, args);
}
static w(...args: string[]) {
static warn(...args: string[]) {
hilog.warn(domain, prefix, format, args);
}
static e(...args: string[]) {
static error(...args: string[]) {
hilog.error(domain, prefix, format, args);
}
static f(...args: string[]) {
static fatal(...args: string[]) {
hilog.fatal(domain,prefix, format, args);
}

View File

@@ -106,7 +106,7 @@ export class ScreenUtil {
}
setWindowKeepScreenOn(isKeep: boolean) {
Log.i(`setWindowKeepScreenOn:${isKeep}`)
Log.info(`setWindowKeepScreenOn:${isKeep}`)
window.getLastWindow(getContext(this))
.then((windowClass: window.Window) => {
windowClass.setWindowKeepScreenOn(isKeep);