"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IOSNotificationService = void 0;
const constants = require("../constants");
const yok_1 = require("../yok");
const _ = require("lodash");
class IOSNotificationService {
    constructor($iosDeviceOperations) {
        this.$iosDeviceOperations = $iosDeviceOperations;
    }
    async awaitNotification(deviceIdentifier, socket, timeout) {
        const notificationResponse = await this.$iosDeviceOperations.awaitNotificationResponse([
            {
                deviceId: deviceIdentifier,
                socket: socket,
                timeout: timeout,
                responseCommandType: constants.IOS_RELAY_NOTIFICATION_COMMAND_TYPE,
                responsePropertyName: "Name",
            },
        ]);
        return _.first(notificationResponse[deviceIdentifier]).response;
    }
    async postNotification(deviceIdentifier, notification, commandType) {
        commandType = commandType || constants.IOS_POST_NOTIFICATION_COMMAND_TYPE;
        const response = await this.$iosDeviceOperations.postNotification([
            {
                deviceId: deviceIdentifier,
                commandType: commandType,
                notificationName: notification,
            },
        ]);
        return +_.first(response[deviceIdentifier]).response;
    }
}
exports.IOSNotificationService = IOSNotificationService;
yok_1.injector.register("iOSNotificationService", IOSNotificationService);
