Skip to content

potatoenergy/max-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MAX Wrapper

Native Android wrapper for MAX messenger with Capacitor

Compliance Statement

⚠️ Disclaimer & Ethical Usage

  • This project does not claim ownership of the MAX messenger application.
  • MAX is a trademark of ООО "Коммуникационная Платформа". This project is not affiliated with or endorsed by the company.
  • No monetization is performed through this wrapper — it is a personal utility for convenient access.
  • All rights to the MAX brand, design assets, and service belong to their respective owners.

Prerequisites

  • NixOS with nix package manager
  • Android SDK (API 34+, Build Tools 35)
  • Node.js 20+ and npm
  • Physical Android device or emulator (minSdk 24 / Android 7.0)

Environment Variables

.env configuration (optional, for future extensions):

CAPACITOR_SERVER_URL=https://web.max.ru
DEBUG_MODE=false
SPLASH_DURATION=2000
Variable Purpose Default
CAPACITOR_SERVER_URL Web endpoint to wrap https://web.max.ru
DEBUG_MODE Enable WebView debugging false
SPLASH_DURATION Splash screen duration (ms) 2000
MIN_SDK Minimum Android API level 24

Key Features

1. Native Android Shell:

# WebView loads https://web.max.ru with full browser capabilities
# Hardware acceleration, mixed content support, debugging enabled

2. Brand-Compliant UI:

• Adaptive icon: white MAX logo on gradient background (#1CBBFF → #471AFF → #8114FF)
• Status bar: firm purple (#471AFF) matching MAX brand
• Navigation bar: white (#FFFFFF) for clean interface
• Splash screen: 2s gradient animation with centered logo

3. Permission Management:

  • Camera & microphone access for WebRTC calls
  • Notifications support (FCM-ready)
  • Runtime permission requests with graceful fallback

4. Navigation Handling:

  • Hardware back button / gesture → WebView history navigation
  • Exit app only when at root page

NixOS Build Instructions

# 1. Enter development shell with Android Studio + Node.js
export NIXPKGS_ALLOW_UNFREE=1
nix shell nixpkgs#android-studio nixpkgs#nodejs --impure

# 2. Install dependencies
npm install

# 3. Generate Android assets from SVG/PNG sources
# Place source files in assets/ first:
#   - Max white.png → icon-foreground.png (for adaptive icon)
#   - Max full colored w.png → splash.png (for splash screen)
npx capacitor-assets generate --android \
  --iconBackgroundColor '#FFFFFF' \
  --splashBackgroundColor '#471AFF'

# 4. Sync Capacitor configuration to Android project
npx cap sync android

# 5. Manual XML tweaks (Capacitor Assets doesn't support <inset>):
# Edit these two files to add 30% logo inset:
nano android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
nano android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

# 6. Open in Android Studio (fix Nix path issue)
export CAPACITOR_ANDROID_STUDIO_PATH=$(find /nix/store -name "bin" -path "*/android-studio-*" | head -1)/studio.sh
npx cap open android

# 7. Build & install
cd android
./gradlew clean assembleDebug
adb install -r app/build/outputs/apk/debug/app-debug.apk

⚠️ Important: Uninstall previous version from device before installing new build — Android caches launcher icons.

Plugin Development

// Example: Adding a Capacitor plugin for native features
import { registerPlugin } from '@capacitor/core';

export interface MaxNativePlugin {
  echo(options: { value: string }): Promise<{ value: string }>;
}

const MaxNative = registerPlugin<MaxNativePlugin>('MaxNative', {
  web: () => import('./web').then(m => new m.MaxNativeWeb()),
});

export { MaxNative };

Available Capacitor Plugins:

  • @capacitor/splash-screen — native splash control
  • @capacitor/camera — (optional) native camera access
  • @capacitor/push-notifications — (optional) FCM integration

Technical Architecture

Processing Pipeline:

  1. App launch → native splash screen (2s)
  2. WebView initialization with https://web.max.ru
  3. Permission requests (camera/mic/notifications) on first use
  4. WebView loads MAX web app with full feature support
  5. Back navigation → WebView history → exit at root

Safety Systems:

  • Mixed content allowed for MAX subdomains
  • WebView debugging enabled for development
  • Runtime permissions with user consent flow
  • No data persistence beyond WebView cache

Asset Pipeline:

assets/
├── icon-foreground.png (Max white.png) → mipmap-*/ic_launcher_foreground.png
├── icon-background.xml (gradient) → drawable/ic_launcher_background.xml
├── splash.png (Max full colored w.png) → drawable-*/splash.png
└── capacitor.config.json → android/app/src/main/assets/capacitor.config.json

License

MIT License

This project is for personal/educational use only. MAX and all related trademarks are property of ООО "Коммуникационная Платформа".

Releases

No releases published

Contributors