mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
1 line
77 KiB
JSON
1 line
77 KiB
JSON
|
|
{"ast":null,"code":"import { __extends } from \"tslib\";\nimport { Injectable } from '@angular/core';\nimport { AwesomeCordovaNativePlugin, checkAvailability, cordovaPropertyGet, cordovaPropertySet, getPromise } from '@awesome-cordova-plugins/core';\nimport * as ɵngcc0 from '@angular/core';\nvar File = /** @class */function (_super) {\n __extends(File, _super);\n function File() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.cordovaFileError = {\n 1: 'NOT_FOUND_ERR',\n 2: 'SECURITY_ERR',\n 3: 'ABORT_ERR',\n 4: 'NOT_READABLE_ERR',\n 5: 'ENCODING_ERR',\n 6: 'NO_MODIFICATION_ALLOWED_ERR',\n 7: 'INVALID_STATE_ERR',\n 8: 'SYNTAX_ERR',\n 9: 'INVALID_MODIFICATION_ERR',\n 10: 'QUOTA_EXCEEDED_ERR',\n 11: 'TYPE_MISMATCH_ERR',\n 12: 'PATH_EXISTS_ERR',\n 13: 'WRONG_ENTRY_TYPE',\n 14: 'DIR_READ_ERR'\n };\n return _this;\n }\n File.prototype.getFreeDiskSpace = function () {\n var _this = this;\n return function () {\n if (checkAvailability(_this) === true) {\n return getPromise(function (resolve, reject) {\n cordova.exec(resolve, reject, 'File', 'getFreeDiskSpace', []);\n });\n }\n }();\n };\n File.prototype.checkDir = function (path, dir) {\n var _this = this;\n return function () {\n if (checkAvailability(_this) === true) {\n if (/^\\//.test(dir)) {\n var err = new FileError(5);\n err.message = 'directory cannot start with /';\n return Promise.reject(err);\n }\n var fullPath = path + dir;\n return _this.resolveDirectoryUrl(fullPath).then(function () {\n return true;\n });\n }\n }();\n };\n File.prototype.createDir = function (path, dirName, replace) {\n var _this = this;\n return function () {\n if (checkAvailability(_this) === true) {\n if (/^\\//.test(dirName)) {\n var err = new FileError(5);\n err.message = 'directory cannot start with /';\n return Promise.reject(err);\n }\n var options = {\n create: true\n };\n if (!replace) {\n options.exclusive = true;\n }\n return _this.resolveDirectoryUrl(path).then(function (fse) {\n return _this.getDirectory(fse, dirName, options);\n });\n }\n }();\n };\n File.prototype.removeDir = function (path, dirName) {\n var _this = this;\n return function () {\n if (checkAvailability(_this) === true) {\n if (/^\\//.test(dirName)) {\n var err = new FileError(5);\n err.message = 'directory cannot start with /';\n return Promise.reject(err);\n }\n return _this.resolveDirectoryUrl(path).then(function (fse) {\n return _this.getDirectory(fse, dirName, {\n create: false\n });\n }).then(function (de) {\n return _this.remove(de);\n });\n }\n }();\n };\n File.prototype.moveDir = function (path, dirName, newPath, newDirName) {\n var _this = this;\n return function () {\n if (checkAvailability(_this) === true) {\n newDirName = newDirName || dirName;\n if (/^\\//.test(newDirName)) {\n var err = new FileError(5);\n err.message = 'directory cannot start with /';\n return Promise.reject(err);\n }\n return _this.resolveDirectoryUrl(path).then(function (fse) {\n return _this.getDirectory(fse, dirName, {\n create: false\n });\n }).then(function (srcde) {\n return _this.resolveDirectoryUrl(newPath).then(function (destenation) {\n return _this.move(srcde, destenation, newDirName);\n });\n });\n }\n }();\n };\n File.prototype.copyDir = function (path, dirName, newPath, newDirName) {\n var _this = this;\n return function () {\n if (checkAvailability(_this) === true) {\n if (/^\\//.test(newDirName)) {\n var err = new FileError(5);\n err.mess
|