MidJourney Images Compose Multiplatform

repository·master·Indexed 43 days ago

https://github.com/mbakgun/midjourney-images-compose-multiplatform

A Compose Multiplatform application for displaying MidJourney generated images. It supports Android (Phone, Wear OS, TV, Automotive), iOS, Desktop (Windows, Debian, MacOS), and Web (JS/Wasm). The project utilizes an MVVM architecture with MjImagesViewModel to manage UI state, pagination, and image caching, providing a common UI layer via the MjImagesApp Composable.

Tokens
2.1K
Snippets
14
Records
20
Agent score
54%

What's inside MidJourney Images Compose Multiplatform

  1. How the application architecture works

    master

    The application is built using the MVVM (Model-View-ViewModel) pattern with Kotlin and Jetpack Compose. It features network request state management, endless pagination, image loading processes, offline mode, and image caching.

    Consumer applications (platform-specific targets) do not have complex structures or operations. They are responsible for creating the MjImagesApp composable. Both MjImagesApp and its dependency, MjImagesViewModel, function identically across all supported platforms.

  2. How to integrate MidJourney Images into consumer apps

    master

    The application is designed so that consumer apps do not need complex structures. You can use the common UI layer and ViewModel across all platforms. To integrate the existing UI, you should use the MjImagesApp Composable. This Composable and its dependency, MjImagesViewModel, behave identically across all supported platforms (Android, iOS, Web, Wear OS, etc.).

    // Use the common UI layer in your platform-specific entry points
    // MjImagesApp and MjImagesViewModel work the same on all platforms
    MjImagesApp()
  3. Compile and run Wear OS, Android TV, and Android Automotive applications

    master

    Use the following Gradle commands to build the specific Android platform applications:

    • Wear OS: ./gradlew :wearApp:assembleDebug
    • Android TV: ./gradlew :televisionApp:assembleDebug
    • Android Automotive: ./gradlew :automotiveApp:assembleDebug (Requires Android Studio Hedgehog for emulators)
    # Wear OS
    ./gradlew :wearApp:assembleDebug
    
    # Android TV
    ./gradlew :televisionApp:assembleDebug
    
    # Android Automotive
    ./gradlew :automotiveApp:assembleDebug
  4. Build and run Web (JS and Wasm) applications

    master

    The project supports both Compose for Web (JS) and Compose for Web (Wasm).

    Compose for Web (JS)

    • Development: ./gradlew :webApp:jsBrowserDevelopmentRun
    • Distribution: ./gradlew :webApp:jsBrowserDevelopmentExecutableDistribution or ./gradlew :webApp:jsBrowserDistribution

    Compose for Web (Wasm)

    • Development: ./gradlew :wasmApp:wasmBrowserDevelopmentRun
    • Distribution: ./gradlew :wasmApp:wasmBrowserDevelopmentExecutableDistribution or ./gradlew :wasmApp:wasmJsBrowserDistribution
    # JS Development
    ./gradlew :webApp:jsBrowserDevelopmentRun
    
    # Wasm Development
    ./gradlew :wasmApp:wasmBrowserDevelopmentRun
  5. Build and run the Desktop application

    master

    The desktop application supports Windows, Debian, and MacOS. To run it directly:

    ./gradlew desktopApp:run

    To build a native desktop distribution, use the packageDistributionForCurrentOS task. The resulting binaries are written to desktopApp/build/compose/binaries.

    # Run desktop app
    ./gradlew desktopApp:run
    
    # Build native distribution
    ./gradlew :desktop:packageDistributionForCurrentOS