From 9128f9ed5bd08ad0302b6f3f92138e5f0925ceb4 Mon Sep 17 00:00:00 2001 From: fyears Date: Sat, 27 Nov 2021 00:49:21 +0800 Subject: [PATCH] add support for ios 5-times click --- src/main.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index a5d2b5c..39a34f5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -296,8 +296,18 @@ class RemotelySaveSettingTab extends PluginSettingTab { // we need to create the div in advance of s3Div and webdavDiv const serviceChooserDiv = generalDiv.createEl("div"); + let clickChooserTimes = 0; serviceChooserDiv.onClickEvent((x) => { - if (x.detail === 5) { + if (Platform.isIosApp) { + // downgrade the experiment + // because iOS doesn't support x.detail + clickChooserTimes += 1; + setTimeout(function () { + clickChooserTimes = 0; + }, 2000); + } + + if ((Platform.isIosApp && clickChooserTimes === 5) || x.detail === 5) { if (this.plugin.settings.serviceType === "webdav") { new Notice( "You've enabled hidden unstable experimental webdav support before. Nothing changes." @@ -316,6 +326,7 @@ class RemotelySaveSettingTab extends PluginSettingTab { ); } } + x.preventDefault(); }); const s3Div = containerEl.createEl("div", { cls: "s3-hide" });