'use strict';

var angular = require('angular'),
  _ = require('jsUtil');
require('../modules');

var module = angular.module('vpnmanager.services');

/* @ngInject */
module.factory('vpnService', function($q) {
    function waitLoginVpn() {
        var defer = $q.defer();
        if (window.SinoNetwork && window.SinoNetwork.waitLoginVpn) {
            window.SinoNetwork.waitLoginVpn(function() {
                defer.resolve(true);
            }, function(error) {
                defer.reject(error);
            });
        } else {
            defer.resolve(true);
        }
        return defer.promise;
    }

    return {
        waitLoginVpn: waitLoginVpn
    };
});