google drive is usable now

This commit is contained in:
fyears
2024-06-02 23:37:53 +08:00
parent 2ace90155c
commit e116bb1deb
35 changed files with 1595 additions and 24 deletions
+44 -3
View File
@@ -21,6 +21,7 @@ import type {
} from "./baseTypes";
import cloneDeep from "lodash/cloneDeep";
import { generateGoogleDriveSettingsPart } from "../pro/src/settingsGoogleDrive";
import { generateProSettingsPart } from "../pro/src/settingsPro";
import { API_VER_ENSURE_REQURL_OK, VALID_REQURL } from "./baseTypesObs";
import { messyConfigToNormal } from "./configPersist";
@@ -169,7 +170,7 @@ class EncryptionMethodModal extends Modal {
}
}
class ChangeRemoteBaseDirModal extends Modal {
export class ChangeRemoteBaseDirModal extends Modal {
readonly plugin: RemotelySavePlugin;
readonly newRemoteBaseDir: string;
readonly service: SUPPORTED_SERVICES_TYPE_WITH_REMOTE_BASE_DIR;
@@ -1791,6 +1792,22 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
});
});
//////////////////////////////////////////////////
// below for googledrive
//////////////////////////////////////////////////
const {
googleDriveDiv,
googleDriveAllowedToUsedDiv,
googleDriveNotShowUpHintSetting,
} = generateGoogleDriveSettingsPart(
containerEl,
t,
this.app,
this.plugin,
() => this.plugin.saveSettings()
);
//////////////////////////////////////////////////
// below for general chooser (part 2/2)
//////////////////////////////////////////////////
@@ -1806,6 +1823,10 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
dropdown.addOption("webdav", t("settings_chooseservice_webdav"));
dropdown.addOption("onedrive", t("settings_chooseservice_onedrive"));
dropdown.addOption("webdis", t("settings_chooseservice_webdis"));
dropdown.addOption(
"googledrive",
t("settings_chooseservice_googledrive")
);
dropdown
.setValue(this.plugin.settings.serviceType)
@@ -1831,6 +1852,10 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
"webdis-hide",
this.plugin.settings.serviceType !== "webdis"
);
googleDriveDiv.toggleClass(
"googledrive-hide",
this.plugin.settings.serviceType !== "googledrive"
);
await this.plugin.saveSettings();
});
});
@@ -2383,6 +2408,16 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
button.onClick(async () => {
new ExportSettingsQrCodeModal(this.app, this.plugin, "webdis").open();
});
})
.addButton(async (button) => {
button.setButtonText(t("settings_export_googledrive_button"));
button.onClick(async () => {
new ExportSettingsQrCodeModal(
this.app,
this.plugin,
"googledrive"
).open();
});
});
let importSettingVal = "";
@@ -2442,8 +2477,14 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
//////////////////////////////////////////////////
const proDiv = containerEl.createEl("div");
generateProSettingsPart(proDiv, t, this.app, this.plugin, () =>
this.plugin.saveSettings()
generateProSettingsPart(
proDiv,
t,
this.app,
this.plugin,
() => this.plugin.saveSettings(),
googleDriveAllowedToUsedDiv,
googleDriveNotShowUpHintSetting
);
//////////////////////////////////////////////////