async addSftp(...args) {
		let stopConnection = false;

		const {
			hostname,
			username,
			keyFile,
			password,
			passPhrase,
			port,
			alias,
			usePassword,
		} = await prompt(...args);
		const authType = usePassword ? "password" : "keyFile";

		loader.create(strings["add sftp"], strings["connecting..."], {
			timeout: 10000,
			callback() {
				stopConnection = true;
			},
		});
		const connection = Sftp(hostname, Number.parseInt(port), username, {
			password,
			keyFile,
			passPhrase,
		});

		try {
			const [home] = await Promise.all([connection.pwd(), loadAd()]);

			if (stopConnection) {
				stopConnection = false;
				return;
			}

			let localKeyFile = "";
			if (keyFile) {
				let fs = fsOperation(keyFile);
				const text = await fs.readFile("utf8");

				//Original key file sometimes gives permission error
				//To solve permission error
				const filename = keyFile.hashCode();
				localKeyFile = Url.join(DATA_STORAGE, filename);
				fs = fsOperation(localKeyFile);
				const exists = await fs.exists();
				if (exists) {
					await fs.writeFile(text);
				} else {
					let fs = fsOperation(DATA_STORAGE);
					await fs.createFile(filename, text);
				}
			}

			const url = Url.formate({
				protocol: "sftp:",
				hostname,
				username,
				password,
				port,
				path: "/",
				query: {
					keyFile: localKeyFile,
					passPhrase,
				},
			});
			loader.destroy();
			if (IS_FREE_VERSION && (await window.iad?.isLoaded())) {
				window.iad.show();
			}
			return {
				alias,
				name: alias,
				url,
				type: "sftp",
				home,
			};
		} catch (err) {
			if (stopConnection) {
				stopConnection = false;
				return;
			}

			loader.destroy();
			await helpers.error(err);
			return await this.addSftp(
				hostname,
				username,
				keyFile,
				password,
				passPhrase,
				port,
				alias,
				authType,
			);
		}

		function prompt(
			hostname,
			username,
			keyFile,
			password,
			passPhrase,
			port,
			alias,
			authType = "password",
		) {
			port = port || 22;

			const MODE_PASS = authType === "password";
			const inputs = [
				{
					id: "alias",
					placeholder: strings.name,
					type: "text",
					value: alias ? alias : "",
					required: true,
				},
				{
					id: "username",
					placeholder: `${strings.username} (${strings.optional})`,
					type: "text",
					value: username,
				},
				{
					id: "hostname",
					placeholder: strings.hostname,
					type: "text",
					required: true,
					value: hostname,
				},
				[
					"Authentication type: ",
					{
						id: "usePassword",
						placeholder: strings.password,
						name: "authType",
						type: "radio",
						value: MODE_PASS,
						onchange() {
							if (!!this.value) {
								this.prompt.$body.get("#password").hidden = false;
								this.prompt.$body.get("#keyFile").hidden = true;
								this.prompt.$body.get("#passPhrase").hidden = true;
							}
						},
					},
					{
						id: "useKeyFile",
						placeholder: strings["key file"],
						name: "authType",
						type: "radio",
						value: !MODE_PASS,
						onchange() {
							if (!!this.value) {
								const $password = this.prompt.$body.get("#password");
								$password.hidden = true;
								$password.value = "";
								this.prompt.$body.get("#keyFile").hidden = false;
								this.prompt.$body.get("#passPhrase").hidden = false;
							}
						},
					},
				],
				{
					id: "password",
					placeholder: strings.password,
					name: "password",
					type: "password",
					value: password,
					hidden: !MODE_PASS,
				},
				{
					id: "keyFile",
					placeholder: strings["select key file"],
					name: "keyFile",
					hidden: MODE_PASS,
					value: keyFile,
					type: "text",
					onclick() {
						sdcard.openDocumentFile((res) => {
							this.value = res.uri;
						});
					},
				},
				{
					id: "passPhrase",
					placeholder: `${strings.passphrase} (${strings.optional})`,
					name: "passPhrase",
					type: "password",
					hidden: MODE_PASS,
					value: passPhrase,
				},
				{
					id: "port",
					placeholder: `${strings.port} (${strings.optional})`,
					type: "number",
					value: port,
				},
			];

			return multiPrompt(strings["add sftp"], inputs);
		}
	}
@param {...any} args [hostname, username, keyFile, password, passphrase, port, name]