"use strict";
/*
 * Tencent is pleased to support the open source community by making
 * Hippy available.
 *
 * Copyright (C) 2017-2019 THL A29 Limited, a Tencent company.
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.initAppClient = void 0;
const enum_1 = require("@debug-server-next/@types/enum");
const constants_1 = require("@debug-server-next/@types/constants");
const app_client_manager_1 = require("./app-client-manager");
const iwdp_app_client_1 = require("./iwdp-app-client");
const tunnel_app_client_1 = require("./tunnel-app-client");
const ws_app_client_1 = require("./ws-app-client");
const initAppClient = () => {
    const { tunnel, enableIOS } = global.debugAppArgv;
    const DefaultCtor = tunnel === enum_1.DebugTunnel.WS ? ws_app_client_1.WSAppClient : tunnel_app_client_1.TunnelAppClient;
    app_client_manager_1.appClientManager.addAndroidAppClientOption({
        useAllDomain: true,
        Ctor: DefaultCtor,
        platform: enum_1.DevicePlatform.Android,
    });
    app_client_manager_1.appClientManager.addIOSAppClientOption({
        useAllDomain: false,
        acceptDomains: constants_1.customDomains,
        Ctor: DefaultCtor,
        platform: enum_1.DevicePlatform.IOS,
    });
    if (enableIOS) {
        app_client_manager_1.appClientManager.addIOSAppClientOption({
            useAllDomain: false,
            ignoreDomains: constants_1.customDomains,
            Ctor: iwdp_app_client_1.IWDPAppClient,
            platform: enum_1.DevicePlatform.IOS,
        });
    }
};
exports.initAppClient = initAppClient;
