mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-22 14:33:57 +00:00
feat: Refactor and modularize flow handling for improved maintainability
- Extracted BuyModeHandler, DesktopFlow, MobileFlow, and SummaryReporter into separate modules for better organization and testability. - Enhanced type safety and added interfaces for various return types in Load, Logger, UserAgent, and flow modules. - Implemented comprehensive error handling and logging throughout the new modules. - Added unit tests for DesktopFlow, MobileFlow, and SummaryReporter to ensure functionality and correctness. - Updated existing utility functions to support new flow structures and improve code clarity.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { dashboardState } from './state'
|
||||
import type { MicrosoftRewardsBot } from '../index'
|
||||
import { log as botLog } from '../util/Logger'
|
||||
import { getErrorMessage } from '../util/Utils'
|
||||
import { dashboardState } from './state'
|
||||
|
||||
export class BotController {
|
||||
private botInstance: MicrosoftRewardsBot | null = null
|
||||
@@ -11,7 +12,7 @@ export class BotController {
|
||||
}
|
||||
|
||||
private log(message: string, level: 'log' | 'warn' | 'error' = 'log'): void {
|
||||
console.log(`[BotController] ${message}`)
|
||||
botLog('main', 'BOT-CONTROLLER', message, level)
|
||||
|
||||
dashboardState.addLog({
|
||||
timestamp: new Date().toISOString(),
|
||||
|
||||
Reference in New Issue
Block a user