!252 新增自动旋转开关

Merge pull request !252 from Drizzle/master
This commit is contained in:
openharmony_ci
2022-10-25 13:57:38 +00:00
committed by Gitee
@@ -79,12 +79,14 @@ export class AutoRotateService {
async changeSwitch(status: boolean): Promise<void> {
screen.setScreenRotationLocked(!status).then((err, data) => {
this.updateAutoRotateSwitchStatus();
if (err.code) {
Log.showDebug(TAG, `changeSwitch, error: ${JSON.stringify(err)}`);
} else {
Log.showDebug(TAG, `changeSwitch success, isAutoRotate: ${JSON.stringify(status)}`);
}
this.updateAutoRotateSwitchStatus();
Log.showDebug(TAG, `changeSwitch success, isAutoRotate: ${JSON.stringify(status)}`);
});
this.updateAutoRotateSwitchStatus();
}
}