Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 7c3c0455 authored by Simon Chan's avatar Simon Chan
Browse files

feat(scrcpy): expose notification panel controls

parent 28b1bd3c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -441,7 +441,7 @@ export class AdbServerClient {
    }
}

async function raceSignal<T>(
export async function raceSignal<T>(
    callback: () => Promise<T>,
    ...signals: (AbortSignal | undefined)[]
): Promise<T> {
+25 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ import type {
    ScrcpyScrollController,
} from "../options/index.js";

import { BasicControlMessage } from "./basic.js";
import type { AndroidKeyEventAction } from "./inject-keycode.js";
import { ScrcpyInjectKeyCodeControlMessage } from "./inject-keycode.js";
import type { ScrcpyInjectScrollControlMessage } from "./inject-scroll.js";
@@ -83,6 +84,30 @@ export class ScrcpyControlMessageSerializer {
        });
    }

    expandNotificationPanel() {
        return BasicControlMessage.serialize({
            type: this.#typeValues.get(
                ScrcpyControlMessageType.ExpandNotificationPanel,
            ),
        });
    }

    expandSettingPanel() {
        return BasicControlMessage.serialize({
            type: this.#typeValues.get(
                ScrcpyControlMessageType.ExpandSettingPanel,
            ),
        });
    }

    collapseNotificationPanel() {
        return BasicControlMessage.serialize({
            type: this.#typeValues.get(
                ScrcpyControlMessageType.CollapseNotificationPanel,
            ),
        });
    }

    rotateDevice() {
        return ScrcpyRotateDeviceControlMessage.serialize({
            type: this.#typeValues.get(ScrcpyControlMessageType.RotateDevice),
+12 −0
Original line number Diff line number Diff line
@@ -71,6 +71,18 @@ export class ScrcpyControlMessageWriter {
        await this.write(this.#serializer.setScreenPowerMode(mode));
    }

    async expandNotificationPanel() {
        await this.write(this.#serializer.expandNotificationPanel());
    }

    async expandSettingPanel() {
        await this.write(this.#serializer.expandSettingPanel());
    }

    async collapseNotificationPanel() {
        await this.write(this.#serializer.collapseNotificationPanel());
    }

    async rotateDevice() {
        await this.write(this.#serializer.rotateDevice());
    }