Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22
20
27 changes: 18 additions & 9 deletions docs/TODOS/TECH_DEBT.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ Status legend:

## Medium Refactors

- [~] Refactor `SettingsService` for typed models and safe subscription lifecycle.
- [x] Refactor `SettingsService` for typed models and safe subscription lifecycle.
- Impact: High
- Effort: M
- Validation: lint/test/build + settings UI regression check.
- Validation: typed internal stores, guarded keyed-setting operations, explicit persistence subscriptions, `tsc --noEmit`, focused eslint pass.

- [x] Optimize `ScrollClassToggleDirective` scroll handling by batching with `requestAnimationFrame` and caching class lists.
- Impact: Medium
Expand All @@ -64,16 +64,25 @@ Status legend:
- Impact: High
- Effort: M
- Validation: app launch/focus/close regression tests.

- [~] Stabilize `TypewriterService` timer and callback semantics.
- Progress: extracted localStorage open-app persistence into `ApplicationStatePersistenceService`.
- Progress: extracted shared app IDs/types/window constraints into `application-manager.models.ts` and updated consumers.
- Progress: extracted static app registration definitions into `application-catalog.ts`.
- Progress: extracted registry storage and app lookup/query behavior into `ApplicationRegistryService`.
- Progress: extracted open/close/focus/memory/persistence lifecycle state into `ApplicationLifecycleService`.
- Progress: normalized saved instance IDs during restore and forced deterministic re-open for repeated entries.
- Progress: switched persisted open-app payloads to base app IDs for safer multi-instance restoration.
- Progress: added focused unit specs for lifecycle restore/instance behavior (`application-lifecycle.service.spec.ts`, `application-manager.service.spec.ts`).

- [x] Stabilize `TypewriterService` timer and callback semantics.
- Impact: Medium
- Effort: M
- Validation: CLI typing flow checks and queue behavior tests.
- Validation: CLI typing flow checks, queue behavior unit tests (`typewriter.service.spec.ts`), `tsc --noEmit`.

- [~] Reduce startup randomness/cost in `FileSystemService`.
- [x] Reduce startup randomness/cost in `FileSystemService`.
- Impact: Medium
- Effort: M
- Validation: finder behavior and startup responsiveness.
- Validation: finder behavior and startup responsiveness, deterministic startup unit tests (`file-system.service.spec.ts`), `tsc --noEmit`.
- Progress: replaced random deep favorite-folder generation at startup with deterministic lightweight seeded folder content.

## Larger Changes (Riskier, Stage Later)

Expand All @@ -87,10 +96,10 @@ Status legend:
- Effort: L
- Validation: XSS regression tests + UI snapshot/manual checks.

- [~] Enforce supported Node LTS through `.nvmrc`/`engines` and CI checks.
- [x] Enforce supported Node LTS through `.nvmrc`/`engines` and CI checks.
- Impact: Medium
- Effort: S
- Validation: consistent local/CI build success.
- Validation: consistent local/CI build success, `.nvmrc` present, and workflow Node setup parity.

## Suggested Execution Order

Expand Down
11 changes: 4 additions & 7 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import {Routes} from '@angular/router';

import {redirectGuard} from './guards/redirect.guard';
import {AuthGuard, redirectUnauthorizedTo, redirectLoggedInTo} from '@angular/fire/auth-guard';

const redirectUnauthorizedToLogin = () => redirectUnauthorizedTo([PATH_NAMES.OS_LOGIN]);
const redirectLoggedInToHome = () => redirectLoggedInTo([PATH_NAMES.OS_MAIN]);
import {AuthGuard} from './guards/auth.guard';

export const PATH_NAMES = {
OS_MAIN: 'os',
Expand All @@ -26,19 +23,19 @@ export const routes: Routes = [
path: PATH_NAMES.OS_MAIN,
pathMatch: 'full',
canActivate: [AuthGuard],
data: {authGuardPipe: redirectUnauthorizedToLogin, animation: 'DesktopWindow'},
data: {animation: 'DesktopWindow'},
loadComponent: () => import('./components/game/desktop/desktop.component').then(m => m.DesktopComponent)
},
{
path: `${PATH_NAMES.OS_MAIN}/:app`,
pathMatch: 'full',
canActivate: [AuthGuard],
data: {authGuardPipe: redirectUnauthorizedToLogin, animation: 'DesktopWindow'},
data: {animation: 'DesktopWindow'},
loadComponent: () => import('./components/game/desktop/desktop.component').then(m => m.DesktopComponent),
},
{
path: PATH_NAMES.OS_LOGIN,
data: {authGuardPipe: redirectLoggedInToHome, animation: 'LoginWindow'},
data: {animation: 'LoginWindow'},
loadComponent: () => import('./components/game/system/login-screen/login-screen.component').then(m => m.LoginScreenComponent),
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class MarkdownReaderComponent {

private _filename: string = 'gameplay.doc.md';

@Input() params: any;
@Input() params: unknown;

@Input()
set filename(value: string) {
Expand All @@ -42,8 +42,10 @@ export class MarkdownReaderComponent {


const currentApp = this.appManager.getCurrentApp();

this.filename = currentApp?.params?.file;
const params = currentApp?.params;
if (params && typeof params === 'object' && 'file' in params && typeof params.file === 'string') {
this.filename = params.file;
}
console.warn('FILE', this.filename);
this.document = this.docsPath + this.filename;
}
Expand Down
9 changes: 6 additions & 3 deletions src/app/components/game/desktop/desktop.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import {TypewriterService} from '../services/typewriter.service';
import {SoundService} from '../services/sound.service';
import {UserService} from '../services/user.service';
import {OverlayService} from '../services/overlay.service';
import {
ApplicationManagerService
} from '../services/application-manager.service';
import {
APP_ID,
ApplicationManagerService, WINDOW_HEIGHT_MIN,
WINDOW_HEIGHT_MIN,
WINDOW_WIDTH_MAX,
WINDOW_WIDTH_MIN
} from '../services/application-manager.service';
} from '../services/application-manager.models';
import {SystemTrayComponent} from '../system/system-tray/system-tray.component';
import {NotificationService} from '../services/notification.service';
import {MediaItem} from '../services/media.service';
Expand Down Expand Up @@ -75,7 +78,7 @@ export class DesktopComponent implements OnInit, AfterViewInit {
this.onBeginInvestigation();
}

openApp(id: string, params?: any) {
openApp(id: string, params?: unknown) {
this.appManager.openApplication(id, params);
}

Expand Down
7 changes: 4 additions & 3 deletions src/app/components/game/factories/application-factory.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import {Injectable} from '@angular/core';
import {AppEntry, ApplicationInstance} from '../services/application-manager.service';
import {AppEntry, ApplicationInstance} from '../services/application-manager.models';

@Injectable({providedIn: 'root'})
export class ApplicationFactory {
createInstance(
id: string,
app: AppEntry,
offsetX: number,
offsetY: number
offsetY: number,
params?: unknown
): ApplicationInstance {
// Dynamic defaults or more sophisticated rules can go here
const memory = app.memory || 64; // Default memory
Expand All @@ -29,7 +30,7 @@ export class ApplicationFactory {
installed: app.installed,
instanceIndex: app.instanceIndex,
focused: app.focused ?? false,
params: app.params,
params: params ?? app.params,
};
}
}
Loading