From e209fe47f87f6e3b5bdf45f417073f7c5e38eab2 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Mon, 29 Sep 2025 07:38:46 +0000 Subject: [PATCH] chore: missing config --- test-apps/android-test/src/index.ts | 104 +++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) diff --git a/test-apps/android-test/src/index.ts b/test-apps/android-test/src/index.ts index 2aaa82f..68d8782 100644 --- a/test-apps/android-test/src/index.ts +++ b/test-apps/android-test/src/index.ts @@ -1,5 +1,107 @@ import { Capacitor } from '@capacitor/core'; -import { ConfigLoader, MockDailyNotificationService, TestLogger } from '../shared/config-loader'; + +// Mock classes for testing when shared utilities aren't available +class ConfigLoader { + private static instance: ConfigLoader; + private config: any; + + static getInstance(): ConfigLoader { + if (!this.instance) { + this.instance = new ConfigLoader(); + } + return this.instance; + } + + async loadConfig(): Promise { + this.config = { + timesafari: { + appId: 'timesafari-android-test', + appName: 'TimeSafari Android Test', + version: '1.0.0' + }, + scheduling: { + contentFetch: { schedule: '0 8 * * *' }, + userNotification: { schedule: '0 9 * * *' } + }, + endorser: { + baseUrl: 'http://10.0.2.2:3001/api/v2/report', + apiKey: 'test-api-key' + }, + testData: { + userDid: 'user:test', + lastKnownOfferId: '0', + lastKnownPlanId: '0', + starredPlanIds: ['plan:test'] + } + }; + } + + getConfig(): any { + return this.config; + } + + getEndorserUrl(endpoint: string): string { + const endpoints: { [key: string]: string } = { + notificationsBundle: '/notifications/bundle', + offers: '/offersToPerson', + offersToPlans: '/offersToPlansOwnedByMe', + plansLastUpdated: '/plansLastUpdatedBetween' + }; + return `${this.config.endorser.baseUrl}${endpoints[endpoint] || endpoint}`; + } + + getAuthHeaders(): any { + return { + 'Authorization': `Bearer ${this.config.endorser.apiKey}`, + 'Content-Type': 'application/json' + }; + } +} + +class MockDailyNotificationService { + constructor(config: any) { + this.config = config; + } + + private config: any; + + async initialize(): Promise { + console.log('Mock notification service initialized'); + } + + async scheduleDualNotification(config: any): Promise { + console.log('Mock dual notification scheduled:', config); + } + + async registerCallback(name: string, callback: Function): Promise { + console.log(`Mock callback registered: ${name}`); + } + + async getDualScheduleStatus(): Promise { + return { + contentFetch: { enabled: true }, + userNotification: { enabled: true } + }; + } +} + +class TestLogger { + constructor(level: string) { + console.log('Mock logger initialized with level:', level); + } + + info(message: string, data?: any) { + console.log(`[INFO] ${message}`, data); + } + + error(message: string, data?: any) { + console.error(`[ERROR] ${message}`, data); + } + + debug(message: string, data?: any) { + console.log(`[DEBUG] ${message}`, data); + } +} // Enhanced UI components for comprehensive testing class PermissionManager {