From b9b2a6d031b8c9c20af49afe59dd29d933d685a2 Mon Sep 17 00:00:00 2001 From: Tero Date: Fri, 16 Oct 2026 22:41:16 +0300 Subject: [PATCH] Refractoring Stage 6.17 Scoped the OpenPGP key-management UI helpers locally; its Preferences integration remains through the productivity API. Bumped the version to 0.4.29 (Android version code 429) and updated REFACTOR_PLAN.md. --- REFACTOR_PLAN.md | 4 +++- package-lock.json | 4 ++-- package.json | 2 +- pgp-ui.js | 2 ++ tests/renderer-mail-api.test.cjs | 1 + www/pgp-ui.js | 2 ++ 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/REFACTOR_PLAN.md b/REFACTOR_PLAN.md index 7883702..c650d4d 100644 --- a/REFACTOR_PLAN.md +++ b/REFACTOR_PLAN.md @@ -117,6 +117,7 @@ This is a gradual destination, not a requirement to move everything at once. IPC - [x] Encapsulate DAV helpers in a local module scope while preserving `window.epMailFeatures.dav` (`dav-ui.js`). - [x] Encapsulate core renderer implementation behind `window.epMailShell` (`app.js`). - [x] Encapsulate mail UI implementation behind `window.epMailFeatures.mail` (`mail-ui.js`). +- [x] Encapsulate OpenPGP key-management UI helpers locally; it contributes to Preferences through the productivity API (`pgp-ui.js`). - [x] Migrate additional mail-related consumers to unique local aliases to avoid classic-script lexical redeclarations. - [x] Add a combined-script parse test to prevent duplicate top-level lexical declarations from stopping later UI scripts. - [ ] Migrate remaining mail-related consumers and remove transitional global dependencies. @@ -145,7 +146,7 @@ This is a gradual destination, not a requirement to move everything at once. IPC - Electron Builder and the desktop Actions artifact name derive from `package.json`. - Android `versionName` derives from the same package version. Its current `versionCode` mapping is `major * 10000 + minor * 100 + patch`; keep minor and patch below 100, and revise the mapping before reaching that boundary to avoid collisions. - `scripts/build-all.ps1` uses the package version for APK naming. Before a release, bump once with `npm run bump:build`, verify the lockfile and computed Android version code, and build every target without another bump. -- Latest version check: `package.json` and both lockfile version fields are `0.4.28`; Android derives `versionName 0.4.28` and `versionCode 428`. The user confirms the previous artifact works; this bump is for the next build. +- Latest version check: `package.json` and both lockfile version fields are `0.4.29`; Android derives `versionName 0.4.29` and `versionCode 429`. The user confirms the previous artifact works; this bump is for the next build. ## Progress log @@ -176,5 +177,6 @@ This is a gradual destination, not a requirement to move everything at once. IPC - Step 6 at version `0.4.26` wraps DAV UI internals in a local scope while preserving the public DAV feature API. - Step 6 at version `0.4.27` scopes core renderer functions and state in `app.js`; other scripts continue through the explicit `epMailShell` interface. - Step 6 at version `0.4.28` scopes mail UI implementation details while retaining its explicit mail feature API. +- Step 6 at version `0.4.29` scopes OpenPGP key UI implementation helpers without changing its Preferences integration. - The current IPC/DAV validation changes pass the full suite: 108 tests. - While work continued, `package.json` and `package-lock.json` reflected a version bump to `0.4.6`; those changes were preserved. diff --git a/package-lock.json b/package-lock.json index d98cfb1..efb53d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ep-mail", - "version": "0.4.28", + "version": "0.4.29", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ep-mail", - "version": "0.4.28", + "version": "0.4.29", "dependencies": { "@capacitor/android": "^8.5.2", "@capacitor/core": "^8.5.2", diff --git a/package.json b/package.json index 31a566f..2523aa9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ep-mail", - "version": "0.4.28", + "version": "0.4.29", "private": true, "description": "Eternity Project mail client", "homepage": "https://git.eternityproject.fi/thuttu/ep-mail-client", diff --git a/pgp-ui.js b/pgp-ui.js index fa41376..c83e670 100644 --- a/pgp-ui.js +++ b/pgp-ui.js @@ -1,3 +1,4 @@ +(() => { // Encryption key management (desktop). Hidden where the platform has no key store yet. const pgpKeyMailUi = window.epMailFeatures.mail; const selectPgpKeyUi = pgpKeyMailUi.select; @@ -419,3 +420,4 @@ window.epMailFeatures.productivity.wrapOpenPreferences(baseOpenPreferences => fu button.onclick = openEncryptionKeys; fields.append(button); }); +})(); diff --git a/tests/renderer-mail-api.test.cjs b/tests/renderer-mail-api.test.cjs index cb5157a..351defe 100644 --- a/tests/renderer-mail-api.test.cjs +++ b/tests/renderer-mail-api.test.cjs @@ -73,6 +73,7 @@ test('account and snooze UI consume the explicit mail API instead of selected le assert.match(attachmentUi, /window\.epMailFeatures\.mail/); assert.match(pgpMailUi, /window\.epMailFeatures\.mail/); assert.match(pgpUi, /window\.epMailFeatures\.mail\.connectedAccount/); + assert.match(pgpUi, /^\(\(\) => \{/); assert.match(accountUi, /const accountDavUi = window\.epMailFeatures\.dav/); assert.match(accountUi, /accountDavUi\.openManager/); assert.doesNotMatch(accountUi, /(? { // Encryption key management (desktop). Hidden where the platform has no key store yet. const pgpKeyMailUi = window.epMailFeatures.mail; const selectPgpKeyUi = pgpKeyMailUi.select; @@ -419,3 +420,4 @@ window.epMailFeatures.productivity.wrapOpenPreferences(baseOpenPreferences => fu button.onclick = openEncryptionKeys; fields.append(button); }); +})();