"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
function _interopRequireDefault(e) {
  return e && e.__esModule ? e : {
    default: e
  };
}
const StorageController = {
  async: 1,
  getItemAsync(path) {
    return new Promise((resolve, reject) => {
      _CoreManager.default.getAsyncStorage().getItem(path, (err, value) => {
        if (err) {
          reject(err);
        } else {
          resolve(value || null);
        }
      });
    });
  },
  setItemAsync(path, value) {
    return new Promise((resolve, reject) => {
      _CoreManager.default.getAsyncStorage().setItem(path, value, err => {
        if (err) {
          reject(err);
        } else {
          resolve();
        }
      });
    });
  },
  removeItemAsync(path) {
    return new Promise((resolve, reject) => {
      _CoreManager.default.getAsyncStorage().removeItem(path, err => {
        if (err) {
          reject(err);
        } else {
          resolve();
        }
      });
    });
  },
  getAllKeysAsync() {
    return new Promise((resolve, reject) => {
      _CoreManager.default.getAsyncStorage().getAllKeys((err, keys) => {
        if (err) {
          reject(err);
        } else {
          resolve(keys || []);
        }
      });
    });
  },
  multiGet(keys) {
    return new Promise((resolve, reject) => {
      _CoreManager.default.getAsyncStorage().multiGet(keys, (err, result) => {
        if (err) {
          reject(err);
        } else {
          resolve(result || null);
        }
      });
    });
  },
  multiRemove(keys) {
    return new Promise((resolve, reject) => {
      _CoreManager.default.getAsyncStorage().multiRemove(keys, err => {
        if (err) {
          reject(err);
        } else {
          resolve(keys);
        }
      });
    });
  },
  clear() {
    return _CoreManager.default.getAsyncStorage().clear();
  }
};
module.exports = StorageController;
var _default = exports.default = StorageController;