Add setting/toggle to automatically download reviews (#1221)

This commit is contained in:
Aditya Chandel
2025-09-26 14:39:52 -06:00
committed by GitHub
parent a9c1be9854
commit 06523d4c24
10 changed files with 124 additions and 31 deletions
@@ -10,12 +10,28 @@
</div>
<p class="setting-description">
<i class="pi pi-info-circle"></i>
Automatically download user reviews from enabled platforms (Amazon, Goodreads, Hardcover) when fetching book metadata. Reviews will be stored with your books for offline access.
Enable downloading user reviews from configured platforms (Amazon, Goodreads, Hardcover). Reviews will be stored with your books for offline access.
</p>
</div>
</div>
@if (publicReviewSettings.downloadEnabled) {
<div class="setting-item">
<div class="setting-info">
<div class="setting-label-row">
<label class="setting-label">Auto Download on Book Open</label>
<p-toggleswitch
[(ngModel)]="publicReviewSettings.autoDownloadEnabled"
(onChange)="onAutoDownloadToggle($event.checked)">
</p-toggleswitch>
</div>
<p class="setting-description">
<i class="pi pi-info-circle"></i>
Automatically fetch reviews when you open a book's details page. When disabled, reviews will only be downloaded manually or during metadata refresh, reducing background network activity and improving performance.
</p>
</div>
</div>
<div class="review-sources-section">
<div class="sources-header">
<h4 class="subsection-title">Review Sources</h4>
@@ -25,6 +25,7 @@ export class PublicReviewsSettingsComponent implements OnInit {
publicReviewSettings: PublicReviewSettings = {
downloadEnabled: true,
autoDownloadEnabled: false,
providers: [...DEFAULT_PROVIDERS]
};
@@ -42,6 +43,11 @@ export class PublicReviewsSettingsComponent implements OnInit {
this.settingsHelper.saveSetting(AppSettingKey.METADATA_PUBLIC_REVIEWS_SETTINGS, this.publicReviewSettings);
}
onAutoDownloadToggle(checked: boolean): void {
this.publicReviewSettings.autoDownloadEnabled = checked;
this.settingsHelper.saveSetting(AppSettingKey.METADATA_PUBLIC_REVIEWS_SETTINGS, this.publicReviewSettings);
}
onProviderToggle(providerName: string, enabled: boolean): void {
this.updateProviderProperty(providerName, 'enabled', enabled);
}