"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.updater = undefined;
exports.changeChannel = changeChannel;

var _electronUpdater = require("electron-updater");

var _config = require("./config");

var _config2 = _interopRequireDefault(_config);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

if (process.platform === 'win32') {
  _electronUpdater.autoUpdater.logger = require("electron-log");
  _electronUpdater.autoUpdater.logger.transports.file.level = "info";

  _electronUpdater.autoUpdater.setFeedURL({
    provider: "generic",
    url: "https://poi.io/dist",
    channel: _config2.default.get('poi.betaChannel', false) ? "beta" : "latest"
  });
  _electronUpdater.autoUpdater.autoDownload = false;
}

function changeChannel(channel) {
  if (process.platform == 'win32') {
    _electronUpdater.autoUpdater.setFeedURL({
      provider: "generic",
      url: "https://poi.io/dist",
      channel
    });
  }
}

const updater = exports.updater = _electronUpdater.autoUpdater;