fix: send notification when settings are manually synced (#1378)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
Ryan Cao 2023-07-04 23:59:42 +08:00 committed by GitHub
parent 8027daa2b0
commit 232e340fab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

@ -86,7 +86,7 @@ function SettingsSyncSection() {
<Button <Button
size={Button.Sizes.SMALL} size={Button.Sizes.SMALL}
disabled={!sectionEnabled} disabled={!sectionEnabled}
onClick={() => putCloudSettings()} onClick={() => putCloudSettings(true)}
>Sync to Cloud</Button> >Sync to Cloud</Button>
<Tooltip text="This will overwrite your local settings with the ones on the cloud. Use wisely!"> <Tooltip text="This will overwrite your local settings with the ones on the cloud. Use wisely!">
{({ onMouseLeave, onMouseEnter }) => ( {({ onMouseLeave, onMouseEnter }) => (

@ -121,7 +121,7 @@ export async function uploadSettingsBackup(showToast = true): Promise<void> {
// Cloud settings // Cloud settings
const cloudSettingsLogger = new Logger("Cloud:Settings", "#39b7e0"); const cloudSettingsLogger = new Logger("Cloud:Settings", "#39b7e0");
export async function putCloudSettings() { export async function putCloudSettings(manual?: boolean) {
const settings = await exportSettings({ minify: true }); const settings = await exportSettings({ minify: true });
try { try {
@ -149,6 +149,14 @@ export async function putCloudSettings() {
VencordNative.settings.set(JSON.stringify(PlainSettings, null, 4)); VencordNative.settings.set(JSON.stringify(PlainSettings, null, 4));
cloudSettingsLogger.info("Settings uploaded to cloud successfully"); cloudSettingsLogger.info("Settings uploaded to cloud successfully");
if (manual) {
showNotification({
title: "Cloud Settings",
body: "Synchronized settings to the cloud!",
noPersist: true,
});
}
} catch (e: any) { } catch (e: any) {
cloudSettingsLogger.error("Failed to sync up", e); cloudSettingsLogger.error("Failed to sync up", e);
showNotification({ showNotification({