/**
 * @fileoverview added by tsickle
 * Generated from: lib/widgets/entry-components/loading/services/loading.service.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { TranslatePipe } from './../../../../shared/translate/pipes/translate.pipe';
import { Injectable } from '@angular/core';
import { LoadingController } from '@ionic/angular';
import * as i0 from "@angular/core";
import * as i1 from "@ionic/angular";
import * as i2 from "../../../../shared/translate/pipes/translate.pipe";
var LoadingService = /** @class */ (function () {
    function LoadingService(loadingController, translatePipe) {
        this.loadingController = loadingController;
        this.translatePipe = translatePipe;
    }
    /**
     * @param {?} msg
     * @return {?}
     */
    LoadingService.prototype.presentLoading = /**
     * @param {?} msg
     * @return {?}
     */
    function (msg) {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var _this = this;
            return tslib_1.__generator(this, function (_a) {
                this.dismissLoading();
                return [2 /*return*/, new Promise((/**
                     * @param {?} resolve
                     * @param {?} reject
                     * @return {?}
                     */
                    function (resolve, reject) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
                        var _a;
                        return tslib_1.__generator(this, function (_b) {
                            switch (_b.label) {
                                case 0:
                                    _a = this;
                                    return [4 /*yield*/, this.loadingController.create({
                                            message: this.translatePipe.transform(msg),
                                        })];
                                case 1:
                                    _a.loader = _b.sent();
                                    return [4 /*yield*/, this.loader.present()];
                                case 2:
                                    _b.sent();
                                    resolve();
                                    return [2 /*return*/];
                            }
                        });
                    }); }))];
            });
        });
    };
    /**
     * @return {?}
     */
    LoadingService.prototype.dismissLoading = /**
     * @return {?}
     */
    function () {
        if (this.loader) {
            this.loader.dismiss();
        }
    };
    LoadingService.decorators = [
        { type: Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    /** @nocollapse */
    LoadingService.ctorParameters = function () { return [
        { type: LoadingController },
        { type: TranslatePipe }
    ]; };
    /** @nocollapse */ LoadingService.ngInjectableDef = i0.defineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(i0.inject(i1.LoadingController), i0.inject(i2.TranslatePipe)); }, token: LoadingService, providedIn: "root" });
    return LoadingService;
}());
export { LoadingService };
if (false) {
    /** @type {?} */
    LoadingService.prototype.loader;
    /**
     * @type {?}
     * @private
     */
    LoadingService.prototype.loadingController;
    /**
     * @type {?}
     * @private
     */
    LoadingService.prototype.translatePipe;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZGluZy5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGluY2xvdWRlZC9pb25pYzQtaW5jbG91ZGVkLWxpYi8iLCJzb3VyY2VzIjpbImxpYi93aWRnZXRzL2VudHJ5LWNvbXBvbmVudHMvbG9hZGluZy9zZXJ2aWNlcy9sb2FkaW5nLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLHFEQUFxRCxDQUFDO0FBQ3BGLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDM0MsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sZ0JBQWdCLENBQUM7Ozs7QUFFbkQ7SUFNSSx3QkFBb0IsaUJBQW9DLEVBQVUsYUFBNEI7UUFBMUUsc0JBQWlCLEdBQWpCLGlCQUFpQixDQUFtQjtRQUFVLGtCQUFhLEdBQWIsYUFBYSxDQUFlO0lBQUksQ0FBQzs7Ozs7SUFFN0YsdUNBQWM7Ozs7SUFBcEIsVUFBcUIsR0FBVzs7OztnQkFDNUIsSUFBSSxDQUFDLGNBQWMsRUFBRSxDQUFDO2dCQUN0QixzQkFBTyxJQUFJLE9BQU87Ozs7O29CQUFDLFVBQU8sT0FBTyxFQUFFLE1BQU07Ozs7O29DQUNyQyxLQUFBLElBQUksQ0FBQTtvQ0FBVSxxQkFBTSxJQUFJLENBQUMsaUJBQWlCLEN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