diff --git a/.agents/rules/flutter_build.md b/.agents/rules/flutter_build.md new file mode 100644 index 0000000..44e4e16 --- /dev/null +++ b/.agents/rules/flutter_build.md @@ -0,0 +1,32 @@ +# Flutter Build Rules + +When building releases for this repository, always follow these rules to ensure optimal file size, performance, and architecture compatibility. + +## 1. Android APK Build Rules +Always build size-optimized APKs supporting both 32-bit and 64-bit architectures using ABI splitting, code obfuscation, and stripped debug info: + +```bash +# Split per ABI (recommended for distribution to reduce download sizes to ~25-28MB) +flutter build apk --release --split-per-abi --obfuscate --split-debug-info=./build/symbols + +# Output artifacts generated in build/app/outputs/flutter-apk/: +# - app-armeabi-v7a-release.apk (32-bit ARM devices) +# - app-arm64-v8a-release.apk (64-bit ARM devices) +# - app-x86_64-release.apk (64-bit x86 emulators/tablets) + +# Universal all-in-one APK (fallback when single installer is needed): +flutter build apk --release --obfuscate --split-debug-info=./build/symbols +# Output artifact: app-release.apk +``` + +## 2. Windows Build Rules +Always build the Windows Desktop client in release mode with obfuscation and symbol splitting: + +```bash +flutter build windows --release --obfuscate --split-debug-info=./build/symbols +# Output directory: build/windows/x64/runner/Release/ +``` + +### Windows Packaging & Dependencies +- Include required Windows Visual C++ / .NET runtime libraries or bundled DLLs when creating standalone/portable zip archives or installers. +- Compress output archives with maximum deflate/LZMA compression for lightweight distribution. diff --git a/.gitignore b/.gitignore index 38616d1..1f372a2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ backend/node_modules backend/bin/cloudflared.exe requirements TIS* +!*.iss # Environment secrets backend/.env @@ -35,6 +36,7 @@ backend/test_*.js # Flutter build artifacts frontend/.dart_tool/ frontend/build/ +frontend/android/build/ frontend/.flutter-plugins frontend/.flutter-plugins-dependencies # Backup logs diff --git a/frontend/INSTALL.md b/frontend/INSTALL.md new file mode 100644 index 0000000..786b205 --- /dev/null +++ b/frontend/INSTALL.md @@ -0,0 +1,51 @@ +# TIS RMS Installation & Deployment Guide + +This guide provides instructions for installing and running the **TIS RMS** frontend client on Android and Windows devices. + +--- + +## 1. Android Installation (APK) + +The Android application is distributed as size-optimized APKs supporting both 32-bit and 64-bit architectures. + +### Choosing the Right APK: + +| APK File | Architecture | Description | +| :--- | :--- | :--- | +| **`app-arm64-v8a-release.apk`** | **64-bit ARM** | **Recommended** for modern Android smartphones and tablets (Android 7.0+). Smallest download (~27MB). | +| **`app-armeabi-v7a-release.apk`** | **32-bit ARM** | For older smartphones or 32-bit budget Android devices (~25MB). | +| **`app-release.apk`** | **Universal** | Contains all architectures in a single APK (~72MB). Use if unsure of device CPU architecture. | + +### Installation Steps: +1. Transfer the selected `.apk` file to your Android phone/tablet (via USB, local network share, or download). +2. Tap the `.apk` file in your file manager. +3. If prompted, enable **"Install unknown apps"** or **"Allow from this source"** in Android Settings. +4. Tap **Install** and open the app. +5. On startup, the app will automatically scan the local Wi-Fi/LAN for the TIS RMS server (port `18484`) or connect to the secure tunnel domain (`https://tis-rms.cc.cd/api`). + +--- + +## 2. Windows Desktop Installation + +The Windows client runs natively on Windows 10 and Windows 11 (64-bit). + +### Prerequisites: +- **Microsoft Visual C++ 2015–2022 Redistributable (x64)** (usually pre-installed on Windows). +- **.NET Desktop Runtime 6.0/8.0+** (if leveraging Windows background sync tools). + +### Running Portable / Standalone: +1. Extract the release folder or zip archive (`TIS_RMS_Client_Windows_x64.zip`). +2. Open the folder and double-click **`tis_rms_server.exe`** (or `tis_rms_frontend.exe`). +3. (Optional) Right-click `tis_rms_server.exe` -> **Send to** -> **Desktop (create shortcut)**. + +### Windows Automated Installer: +- Run `TIS_RMS_Client_Setup.exe` from the `installers/` folder for an automated desktop shortcut and start menu entry. + +--- + +## 3. Server Discovery & Network Connectivity + +When launching TIS RMS on either platform: +1. **Local LAN Scan**: The app automatically searches your local subnet on port `18484` for ultra-fast local server response. +2. **Tunnel Domain Fallback**: If you are outside the local network, the app automatically switches to the cloud tunnel domain (`https://tis-rms.cc.cd/api`). +3. **Manual Server Selection**: You can tap the server icon at the top of the Login Screen anytime to specify a custom server IP or domain. diff --git a/frontend/TIS_RMS_Client.iss b/frontend/TIS_RMS_Client.iss new file mode 100644 index 0000000..0e3c463 --- /dev/null +++ b/frontend/TIS_RMS_Client.iss @@ -0,0 +1,68 @@ +; Script generated for Inno Setup 6 +; TIS RMS Windows Desktop Client Installer + +#define MyAppName "TIS RMS Client" +#define MyAppVersion "1.0.0" +#define MyAppPublisher "TIS RMS" +#define MyAppExeName "frontend.exe" +#define MyAppIcon "windows\runner\resources\app_icon.ico" + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. +AppId={{D36F3B1A-58F9-4672-91EA-A2B095790FC4} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +AppPublisher={#MyAppPublisher} +DefaultDirName={autopf}\TIS RMS Client +DefaultGroupName={#MyAppName} +AllowNoIcons=yes +; Output configuration +OutputDir=..\installers +OutputBaseFilename=TIS_RMS_Client_Setup +SetupIconFile={#MyAppIcon} +UninstallDisplayIcon={app}\{#MyAppExeName} +; Ultra compression for smallest file size +Compression=lzma2/ultra64 +SolidCompression=yes +WizardStyle=modern +ArchitecturesInstallIn64BitMode=x64compatible +ArchitecturesAllowed=x64compatible +DisableDirPage=no +DisableProgramGroupPage=no + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked + +[Files] +; Main application binaries and libraries (excluding dev .lib and .exp files) +Source: "build\windows\x64\runner\Release\*.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "build\windows\x64\runner\Release\*.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "build\windows\x64\runner\Release\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#MyAppIcon}"; DestDir: "{app}"; DestName: "app_icon.ico"; Flags: ignoreversion + +[Icons] +Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\app_icon.ico" +Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" +Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\app_icon.ico"; Tasks: desktopicon + +[Run] +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent + +[Code] +// Helper function to check for Microsoft Visual C++ 2015-2022 Redistributable (x64) +function IsVCRedistInstalled: Boolean; +var + installed: Cardinal; +begin + Result := RegQueryDWordValue(HKLM64, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\X64', 'Installed', installed) and (installed = 1); + if not Result then + Result := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\X64', 'Installed', installed) and (installed = 1); +end; + +function InitializeSetup: Boolean; +begin + Result := True; +end;