文件最后提交记录最后更新时间
feat(viewer): add mpp-viewer and mpp-viewer-web modules #453 Introduce new multiplatform viewer modules with core classes and web support. Update UI wrappers and build scripts to integrate viewer functionality. 6 个月前
feat(viewer): add mpp-viewer and mpp-viewer-web modules #453 Introduce new multiplatform viewer modules with core classes and web support. Update UI wrappers and build scripts to integrate viewer functionality. 6 个月前
chore(deps): update Gradle dependencies and versions Update dependency versions across multiple modules to keep builds up to date and maintain compatibility. 5 个月前
README.md

mpp-viewer

Universal viewer module for AutoDev - provides a platform-agnostic API for displaying various types of content (code, markdown, images, etc.).

Architecture

This module is split into two parts:

  1. mpp-viewer (this module): Core API and interfaces

    • ViewerType: Enumeration of supported content types
    • ViewerRequest: Data class for content display requests
    • ViewerHost: Interface for viewer implementations
    • LanguageDetector: Utility for detecting programming languages
  2. mpp-viewer-web (separate module): WebView-based implementation

    • WebView host using compose-webview-multiplatform
    • Monaco Editor integration for code viewing
    • Offline-capable viewer HTML

Usage

1. Create a Viewer Request

val request = ViewerRequest(
    type = ViewerType.CODE,
    content = fileContent,
    language = LanguageDetector.detectLanguage(filePath),
    fileName = fileName,
    filePath = filePath,
    readOnly = true
)

2. Display Content

val viewerHost: ViewerHost = // ... get platform-specific implementation
viewerHost.showContent(request)

Supported Content Types

  • CODE: Syntax-highlighted code with Monaco Editor
  • MARKDOWN: Rendered markdown preview
  • IMAGE: Image display
  • PDF: PDF document viewer
  • VIDEO: Video player
  • AUDIO: Audio player
  • UNSUPPORTED: Fallback for unknown types

Dependencies

This module only requires kotlinx-serialization-json for data serialization. The actual viewer implementation (WebView, Monaco Editor) is provided by mpp-viewer-web.