From 928410b10e2cd1cf544120f30dbccb1ba8c2f166 Mon Sep 17 00:00:00 2001 From: Tero Date: Fri, 16 Oct 2026 22:22:14 +0300 Subject: [PATCH] Refractoring Stage 6.13 Encapsulated productivity.js in a local scope; its consumers continue to use the existing productivity feature API. Bumped the version to 0.4.25 (Android version code 425) and updated REFACTOR_PLAN.md. --- REFACTOR_PLAN.md | 4 +++- package-lock.json | 4 ++-- package.json | 2 +- productivity.js | 2 ++ tests/renderer-mail-api.test.cjs | 2 ++ www/productivity.js | 2 ++ 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/REFACTOR_PLAN.md b/REFACTOR_PLAN.md index 03bca8c..3301d98 100644 --- a/REFACTOR_PLAN.md +++ b/REFACTOR_PLAN.md @@ -113,6 +113,7 @@ This is a gradual destination, not a requirement to move everything at once. IPC - [x] Expose core shell behavior through an explicit renderer API and migrate mail UI selectors, notifications, rendering, and compose hooks to that API (`app.js`, `mail-ui.js`). - [x] Hide the account-manager script in a local module scope and route selectors, escaping, notifications, and DAV navigation through explicit feature APIs (`account-ui.js`, `dav-ui.js`). - [x] Route the snooze action's message-label hook through the productivity feature API (`snooze-ui.js`, `productivity.js`). +- [x] Encapsulate productivity implementation state and helpers in a local module scope, preserving the explicit productivity feature API (`productivity.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. @@ -141,7 +142,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.24`; Android derives `versionName 0.4.24` and `versionCode 424`. 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.25`; Android derives `versionName 0.4.25` and `versionCode 425`. The user confirms the previous artifact works; this bump is for the next build. ## Progress log @@ -168,5 +169,6 @@ This is a gradual destination, not a requirement to move everything at once. IPC - Step 6 verification at version `0.4.22` / Android build number `422`: all 123 tests pass, including generated `www/` parity and combined classic-script parsing. - Step 6 at version `0.4.23` moves account-manager dependencies onto feature APIs and publishes the DAV manager through `window.epMailFeatures.dav` instead of a free global function. - Step 6 at version `0.4.24` removes the snooze-to-productivity label action's implicit global call; account and snooze feature API checks are covered by the renderer tests. +- Step 6 at version `0.4.25` wraps productivity internals in a local scope; Calendar, Contacts, labels, and profile behavior remain published through the productivity feature API. - 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 486ff04..636b6a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ep-mail", - "version": "0.4.24", + "version": "0.4.25", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ep-mail", - "version": "0.4.24", + "version": "0.4.25", "dependencies": { "@capacitor/android": "^8.5.2", "@capacitor/core": "^8.5.2", diff --git a/package.json b/package.json index 6d03df7..64947ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ep-mail", - "version": "0.4.24", + "version": "0.4.25", "private": true, "description": "Eternity Project mail client", "homepage": "https://git.eternityproject.fi/thuttu/ep-mail-client", diff --git a/productivity.js b/productivity.js index d77a9af..3c3c8ff 100644 --- a/productivity.js +++ b/productivity.js @@ -1,3 +1,4 @@ +(() => { // Persistent profile, calendar and contact tools, plus actions for the mail UI. const productivityMailUi = window.epMailFeatures.mail; const selectProductivityUi = productivityMailUi.select; @@ -97,3 +98,4 @@ window.epMailFeatures.productivity = Object.freeze({ openPreferences = decorator(openPreferences); } }); +})(); diff --git a/tests/renderer-mail-api.test.cjs b/tests/renderer-mail-api.test.cjs index f78b1ff..a2cf2aa 100644 --- a/tests/renderer-mail-api.test.cjs +++ b/tests/renderer-mail-api.test.cjs @@ -89,6 +89,8 @@ test('account and snooze UI consume the explicit mail API instead of selected le assert.doesNotMatch(pgpMailUi, /(? \{/); + assert.match(productivityUi, /window\.epMailFeatures\.productivity = Object\.freeze/); assert.match(productivityUi, /addMessageLabel,/); assert.match(snoozeUi, /snoozeProductivityUi\.addMessageLabel/); assert.doesNotMatch(snoozeUi, /(? { // Persistent profile, calendar and contact tools, plus actions for the mail UI. const productivityMailUi = window.epMailFeatures.mail; const selectProductivityUi = productivityMailUi.select; @@ -97,3 +98,4 @@ window.epMailFeatures.productivity = Object.freeze({ openPreferences = decorator(openPreferences); } }); +})();