diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html
index f1582e2..7397dba 100644
--- a/src/app/home/home.page.html
+++ b/src/app/home/home.page.html
@@ -18,10 +18,12 @@
(keyup.enter)="hideKeyboard()"
>
-
-
- Which site or app are you logging into? e.g. when.fm
-
+ @if (show_home_help) {
+
+
+ Which site or app are you logging into? e.g. when.fm
+
+ }
-
-
- Think of it as your digital skeleton key – a super secret, memorable password, that will enable you
- to generate and recall separate login details for each service you use
-
+ @if (show_home_help) {
+
+
+ Think of it as your digital skeleton key – a super secret, memorable password, that will enable you
+ to generate and recall separate login details for each service you use
+
+ }
@if (non_domain_warning) {
diff --git a/src/app/home/home.page.spec.ts b/src/app/home/home.page.spec.ts
index 6be5761..c0cc821 100644
--- a/src/app/home/home.page.spec.ts
+++ b/src/app/home/home.page.spec.ts
@@ -6,6 +6,8 @@ import { IonicStorageModule } from '@ionic/storage-angular';
import { CapacitorSqliteDriverService } from '../capacitor-sqlite-driver.service';
import { HomePageComponent } from './home.page';
+import { SettingsService } from '../settings.service';
+import { SettingsSimple } from '../../models/SettingsSimple';
declare global {
interface Window {
@@ -41,4 +43,34 @@ describe('HomePageComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should show help paragraphs when show_home_help is true', async () => {
+ const settingsService = TestBed.inject(SettingsService);
+ const settings = new SettingsSimple();
+ settings.show_home_help = true;
+ vi.spyOn(settingsService, 'settings').mockReturnValue(settings);
+ vi.spyOn(settingsService, 'getCurrentSettings').mockResolvedValue(settings);
+
+ await component.update();
+ fixture.detectChanges();
+
+ const compiled = fixture.nativeElement as HTMLElement;
+ const helpParagraphs = compiled.querySelectorAll('p.help');
+ expect(helpParagraphs.length).toBe(2);
+ });
+
+ it('should hide help paragraphs when show_home_help is false', async () => {
+ const settingsService = TestBed.inject(SettingsService);
+ const settings = new SettingsSimple();
+ settings.show_home_help = false;
+ vi.spyOn(settingsService, 'settings').mockReturnValue(settings);
+ vi.spyOn(settingsService, 'getCurrentSettings').mockResolvedValue(settings);
+
+ await component.update();
+ fixture.detectChanges();
+
+ const compiled = fixture.nativeElement as HTMLElement;
+ const helpParagraphs = compiled.querySelectorAll('p.help');
+ expect(helpParagraphs.length).toBe(0);
+ });
});
diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts
index 11ba625..bda4eb3 100644
--- a/src/app/home/home.page.ts
+++ b/src/app/home/home.page.ts
@@ -95,6 +95,10 @@ export class HomePageComponent implements OnInit {
: false;
}
+ get show_home_help(): boolean {
+ return this.settings?.show_home_help ?? true;
+ }
+
async update() {
let settings: Settings;
try {
diff --git a/src/app/settings.service.spec.ts b/src/app/settings.service.spec.ts
index 24aecff..17a04d9 100644
--- a/src/app/settings.service.spec.ts
+++ b/src/app/settings.service.spec.ts
@@ -33,4 +33,80 @@ describe("SettingsService", () => {
expect(service).toBeTruthy();
}
));
+
+ it("should hydrate legacy SettingsSimple without show_home_help with default true", inject(
+ [SettingsService],
+ (service: SettingsService) => {
+ const legacyRaw = {
+ class: "SettingsSimple",
+ added_number_on: false,
+ added_number: 0,
+ algorithm: "hmac-sha256",
+ domain_only: true,
+ output_character_set: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
+ output_length: 15,
+ remember_minutes: 5,
+ master_password_hash: false,
+ };
+
+ const hydrated = service.hydrateSettings(legacyRaw);
+ expect(hydrated instanceof SettingsSimple).toBe(true);
+ expect(hydrated.show_home_help).toBe(true);
+ }
+ ));
+
+ it("should hydrate legacy SettingsAdvanced without show_home_help with default true", inject(
+ [SettingsService],
+ (service: SettingsService) => {
+ const legacyRaw = {
+ class: "SettingsAdvanced",
+ active_profile_id: 1,
+ remember_minutes: 5,
+ master_password_hash: false,
+ profiles: [
+ {
+ profile_id: 1,
+ name: "Default",
+ algorithm: "hmac-sha256",
+ domain_only: true,
+ leet_level: 0,
+ leet_location: "none",
+ modifier: "",
+ output_character_set_custom: "",
+ output_character_set_preset: "alphanumeric",
+ output_length: 15,
+ password_hash: "",
+ post_processing_suffix: "",
+ prefix: "",
+ suffix: "",
+ url_patterns: [],
+ },
+ ],
+ };
+
+ const hydrated = service.hydrateSettings(legacyRaw);
+ expect(hydrated.show_home_help).toBe(true);
+ }
+ ));
+
+ it("should hydrate Settings with show_home_help set to false", inject(
+ [SettingsService],
+ (service: SettingsService) => {
+ const rawSimple = {
+ class: "SettingsSimple",
+ show_home_help: false,
+ };
+ const hydratedSimple = service.hydrateSettings(rawSimple);
+ expect(hydratedSimple.show_home_help).toBe(false);
+
+ const rawAdvanced = {
+ class: "SettingsAdvanced",
+ show_home_help: false,
+ active_profile_id: 1,
+ profiles: [{ profile_id: 1, name: "Default" }],
+ };
+ const hydratedAdvanced = service.hydrateSettings(rawAdvanced);
+ expect(hydratedAdvanced.show_home_help).toBe(false);
+ }
+ ));
});
diff --git a/src/app/settings/settings.page.html b/src/app/settings/settings.page.html
index ca4ef1e..0c54c89 100644
--- a/src/app/settings/settings.page.html
+++ b/src/app/settings/settings.page.html
@@ -142,6 +142,16 @@
Whether to display a 3 character hash of your master password when you enter it, to help you confirm you've typed it correctly.
+
+ Show usage hints
+
+
@if (settingsForm.invalid) {
diff --git a/src/app/settings/settings.page.spec.ts b/src/app/settings/settings.page.spec.ts
index 4d1ab30..64914fd 100644
--- a/src/app/settings/settings.page.spec.ts
+++ b/src/app/settings/settings.page.spec.ts
@@ -87,6 +87,22 @@ describe("SettingsPageComponent", () => {
expect(settingsService.save).toHaveBeenCalled();
});
+ it("should auto-save settings when show_home_help is toggled", async () => {
+ const mockSettings = new SettingsSimple();
+ vi.spyOn(settingsService, "settings").mockReturnValue(mockSettings);
+ vi.spyOn(settingsService, "getCurrentSettings").mockResolvedValue(mockSettings);
+ vi.spyOn(settingsService, "save").mockResolvedValue(undefined);
+
+ await component.ngOnInit();
+
+ // Toggle show_home_help
+ component.settingsForm.patchValue({ show_home_help: false });
+
+ expect(settingsService.save).toHaveBeenCalledWith(
+ expect.objectContaining({ show_home_help: false })
+ );
+ });
+
it("should not auto-save when form is invalid", async () => {
const mockSettings = new SettingsSimple();
vi.spyOn(settingsService, "getCurrentSettings").mockResolvedValue(
diff --git a/src/app/settings/settings.page.ts b/src/app/settings/settings.page.ts
index f014a95..f760908 100644
--- a/src/app/settings/settings.page.ts
+++ b/src/app/settings/settings.page.ts
@@ -99,6 +99,7 @@ export class SettingsPageComponent implements OnInit, OnDestroy {
remember_minutes: [5, Validators.required],
added_number_on: [false],
added_number: [0],
+ show_home_help: [true],
});
addIcons({
addCircleOutline,
diff --git a/src/models/Settings.ts b/src/models/Settings.ts
index 3465918..f7d3cbf 100644
--- a/src/models/Settings.ts
+++ b/src/models/Settings.ts
@@ -7,12 +7,13 @@ export abstract class Settings {
master_password_hash = false;
remember_minutes = 5;
+ show_home_help = true;
/**
* Properties that are defined directly on the Settings base class (excluding 'class' which is for serialization).
* Update this list whenever new properties are added to the Settings class.
*/
- private static readonly COMMON_SETTINGS_PROPERTIES = ['master_password_hash', 'remember_minutes'] as const;
+ private static readonly COMMON_SETTINGS_PROPERTIES = ['master_password_hash', 'remember_minutes', 'show_home_help'] as const;
abstract getAlgorithm(): 'hmac-sha256' | 'sha256' | 'hmac-sha1' | 'sha1' | 'hmac-md5' | 'md5' | 'hmac-ripemd160' | 'ripemd160';
abstract getLeetLocation(): 'none' | 'before-hashing' | 'after-hashing' | 'both';
@@ -25,7 +26,7 @@ export abstract class Settings {
abstract getSuffix(): string;
abstract isDomainOnly(): boolean;
- getCommonSettingsProperties(): readonly ('master_password_hash' | 'remember_minutes')[] {
+ getCommonSettingsProperties(): readonly ('master_password_hash' | 'remember_minutes' | 'show_home_help')[] {
return Settings.COMMON_SETTINGS_PROPERTIES;
}
}
diff --git a/src/models/SettingsAdvanced.spec.ts b/src/models/SettingsAdvanced.spec.ts
index 3a13796..38a4a4b 100644
--- a/src/models/SettingsAdvanced.spec.ts
+++ b/src/models/SettingsAdvanced.spec.ts
@@ -12,6 +12,7 @@ describe('SettingsAdvanced', () => {
settingsSimple.output_character_set = '0123456789';
settingsSimple.output_length = 13;
settingsSimple.remember_minutes = 3;
+ settingsSimple.show_home_help = false;
// This constructor should set up the first profile with ID 1 and set that to be active.
const settingsAdvanced = new SettingsAdvanced(settingsSimple);
@@ -25,6 +26,7 @@ describe('SettingsAdvanced', () => {
expect(settingsAdvanced.getOutputLength()).toBe(13);
expect(settingsAdvanced.getPostProcessingSuffix()).toBe('4');
expect(settingsAdvanced.remember_minutes).toBe(3);
+ expect(settingsAdvanced.show_home_help).toBe(false);
// ...and check defaults are as expected
expect(settingsAdvanced.getLeetLevel()).toBe(0);
@@ -48,6 +50,7 @@ describe('SettingsAdvanced', () => {
expect(settings.getPostProcessingSuffix()).toBe('');
expect(settings.getPrefix()).toBe('');
expect(settings.remember_minutes).toBe(5);
+ expect(settings.show_home_help).toBe(true);
expect(settings.getSuffix()).toBe('');
expect(settings.isDomainOnly()).toBe(true);
});
diff --git a/src/models/SettingsSimple.spec.ts b/src/models/SettingsSimple.spec.ts
index a3c827c..d721532 100644
--- a/src/models/SettingsSimple.spec.ts
+++ b/src/models/SettingsSimple.spec.ts
@@ -13,6 +13,7 @@ describe('SettingsSimple', () => {
expect(settings.getPostProcessingSuffix()).toBe('');
expect(settings.getPrefix()).toBe('');
expect(settings.remember_minutes).toBe(5);
+ expect(settings.show_home_help).toBe(true);
expect(settings.getSuffix()).toBe('');
expect(settings.isDomainOnly()).toBe(true);
});