diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..951137f --- /dev/null +++ b/.gitignore @@ -0,0 +1,221 @@ +# ============================================================ +# Automiz_app — repository .gitignore +# Apps covered: +# Python (Flask) : cms_backend, cms_asset_manager, cms_workflow +# Node : asset_manager_app_web_socket, dbase_manager +# React (CRA) : cms_frontend_new +# Flutter / Dart : planxo +# Static HTML : tpm_artwork_template_creater_and_editor +# Note: keep pubspec.lock, package-lock.json and requirements.txt TRACKED. +# ============================================================ + +# ------------------------------------------------------------ +# Secrets & environment — NEVER commit +# ------------------------------------------------------------ +.env +.env.* +!.env.example +!.env.sample +!.env.template +*.pem +*.key +*.p12 +*.pfx +*.keystore +*.jks +credentials +aws.json +service-account*.json + +# ------------------------------------------------------------ +# OS / editor / IDE +# ------------------------------------------------------------ +.DS_Store +.DS_Store? +._* +.AppleDouble +.LSOverride +.Spotlight-V100 +.Trashes +Icon? +Thumbs.db +ehthumbs.db +Desktop.ini +.idea/ +.vscode/ +*.iml +*.ipr +*.iws +*.swp +*.swo +*~ +*.sublime-workspace + +# ------------------------------------------------------------ +# Logs & temp +# ------------------------------------------------------------ +*.log +logs/ +*.tmp +*.temp +*.pid +*.seed +*.bak +*.orig + +# ============================================================ +# Python (cms_backend, cms_asset_manager, cms_workflow) +# ============================================================ +__pycache__/ +*.py[cod] +*$py.class +.Python +*.egg +*.egg-info/ +.eggs/ +build/ +dist/ +develop-eggs/ +downloads/ +.installed.cfg +pip-log.txt +pip-wheel-metadata/ + +# Virtual environments +.venv/ +venv/ +env/ +ENV/ +.python-version + +# Flask instance folder (may hold local config/secrets) +instance/ +.webassets-cache + +# Testing / typing / linting caches +.pytest_cache/ +.cache/ +.coverage +.coverage.* +htmlcov/ +coverage.xml +nosetests.xml +.mypy_cache/ +.dmypy.json +.ruff_cache/ +.tox/ + +# Local upload/scratch dirs used by the backend +uploads/ +tmp/ + +# ============================================================ +# Node / React (cms_frontend_new, asset_manager_app_web_socket, dbase_manager) +# ============================================================ +node_modules/ +/build +build/ +/dist +dist/ +.pnp +.pnp.* +coverage/ +.eslintcache +.stylelintcache +.npm +.yarn-integrity +.yarn/ +*.tsbuildinfo +.parcel-cache/ +.turbo/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# React production build (deploy artifact only) +cms_frontend_new/build/ + +# ============================================================ +# Flutter / Dart (planxo) +# ============================================================ +# Dart / pub +.dart_tool/ +.packages +.pub-cache/ +.pub/ +build/ +.flutter-plugins +.flutter-plugins-dependencies +**/doc/api/ +**/generated_plugin_registrant.* +**/GeneratedPluginRegistrant.* +# analyzer scratch dump +planxo/errors.txt + +# Flutter — iOS +**/ios/Pods/ +**/ios/.symlinks/ +**/ios/Flutter/.last_build_id +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Flutter.podspec +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/ephemeral/ +**/ios/Flutter/flutter_export_environment.sh + +# Flutter — macOS +**/macos/Pods/ +**/macos/Flutter/ephemeral/ +**/macos/Flutter/Flutter-Generated.xcconfig +**/macos/Flutter/GeneratedPluginRegistrant.swift + +# Flutter — Android +**/android/.gradle/ +**/android/captures/ +**/android/local.properties +**/android/key.properties +**/android/app/debug/ +**/android/app/profile/ +**/android/app/release/ +**/.cxx/ + +# Flutter — Linux / Windows ephemeral build +**/linux/flutter/ephemeral/ +**/windows/flutter/ephemeral/ + +# CocoaPods lockfile (generated) +**/Podfile.lock + +# Xcode user/derived data +**/xcuserdata/ +**/DerivedData/ +*.moved-aside +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +# Desktop sync app per-machine state (not source) +*.planxo_sync_meta.json +*.planxo_sync_settings.json + +# ============================================================ +# C / C++ build (in case the AutomizPDF SDK is added here) +# ============================================================ +CMakeBuild/ +CMakeCache.txt +CMakeFiles/ +*.o +*.obj +*.so +*.dylib +*.a + +# ============================================================ +# Archives / large local artifacts +# ============================================================ +*.zip +*.tar +*.tar.gz +*.7z diff --git a/Automiz_App_Plan.docx b/Automiz_App_Plan.docx new file mode 100644 index 0000000..e69de29 diff --git a/development/CLAUDE.md b/development/CLAUDE.md new file mode 100644 index 0000000..69cf44f --- /dev/null +++ b/development/CLAUDE.md @@ -0,0 +1,425 @@ +# TPM CMS — Compact Codebase Reference + +> **Purpose:** Load this file at the start of any AI session to understand the full stack without reading source files. +> Last updated: 2026-06-05 + +--- + +## Architecture Overview + +``` +Browser (React) ←→ tpm_cms_backend (Flask :5000) + ├── tpm_cms_workflow (Flask :5001) # email/node workflow engine + ├── tpm_cms_asset_manager (Flask :5002) # S3 file ops + └── tpm_asset_manager_app_web_socket # Node.js WS bridge + ├── WebSocket server (:WS_PORT) # desktop Flutter app connects here + └── HTTP bridge (:HTTP_PORT) # backend POSTs to /send_message +Flutter Desktop App ←→ WebSocket bridge +``` + +All Python services share the same MongoDB database (default database from MONGO_URI). No message queue; services call each other via HTTP. + +--- + +## Services + +### 1. `tpm_cms_backend` — main API (Flask + JWT) +- **Entry:** `app.py` (~3466 lines, single file) +- **Port:** 5000 (dev), proxied via Nginx in prod +- **Auth:** JWT (`flask_jwt_extended`), bcrypt passwords, optional Azure SSO +- **Key env vars:** `MONGO_URI`, `JWT_SECRET_KEY`, `FLASK_SECRET_KEY`, `AZURE_REDIRECT_URI`, `WS_BRIDGE_HTTP_URL`, `DESKTOP_UNIQUE_ID`, `ASSET_MANAGER_URL` + +#### Collections used +| Collection | Purpose | +|---|---| +| `users` | auth, roles (admin/pm/lead/user) | +| `clients` | client companies | +| `projects` | projects with embedded stages[] | +| `tasks` | user task assignments with time tracking | +| `brief_templates` | project brief + workflow templates | +| `sections` | reusable brief sections | +| `histories` | project history log | +| `dashboard_configs` | per-user dashboard widget configs | +| `planxo_auth_keys` | desktop app auth tokens | +| `azure_config` | Azure SSO config (single doc) | +| `settings` | `{type:'desktop_sync'}`, `{type:'folder_sync'}` | +| `planxo_approvals` | desktop access approval records | + +#### API routes (all `@jwt_required()` unless noted) +``` +POST /register # public +POST /login # public; GET returns HTML login page +GET /me +GET /health # public + +# Clients +GET/POST /clients +GET/PUT/DELETE /clients/ + +# Projects +GET/POST /projects +GET/PUT/DELETE /projects/ # id = MongoDB ObjectId +GET /projects/ # id = numeric project_id +GET /projects/search +GET/POST /projects//history +GET /projects//brief_template +POST /projects//brief +GET /projects//stages +POST /projects//stages/ # set status +POST /projects//stages//start +POST /projects//stages//pause +POST /projects//stages//complete +POST /projects//stages//assign +POST /projects//desktop-download # triggers WS bridge + +# Brief Templates / Sections +GET/POST /brief_templates +GET/PUT/DELETE /brief_templates/ +GET /clients//brief_templates +GET/POST /sections +PUT/DELETE /sections/ + +# Tasks +GET/POST /tasks +POST /tasks//assign|start|pause|resume|complete|reject + +# Users (admin only for write) +GET/POST /users +PUT /users/ +POST /users//activate|deactivate + +# Dashboard +GET /dashboard-stats +GET/POST /dashboard-configs +GET/PUT/DELETE /dashboard-configs/ +GET /dashboard-configs/default +POST /dashboard-data # widget data with filters +POST /dashboard-export # CSV + +# Settings +GET/POST /settings/desktop-sync +GET/POST /settings/folder-sync + +# PlanXO Desktop Auth +GET /planxo-auth/ # HTML approval page +POST /planxo/app/auth/register-key # public +POST /api/planxo/app/auth//approve +POST /planxo/app/auth//approve # alias +POST /api/planxo-auth//approve # alias +GET /planxo/app/auth/check +POST /planxo/app/auth/revoke +GET /planxo/app/auth/keys +POST /planxo/app/auth/validate-key # public (called by WS server) +GET /planxo/folders/filtered # role-filtered S3 folder list + +# Azure SSO +GET /azure-login-url +POST /azure-callback +POST /azure-config (admin) + +# Server admin +GET /server-status +GET /server-status/logs/ +POST /server-status/restart/ # admin only +GET/POST /desktop-bridge/health|clients # proxy to WS bridge + +# Files (GridFS — legacy) +POST /files/upload +GET /files/ + +# Color (prepress) +POST /compute # Pantone→ECG via transicc +``` + +#### Role system +- `role_required('admin')` — admin only +- `role_required('pm','admin','lead','user')` — most write ops +- `jwt_required()` — any authenticated user +- `get_authenticated_user()` — reads token from URL param `?token=` OR `Authorization: Bearer` + +--- + +### 2. `tpm_cms_asset_manager` — S3 file service (Flask :5002) +- **Entry:** `asset_manager_app.py` +- **No auth** — internal calls only from backend +- **Key env vars:** `S3_BUCKET`, `AWS_REGION`, `MONGO_URI` + +#### S3 path convention +``` +clients/{client_name}/{numeric_project_id}/ ← if client exists +projects/{numeric_project_id}/ ← no client +``` +Folders created by uploading `{path}/.keep` placeholder. + +#### Routes +``` +POST /clients//create-folder +POST /projects//create-folder +POST /folders/create # generic, validates root prefix +POST /folders/batch-create # {base_folder, subfolders:[]} +GET /assets # ?folder=&q=&owner_id=&include_folders= +DELETE /assets/ +POST /assets/presign-upload # returns S3 presigned URL +POST /assets/confirm-upload # save asset record to MongoDB +GET /assets//download # presigned GET URL +POST /assets/batch-delete +GET /assets/folder-contents # flat list with S3 metadata +POST /zip-download # zip multiple keys +``` + +Assets stored in MongoDB `assets` collection with `s3_key`, `folder`, `filename`, `content_type`, `size`, `owner_id`, `created_at`. + +--- + +### 3. `tpm_cms_workflow` — workflow engine (Flask :5001) +- **Entry:** `workflow_app.py` +- **No auth** — internal calls only from backend +- **Key env vars:** `MONGO_URI`, `AWS_REGION`, `SENDER_EMAIL`, `SENDER_NAME` +- Uses `ThreadPoolExecutor(max_workers=5)` for async node processing + +#### Collections +- `workflows` — `{project_id, nodes:[], edges:[]}` +- `workflow_logs` — execution log per node + +#### Node types +- `project` — pass-through start node +- `sendEmail` — sends via AWS SES; resolves `{{variable}}` placeholders +- `router` — conditional branching +- `stage` — maps to project stage key +- `approval` — waits for human approval action + +#### Routes +``` +POST /workflow # create workflow for project +POST /workflow//process # {node_id, variables:{}} — triggers async execution +GET /workflow/ +GET /workflow/project/ +POST /workflow//nodes//approve|reject +``` + +--- + +### 4. `tpm_asset_manager_app_web_socket` — WS bridge (Node.js) +- **Entry:** `server.js` +- **Ports:** `WS_PORT` (WebSocket), `HTTP_PORT` (Express HTTP) +- **Auth:** `?apiKey=` on WebSocket connect + `unique_id` per client +- Stores connected clients in `Map` + +#### HTTP endpoints (called by backend) +``` +POST /send_message # {unique_id, message:{type,data}} → forward to WS client +POST /request_download # {unique_id, folder, projectId} → trigger download on desktop +GET /health # returns {clients:[...unique_ids]} +GET /clients +``` + +#### WebSocket message types (server→client) +- `auth_approved` — desktop auth approved; includes user, expires_at, sync_interval +- `auth_revoked` — user logged in from web; desktop must logout +- `download_request` — trigger file download + +#### WebSocket message types (client→server) +- `register_auth_key` — desktop registers key before browser approval +- `file_sync_complete`, `file_upload_complete` — status callbacks + +--- + +## Data Models (key fields) + +### Project +```json +{ + "_id": ObjectId, + "project_id": 1000007, // numeric, auto-increment from last+1 + "projectName": "string", // indexed unique per clientId + "clientId": ObjectId|null, + "project_name": "string", // duplicate of projectName (legacy) + "client_id": "string"|null, // duplicate of clientId (legacy) + "brand": "", "product": "", "variant": "", + "brief": {}, + "template_id": "string", + "stages": [ + { + "key": "stage_key", + "title": "Stage Title", + "status": "pending|in_progress|paused|completed", + "time": {"total_seconds": 0}, + "start_time": 1234567890, // unix timestamp, present only when in_progress + "assigned_to": "user_id", + "history": [{"action":"start","timestamp":0,"user_id":""}] + } + ], + "version": 1, + "created_at": ISODate, + "created_by": "user_id", + "project_update_history": [{"user_id":"","user_name":"","changed_fields":[],"timestamp":ms}] +} +``` + +### User +```json +{ + "_id": ObjectId, + "username": "string", + "password": "bcrypt_hash", + "role": "admin|pm|lead|user", + "email": "", "name": "", "fullName": "", // name+fullName kept in sync + "mobile": "", + "isActive": true, "active": true, // both kept in sync + "last_active": ISODate // updated on /me call +} +``` + +### PlanXO Auth Key +```json +{ + "auth_key": "string", + "unique_id": "desktop_client_id", + "status": "pending|approved|revoked", + "is_active": true, + "user_id": ObjectId, + "role": "string", + "expires_at": ISODate, // admin: +100 years; others: +8 hours + "approved_at": ISODate +} +``` + +--- + +## Code Review Findings + +### 🔴 Critical Issues + +**1. Password logged in plaintext (backend/app.py:300)** +```python +print(f"Login attempt for user: {username}, password: {password}") # REMOVE THIS +``` + +**2. `get_current_user_id()` referenced but never defined (app.py:3402)** +`/planxo/folders/filtered` calls `get_current_user_id()` — this will raise `NameError` at runtime. Replace with `get_jwt_identity()` and add `@jwt_required()`. + +**3. `safe_text()` referenced but never defined (app.py:3142)** +`/projects//desktop-download` calls `safe_text(resp)` which doesn't exist — will crash. + +**4. `pymongo` imported twice; `pymongo.errors.DuplicateKeyError` used without top-level import** +`app.py:7` imports `secrets` twice. `pymongo` is used at line 785 but only imported via `from pymongo import ...` — `pymongo.errors` won't resolve. Add `import pymongo` at top. + +**5. `/compute` endpoint has no auth** +The Pantone/ECG color conversion endpoint is publicly accessible. Add `@jwt_required()`. + +**6. Asset manager has no authentication** +All routes in `asset_manager_app.py` are unauthenticated. If the port is ever exposed, anyone can read/write S3. Add at minimum an internal shared secret header check. + +**7. Unreachable code in `start_stage` (app.py:1232)** +```python +return jsonify({'success': True, 'stages': stages, 'workflow_result': workflow_result}) +return jsonify({'success': True, 'stages': stages}) # ← dead code, never reached +``` + +### 🟡 Important Issues + +**8. `list_projects` loads ALL projects with no pagination** +`projects_col.find().sort(...)` returns everything. With hundreds of projects this will be slow. Add `limit`/`skip` or cursor-based pagination. + +**9. Duplicate field names in MongoDB documents** +`project_name`/`projectName`, `client_id`/`clientId`, `name`/`fullName`, `active`/`isActive`, `created_at`/`createdAt` are all stored twice. This doubles write load and creates inconsistency risk. Pick one canonical name per field. + +**10. Workflow service URL hardcoded** +`app.py:878,885,894` uses `http://localhost:5001` directly instead of an env var like `WORKFLOW_URL`. Inconsistent with other services. + +**11. Stage parsing handles both JSON string and list** +Multiple endpoints do: +```python +if isinstance(project['stages'], str): + stages = json.loads(project['stages']) +else: + stages = project['stages'] +``` +Stages should always be stored as a list. This defensive code masks a schema inconsistency. + +**12. `before_request` logs every endpoint — noisy in production** +```python +@app.before_request +def log_request(): + print(f">>> Endpoint called: {request.endpoint}") +``` +Replace with proper logging or remove for production. + +**13. DEBUG print statements left in approval flows (app.py:2394–2512)** +Many `print(f"DEBUG: ...")` lines in the PlanXO approval endpoints should be removed or converted to `logging.debug()`. + +**14. `get_azure_config()` is a function, not a route** +`app.py:2937` defines `get_azure_config()` without a `@app.route` decorator, so it's never reachable. + +**15. WS bridge API key is in env with a weak default** +`server.js:22`: `process.env.API_KEY || "aasdf345scwe"` — the fallback default is weak. Fail hard if `API_KEY` not set in production. + +**16. `delete_asset` in asset manager uses string `_id`** +`assets.find_one({"_id": asset_id})` — MongoDB stores `_id` as ObjectId, not string. This will never find anything. Use `ObjectId(asset_id)`. + +### 🟢 Suggestions + +**17. Extract stage manipulation into a helper** +`start_stage`, `pause_stage`, `complete_stage`, and `assign_stage` share ~40 lines of identical stage-parsing boilerplate. Extract to `_get_stages(project)` and `_save_stages(project_id, stages)`. + +**18. `get_project_folder_path` is duplicated logic** +The folder path logic in `app.py:3082` and `asset_manager_app.py` should live in one place (asset manager) and backend should call it. + +**19. JWT token expiry is 1 hour; comment says 12h/1d/30d** +`JWT_ACCESS_TOKEN_EXPIRES = timedelta(hours=1)` — the comment is stale. Clarify intended expiry and consider refresh tokens. + +**20. No index on `planxo_auth_keys.auth_key`** +This field is queried on every desktop connect. Add a unique index. + +--- + +## Environment Variables Reference + +### Backend (`.env` / `.env.prod`) +``` +MONGO_URI= +JWT_SECRET_KEY= +FLASK_SECRET_KEY= +FLASK_ENV=production +AZURE_REDIRECT_URI=https://cms.techpremedia.com/azure-callback +AZURE_CLIENT_SECRET= +WS_BRIDGE_HTTP_URL=http://localhost:5003 +DESKTOP_UNIQUE_ID= +ASSET_MANAGER_URL=http://localhost:5002 +``` + +### Asset Manager +``` +MONGO_URI= +S3_BUCKET= +AWS_REGION= +``` + +### Workflow +``` +MONGO_URI= +AWS_REGION= +SENDER_EMAIL= +SENDER_NAME= +FLASK_SECRET_KEY= +``` + +### WebSocket Bridge +``` +WS_PORT= +HTTP_PORT= +API_KEY= +ASSET_MANAGER_URL=http://localhost:5002 +CMS_BACKEND_URL=https://cms.techpremedia.com +NODE_ENV=production +``` + +--- + +## Key Patterns + +- **ObjectId serialization:** every route converts `_id` via `str(doc['_id'])` before jsonify +- **`now()`:** all services define their own `now()` returning `datetime.utcnow()` +- **S3 "folders":** implemented as empty `.keep` placeholder objects +- **Project numeric ID:** auto-incremented by querying `projects_col.find_one(sort=[("project_id",-1)])` — not atomic, could duplicate under concurrent creates +- **Desktop auth flow:** desktop → register-key → browser opens `/planxo-auth/` → user approves → WS bridge notified → desktop receives `auth_approved` diff --git a/development/artwork_template_creater_and_editor/prepress_multi_artboard.html b/development/artwork_template_creater_and_editor/prepress_multi_artboard.html new file mode 100644 index 0000000..fddbf1c --- /dev/null +++ b/development/artwork_template_creater_and_editor/prepress_multi_artboard.html @@ -0,0 +1,1328 @@ + + + + + +Prepress Studio + + + + +
+ +
+ + +
+
+ + + + + + + +
+
+ + +
+ + +
+
Bleed
+
Trim
+
Crease
+
Safe
+
+
+
+ + +
+
+
+ +
+ + +
+
+ + + + +
+
+ +
+
Text
+
+
H
Heading
+
Paragraph
+
T
Single line
+
Aa
Legal text
+
+
Tables
+
+
Nutrition EU
+
Nutrition US
+
Ingredients
+
Custom table
+
+
Compliance
+
+
▮▮
Barcode
+
QR Code
+
Claim badge
+
Symbol
+
+
Media
+
+
Image
+
Shape
+
+ +
Auto layout
+
+
+ + +
+
Gappx
+ +
+ +
Alignment
+
+
Align selected to artboard or first object
+
+
+ + +
+
+
+ + + + + + + + + +
+
+ + +
+
+ + +
+
+
+ + + + + + + +
+
+ + +
+
+ +
+
+
+
+
+
+
+
+
+ + 100% + + +
+
+ + + +
+ +
Ready100%
+
+
+

New artboard

+
+
+ + +
+
+
+ + + + diff --git a/development/asset_manager_app_web_socket b/development/asset_manager_app_web_socket new file mode 160000 index 0000000..ca15bcb --- /dev/null +++ b/development/asset_manager_app_web_socket @@ -0,0 +1 @@ +Subproject commit ca15bcb4e6d0a9c518502ecf00dafb73149d5538 diff --git a/development/cms_asset_manager b/development/cms_asset_manager new file mode 160000 index 0000000..68b59e3 --- /dev/null +++ b/development/cms_asset_manager @@ -0,0 +1 @@ +Subproject commit 68b59e38483aa042a45814e89d2ea02935fc9bae diff --git a/development/cms_backend b/development/cms_backend new file mode 160000 index 0000000..481428a --- /dev/null +++ b/development/cms_backend @@ -0,0 +1 @@ +Subproject commit 481428ae55d491eee1bae30bb541c1c19e810109 diff --git a/development/cms_frontend_new b/development/cms_frontend_new new file mode 160000 index 0000000..ff0e604 --- /dev/null +++ b/development/cms_frontend_new @@ -0,0 +1 @@ +Subproject commit ff0e604afad28c15ab0e5f738fe974e8bc3a12c2 diff --git a/development/cms_workflow b/development/cms_workflow new file mode 160000 index 0000000..f81ae56 --- /dev/null +++ b/development/cms_workflow @@ -0,0 +1 @@ +Subproject commit f81ae56eb1cc488a7a908d137cf4363f00d859fd diff --git a/development/dbase_manager b/development/dbase_manager new file mode 160000 index 0000000..fcebcc3 --- /dev/null +++ b/development/dbase_manager @@ -0,0 +1 @@ +Subproject commit fcebcc3a3d9591c0a4873316d9d60c8e449d072b diff --git a/development/planxo/.gitignore b/development/planxo/.gitignore new file mode 100644 index 0000000..3820a95 --- /dev/null +++ b/development/planxo/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/development/planxo/.metadata b/development/planxo/.metadata new file mode 100644 index 0000000..5f4336f --- /dev/null +++ b/development/planxo/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "adc901062556672b4138e18a4dc62a4be8f4b3c2" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + - platform: android + create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + - platform: ios + create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + - platform: linux + create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + - platform: macos + create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + - platform: web + create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + - platform: windows + create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/development/planxo/PLANXO_SYSTEM_DOC.md b/development/planxo/PLANXO_SYSTEM_DOC.md new file mode 100644 index 0000000..accbe05 --- /dev/null +++ b/development/planxo/PLANXO_SYSTEM_DOC.md @@ -0,0 +1,236 @@ +# PlanXO Desktop Sync – System Documentation & Issue Report + +> Last reviewed: March 2026 +> Target platform: macOS Desktop (Flutter); Windows Desktop planned + +--- + +## 1. System Architecture + +``` +┌─────────────────────────────────────────────────────────────────┐ +│ PlanXO Desktop App (Flutter/Dart) │ +│ main.dart │ +└───────────────────────────┬─────────────────────────────────────┘ + WebSocket (wss) │ HTTP (https / dio) + ┌──────────────────┘──────────────────────┐ + ▼ ▼ +┌─────────────────────┐ ┌──────────────────────────┐ +│ WebSocket Bridge │ axios (HTTP)│ Asset Manager (Python) │ +│ server.js (Node) │◄──────────────┤ asset_manager_app.py │ +│ Port: WS_PORT | │ │ Port: 5002 │ +│ Port: HTTP_PORT │ │ S3 + MongoDB │ +└─────────┬───────────┘ └──────────────────────────┘ + │ HTTP (axios) + ▼ +┌─────────────────────┐ +│ CMS Backend │ +│ app.py (Flask) │ +│ + MongoDB + JWT │ +└─────────────────────┘ +``` + +### Component Roles + +| Component | Language | Responsibility | +|---|---|---| +| `main.dart` | Flutter/Dart | Desktop UI, file watch, upload/download sync | +| `server.js` | Node.js (Express + WS) | WebSocket relay, auth key registration/approval, message routing | +| `asset_manager_app.py` | Python (Flask) | S3 operations: upload presign, download folder as ZIP, asset CRUD | +| `app.py` | Python (Flask) | CMS logic: users, projects, auth key CRUD, JWT, role enforcement | + +### Frontend Admin Settings + +| File | Purpose | +|---|---| +| `DesktopSyncSettings.js` | Sets global sync interval (stored in CMS backend via `/settings/desktop-sync`) | +| `FolderSyncSettings.js` | Sets admin folder age filter (how many days back to sync; via `/settings/folder-sync`) | + +--- + +## 2. Authentication Flow + +``` +Desktop App WebSocket Server CMS Backend Browser + │ │ │ │ + │─── WSS connect (apiKey, unique_id) ───────────────────► │ │ + │ │ │ │ + │─── register_auth_key ─────────► │ │ + │ │─── POST /planxo/app/auth/register-key ──────────► │ + │ │◄── {auth_key, browser_url} ───────────────────── │ + │◄── auth_key_registered ───────│ │ │ + │ │ │ │ + │─── open browser with /planxo-auth/{auth_key} ─────────────────────────────────► │ + │ │ │ │ + │ (polling validate_auth every 2s) ──────────────────────► │ │ + │ │ │ │ + │ │ Admin approves in browser ◄────────────────│ + │ │◄── POST /api/planxo/app/auth/{key}/approve ────── │ + │◄── auth_approved (user, sync_interval) ────────────────── │ │ + │ │ │ │ + │ store auth key, start sync │ │ +``` + +--- + +## 3. Sync Logic (Download Path) + +1. After successful auth, `fetchFileList()` is called. +2. App fetches filtered folders list: `GET /planxo/folders/filtered` (HTTP, with `X-Auth-Key` header). +3. For each folder in the list, `_downloadAndExtractFolder(folder)` is called: + - `GET /folders/download?folder=` → returns a ZIP stream. + - ZIP is decoded with `archive` package. + - For each file in ZIP: if local file does NOT exist OR remote mtime is newer → write to disk. + - After extraction, `_primeKnownKeys(prefix)` fetches the S3 asset list into `_knownS3Keys`. + - A `DirectoryWatcher` is started on the local folder. +4. Periodic sync (per-folder timer or global timer) calls `_downloadAndExtractFolder` again to check for remote changes. + +## 4. Sync Logic (Upload Path) + +1. `DirectoryWatcher` fires `ADD` or `MODIFY` events. +2. `_onLocalFileChanged(path, folderPrefix)` is called: + - Debounces: skip if same file was processed < 1 second ago. + - Computes SHA-256 hash. Compares to `_syncMeta[path]['hash']`. Skips if unchanged. + - If file key is in `_knownS3Keys`: calls `_replaceExisting()` (presign-replace → PUT to S3 → complete-replace). + - Else: calls `_uploadNew()` (presign-upload → PUT to S3 → register-upload). + - Updates `_syncMeta` and persists to `~/.planxo_sync_meta.json`. +3. Periodic `_syncLocalChanges()` also scans all files and uploads modified ones (same logic). + +## 5. Persistence Files (macOS `$HOME`) + +| File | Content | +|---|---| +| `~/.planxo_client` | Last used client name (subdomain) | +| `~/.planxo_auth_key` | Saved auth key (plaintext) | +| `~/.planxo_storage` | Storage base path | +| `~/.planxo_sync_settings.json` | Per-folder sync enabled/interval | +| `~/.planxo_sync_meta.json` | Per-file `{lastModified, hash}` for change detection | +| `~/Library/.../sync_data.db` | SQLite event log via DatabaseHelper | + +## 6. Role-Based Sync Intent (Design Goal) + +| Role | Intended Behaviour | +|---|---| +| **Normal user** | Sync only folders/projects assigned to them | +| **Admin** | Sync all projects created within `folder_age_days` (configured in Frontend `FolderSyncSettings.js`) | + +The filtering is supposed to happen at `GET /planxo/folders/filtered` on the CMS backend. The desktop app currently passes `X-Auth-Key` so the backend knows who the user is. + +--- + +## 7. Issues Found + +### 🔴 Critical Bugs + + + +### 🟠 Logic Bugs + + + + + + +#### 7.16 `_buildLoginScreen` Shows WS Status But Never Initiates Connection + +The login screen shows a red/green dot for WS status, but `_connectWs()` is never called on app launch. The dot will always be red until the user clicks "Login". + +See also issue 7.14 above. + +--- + +#### 7.17 `MyApp` (Root Widget) Holds All State + +The entire app state including network connections, timers, and file watchers lives in `_MyAppState` which wraps `MaterialApp`. This is an anti-pattern in Flutter. A rebuild of `MyApp` disposes and re-creates all state including open WebSockets. + +**Recommendation:** Break out a `HomePage` stateful widget and keep `MyApp` as a thin shell containing only `MaterialApp` configuration. + +--- + +#### 7.18 Auth Key Stored as Plaintext File + +`~/.planxo_auth_key` is a plaintext file readable by any process running as the same user. On a shared machine this is a security risk. + +**Recommendation (macOS):** Use the macOS Keychain via the `flutter_secure_storage` package. + +--- + +#### 7.19 `_storageController` and `_clientController` Are Leaked + +These `TextEditingController` instances are initialized in `initState` but the `_storageController.text` is only set later in async callbacks (`_loadStoragePath`, `_loadClientName`). If the widget is disposed before these complete, there could be a "setState called after dispose" error. The async loaders call `setState()` without a `mounted` guard. + +**Fix:** Wrap all `setState()` calls inside async methods with `if (!mounted) return;`. + +--- + +#### 7.20 `_syncInterval` from Backend Not Passed to Per-Folder Timers + +`_syncInterval` (received from `auth_approved` or `auth_success`) is used only for `_periodicSyncTimer`. The per-folder timers (`_syncTimers`) use a locally configured interval. There is no reconciliation between the admin-set global interval from the frontend (`DesktopSyncSettings.js`) and the per-folder interval. + +**Fix:** When `_syncInterval` is received from the server, apply it as the default for any new folder timers and update existing ones. + +--- + +## 8. Windows Desktop Readiness + +| Item | Status | +|---|---| +| `dart:io` WebSocket | ✅ Works on Windows | +| `file_selector` | ✅ Has Windows support | +| `watcher` | ✅ Uses native FS events | +| `sqflite` + FFI | ⚠️ Needs `sqflite_common_ffi` + Windows SQLite DLL | +| `Process.run('open', [...])` | ❌ macOS only – all `openInFinder`, `_openUrl`, `_ensureStorageBaseExists` use `open` command | +| `Platform.environment['HOME']` | ⚠️ On Windows use `Platform.environment['USERPROFILE']` | +| Sandbox / path permissions | ✅ Windows has fewer restrictions than macOS | + +**Recommended abstraction:** + +```dart +String getHomeDir() { + if (Platform.isMacOS || Platform.isLinux) { + return Platform.environment['HOME'] ?? Directory.current.path; + } else if (Platform.isWindows) { + return Platform.environment['USERPROFILE'] ?? Platform.environment['HOMEPATH'] ?? 'C:\\Users\\Default'; + } + return Directory.current.path; +} + +Future openInExplorer(String path) async { + if (Platform.isMacOS) { + await Process.run('open', ['-R', path]); + } else if (Platform.isWindows) { + await Process.run('explorer', ['/select,', path]); + } else { + await Process.run('xdg-open', [p.dirname(path)]); + } +} +``` + +--- + +## 9. Summary Table + +| # | Severity | Category | Issue | +|---|---|---|---| +| 7.1 | 🔴 Critical | Architecture | `unique_id` hardcoded – breaks multi-machine | +| 7.2 | 🔴 Critical | Platform | `sqflite` won't work on macOS/Windows desktop without FFI | +| 7.3 | 🔴 Critical | Logic | `_uploadFile` ignores `relativePath` param | +| 7.4 | 🔴 Critical | Logic | ZIP mtime is DOS format, not Unix – skip-overwrite logic wrong | +| 7.5 | 🔴 Critical | Stability | `_ws!.add` without null/open guard → potential crash | +| 7.6 | 🟠 Bug | Stability | Double reconnect scheduling, exponential reconnect storms | +| 7.7 | 🟠 Bug | Logic | `_handleAuthRevoked` leaks per-folder timers | +| 7.8 | 🟠 Bug | Performance | Auth polling sends WS validate during pending phase (noise) | +| 7.9 | 🟠 Bug | Logic | `_primeKnownKeys` expects List, gets Map → always empty | +| 7.10 | 🟠 Bug | Logic | Role-based folder filtering skipped when WS is connected | +| 7.11 | 🟠 Bug | Logic | Two overlapping periodic sync timers cause race conditions | +| 7.12 | 🟡 Quality | State | `_knownS3Keys` lost on restart → all files re-uploaded as new | +| 7.13 | 🟡 Quality | Deps | `http` and `web_socket_channel` are unused dependencies | +| 7.14 | 🟡 Quality | UX | WS not auto-connected on startup with saved auth | +| 7.15 | 🟡 Quality | Feature | `guessContentType` missing most media file types | +| 7.16 | 🟡 Quality | UX | Login screen WS indicator always red at launch | +| 7.17 | 🟡 Quality | Architecture | All state in root `MyApp` widget (anti-pattern) | +| 7.18 | 🟡 Quality | Security | Auth key stored as plaintext file | +| 7.19 | 🟡 Quality | Stability | `setState` after dispose possible in async loaders | +| 7.20 | 🟡 Quality | Feature | Backend sync interval not applied to per-folder timers | +| W.1 | 🟠 Platform | Windows | All `Process.run('open', ...)` calls are macOS-only | +| W.2 | 🟠 Platform | Windows | `HOME` env var not set on Windows – use `USERPROFILE` | diff --git a/development/planxo/README.md b/development/planxo/README.md new file mode 100644 index 0000000..f50e0a0 --- /dev/null +++ b/development/planxo/README.md @@ -0,0 +1,16 @@ +# planxo + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/development/planxo/analysis_options.yaml b/development/planxo/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/development/planxo/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/development/planxo/android/.gitignore b/development/planxo/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/development/planxo/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/development/planxo/android/app/build.gradle.kts b/development/planxo/android/app/build.gradle.kts new file mode 100644 index 0000000..5ca28c5 --- /dev/null +++ b/development/planxo/android/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.example.planxo" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.planxo" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/development/planxo/android/app/src/debug/AndroidManifest.xml b/development/planxo/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/development/planxo/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/development/planxo/android/app/src/main/AndroidManifest.xml b/development/planxo/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..209d504 --- /dev/null +++ b/development/planxo/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/development/planxo/android/app/src/main/kotlin/com/example/planxo/MainActivity.kt b/development/planxo/android/app/src/main/kotlin/com/example/planxo/MainActivity.kt new file mode 100644 index 0000000..e045fa6 --- /dev/null +++ b/development/planxo/android/app/src/main/kotlin/com/example/planxo/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.planxo + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/development/planxo/android/app/src/main/res/drawable-v21/launch_background.xml b/development/planxo/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/development/planxo/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/development/planxo/android/app/src/main/res/drawable/launch_background.xml b/development/planxo/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/development/planxo/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/development/planxo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/development/planxo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/development/planxo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/development/planxo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/development/planxo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/development/planxo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/development/planxo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/development/planxo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/development/planxo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/development/planxo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/development/planxo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/development/planxo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/development/planxo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/development/planxo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/development/planxo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/development/planxo/android/app/src/main/res/values-night/styles.xml b/development/planxo/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/development/planxo/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/development/planxo/android/app/src/main/res/values/styles.xml b/development/planxo/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/development/planxo/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/development/planxo/android/app/src/profile/AndroidManifest.xml b/development/planxo/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/development/planxo/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/development/planxo/android/build.gradle.kts b/development/planxo/android/build.gradle.kts new file mode 100644 index 0000000..dbee657 --- /dev/null +++ b/development/planxo/android/build.gradle.kts @@ -0,0 +1,24 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/development/planxo/android/gradle.properties b/development/planxo/android/gradle.properties new file mode 100644 index 0000000..f018a61 --- /dev/null +++ b/development/planxo/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +android.enableJetifier=true diff --git a/development/planxo/android/gradle/wrapper/gradle-wrapper.properties b/development/planxo/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ac3b479 --- /dev/null +++ b/development/planxo/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip diff --git a/development/planxo/android/settings.gradle.kts b/development/planxo/android/settings.gradle.kts new file mode 100644 index 0000000..fb605bc --- /dev/null +++ b/development/planxo/android/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.9.1" apply false + id("org.jetbrains.kotlin.android") version "2.1.0" apply false +} + +include(":app") diff --git a/development/planxo/cocoapods.readme b/development/planxo/cocoapods.readme new file mode 100644 index 0000000..eeaff2e --- /dev/null +++ b/development/planxo/cocoapods.readme @@ -0,0 +1,55 @@ +# install a modern Ruby with rbenv (safe, no sudo for gems) +# 1) Install Homebrew (if you don't have it) +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + +# 2) Install rbenv + ruby-build +brew update +brew install rbenv ruby-build + +# 3) Initialize rbenv in your shell (zsh) +echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc +echo 'eval "$(rbenv init -)"' >> ~/.zshrc +source ~/.zshrc + +# 4) Install a modern Ruby (pick a 3.x version; 3.2.x or 3.1.x are fine) +rbenv install 3.2.2 # or `rbenv install 3.3.0` if available and you want latest +rbenv global 3.2.2 + +# verify +ruby -v + +# 5) Install CocoaPods (no sudo) +gem install cocoapods + +# 6) Rehash rbenv shims +rbenv rehash + + +# 1. Confirm rbenv state and active ruby +rbenv versions +rbenv global # shows global version +ruby -v + +# 2. Make sure the active ruby is what you expect (optional if you already set it) +# If `rbenv global` is not 3.2.2, set it: +rbenv global 3.2.2 + +# 3. Install CocoaPods for the active Ruby (no sudo) +gem install cocoapods + +# 4. Rebuild rbenv shims so `pod` is available +rbenv rehash + +# 5. Verify +which pod +pod --version + + +cd # e.g. ~/Dev/planxo or wherever +# if project has macOS support: +cd macos +pod install --repo-update +cd .. +flutter clean +flutter pub get +flutter run -d macos diff --git a/development/planxo/errors.txt b/development/planxo/errors.txt new file mode 100644 index 0000000..efc8470 --- /dev/null +++ b/development/planxo/errors.txt @@ -0,0 +1,789 @@ +Launching lib/main.dart on macOS in debug mode... +Running pod install... +Building macOS application... + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:82359:23: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 82359 | int nCopy = MIN(nOut, nIn); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:82393:18: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 82393 | nOut = MIN(pBt->usableSize - 4, nRem); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:84401:21: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 84401 | const int nCopy = MIN(nSrcPgsz, nDestPgsz); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:84672:18: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 84672 | iEnd = MIN(PENDING_BYTE + pgszDest, iSize); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:86227:49: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 86227 | if( sqlite3VdbeMemClearAndResize(pMem, (int)MAX(nAlloc,32)) ){ + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:86309:49: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 86309 | if( sqlite3VdbeMemClearAndResize(pMem, (int)MAX(nAlloc,32)) ){ + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:92009:22: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 92009 | int nCmp = MIN(mem1.n, pRhs->n); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:92037:22: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 92037 | int nCmp = MIN(nStr, pRhs->n); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:92245:12: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 92245 | nCmp = MIN( pPKey2->n, nStr ); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:94656:42: warning: implicit conversion loses integer precision: 'sqlite3_uint64' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32] + 94656 | rc = sqlite3_bind_zeroblob(pStmt, i, n); + | ~~~~~~~~~~~~~~~~~~~~~ ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:95497:19: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 95497 | nextIndex = MAX(idx + 1, nextIndex); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:95475:41: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 95475 | sqlite3_str_append(&out, zRawSql, n); + | ~~~~~~~~~~~~~~~~~~ ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:95493:53: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 95493 | idx = sqlite3VdbeParameterIndex(p, zRawSql, nToken); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:96416:48: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'u32' (aka 'unsigned int') [-Wshorten-64-to-32] + 96416 | rc = sqlite3BtreePayload(pC->uc.pCursor, iOffset, len, pBuf); + | ~~~~~~~~~~~~~~~~~~~ ^~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:96439:50: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'u32' (aka 'unsigned int') [-Wshorten-64-to-32] + 96439 | rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, iOffset, len, pDest); + | ~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:99361:21: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 99361 | pOut->u.nZero = nZero; + | ~ ^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:106058:28: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 106058 | sqlite3_int64 nNew = MAX(128, 2*(sqlite3_int64)p->nAlloc); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:106062:19: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 106062 | p->nAlloc = nNew; + | ~ ^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:106339:25: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 106339 | res = memcmp(v1, v2, (MIN(n1, n2) - 13)/2); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:106535:17: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 106535 | mxCache = MIN(mxCache, SQLITE_MAX_PMASZ); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:106536:28: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 106536 | pSorter->mxPmaSize = MAX(pSorter->mnPmaSize, (int)mxCache); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:107372:26: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 107372 | pSorter->mxKeysize = nPMA; + | ~ ^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:107376:33: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 107376 | int nMin = pSorter->iMemory + nReq; + | ~~~~ ~~~~~~~~~~~~~~~~~^~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:107383:45: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 107383 | iListOff = (u8*)pSorter->list.pList - pSorter->list.aMemory; + | ~ ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:107394:26: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 107394 | pSorter->nMemory = nNew; + | ~ ^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:107548:19: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 107548 | pIncr->mxSz = MAX(pTask->pSorter->mxKeysize+9,pTask->pSorter->mxPmaSize/2); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:108002:21: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 108002 | nReader = MIN(pTask->nPMA - i, SORTER_MAX_MERGE_COUNT); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:108879:17: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 108879 | int nCopy = MIN(nRead, (p->nChunkSize - iChunkOffset)); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:108919:40: warning: implicit conversion loses integer precision: 'sqlite_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 108919 | nChunk = copy.endpoint.iOffset - iOff; + | ~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:108986:22: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 108986 | int iSpace = MIN(nWrite, p->nChunkSize - iChunkOffset); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:109200:10: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 109200 | return MAX(pVfs->szOsFile, (int)sizeof(MemJournal)); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:121896:13: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 121896 | int n = sqlite3GetToken(&z[nRet], &t); + | ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:122359:18: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 122359 | int nToken = sqlite3GetToken(&zTmp[iOff], &t); + | ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:122401:72: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 122401 | nCons = alterRtrimConstraint(pParse->db, pCons, pParse->sLastToken.z - pCons); + | ~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~^~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:122521:72: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 122521 | nCons = alterRtrimConstraint(pParse->db, pCons, pParse->sLastToken.z - pCons); + | ~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~^~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:123609:18: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 123609 | pParse->nTab = MAX(pParse->nTab, iTab); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:130012:15: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 130012 | int nCopy = MIN(ArraySize(aVal), pIdx->nKeyCol); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:130279:20: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'u32' (aka 'unsigned int') [-Wshorten-64-to-32] + 130279 | pSrc->nAlloc = nAlloc; + | ~ ^~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:133459:24: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 133459 | sqlite3_randomness(n, p); + | ~~~~~~~~~~~~~~~~~~ ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:133460:44: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 133460 | sqlite3_result_blob(context, (char*)p, n, sqlite3_free); + | ~~~~~~~~~~~~~~~~~~~ ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:133997:31: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'u32' (aka 'unsigned int') [-Wshorten-64-to-32] + 133997 | pStr->nChar = nBlob*2 + 3; + | ~ ~~~~~~~~^~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:134073:11: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 134073 | n = z - &zIn[i]; + | ~ ~~^~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:134310:39: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 134310 | sqlite3_result_blob(pCtx, pBlob, (p - pBlob), sqlite3_free); + | ~~~~~~~~~~~~~~~~~~~ ~~^~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:137661:75: warning: possible misuse of comma operator here [-Wcomma] + 137661 | pRaise = sqlite3Expr(db, TK_STRING, "FOREIGN KEY constraint failed"), + | ^ + 137661 | pRaise = sqlite3Expr(db, TK_STRING, "FOREIGN KEY constraint failed"), + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | (void)( ) +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:142782:36: warning: implicit conversion loses integer precision: 'u64' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32] + 142782 | sqlite3OsDlError(pVfs, nMsg-1, zErrmsg); + | ~~~~~~~~~~~~~~~~ ~~~~^~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:142823:34: warning: implicit conversion loses integer precision: 'u64' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32] + 142823 | sqlite3OsDlError(pVfs, nMsg-1, zErrmsg); + | ~~~~~~~~~~~~~~~~ ~~~~^~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:146025:28: warning: implicit conversion loses integer precision: 'const u64' (aka 'const unsigned long long') to 'int' [-Wshorten-64-to-32] + 146025 | int iCookie = pPragma->iArg; /* Which cookie to read or write */ + | ~~~~~~~ ~~~~~~~~~^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:154021:29: warning: implicit conversion loses integer precision: 'u64' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32] + 154021 | int flags = pParse->db->flags; + | ~~~~~ ~~~~~~~~~~~~^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:164719:19: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 164719 | nExtraReg = MAX(nExtraReg, pLoop->u.btree.nBtm); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:164726:19: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 164726 | nExtraReg = MAX(nExtraReg, pLoop->u.btree.nTop); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:168124:43: warning: possible misuse of comma operator here [-Wcomma] + 168124 | && (pX = pTerm->pExpr->pRight, ALWAYS(pX!=0)) + | ^ + 168124 | && (pX = pTerm->pExpr->pRight, ALWAYS(pX!=0)) + | ^~~~~~~~~~~~~~~~~~~~~~~~~ + | (void)( ) +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:168807:14: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 168807 | mxBitCol = MIN(BMS-1,pTable->nCol); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:170416:25: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 170416 | pTemplate->rRun = MIN(p->rRun, pTemplate->rRun); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:170417:25: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 170417 | pTemplate->nOut = MIN(p->nOut - 1, pTemplate->nOut); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:170425:25: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 170425 | pTemplate->rRun = MAX(p->rRun, pTemplate->rRun); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:170426:25: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 170426 | pTemplate->nOut = MAX(p->nOut + 1, pTemplate->nOut); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:170856:10: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 170856 | nCmp = MIN(nCmp, (pIdx->nColumn - nEq)); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:173616:19: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 173616 | aFrom[0].nRow = MIN(pParse->nQueryLoop, 48); assert( 48==sqlite3LogEst(28) ); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:176049:28: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 176049 | int nSize = (p->nTotal / p->nParam); + | ~~~~~ ~~~~~~~~~~^~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:177598:12: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 177598 | nArg = MAX(nArg, windowArgCount(pWin)); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:178886:64: warning: implicit conversion loses integer precision: 'sqlite3_uint64' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32] + 178886 | void *p = sqlite3FaultSim(700) ? 0 : sqlite3_realloc(pOld, newSize); + | ~~~~~~~~~~~~~~~ ^~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:183838:173: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 183838 | sqlite3AlterAddConstraint(pParse, yymsp[-8].minor.yy203, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy0.z+1, (yymsp[-1].minor.yy0.z-yymsp[-3].minor.yy0.z-1)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:183844:154: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 183844 | sqlite3AlterAddConstraint(pParse, yymsp[-6].minor.yy203, &yymsp[-4].minor.yy0, 0, yymsp[-3].minor.yy0.z+1, (yymsp[-1].minor.yy0.z-yymsp[-3].minor.yy0.z-1)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:182506:9: warning: code will never be executed [-Wunreachable-code] + 182506 | YYMINORTYPE yylhsminor; + | ^~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:187039:19: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 187039 | nBig = szAlloc/(3*LOOKASIDE_SMALL+sz); + | ~ ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:187040:40: warning: implicit conversion loses integer precision: 'sqlite_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 187040 | nSm = (szAlloc - (i64)sz*(i64)nBig)/LOOKASIDE_SMALL; + | ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:187042:19: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 187042 | nBig = szAlloc/(LOOKASIDE_SMALL+sz); + | ~ ~~~~~~~^~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:187043:40: warning: implicit conversion loses integer precision: 'sqlite_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 187043 | nSm = (szAlloc - (i64)sz*(i64)nBig)/LOOKASIDE_SMALL; + | ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:187047:19: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 187047 | nBig = szAlloc/sz; + | ~ ~~~~~~~^~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:212369:28: warning: implicit conversion loses integer precision: 'u64' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32] + 212369 | pParse->nJson = p->nUsed; + | ~ ~~~^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:213603:20: warning: implicit conversion loses integer precision: 'u64' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32] + 213603 | px.nJson = pStr->nUsed; + | ~ ~~~~~~^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:214147:43: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'u32' (aka 'unsigned int') [-Wshorten-64-to-32] + 214147 | jsonBlobExpand(pParse, pParse->nBlob+d); + | ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~^~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:216731:19: warning: implicit conversion loses integer precision: 'u64' (aka 'unsigned long long') to 'u32' (aka 'unsigned int') [-Wshorten-64-to-32] + 216731 | u32 n = p->path.nUsed; + | ~ ~~~~~~~~^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:219319:26: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 219319 | p1->aCoord[ii].f = MIN(p1->aCoord[ii].f, p2->aCoord[ii].f); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:219320:28: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 219320 | p1->aCoord[ii+1].f = MAX(p1->aCoord[ii+1].f, p2->aCoord[ii+1].f); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:219325:26: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 219325 | p1->aCoord[ii].i = MIN(p1->aCoord[ii].i, p2->aCoord[ii].i); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:219326:28: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 219326 | p1->aCoord[ii+1].i = MAX(p1->aCoord[ii+1].i, p2->aCoord[ii+1].i); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:219367:12: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 219367 | x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj])); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:219368:12: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 219368 | x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1])); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:220488:21: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 220488 | pRtree->nRowEst = MAX(nRow, RTREE_MIN_ROWEST); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:220747:10: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 220747 | return sqlite3GetToken((const unsigned char*)z,&dummy); + | ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:223383:20: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'u32' (aka 'unsigned int') [-Wshorten-64-to-32] + 223383 | pBlob->iSize = nBlob; + | ~ ^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:233398:66: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 233398 | int iHash = sessionChangeHash(pTab, bPkOnly, p->aRecord, nNew); + | ~~~~~~~~~~~~~~~~~ ^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:233406:21: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 233406 | pTab->nChange = nNew; + | ~ ^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:233840:19: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 233840 | p->nAlloc = nNew; + | ~ ^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:234094:22: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 234094 | int nIncr = nNew - pC->nMaxSize; + | ~~~~~ ~~~~~^~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:234095:20: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 234095 | pC->nMaxSize = nNew; + | ~ ^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:234249:21: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 234249 | pC->nRecord = nByte; + | ~ ^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:238132:28: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 238132 | pNew->nRecord = pOut - pNew->aRecord; + | ~ ~~~~~^~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:238168:30: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 238168 | pNew->nRecord = pOut - pNew->aRecord; + | ~ ~~~~~^~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:238854:22: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 238854 | pBuf->nBuf = pOut-pBuf->aBuf; + | ~ ~~~~^~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:238926:26: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 238926 | pBuf->nBuf = (pOut - pBuf->aBuf); + | ~ ~~~~~^~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:239018:29: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 239017 | sessionAppendRecordMerge(&sOut, pIter->nCol, + | ~~~~~~~~~~~~~~~~~~~~~~~~ + 239018 | pCsr, nRec-(pCsr-aRec), + | ~~~~^~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:242000:9: warning: code will never be executed [-Wunreachable-code] + 242000 | fts5YYMINORTYPE fts5yylhsminor; + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:244037:29: warning: implicit conversion loses integer precision: 'sqlite3_int64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 244037 | pConfig->t.nArg = nArg; + | ~ ^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:245078:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 245078 | pToken->n = (z2 - z); + | ~ ~~~^~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:245090:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 245090 | pToken->n = (z2 - z); + | ~ ~~~^~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:247128:18: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 247128 | p->iHeight = MAX(p->iHeight, p->apChild[ii]->iHeight + 1); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:248538:18: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 248538 | int nMin = MIN(p1->nKey, p2->nKey); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:249522:10: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 249522 | nCmp = MIN(pLeft->n, pRight->n); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:249597:20: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 249597 | pRet->nn = nByte; + | ~ ^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:249604:50: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 249604 | rc = sqlite3_blob_read(p->pReader, aOut, nByte, 0); + | ~~~~~~~~~~~~~~~~~ ^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:249904:27: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 249904 | nOriginCntr = MAX(nOriginCntr, pSeg->iOrigin2); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:250595:18: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 250595 | int iEod = MIN(pIter->iEndofDoclist, pIter->pLeaf->szLeaf); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:250592:23: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 250592 | int iOff = pIter->iLeafOffset; /* Offset to read at */ + | ~~~~ ~~~~~~~^~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:250666:28: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 250666 | pIter->iTermLeafOffset = iOff; + | ~ ^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:250707:26: warning: implicit conversion loses integer precision: 'const i64' (aka 'const long long') to 'int' [-Wshorten-64-to-32] + 250707 | pNew->nTombstone = nTomb; + | ~ ^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:250777:18: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 250777 | int i = pIter->iLeafOffset; + | ~ ~~~~~~~^~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:250815:29: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 250815 | pIter->nRowidOffset = nNew; + | ~ ^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:250818:50: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 250818 | pIter->aRowidOffset[iRowidOffset++] = pIter->iLeafOffset; + | ~ ~~~~~~~^~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:250911:19: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 250911 | iOff = pIter->iLeafOffset; + | ~ ~~~~~~~^~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:250940:17: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 250940 | iOff = pIter->iLeafOffset; + | ~ ~~~~~~~^~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:251021:29: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 251021 | iOff = pIter->iLeafOffset + pIter->nPos; + | ~ ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:251296:19: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 251296 | nCmp = (u32)MIN(nNew, nTerm-nMatch); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:251364:35: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 251364 | pIter->iTermLeafOffset = pIter->iLeafOffset; + | ~ ~~~~~~~^~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:252171:18: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 252171 | pNew->nSeg = nSlot; + | ~ ^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:252301:16: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 252301 | int nChunk = MIN(nRem, pSeg->pLeaf->szLeaf - pSeg->iLeafOffset); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:252326:16: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 252326 | nChunk = MIN(nRem, pData->szLeaf - 4); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:252301:46: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 252301 | int nChunk = MIN(nRem, pSeg->pLeaf->szLeaf - pSeg->iLeafOffset); + | ~~~~~~ ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:252423:32: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 252423 | pIter->base.nData = p-aCopy; + | ~ ~^~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:252543:30: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 252543 | pIter->base.nData = aOut - pIter->poslist.p; + | ~ ~~~~~^~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:252670:14: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 252670 | nSeg = MIN(pStruct->aLevel[iLevel].nSeg, nSegment); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:253176:14: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 253176 | int nMin = MIN(pPage->term.n, nTerm); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:253651:38: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 253651 | int nPercent = (nTomb * 100) / nEntry; + | ~~~~~~~~ ~~~~~~~~~~~~~~^~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:254128:17: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 254128 | nPrefix = MIN(nPrefix, nPrefix2); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:254185:51: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 254185 | fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx); + | ~~~~~~~~~~~~~ ~~~~~~~~^~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:254574:20: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 254574 | pNew->nLevel = MIN(pStruct->nLevel+1, FTS5_MAX_LEVEL); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:255239:18: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 255239 | int n1 = MIN(nHalf, pT->nMap-i1); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:255240:18: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 255240 | int n2 = MIN(nHalf, pT->nMap-i1-n1); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:255239:22: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 255239 | int n1 = MIN(nHalf, pT->nMap-i1); + | ~~ ^~~~~ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:255239:37: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 255239 | int n1 = MIN(nHalf, pT->nMap-i1); + | ~~ ~~~~~~~~^~~ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:255240:22: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 255240 | int n2 = MIN(nHalf, pT->nMap-i1-n1); + | ~~ ^~~~~ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:255240:40: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 255240 | int n2 = MIN(nHalf, pT->nMap-i1-n1); + | ~~ ~~~~~~~~~~~^~~ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:256338:12: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 256338 | i2 = pT->nMap; + | ~ ~~~~^~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:256693:22: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 256693 | int nSlotPerPage = MAX(MINSLOT, (p->pConfig->pgsz - 8) / szKey); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:256723:13: warning: ambiguous expansion of macro 'MAX' [-Wambiguous-macro] + 256723 | nSlot = MAX(nElem*4, MINSLOT); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 218 | #define MAX(a, b) (((a)>(b))?(a):(b)) + | ^ + 15576 | # define MAX(A,B) ((A)>(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:257241:53: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 257241 | res = fts5Memcmp(&pLeaf->p[iOff], zIdxTerm, MIN(nTerm, nIdxTerm)); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:259152:40: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 259152 | pSorter->aIdx[i] = &aBlob[nBlob] - a; + | ~ ~~~~~~~~~~~~~~^~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:261897:38: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 261897 | sqlite3_result_text(pCtx, zText, nText, SQLITE_TRANSIENT); + | ~~~~~~~~~~~~~~~~~~~ ^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:261920:38: warning: implicit conversion loses integer precision: 'i64' (aka 'long long') to 'int' [-Wshorten-64-to-32] + 261920 | sqlite3_result_blob(pCtx, pBlob, nBlob, sqlite3_free); + | ~~~~~~~~~~~~~~~~~~~ ^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:264142:19: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 264142 | is = zCsr - (unsigned char*)pText; + | ~ ~~~~~^~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:264149:21: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 264149 | is = zCsr - (unsigned char*)pText; + | ~ ~~~~~^~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:264199:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 264199 | ie = zCsr - (unsigned char*)pText; + | ~ ~~~~~^~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:264203:37: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 264203 | rc = xToken(pCtx, 0, aFold, zOut-aFold, is, ie); + | ~~~~~~ ~~~~^~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:265030:24: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 265030 | aStart[ii] = zIn - (const unsigned char*)pText; + | ~ ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:265052:19: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 265052 | iNext = zIn - (const unsigned char*)pText; + | ~ ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:265062:36: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] + 265062 | rc = xToken(pCtx, 0, aBuf, zOut-aBuf, aStart[0], iNext); + | ~~~~~~ ~~~~^~~~~ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:266727:18: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 266727 | int nCmp = MIN(nTerm, pCsr->nLeTerm); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +/Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:266801:20: warning: ambiguous expansion of macro 'MIN' [-Wambiguous-macro] + 266801 | int nCmp = MIN(nTerm, pCsr->nLeTerm); + | ^ +In module 'Darwin' imported from /Users/mac/Desktop/TP/CMS/planxo/macos/Pods/sqlite3/sqlite-src-3520000/sqlite3.c:27675: + 215 | #define MIN(a, b) (((a)<(b))?(a):(b)) + | ^ + 15573 | # define MIN(A,B) ((A)<(B)?(A):(B)) + | ^ +192 warnings generated. +✓ Built build/macos/Build/Products/Debug/planxo.app +2026-03-10 10:28:26.480 planxo[25765:2717534] Running with merged UI and platform thread. Experimental. +Failed to foreground app; open returned 1 +Debug service listening on ws://127.0.0.1:51205/6sznUIvsZIU=/ws +Syncing files to device macOS... +flutter: *** sqflite warning *** + +You are changing sqflite default factory. +Be aware of the potential side effects. Any library using sqflite +will have this factory as the default for all operations. + +*** sqflite warning *** + +flutter: Device ID created: 34264b4d-8303-4593-af2d-49c90fc4689b +flutter: Updated URLs for client cms: https://cms.techpremedia.com +flutter: Updated URLs for client cms: https://cms.techpremedia.com +flutter: Attempting WebSocket connect to: wss://cms.techpremedia.com/ws?apiKey=aasdf345scwe&unique_id=34264b4d-8303-4593-af2d-49c90fc4689b +flutter: Connected to WS at wss://cms.techpremedia.com/ws?apiKey=aasdf345scwe&unique_id=34264b4d-8303-4593-af2d-49c90fc4689b +flutter: Successfully opened URL with open command +flutter: Successfully opened URL with open command +flutter: Auth transient: Invalid or expired auth key +flutter: Updated URLs for client cms: https://cms.techpremedia.com +flutter: Successfully opened URL with open command +flutter: Successfully opened URL with open command +flutter: Starting periodic sync every 30 minutes +flutter: Skipping periodic sync - not ready (auth: true, project: false) \ No newline at end of file diff --git a/development/planxo/ios/.gitignore b/development/planxo/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/development/planxo/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/development/planxo/ios/Flutter/AppFrameworkInfo.plist b/development/planxo/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..1dc6cf7 --- /dev/null +++ b/development/planxo/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 13.0 + + diff --git a/development/planxo/ios/Flutter/Debug.xcconfig b/development/planxo/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..ec97fc6 --- /dev/null +++ b/development/planxo/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/development/planxo/ios/Flutter/Release.xcconfig b/development/planxo/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..c4855bf --- /dev/null +++ b/development/planxo/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/development/planxo/ios/Podfile b/development/planxo/ios/Podfile new file mode 100644 index 0000000..620e46e --- /dev/null +++ b/development/planxo/ios/Podfile @@ -0,0 +1,43 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '13.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/development/planxo/ios/Runner.xcodeproj/project.pbxproj b/development/planxo/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..491fd70 --- /dev/null +++ b/development/planxo/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,616 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.planxo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.planxo.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.planxo.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.planxo.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.planxo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.planxo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/development/planxo/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/development/planxo/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/development/planxo/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/development/planxo/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/development/planxo/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/development/planxo/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/development/planxo/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/development/planxo/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/development/planxo/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/development/planxo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/development/planxo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..e3773d4 --- /dev/null +++ b/development/planxo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/development/planxo/ios/Runner.xcworkspace/contents.xcworkspacedata b/development/planxo/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/development/planxo/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/development/planxo/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/development/planxo/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/development/planxo/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/development/planxo/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/development/planxo/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/development/planxo/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/development/planxo/ios/Runner/AppDelegate.swift b/development/planxo/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..6266644 --- /dev/null +++ b/development/planxo/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Flutter +import UIKit + +@main +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..7353c41 Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..6ed2d93 Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cd7b00 Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..fe73094 Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..321773c Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..502f463 Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..e9f5fea Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..8953cba Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..0467bf1 Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/development/planxo/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/development/planxo/ios/Runner/Base.lproj/LaunchScreen.storyboard b/development/planxo/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/development/planxo/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/development/planxo/ios/Runner/Base.lproj/Main.storyboard b/development/planxo/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/development/planxo/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/development/planxo/ios/Runner/Info.plist b/development/planxo/ios/Runner/Info.plist new file mode 100644 index 0000000..8e22f2b --- /dev/null +++ b/development/planxo/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Planxo + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + planxo + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/development/planxo/ios/Runner/Runner-Bridging-Header.h b/development/planxo/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/development/planxo/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/development/planxo/ios/RunnerTests/RunnerTests.swift b/development/planxo/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/development/planxo/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/development/planxo/lib/helpers/database_helper.dart b/development/planxo/lib/helpers/database_helper.dart new file mode 100644 index 0000000..d06fe98 --- /dev/null +++ b/development/planxo/lib/helpers/database_helper.dart @@ -0,0 +1,122 @@ +import 'dart:async'; +import 'package:path/path.dart'; +import 'package:sqflite/sqflite.dart'; + +class DatabaseHelper { + static final DatabaseHelper _instance = DatabaseHelper._internal(); + factory DatabaseHelper() => _instance; + + static Database? _database; + + DatabaseHelper._internal(); + + Future get database async { + if (_database != null) return _database!; + _database = await _initDatabase(); + return _database!; + } + + Future _initDatabase() async { + final dbPath = await getDatabasesPath(); + final path = join(dbPath, 'sync_data.db'); + + return await openDatabase( + path, + version: 2, + onCreate: (db, version) async { + await db.execute(''' + CREATE TABLE sync_data ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + folder TEXT NOT NULL, + enabled INTEGER NOT NULL, + interval INTEGER NOT NULL, + last_synced TEXT, + file_path TEXT, + sync_status INTEGER NOT NULL DEFAULT 0 + ) + '''); + await db.execute(''' + CREATE TABLE sync_events ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + event_type TEXT NOT NULL, + folder TEXT, + s3_key TEXT, + local_path TEXT, + size INTEGER, + hash TEXT, + status TEXT, + message TEXT, + ts TEXT NOT NULL + ) + '''); + }, + onUpgrade: (db, oldVersion, newVersion) async { + if (oldVersion < 2) { + await db.execute(''' + CREATE TABLE IF NOT EXISTS sync_events ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + event_type TEXT NOT NULL, + folder TEXT, + s3_key TEXT, + local_path TEXT, + size INTEGER, + hash TEXT, + status TEXT, + message TEXT, + ts TEXT NOT NULL + ) + '''); + } + }, + ); + } + + Future insertSyncData(Map data) async { + final db = await database; + return await db.insert('sync_data', data); + } + + Future>> getUnsyncedOrUpdatedData() async { + final db = await database; + return await db.query('sync_data', where: 'sync_status IN (0, 2)'); + } + + Future updateSyncStatus(int id, int status) async { + final db = await database; + return await db.update( + 'sync_data', + {'sync_status': status}, + where: 'id = ?', + whereArgs: [id], + ); + } + + Future insertEvent({ + required String eventType, + String? folder, + String? s3Key, + String? localPath, + int? size, + String? hash, + String? status, + String? message, + }) async { + final db = await database; + return await db.insert('sync_events', { + 'event_type': eventType, + 'folder': folder, + 's3_key': s3Key, + 'local_path': localPath, + 'size': size, + 'hash': hash, + 'status': status, + 'message': message, + 'ts': DateTime.now().toIso8601String(), + }); + } + + Future>> recentEvents({int limit = 100}) async { + final db = await database; + return await db.query('sync_events', orderBy: 'id DESC', limit: limit); + } +} \ No newline at end of file diff --git a/development/planxo/lib/main.dart b/development/planxo/lib/main.dart new file mode 100644 index 0000000..1739cdf --- /dev/null +++ b/development/planxo/lib/main.dart @@ -0,0 +1,4267 @@ +// lib/main.dart +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; +import 'dart:math'; + +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import 'package:path/path.dart' as p; +import 'package:archive/archive.dart'; +import 'package:file_selector/file_selector.dart'; +import 'package:watcher/watcher.dart'; +import 'package:crypto/crypto.dart' as crypto; +import 'helpers/database_helper.dart'; + +// Global ScaffoldMessenger key to allow showing SnackBars even during early lifecycle +final GlobalKey rootMessengerKey = GlobalKey(); +// Global Navigator key so dialogs can be shown from _MyAppState (which is above MaterialApp) +final GlobalKey rootNavigatorKey = GlobalKey(); + +// ── Secure config ───────────────────────────────────────────────────────────── +// All secrets are stored in the OS keychain (macOS Keychain / Windows Credential +// Locker) via flutter_secure_storage — never hardcoded or written to plain files. +const _secureStorage = FlutterSecureStorage(); + +/// Returns the WS bridge API key. On first run a random 32-char key is generated +/// and stored in the keychain. You must set the SAME key on the server side. +Future _getOrCreateApiKey() async { + const storageKey = 'planxo_ws_api_key'; + final stored = await _secureStorage.read(key: storageKey); + if (stored != null && stored.isNotEmpty) return stored; + // Generate a cryptographically random key on first run + final rng = Random.secure(); + final bytes = List.generate(24, (_) => rng.nextInt(256)); + final key = base64UrlEncode(bytes).replaceAll('=', ''); + await _secureStorage.write(key: storageKey, value: key); + return key; +} + +/// Returns this machine's unique client ID. Generated once and stored in keychain. +Future _getOrCreateUniqueId() async { + const storageKey = 'planxo_unique_id'; + final stored = await _secureStorage.read(key: storageKey); + if (stored != null && stored.isNotEmpty) return stored; + final rng = Random.secure(); + final bytes = List.generate(16, (_) => rng.nextInt(256)); + final uid = bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join(); + await _secureStorage.write(key: storageKey, value: uid); + return uid; +} + +// Runtime values — populated in main() before the app starts +String apiKey = ''; +String uniqueId = ''; + +// Dynamic URLs based on client name +String wsUrl = 'wss://cms.techpremedia.com/ws'; +String backendUrl = 'https://cms.techpremedia.com'; +String assetManagerUrl = 'https://cms.techpremedia.com/assets-api'; + +final Dio dio = Dio(); + +// Asset manager shared secret — loaded from keychain at startup. +// Must match ASSET_MANAGER_SECRET on the server. +String _assetManagerSecret = ''; + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + // Load / generate secrets before the UI starts + apiKey = await _getOrCreateApiKey(); + uniqueId = await _getOrCreateUniqueId(); + _assetManagerSecret = await _secureStorage.read(key: 'planxo_asset_manager_secret') ?? ''; + // Inject the secret into every Dio request to the asset manager via interceptor + dio.interceptors.add(InterceptorsWrapper( + onRequest: (options, handler) { + if (_assetManagerSecret.isNotEmpty) { + options.headers['X-Internal-Token'] = _assetManagerSecret; + } + return handler.next(options); + }, + )); + runApp(const MyApp()); +} + +class FileItem { + final String key; // S3 key or object identifier + final String name; // display filename + final int? size; // optional bytes + + // runtime state: + bool isDownloading = false; + int received = 0; + int total = 0; + CancelToken? cancelToken; + String? localPath; // if downloaded, path on disk + FileItem({ + required this.key, + required this.name, + this.size, + }); +} + +class ChangeItem { + final String path; + final String status; // 'new_local', 'modified_local', 'new_remote' + final File? localFile; + final FileItem? remoteItem; + ChangeItem(this.path, this.status, {this.localFile, this.remoteItem}); +} + +class MyApp extends StatefulWidget { + const MyApp({super.key}); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State with SingleTickerProviderStateMixin { + bool _isLoginInProgress = false; + List files = []; + List folders = []; + // Local folders detected on disk (full paths) + List localFolders = []; + bool loading = false; + String? error; + // Client login state + final TextEditingController _clientController = TextEditingController(); + String _clientName = ''; + String _authKey = ''; + Map? _userInfo; + bool _isAuthenticated = false; + int _syncInterval = 15; // Sync interval in minutes from backend + Timer? _periodicSyncTimer; + // Storage base path (where we create ProjectsCache / Downloads). Persisted. + String _storageBasePath = ''; + final TextEditingController _storageController = TextEditingController(); + + // Sync settings: stored as map folder -> { enabled: bool, interval: int } + Map _syncSettings = {}; + final Map _syncTimers = {}; + final Map _syncRunning = {}; + // Extraction preference: when true, extract into storage root using folder path + bool _extractToRoot = true; + // Auto auth polling to avoid manual "Check Auth" button + Timer? _authPollTimer; + // Debounce timer for post-upload file list refresh (avoids cascade on batch uploads) + Timer? _refreshDebounceTimer; + // Per-file debounce timers: fire only after the file has been stable for 5 s. + // This prevents uploading partial/temp files created by Illustrator, Photoshop, etc. + final Map _uploadDebounceTimers = {}; + int _authPollAttempts = 0; + // Track repetitive auth errors to avoid noisy logs + String? _lastAuthError; + int _lastAuthErrorCount = 0; + + // WebSocket members + WebSocket? _ws; + bool _wsOpen = false; + bool _wsConnecting = false; + DateTime? _lastWsAttempt; + final Map>> _pendingListRequests = {}; + final Map> _pendingPresign = {}; + + // Folder sync state + Directory? _currentProjectDir; // local root for extracted folder + String? _currentFolderPrefix; // e.g. 'projects//' + StreamSubscription? _watchSub; // legacy single-watcher (kept for compat) + final Map _watchSubs = {}; // multi-folder watchers + final Map _lastUpload = {}; + final Set _knownS3Keys = {}; // populated from API for the folder + final Map _lastUploadedHash = {}; // localPath -> sha256 + final Map _folderDownloading = {}; // folder -> in-progress + final Map _lastFolderDownloadTs = {}; // folder -> last ts + final DatabaseHelper _db = DatabaseHelper(); + // Sync log state + List> _recentEvents = []; + bool _logLoading = false; + bool _logFilterCurrentOnly = true; + // Track last synced folder for easy resume + String? _lastSyncedFolder; + String? _lastSyncedLocalPath; + + // Store sync metadata: localPath -> {modified, hash} + final Map> _syncMeta = {}; + + // Changes state + List _changes = []; + List _remoteMissingFiles = []; // Added missing field + late TabController _tabController; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + // load sync settings from disk + _loadSyncSettings(); + _loadSyncMeta(); // Load persisted meta + // load saved client name and auth key + _loadClientName(); + _loadAuthKey(); + // load storage path + _loadStoragePath(); + } + + @override + void dispose() { + _tabController.dispose(); + _ws?.close(); + _watchSub?.cancel(); + _authPollTimer?.cancel(); + _refreshDebounceTimer?.cancel(); + _periodicSyncTimer?.cancel(); + _clientController.dispose(); + _storageController.dispose(); + // cancel any active sync timers + for (final t in _syncTimers.values) { + if (t.isActive) t.cancel(); + } + // cancel any pending per-file upload debounce timers + for (final t in _uploadDebounceTimers.values) { + if (t.isActive) t.cancel(); + } + _uploadDebounceTimers.clear(); + super.dispose(); + } + + // --- Added missing methods --- + + Future _syncMetaFile() async { + final home = Platform.environment['HOME'] ?? Directory.current.path; + final f = File(p.join(home, '.planxo_sync_meta.json')); + if (!await f.exists()) await f.create(recursive: true); + return f; + } + + Future _loadSyncMeta() async { + try { + final f = await _syncMetaFile(); + final content = await f.readAsString(); + if (content.trim().isEmpty) return; + final Map data = jsonDecode(content); + data.forEach((k, v) { + if (v is Map) _syncMeta[k] = Map.from(v); + }); + } catch (e) { + print('Failed to load sync meta: $e'); + } + } + + Future _saveSyncMeta() async { + try { + final f = await _syncMetaFile(); + await f.writeAsString(jsonEncode(_syncMeta)); + } catch (e) { + print('Failed to save sync meta: $e'); + } + } + + void _detectRemoteMissingFiles(List list) { + _remoteMissingFiles.clear(); + if (_currentFolderPrefix == null || _currentProjectDir == null) { + return; + } + final prefix = _currentFolderPrefix!; + for (final fi in list) { + if (!fi.key.startsWith(prefix)) continue; + final rel = fi.key.substring(prefix.length); + final localCandidate = p.join(_currentProjectDir!.path, rel); + if (!File(localCandidate).existsSync()) { + _remoteMissingFiles.add(fi); + } + } + } + + Future _checkForChanges() async { + if (_currentProjectDir == null || _currentFolderPrefix == null) return; + + final localDir = _currentProjectDir!; + final prefix = _currentFolderPrefix!; + final newChanges = []; + final remoteMap = {}; + + // Index remote files by relative path + for (var f in files) { + if (f.key.startsWith(prefix)) { + final rel = f.key.substring(prefix.length); + remoteMap[rel] = f; + } + } + + // Scan local + if (await localDir.exists()) { + await for (final entity in localDir.list(recursive: true)) { + if (entity is File) { + final rel = p.relative(entity.path, from: localDir.path).replaceAll('\\', '/'); + if (p.basename(rel) == '.DS_Store' || p.basename(rel) == '.keep') continue; + + final remote = remoteMap[rel]; + if (remote == null) { + newChanges.add(ChangeItem(rel, 'new_local', localFile: entity)); + } else { + // Check modification + final meta = _syncMeta[entity.path]; + final stat = await entity.stat(); + bool isModified = false; + + if (meta == null) { + // No sync record. Check size as proxy if available + if (remote.size != null && remote.size != stat.size) { + isModified = true; + } + } else { + // Check timestamp first + if (stat.modified.millisecondsSinceEpoch != meta['lastModified']) { + // Timestamp changed, check hash + final currentHash = await _hashFile(entity.path); + if (currentHash != meta['hash']) { + isModified = true; + } else { + // Update meta timestamp to avoid re-hashing next time + _syncMeta[entity.path]!['lastModified'] = stat.modified.millisecondsSinceEpoch; + _saveSyncMeta(); + } + } + } + + if (isModified) { + newChanges.add(ChangeItem(rel, 'modified_local', localFile: entity, remoteItem: remote)); + } else { + // Synced + newChanges.add(ChangeItem(rel, 'synced', localFile: entity, remoteItem: remote)); + } + remoteMap.remove(rel); // Handled + } + } + } + } + + // Remaining remote files are missing locally + remoteMap.forEach((rel, item) { + newChanges.add(ChangeItem(rel, 'new_remote', remoteItem: item)); + }); + + // Sort: pending first + newChanges.sort((a, b) { + final aSynced = a.status == 'synced'; + final bSynced = b.status == 'synced'; + if (aSynced && !bSynced) return 1; + if (!aSynced && bSynced) return -1; + return a.path.compareTo(b.path); + }); + + setState(() { + _changes = newChanges; + }); + } + + // ── App-managed storage (hidden, protected) ────────────────────────────────── + // The storage folder is ALWAYS ~/Library/Application Support/PlanXO/. + // It is hidden from Finder via `chflags hidden` and the root folder is + // made user-immutable via `chflags uchg` so users cannot delete or rename it. + // The app temporarily lifts the immutable flag before writing, then restores it. + + /// Canonical managed path — always ~/Library/Application Support/PlanXO + String get _managedStoragePath { + final home = Platform.environment['HOME'] ?? Directory.current.path; + return p.join(home, 'Library', 'Application Support', 'PlanXO'); + } + + /// Remove user-immutable flag so the app can write to the folder. + Future _unlockStorage() async { + try { + await Process.run('chflags', ['nouchg', _managedStoragePath]); + } catch (_) {} + } + + /// Re-apply hidden + user-immutable flags. + Future _lockStorage() async { + try { + await Process.run('chflags', ['hidden', _managedStoragePath]); + await Process.run('chflags', ['uchg', _managedStoragePath]); + } catch (_) {} + } + + Future _loadStoragePath() async { + final managed = _managedStoragePath; + + // One-time migration: if old Downloads/PlanXO (or any previously saved path) + // has data, move it into the managed location. + await _migrateOldStorage(managed); + + // Always use the managed path — ignore any previously saved custom path. + _storageBasePath = managed; + _storageController.text = managed; + setState(() {}); + + // Ensure the folder exists and is hidden/protected. + await _ensureStorageBaseExists(); + + // Populate local folders from the managed directory immediately. + await _scanStorageFolders(); + } + + /// Migrate data from old location (~/Downloads/PlanXO or saved path) into + /// the managed location, then delete the old location. + Future _migrateOldStorage(String managedPath) async { + final home = Platform.environment['HOME'] ?? Directory.current.path; + final candidates = [ + p.join(home, 'Downloads', 'PlanXO'), + p.join(home, 'PlanXO'), + ]; + // Also check previously saved path + try { + final legacyFile = File(p.join(home, '.planxo_storage')); + if (await legacyFile.exists()) { + final saved = (await legacyFile.readAsString()).trim(); + if (saved.isNotEmpty && !candidates.contains(saved)) { + candidates.add(saved); + } + // Remove the legacy config file — path is now fixed. + await legacyFile.delete(); + } + } catch (_) {} + + for (final oldPath in candidates) { + final oldDir = Directory(oldPath); + if (await oldDir.exists() && oldPath != managedPath) { + try { + await _unlockStorage(); + final newDir = Directory(managedPath); + if (!await newDir.exists()) await newDir.create(recursive: true); + // Copy all contents recursively + await for (final entity in oldDir.list(recursive: true, followLinks: false)) { + final rel = p.relative(entity.path, from: oldPath); + final dest = p.join(managedPath, rel); + if (entity is Directory) { + await Directory(dest).create(recursive: true); + } else if (entity is File) { + await Directory(p.dirname(dest)).create(recursive: true); + await entity.copy(dest); + } + } + // Remove old location after successful copy + await oldDir.delete(recursive: true); + _showSnack('Migrated existing data to managed storage.'); + } catch (e) { + print('Storage migration failed: $e'); + } + break; // only migrate first found + } + } + } + + // _saveStoragePath is kept for internal use but no longer exposed to users. + Future _saveStoragePath(String path) async { + _storageBasePath = path; + _storageController.text = path; + } + + Future _ensureStorageBaseExists() async { + try { + await _unlockStorage(); + final d = Directory(_storageBasePath); + if (!await d.exists()) { + await d.create(recursive: true); + } + await _lockStorage(); + } catch (e) { + print('Failed to initialise managed storage: $e'); + } + } + + Future _isPathWritable(String dirPath) async { + try { + await _unlockStorage(); + final testFile = File(p.join(dirPath, '.planxo_write_test')); + await testFile.writeAsString('ok', flush: true); + await testFile.delete(); + await _lockStorage(); + return true; + } catch (e) { + return false; + } + } + + // _pickStorageFolder is no longer exposed — storage path is app-managed. + Future _pickStorageFolder() async { + // No-op: path is now fixed to the managed location. + } + + // ── Secure credential storage (OS keychain) ───────────────────────────────── + // All secrets go through _secureStorage — no plaintext files on disk. + + Future _loadClientName() async { + try { + final name = await _secureStorage.read(key: 'planxo_client_name'); + if (name != null && name.trim().isNotEmpty) { + _clientName = name.trim(); + _clientController.text = _clientName; + _updateUrls(_clientName); + setState(() {}); + } + } catch (e) { + print('Failed to load client name: $e'); + } + } + + void _updateUrls(String clientName) { + if (clientName.isEmpty) return; + final subdomain = clientName.trim().toLowerCase(); + wsUrl = 'wss://$subdomain.techpremedia.com/ws'; + backendUrl = 'https://$subdomain.techpremedia.com'; + assetManagerUrl = 'https://$subdomain.techpremedia.com/assets-api'; + print('Updated URLs for client $subdomain: $backendUrl'); + } + + Future _saveClientName(String name) async { + try { + await _secureStorage.write(key: 'planxo_client_name', value: name); + } catch (e) { + print('Failed to save client name: $e'); + } + } + + Future _loadAuthKey() async { + try { + final key = await _secureStorage.read(key: 'planxo_auth_key'); + if (key != null && key.trim().isNotEmpty) { + _authKey = key.trim(); + setState(() {}); + } + } catch (e) { + print('Failed to load auth key: $e'); + } + } + + Future _saveAuthKey(String key) async { + try { + await _secureStorage.write(key: 'planxo_auth_key', value: key); + _authKey = key; + setState(() {}); + } catch (e) { + print('Failed to save auth key: $e'); + } + } + + Future _clearAuthKey() async { + try { + await _secureStorage.delete(key: 'planxo_auth_key'); + _authKey = ''; + _userInfo = null; + _isAuthenticated = false; + _periodicSyncTimer?.cancel(); + _periodicSyncTimer = null; + setState(() {}); + } catch (e) { + print('Failed to clear auth key: $e'); + } + } + + void _startPeriodicSync() { + // Cancel any existing periodic sync timer + _periodicSyncTimer?.cancel(); + + if (_syncInterval <= 0) return; + + print('Starting periodic sync every $_syncInterval minutes'); + + // Run sync immediately on start + _performPeriodicSync(); + + // Then schedule periodic syncs + _periodicSyncTimer = Timer.periodic(Duration(minutes: _syncInterval), (timer) { + _performPeriodicSync(); + }); + } + + Future _performPeriodicSync() async { + if (!_isAuthenticated || _currentProjectDir == null || _currentFolderPrefix == null) { + print('Skipping periodic sync - not ready (auth: $_isAuthenticated, project: ${_currentProjectDir != null})'); + return; + } + + // Guard: only sync specific job folders (depth ≥ 3, e.g. "clients/ClientName/JobID/") + // A too-broad prefix like "clients/" would download the entire client tree. + final prefixDepth = _currentFolderPrefix!.split('/').where((s) => s.isNotEmpty).length; + if (prefixDepth < 3) { + print('Skipping periodic sync — prefix too broad ($_currentFolderPrefix), depth=$prefixDepth < 3'); + return; + } + + print('⏰ Periodic sync triggered for $_currentFolderPrefix'); + + try { + // 1. Check for local changes and upload + int uploads = await _syncLocalChanges(); + + // 2. Check for remote changes and download + int downloads = await _syncRemoteChanges(); + + if (uploads == 0 && downloads == 0) { + _showSnack('Sync complete: Up to date.'); + } else { + _showSnack('Sync complete: Uploaded $uploads, Downloaded $downloads files.'); + } + + await _logEvent( + eventType: 'periodic_sync', + folder: _currentFolderPrefix!, + status: 'ok', + message: 'Periodic sync completed successfully' + ); + } catch (e) { + print('Periodic sync error: $e'); + await _logEvent( + eventType: 'periodic_sync', + folder: _currentFolderPrefix!, + status: 'error', + message: 'Periodic sync failed: $e' + ); + } + } + + Future _syncLocalChanges() async { + if (_currentProjectDir == null || _currentFolderPrefix == null) return 0; + + int uploadCount = 0; + final localFiles = {}; + final dir = _currentProjectDir!; + + if (!await dir.exists()) return 0; + + await for (final entity in dir.list(recursive: true)) { + if (entity is File) { + final rel = p.relative(entity.path, from: dir.path); + final basename = p.basename(entity.path); + // Ignore system files + if (basename == '.DS_Store' || basename == '.keep') continue; + localFiles[rel] = entity; + } + } + + // Check each local file for changes + for (final entry in localFiles.entries) { + final relPath = entry.key; + final file = entry.value; + final path = file.path; + + // Check sync meta + final stat = await file.stat(); + final lastModified = stat.modified.millisecondsSinceEpoch; + final meta = _syncMeta[path]; + + if (meta != null && meta['lastModified'] == lastModified) { + continue; + } + + final bytes = await file.readAsBytes(); + final hash = crypto.sha256.convert(bytes).toString(); + + if (meta != null && meta['hash'] == hash) { + // Update timestamp only + _syncMeta[path]!['lastModified'] = lastModified; + _saveSyncMeta(); + continue; + } + + print('Uploading modified file: $relPath'); + await _uploadFile(file, relPath); + uploadCount++; + } + return uploadCount; + } + + Future _syncRemoteChanges() async { + if (_currentFolderPrefix == null) return 0; + + // Re-download the folder to get latest changes + // This will extract new/updated files + print('Checking for remote changes in $_currentFolderPrefix'); + return await _downloadAndExtractFolder(_currentFolderPrefix!); + } + + Future _uploadFile(File file, String relativePath) async { + if (_currentProjectDir == null || _currentFolderPrefix == null) return; + await _onLocalFileChanged(file.path, _currentFolderPrefix!); + await _checkForChanges(); // Refresh changes list after upload + } + + Future _checkAuthentication() async { + if (_authKey.isEmpty) { + _isAuthenticated = false; + setState(() {}); + return; + } + + // If already authenticated, skip redundant checks + if (_isAuthenticated) { + return; + } + + if (!_wsOpen) { + _showSnack('WebSocket not connected. Cannot validate authentication.'); + return; + } + + // Send auth validation request via WebSocket + final msg = jsonEncode({ + 'type': 'validate_auth', + 'data': {'auth_key': _authKey} + }); + _ws!.add(msg); + } + + void _handleAuthResult(Map authData) { + if (authData.containsKey('user')) { + _userInfo = authData['user']; + _isAuthenticated = true; + _authPollTimer?.cancel(); + _authPollTimer = null; + + // Get sync interval from auth data + if (authData.containsKey('sync_interval')) { + _syncInterval = authData['sync_interval'] as int; + } + + _showSnack('✅ Authenticated as ${_userInfo!['username']} (${_userInfo!['role']}) - Sync: ${_syncInterval}min'); + setState(() {}); + + // Now we can fetch files + fetchFileList(); + + // Start periodic sync timer + _startPeriodicSync(); + } else { + _isAuthenticated = false; + _userInfo = null; + _showSnack('❌ Authentication failed: ${authData['message'] ?? 'Unknown error'}'); + setState(() {}); + } + } + + void _handleAuthApproval(Map approvalData) { + final authKey = approvalData['auth_key']; + final user = approvalData['user']; + + if (authKey != null && user != null) { + _userInfo = user; + _isAuthenticated = true; + _authKey = authKey; + _saveAuthKey(authKey); + // Stop polling upon success + _authPollTimer?.cancel(); + _authPollTimer = null; + + // Get sync interval from approval data + if (approvalData.containsKey('sync_interval')) { + _syncInterval = approvalData['sync_interval'] as int; + } + + _showSnack('🎉 Authorization approved by ${user['username']}! Sync: ${_syncInterval}min'); + setState(() {}); + + // Fetch files now that we're authorized + fetchFileList(); + + // Start periodic sync timer + _startPeriodicSync(); + } + } + + void _startAuthPolling() { + // Cancel any existing poller + _authPollTimer?.cancel(); + _authPollAttempts = 0; + + // Poll every 2 seconds for up to 2 minutes + _authPollTimer = Timer.periodic(const Duration(seconds: 2), (t) async { + if (!mounted) { + t.cancel(); + return; + } + if (_isAuthenticated) { + t.cancel(); + return; + } + + if (_wsOpen && _authKey.isNotEmpty) { + try { + await _checkAuthentication(); + } catch (_) {} + } + + _authPollAttempts++; + if (_authPollAttempts >= 60) { + t.cancel(); + _showSnack('Authorization is taking longer than expected.'); + } + }); + } + + Future _openUrl(String url) async { + // Security: only open URLs that belong to the configured backend domain. + // This prevents a malicious server response from opening arbitrary URLs. + final uri = Uri.tryParse(url); + if (uri == null || !(uri.scheme == 'https' || uri.scheme == 'http')) { + print('_openUrl blocked — not a valid http/https URL: $url'); + _showSnack('Cannot open URL: invalid format'); + return; + } + final allowedHost = Uri.tryParse(backendUrl)?.host ?? ''; + if (allowedHost.isNotEmpty && uri.host != allowedHost) { + print('_openUrl blocked — host ${uri.host} != expected $allowedHost'); + _showSnack('Cannot open URL: unexpected domain'); + return; + } + try { + // Try multiple methods to open URL + + // Method 1: Direct open command + var result = await Process.run('open', [url]); + if (result.exitCode == 0) { + print('Successfully opened URL with open command'); + return; + } + + // Method 2: Try with specific browser + result = await Process.run('open', ['-a', 'Safari', url]); + if (result.exitCode == 0) { + print('Successfully opened URL with Safari'); + return; + } + + // Method 3: Try with Chrome + result = await Process.run('open', ['-a', 'Google Chrome', url]); + if (result.exitCode == 0) { + print('Successfully opened URL with Chrome'); + return; + } + + // If all methods fail + print('All browser opening methods failed'); + _showSnack('Please manually open: $url'); + + } catch (e) { + print('Error opening URL: $e'); + _showSnack('Please manually open: $url'); + } + } + + // Generate a cryptographically secure auth key (256 bits of entropy) + String _generateAuthKey() { + final rng = Random.secure(); + final bytes = List.generate(32, (_) => rng.nextInt(256)); + return base64UrlEncode(bytes).replaceAll('=', ''); + } + + Future _openLoginForClient(String client) async { + if (client.trim().isEmpty) { + _showSnack('Client name cannot be empty'); + return; + } + + // Prevent multiple login processes + if (_isLoginInProgress) return; + _isLoginInProgress = true; + + try { + final newClientName = client.trim(); + bool clientChanged = newClientName != _clientName; + + _clientName = newClientName; + await _saveClientName(_clientName); + _updateUrls(_clientName); + + // If client changed or WS not open, reconnect + if (clientChanged && _wsOpen) { + _ws!.close(); + } + + // Try to connect WebSocket (non-blocking — if it fails we fall back to HTTP) + if (!_wsOpen) { + await _connectWs(); + } + + // Generate unique auth key + final authKey = _generateAuthKey(); + await _saveAuthKey(authKey); + + // Register auth key — prefer WS, fall back to HTTP + bool usedWs = false; + if (_wsOpen && _ws != null) { + final msg = jsonEncode({ + 'type': 'register_auth_key', + 'data': {'auth_key': authKey} + }); + try { + _ws!.add(msg); + usedWs = true; + } catch (_) {} + } + + if (!usedWs) { + // WS unavailable — register via HTTP then open browser directly + try { + await dio.post( + '$backendUrl/planxo/auth/register-key', + data: {'auth_key': authKey}, + ); + } catch (_) { + // Best-effort: server may not support this endpoint yet, continue anyway + } + _showSnack('Opening browser for authentication...'); + final authUrl = '$backendUrl/planxo-auth/$authKey'; + await _openUrl(authUrl); + } else { + // WS connected — browser will be opened when server sends 'auth_key_registered' + _showSnack('Waiting for server to open browser...'); + } + + setState(() {}); + } catch (e) { + _showSnack('Error during login: $e'); + } finally { + _isLoginInProgress = false; + } +} + + Future _enterAuthKey() async { + // Check if the widget is still mounted and has proper context + if (!mounted) return; + + try { + final controller = TextEditingController(text: _authKey); + final result = await showDialog( + context: rootNavigatorKey.currentContext!, + builder: (ctx) => AlertDialog( + title: const Text('Enter Authorization Key'), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Enter the authorization key you copied from the browser:'), + const SizedBox(height: 16), + TextField( + controller: controller, + decoration: const InputDecoration( + labelText: 'Auth Key', + hintText: 'Paste the key here...', + border: OutlineInputBorder(), + ), + maxLines: 3, + ), + ], + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(ctx), + child: const Text('Cancel'), + ), + TextButton( + onPressed: () => Navigator.pop(ctx, controller.text.trim()), + child: const Text('Save & Validate'), + ), + ], + ), + ); + + if (result != null && result.isNotEmpty) { + await _saveAuthKey(result); + await _checkAuthentication(); + } + } catch (e) { + print('Error opening auth key dialog: $e'); + _showSnack('Unable to open dialog. Please try again.'); + } + } + + /// Scan common locations for a `root/client/` directory and list its subfolders. + Future _scanLocalClientFolders() async { + setState(() { loading = true; }); + try { + final home = Platform.environment['HOME'] ?? ''; + final candidates = []; + candidates.add('/root/client'); + if (home.isNotEmpty) candidates.add(p.join(home, 'root', 'client')); + candidates.add(p.join(Directory.current.path, 'root', 'client')); + + String? found; + for (final c in candidates) { + final d = Directory(c); + if (await d.exists()) { + found = c; + break; + } + } + + if (found == null) { + _showSnack('No `root/client` folder found in checked locations.'); + return; + } + + final dir = Directory(found); + final List foundDirs = []; + await for (final e in dir.list()) { + if (e is Directory) foundDirs.add(e.path); + } + + if (foundDirs.isEmpty) { + _showSnack('No subfolders found in $found'); + return; + } + + localFolders = foundDirs; + setState(() {}); + _showSnack('Found ${localFolders.length} local folders in $found'); + } catch (e) { + _showSnack('Failed to scan local folders: $e'); + } finally { + setState(() { loading = false; }); + } + } + + /// Scan the storage base path and populate [localFolders] with any + /// subdirectories found (recursing one level into clients/ if present). + /// This makes already-synced folders visible in the sidebar and center pane + /// without requiring an API fetch. + Future _scanStorageFolders() async { + if (_storageBasePath.trim().isEmpty) return; + final base = Directory(_storageBasePath); + if (!await base.exists()) return; + try { + final found = {}; + // Walk depth-1 and depth-2 to catch both flat and clients// structures + await for (final e1 in base.list()) { + if (e1 is! Directory) continue; + final name1 = p.basename(e1.path); + // Skip hidden or system dirs + if (name1.startsWith('.') || name1 == 'ProjectsCache') continue; + // If this looks like a wrapper folder (e.g. 'clients'), recurse one more level + bool hasSubFolders = false; + await for (final e2 in e1.list()) { + if (e2 is Directory) { + hasSubFolders = true; + final name2 = p.basename(e2.path); + if (name2.startsWith('.')) continue; + // Recurse one more level for clients// + bool hasDeep = false; + await for (final e3 in e2.list()) { + if (e3 is Directory && !p.basename(e3.path).startsWith('.')) { + found.add(e3.path); + hasDeep = true; + } + } + if (!hasDeep) found.add(e2.path); + } + } + if (!hasSubFolders) found.add(e1.path); + } + if (!mounted) return; + setState(() { + localFolders = found.toList()..sort(); + }); + } catch (e) { + print('Failed to scan storage folders: \$e'); + } + } + + /// Use an existing local folder as the current project folder to watch and upload changes. + Future _useLocalFolderAsProject(String fullPath) async { + final dir = Directory(fullPath); + if (!await dir.exists()) { + _showSnack('Folder not found: $fullPath'); + return; + } + + _currentProjectDir = dir; + + // Derive the S3 folder prefix by stripping the storage base path. + // e.g. storageBase = ".../PlanXO", fullPath = ".../PlanXO/clients/Test Client 1/1000014" + // → prefix = "clients/Test Client 1/1000014/" + // If the path is not under storageBase, fall back to just the basename. + String folderPrefix; + if (_storageBasePath.isNotEmpty && fullPath.startsWith(_storageBasePath)) { + var rel = fullPath.substring(_storageBasePath.length); + if (rel.startsWith('/')) rel = rel.substring(1); + folderPrefix = rel.endsWith('/') ? rel : '$rel/'; + } else { + final name = p.basename(fullPath); + folderPrefix = name.endsWith('/') ? name : '$name/'; + } + + _currentFolderPrefix = folderPrefix; + await _primeKnownKeys(_currentFolderPrefix!); + _startWatcher(dir, _currentFolderPrefix!); + _showSnack('Watching $fullPath and syncing to prefix $_currentFolderPrefix'); + + // Track for easy resume + _lastSyncedFolder = _currentFolderPrefix; + _lastSyncedLocalPath = fullPath; + setState(() {}); + } + + Future _connectWs() async { + const retryDelay = Duration(seconds: 30); + + if (_wsOpen || _wsConnecting) return; // already connected/in-flight + + final base = Uri.parse(wsUrl); + final uri = base.replace(queryParameters: { + ...base.queryParameters, + if (apiKey.isNotEmpty) 'apiKey': apiKey, + if (uniqueId.isNotEmpty) 'unique_id': uniqueId, + }); + + try { + _wsConnecting = true; + _lastWsAttempt = DateTime.now(); + if (mounted) setState(() {}); + print('Attempting WebSocket connect to: $uri'); + _ws = await WebSocket.connect(uri.toString()).timeout(const Duration(seconds: 15)); + _wsOpen = true; + _wsConnecting = false; + _ws!.listen( + _onWsMessage, + onDone: () { + print('WebSocket closed by server'); + _wsOpen = false; + _ws = null; + if (mounted) setState(() {}); + if (mounted) Future.delayed(retryDelay, () { if (mounted) _connectWs(); }); + }, + onError: (err) { + print('WebSocket error: $err'); + _wsOpen = false; + _ws = null; + if (mounted) setState(() {}); + if (mounted) Future.delayed(retryDelay, () { if (mounted) _connectWs(); }); + }, + cancelOnError: true, + ); + if (mounted) setState(() {}); + print('Connected to WS at $uri'); + return; + } catch (e) { + print('WebSocket connect failed to $uri: $e'); + _wsOpen = false; + _wsConnecting = false; + _ws = null; + if (mounted) setState(() {}); + // Schedule reconnect only if still mounted + if (mounted) Future.delayed(retryDelay, () { if (mounted) _connectWs(); }); + } + } + + void _onWsDone() { + print('WebSocket closed by server'); + _wsOpen = false; + _authPollTimer?.cancel(); + setState(() {}); + // Optionally: schedule reconnect logic here + } + + void _onWsError(dynamic err) { + print('WebSocket error: $err'); + _wsOpen = false; + _authPollTimer?.cancel(); + setState(() {}); + // Optionally: schedule reconnect logic here + } + + void _onWsMessage(dynamic raw) async { + try { + if (raw is String) { + final Map msg = jsonDecode(raw); + final type = msg['type'] as String?; + final data = msg['data']; + + if (type == null) return; + + switch (type) { + case 'auth_key_registered': + // Auth key registered, open browser + final authKey = data?['auth_key']; + final browserUrl = data?['browser_url']; + if (authKey != null && browserUrl != null) { + _saveAuthKey(authKey); + _showSnack('Auth key registered. Opening browser for approval...'); + await _openUrl(browserUrl); + _showSnack('Waiting for approval in browser...'); + // Start polling to auto-detect approval + _startAuthPolling(); + } + break; + + case 'auth_approved': + // Browser approval received + _handleAuthApproval(data ?? {}); + break; + + case 'auth_success': + _handleAuthResult(data ?? {}); + break; + + case 'auth_revoked': + // Handle logout/session expiration from server + _handleAuthRevoked(data ?? {}); + break; + + case 'auth_error': + // Ignore stray errors after we are authenticated + if (_isAuthenticated) { + break; + } + + _isAuthenticated = false; + _userInfo = null; + final errorMsg = data?['message'] ?? 'Authentication failed'; + final errorDetails = data?['details'] ?? ''; + final fullMessage = errorDetails.isNotEmpty ? '$errorMsg ($errorDetails)' : errorMsg; + + // Transient errors commonly seen during pending approval + final isTransient = errorMsg == 'Invalid or expired auth key' || errorMsg == 'User not found'; + + // During polling, suppress noisy repeats of transient auth errors + final pollingActive = _authPollTimer != null && _authPollTimer!.isActive; + if (pollingActive && isTransient) { + if (_lastAuthError != errorMsg) { + _lastAuthError = errorMsg; + _lastAuthErrorCount = 1; + // Log once when message changes + print('Auth transient: $errorMsg'); + } else { + _lastAuthErrorCount += 1; + if (_lastAuthErrorCount % 10 == 0) { + // Periodic heartbeat to show it's still happening + print('Auth transient repeating: $errorMsg (x$_lastAuthErrorCount)'); + } + } + setState(() {}); + break; + } + + // Only show snack for non-transient errors + _showSnack('❌ Auth Error: $fullMessage'); + print('Auth Error Details: $data'); + setState(() {}); + break; + case 'connected': + // server acknowledged + print('Server connected: $data'); + break; + case 'download_folder': + final folder = data['folder'] as String?; + final projectId = data['projectId']; + if (folder != null) { + final last = _lastFolderDownloadTs[folder]; + final now = DateTime.now(); + if (_folderDownloading[folder] == true || (last != null && now.difference(last) < const Duration(seconds: 60))) { + break; + } + _downloadAndExtractFolder(folder); + } + break; + + case 'files_list': + // data expected to be list of {key,name,size} + final List list = []; + if (data is List) { + for (final e in data) { + final key = e['key'] as String? ?? ''; + final name = e['name'] as String? ?? key.split('/').last; + final size = e['size'] != null ? (e['size'] as num).toInt() : null; + list.add(FileItem(key: key, name: name, size: size)); + } + } + // complete any pending completer (if request made) + _completeFileListPending(list); + // update UI if not from pending (server push) + if (mounted) { + setState(() { + files = list; + loading = false; + }); + } + break; + + case 'presigned_url': + // data expected { key, url } + final key = data != null ? data['key'] as String? : null; + final url = data != null ? data['url'] as String? : null; + if (key != null) _completePresignPending(key, url); + break; + + case 'error': + final msgText = data != null && data['message'] != null ? data['message'] : data; + _showSnack('Server error: $msgText'); + break; + + default: + print('Unhandled WS message type: $type | data: $data'); + } + } + } catch (e, st) { + print('Failed to parse WS message: $e\n$st'); + } + } + + void _completeFileListPending(List list) { + // find all pending list completers and complete them + if (_pendingListRequests.isEmpty) return; + final keys = List.from(_pendingListRequests.keys); + for (final k in keys) { + final c = _pendingListRequests.remove(k); + if (c != null && !c.isCompleted) c.complete(list); + } + } + + void _completePresignPending(String key, String? url) { + final completer = _pendingPresign.remove(key); + if (completer != null && !completer.isCompleted) completer.complete(url); + } + + Future fetchFileList() async { + if (!_wsOpen) { + // attempt HTTP fallback immediately + await _fetchFileListHttpFallback(); + return; + } + + if (!_isAuthenticated) { + _showSnack('Please authenticate first before accessing files'); + return; + } + + setState(() { + loading = true; + error = null; + }); + + // use a requestId to be robust; server currently responds with 'files_list' + final requestId = DateTime.now().millisecondsSinceEpoch.toString(); + final completer = Completer>(); + _pendingListRequests[requestId] = completer; + + // We send a 'list_files' message. Server should respond with 'files_list'. + final msg = jsonEncode({'type': 'list_files', 'data': {'requestId': requestId}}); + _ws!.add(msg); + + // Race between WS response and fallback HTTP after timeout + List? wsResult; + try { + wsResult = await completer.future.timeout(const Duration(seconds: 6)); + } catch (_) { + // ignore, we'll fallback + } + if (wsResult != null) { + // Also fetch role-filtered folders — the WS 'list_files' response only + // returns file items, not the folders list. Without this, the sidebar and + // center pane would stay empty even when files exist (the HTTP fallback + // path populates folders, but the WS path did not). + List filteredFolders = []; + try { + if (_isAuthenticated && _authKey.isNotEmpty) { + final folderRes = await dio.get( + '$backendUrl/planxo/folders/filtered', + options: Options(headers: {'X-Auth-Key': _authKey}), + ); + if (folderRes.statusCode == 200) { + // Server may return {"folders":[...]} or a raw list directly + List rawList = []; + if (folderRes.data is Map && folderRes.data['folders'] is List) { + rawList = folderRes.data['folders'] as List; + } else if (folderRes.data is List) { + rawList = folderRes.data as List; + } + for (final f in rawList) { + if (f is String) filteredFolders.add(f); + else if (f is Map) { + final val = f['folder'] ?? f['path'] ?? f['prefix'] ?? f['name']; + if (val is String) filteredFolders.add(val); + } + } + } + } + } catch (_) {} + if (!mounted) return; + setState(() { + files = wsResult!; + if (filteredFolders.isNotEmpty) folders = filteredFolders; + loading = false; + }); + _detectRemoteMissingFiles(wsResult!); + _checkForChanges(); // Check changes after fetch + await _scanStorageFolders(); // refresh local folders from disk + } else { + await _fetchFileListHttpFallback(); + } + } + + Future _fetchFileListHttpFallback() async { + setState(() { loading = true; error = null; }); + try { + // 1. Try to fetch filtered folders from backend first + List filteredFolders = []; + try { + if (_isAuthenticated && _authKey.isNotEmpty) { + final folderRes = await dio.get( + '$backendUrl/planxo/folders/filtered', + options: Options(headers: {'X-Auth-Key': _authKey}) + ); + if (folderRes.statusCode == 200) { + // Server may return {"folders":[...]} or a raw list directly + List rawList = []; + if (folderRes.data is Map && folderRes.data['folders'] is List) { + rawList = folderRes.data['folders'] as List; + } else if (folderRes.data is List) { + rawList = folderRes.data as List; + } + for (final f in rawList) { + if (f is String) filteredFolders.add(f); + else if (f is Map) { + final val = f['folder'] ?? f['path'] ?? f['prefix'] ?? f['name']; + if (val is String) filteredFolders.add(val); + } + } + print('Fetched ${filteredFolders.length} filtered folders from backend'); + } + } + } catch (e) { + print('Failed to fetch filtered folders: $e'); + } + + // If we got role-filtered folders, only fetch assets for those folders. + // This prevents non-admin users from seeing files they're not assigned to. + if (filteredFolders.isNotEmpty) { + setState(() { folders = filteredFolders; loading = false; }); + _checkForChanges(); + await _scanStorageFolders(); + return; + } + + final envUrl = const String.fromEnvironment('ASSET_MANAGER_URL'); + final baseUrl = envUrl.isNotEmpty ? envUrl : assetManagerUrl; + print('Falling back to HTTP GET $baseUrl/assets'); + final res = await dio.get('$baseUrl/assets'); + final List list = []; + final List foundFolders = []; + + if (res.statusCode == 200) { + final data = res.data; + // data can be array or object { assets: [], folders: [] } + if (data is List) { + for (final e in data) { + final key = (e['s3_key'] as String?) ?? ''; + final name = (e['filename'] as String?) ?? key.split('/').last; + final size = e['size'] is num ? (e['size'] as num).toInt() : null; + list.add(FileItem(key: key, name: name, size: size)); + } + } else if (data is Map) { + // assets + final assetsData = (data['assets'] is List) ? data['assets'] as List : (data['items'] is List ? data['items'] as List : []); + for (final e in assetsData) { + final key = (e['s3_key'] as String?) ?? e['key'] ?? ''; + final name = (e['filename'] as String?) ?? (key.split('/').isNotEmpty ? key.split('/').last : key); + final size = e['size'] is num ? (e['size'] as num).toInt() : null; + list.add(FileItem(key: key, name: name, size: size)); + } + + // folders (returned by asset_manager_app.py) + final foldersData = (data['folders'] is List) ? data['folders'] as List : []; + for (final f in foldersData) { + final folderPath = f['folder'] as String? ?? f['prefix'] as String? ?? f['path'] as String?; + if (folderPath != null) foundFolders.add(folderPath); + } + } + } + + setState(() { + files = list; + folders = filteredFolders.isNotEmpty ? filteredFolders : foundFolders; + loading = false; + }); + _detectRemoteMissingFiles(list); + _checkForChanges(); // Check changes after fetch + await _scanStorageFolders(); // refresh local folders from disk + } catch (e) { + setState(() { loading = false; error = 'HTTP fallback failed: $e'; }); + } + } + + // Sync settings persistence (simple JSON in HOME) + Future _settingsFile() async { + final home = Platform.environment['HOME'] ?? Directory.current.path; + final f = File(p.join(home, '.planxo_sync_settings.json')); + if (!await f.exists()) await f.create(recursive: true); + return f; + } + + Future _loadSyncSettings() async { + try { + final f = await _settingsFile(); + final content = await f.readAsString(); + if (content.trim().isEmpty) return; + final Map data = jsonDecode(content); + _syncSettings = data.map((k, v) => MapEntry(k, v)); + // Load prefs + final prefs = _syncSettings['_prefs']; + if (prefs is Map && prefs['extract_to_root'] is bool) { + _extractToRoot = prefs['extract_to_root'] as bool; + } + // start timers for enabled ones + _syncSettings.forEach((folder, cfg) { + if (cfg is Map && cfg['enabled'] == true && cfg['interval'] is int) { + _startFolderPeriodicSync(folder, cfg['interval']); + } + }); + } catch (e) { + print('No sync settings or failed to load: $e'); + } + } + + Future _saveSyncSettings() async { + try { + // persist prefs inside settings file + final prefs = (_syncSettings['_prefs'] is Map) + ? Map.from(_syncSettings['_prefs']) + : {}; + prefs['extract_to_root'] = _extractToRoot; + _syncSettings['_prefs'] = prefs; + final f = await _settingsFile(); + await f.writeAsString(jsonEncode(_syncSettings)); + } catch (e) { + print('Failed to save sync settings: $e'); + } + } + + Future _verifyStoragePath() async { + final path = _storageBasePath.trim(); + if (path.isEmpty) { + _showSnack('Set a storage path first'); + return; + } + try { + final d = Directory(path); + if (!await d.exists()) { + await d.create(recursive: true); + } + final testFile = File(p.join(path, '.planxo_write_test')); + await testFile.writeAsString('ok'); + await testFile.delete(); + _showSnack('Storage path verified and writable'); + } catch (e) { + _showSnack('Storage path not writable: $e'); + } + } + + void _startFolderPeriodicSync(String folder, int intervalMinutes) { + // stop any existing + _stopFolderPeriodicSync(folder); + final timer = Timer.periodic(Duration(minutes: intervalMinutes), (_) async { + if (_syncRunning[folder] == true) return; // skip if already running + _syncRunning[folder] = true; + try { + await _downloadAndExtractFolder(folder); + } catch (e) { + print('Periodic sync failed for $folder: $e'); + } finally { + _syncRunning[folder] = false; + } + }); + _syncTimers[folder] = timer; + // update settings map + _syncSettings[folder] = { + 'enabled': true, + 'interval': intervalMinutes, + 'last_started': DateTime.now().toIso8601String() + }; + _saveSyncSettings(); + } + + void _stopFolderPeriodicSync(String folder) { + final t = _syncTimers.remove(folder); + if (t != null && t.isActive) t.cancel(); + if (_syncSettings.containsKey(folder)) { + final cfg = _syncSettings[folder] as Map; + cfg['enabled'] = false; + _syncSettings[folder] = cfg; + _saveSyncSettings(); + } + } + + Future _toggleSyncForFolder(String folder, bool enable) async { + if (enable) { + final interval = (_syncSettings[folder] != null && _syncSettings[folder]['interval'] is int) ? _syncSettings[folder]['interval'] as int : 15; + _startFolderPeriodicSync(folder, interval); + } else { + _stopFolderPeriodicSync(folder); + } + setState(() {}); + } + + Future _setIntervalForFolder(String folder, int minutes) async { + final cfg = _syncSettings[folder] is Map ? Map.from(_syncSettings[folder]) : {}; + cfg['interval'] = minutes; + _syncSettings[folder] = cfg; + _saveSyncSettings(); + // restart timer if enabled + if (cfg['enabled'] == true) { + _startFolderPeriodicSync(folder, minutes); + } + setState(() {}); + } + + Future _showIntervalDialog(String folder) async { + final current = _syncSettings[folder] is Map && _syncSettings[folder]['interval'] is int ? _syncSettings[folder]['interval'] as int : 15; + int selected = current; + await showDialog(context: rootNavigatorKey.currentContext!, builder: (ctx) { + return AlertDialog( + title: Text('Sync interval for $folder'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + RadioListTile(value: 15, groupValue: selected, title: const Text('Every 15 minutes'), onChanged: (v) { if (v!=null) { selected = v; setState(() {}); } }), + RadioListTile(value: 30, groupValue: selected, title: const Text('Every 30 minutes'), onChanged: (v) { if (v!=null) { selected = v; setState(() {}); } }), + RadioListTile(value: 45, groupValue: selected, title: const Text('Every 45 minutes'), onChanged: (v) { if (v!=null) { selected = v; setState(() {}); } }), + ], + ), + actions: [ + TextButton(onPressed: () => Navigator.of(ctx).pop(), child: const Text('Cancel')), + ElevatedButton(onPressed: () { _setIntervalForFolder(folder, selected); Navigator.of(ctx).pop(); }, child: const Text('Save')), + ], + ); + }); + } + + Future fetchPresignedUrl(String key) async { + if (!_wsOpen) { + _showSnack('WebSocket not connected'); + return null; + } + + // create completer and wait for presigned_url with matching key + final completer = Completer(); + _pendingPresign[key] = completer; + + final msg = jsonEncode({'type': 'presign', 'data': {'key': key}}); + _ws!.add(msg); + + try { + final url = await completer.future.timeout(const Duration(seconds: 10)); + return url; + } catch (e) { + _pendingPresign.remove(key); + _showSnack('Failed to get presigned URL: $e'); + return null; + } + } + +Future _downloadAndExtractFolder(String folder) async { + try { + if (_folderDownloading[folder] == true) return 0; + _folderDownloading[folder] = true; + await _unlockStorage(); // lift immutable flag before writing + int updates = 0; + await _logEvent(eventType: 'download_folder_start', folder: folder, status: 'started'); + _showSnack('Checking folder $folder...'); + final envUrl = const String.fromEnvironment('ASSET_MANAGER_URL'); + final baseUrl = envUrl.isNotEmpty ? envUrl : assetManagerUrl; + final url = '$baseUrl/folders/download?folder=${Uri.encodeComponent(folder)}'; + + final response = await dio.get>( + url, + options: Options(responseType: ResponseType.bytes, followRedirects: true), + ); + + final bytes = response.data; + if (bytes == null) { + _showSnack('Folder download returned empty'); + return 0; + } + + final base = _storageBasePath.isNotEmpty ? _storageBasePath : (Platform.environment['HOME'] ?? Directory.current.path); + + // Ensure base storage path exists + final baseDir = Directory(base); + if (!baseDir.existsSync()) { + try { + baseDir.createSync(recursive: true); + print('Created base storage directory: ${baseDir.path}'); + } catch (e) { + _showSnack('Failed to create base storage path: $e'); + await _logEvent(eventType: 'download_folder_error', folder: folder, status: 'error', message: 'Failed to create base directory: $e'); + return 0; + } + } + + Directory projectDir; + if (_extractToRoot) { + var normalized = folder; + if (normalized.startsWith('/')) normalized = normalized.substring(1); + if (normalized.endsWith('/')) normalized = normalized.substring(0, normalized.length - 1); + projectDir = Directory(p.join(base, normalized)); + } else { + projectDir = Directory(p.join(base, 'ProjectsCache', folder.replaceAll('/', '_'))); + } + // Ensure all parent directories exist (e.g., base/clients/691481da936c80306db4cab9/691b07252227750fbe8703ee/) + if (!projectDir.existsSync()) { + try { + projectDir.createSync(recursive: true); + print('Created project directory: ${projectDir.path}'); + } catch (e) { + _showSnack('Failed to create project folder: $e'); + await _logEvent(eventType: 'download_folder_error', folder: folder, status: 'error', message: 'Failed to create project directory: $e'); + return 0; + } + } + + final archive = ZipDecoder().decodeBytes(bytes); + for (final file in archive) { + // ── Zip Slip protection ────────────────────────────────────────────── + // Normalise the entry name, reject any path that escapes the project dir. + final safeName = p.normalize(file.name).replaceAll('\\', '/'); + if (safeName.startsWith('..') || safeName.contains('/../')) { + print('Skipping unsafe zip entry: ${file.name}'); + continue; + } + final outPath = p.join(projectDir.path, safeName); + // Double-check: resolved path must still be inside projectDir + if (!p.isWithin(projectDir.path, outPath) && outPath != projectDir.path) { + print('Zip Slip blocked: $outPath is outside ${projectDir.path}'); + continue; + } + if (file.isFile) { + final outFile = File(outPath); + final parentDir = outFile.parent; + parentDir.createSync(recursive: true); + + // Only overwrite if remote is newer or file doesn't exist + bool shouldWrite = true; + if (await outFile.exists()) { + final localStat = await outFile.stat(); + final remoteMtime = DateTime.fromMillisecondsSinceEpoch(file.lastModTime * 1000); + if (localStat.modified.isAfter(remoteMtime)) { + shouldWrite = false; + } + } + if (shouldWrite) { + outFile.writeAsBytesSync(file.content as List); + // Update sync meta + _syncMeta[outFile.path] = { + 'lastModified': (await outFile.stat()).modified.millisecondsSinceEpoch, + 'hash': await _hashFile(outFile.path), + }; + updates++; + } + } else { + Directory(outPath).createSync(recursive: true); + } + } + + _currentProjectDir = projectDir; + _currentFolderPrefix = folder.endsWith('/') ? folder : '$folder/'; + await _primeKnownKeys(_currentFolderPrefix!); + + if (updates > 0) { + _showSnack('Updated $updates files in ${projectDir.path}'); + } + await _logEvent(eventType: 'download_folder_extracted', folder: folder, localPath: projectDir.path, status: 'ok'); + _startWatcher(projectDir, _currentFolderPrefix!); + _lastFolderDownloadTs[folder] = DateTime.now(); + + // Track for easy resume + _lastSyncedFolder = _currentFolderPrefix; + _lastSyncedLocalPath = projectDir.path; + + _checkForChanges(); // Refresh changes list + return updates; + } on DioException catch (e) { + if (e.type == DioExceptionType.connectionError) { + _showSnack('Folder download failed: Connection error. Please check the server.'); + } else { + _showSnack('Folder download failed: ${e.message}'); + } + await _logEvent(eventType: 'download_folder_error', folder: folder, status: 'error', message: e.message); + return 0; + } catch (e) { + _showSnack('Folder download failed: $e'); + await _logEvent(eventType: 'download_folder_error', folder: folder, status: 'error', message: '$e'); + return 0; + } finally { + _folderDownloading[folder] = false; + await _lockStorage(); // re-apply hidden + immutable flag + } +} + + /// Trigger a full sync for all known folders. + /// This will sequentially download and extract each folder. + Future syncFiles() async { + if (folders.isEmpty) { + _showSnack('No folders to sync'); + return; + } + + int totalUpdates = 0; + for (final folder in folders) { + try { + totalUpdates += await _downloadAndExtractFolder(folder); + } catch (e) { + print('syncFiles: error syncing $folder: $e'); + _showSnack('Sync failed for $folder: $e'); + } + } + if (totalUpdates == 0) { + _showSnack('All folders up to date.'); + } else { + _showSnack('Sync completed. Updated $totalUpdates files.'); + } + } + + void startFileWatcher(Directory directory, String folderPrefix) { + final watcher = DirectoryWatcher(directory.path); + + watcher.events.listen((event) async { + if (event.type == ChangeType.ADD || event.type == ChangeType.MODIFY) { + final file = File(event.path); + if (await file.exists()) { + await syncFile(file, folderPrefix, _currentProjectDir!); + } + } + }); + } + + Future syncFile(File file, String folderPrefix, Directory directory) async { + final now = DateTime.now(); + final localPath = file.path; + + // Debounce rapid consecutive writes + final last = _lastUpload[localPath]; + if (last != null && now.difference(last) < const Duration(seconds: 1)) return; + _lastUpload[localPath] = now; + + // Compute file hash + final bytes = await file.readAsBytes(); + final hash = crypto.sha256.convert(bytes).toString(); + + // Skip upload if content hash is unchanged + if (_lastUploadedHash[localPath] == hash) return; + + // Determine relative path for S3 + final relativePath = p.relative(file.path, from: directory.path).replaceAll('\\', '/'); + final s3Key = (folderPrefix.endsWith('/') ? folderPrefix : '$folderPrefix/') + relativePath; + + // Get last modified and hash + final stat = await file.stat(); + final lastModified = stat.modified.millisecondsSinceEpoch; + final currHash = await _hashFile(localPath); + + // Check sync meta to avoid redundant upload + final meta = _syncMeta[localPath]; + if (meta != null && + meta['lastModified'] == lastModified && + meta['hash'] == currHash) { + // No change since last sync + return; + } + + // Upload file + try { + final contentType = guessContentType(file.path); + if (_lastUploadedHash.containsKey(file.path)) { + await _replaceExisting(file.path, s3Key, contentType); + } else { + // Always use relativePath (with subfolders) for upload + await _uploadNew(file.path, folderPrefix, relativePath, contentType); + } + _lastUploadedHash[localPath] = hash; // Update hash after successful upload + // Update sync meta + _syncMeta[localPath] = { + 'lastModified': lastModified, + 'hash': currHash, + }; + _saveSyncMeta(); // Persist + } catch (e) { + print('Error syncing file $localPath: $e'); + } + } + + Future _primeKnownKeys(String folderPrefix) async { + try { + final envUrl = const String.fromEnvironment('ASSET_MANAGER_URL'); + final baseUrl = envUrl.isNotEmpty ? envUrl : assetManagerUrl; + final url = '$baseUrl/assets?folder=${Uri.encodeComponent(folderPrefix)}'; + final res = await dio.get(url); + _knownS3Keys.clear(); + if (res.statusCode == 200 && res.data is List) { + for (final a in (res.data as List)) { + final key = a['s3_key']; + if (key is String) _knownS3Keys.add(key); + } + } + } catch (e) { + // non-fatal + print('primeKnownKeys error: $e'); + } + } + + void _startWatcher(Directory dir, String folderPrefix) { + // Cancel existing watcher for this folder if any, then register a new one. + // Using a Map so we can watch multiple folders simultaneously. + _watchSubs[folderPrefix]?.cancel(); + final sub = DirectoryWatcher(dir.path).events.listen((event) { + if (event.type == ChangeType.ADD || event.type == ChangeType.MODIFY) { + _onLocalFileChanged(event.path, folderPrefix); + } else if (event.type == ChangeType.REMOVE) { + _onLocalFileDeleted(event.path, folderPrefix); + } + }); + _watchSubs[folderPrefix] = sub; + // Also keep legacy _watchSub pointing to the most recent one for dispose() + _watchSub = sub; + } + + void _stopAllWatchers() { + for (final sub in _watchSubs.values) sub.cancel(); + _watchSubs.clear(); + _watchSub = null; + } + + Future _onLocalFileDeleted(String localPath, String folderPrefix) async { + final baseName = p.basename(localPath); + if (baseName == '.DS_Store' || baseName == '.keep' || baseName.startsWith('~') || baseName.endsWith('~')) return; + if (_currentProjectDir == null) return; + + final relative = p.relative(localPath, from: _currentProjectDir!.path).replaceAll('\\', '/'); + final s3Key = (folderPrefix.endsWith('/') ? folderPrefix : '$folderPrefix/') + relative; + + try { + final envUrl = const String.fromEnvironment('ASSET_MANAGER_URL'); + final baseUrl = envUrl.isNotEmpty ? envUrl : assetManagerUrl; + await dio.delete('$baseUrl/assets/delete-by-key', queryParameters: {'key': s3Key}); + _knownS3Keys.remove(s3Key); + _syncMeta.remove(localPath); + _saveSyncMeta(); + _showSnack('Deleted $baseName from S3'); + await _logEvent(eventType: 'delete_local', folder: folderPrefix, s3Key: s3Key, localPath: localPath, status: 'ok'); + _checkForChanges(); + } catch (e) { + print('Delete sync error for $s3Key: $e'); + await _logEvent(eventType: 'delete_local', folder: folderPrefix, s3Key: s3Key, localPath: localPath, status: 'error', message: '$e'); + } + } + + Future _onLocalFileChanged(String localPath, String folderPrefix) async { + // Skip non-existent files (already cleaned up by OS) + if (!File(localPath).existsSync()) return; + + final baseName = p.basename(localPath); + + // ── Skip system files ──────────────────────────────────────────────────── + if (baseName == '.DS_Store' || baseName == '.keep') return; + + // ── Skip temp / backup files created by Illustrator, Photoshop & others ─ + // Illustrator writes ~filename.ai and filename.ai~ during save. + // Photoshop writes ~PST*.tmp and similar intermediate files. + // Office apps write ~$filename.docx lock/temp files. + if (baseName.startsWith('~') || // any leading-tilde temp file + baseName.endsWith('~') || // trailing-tilde backup copy + baseName.endsWith('.tmp') || // generic temp extension + baseName.endsWith('.lock') || // lock files + baseName.endsWith('.lck') || // alternative lock extension + baseName == 'Thumbs.db') return; // Windows thumbnail cache + + // ── Stable-file debounce ───────────────────────────────────────────────── + // Reset the timer every time the watcher fires for this path. + // The upload only happens after the file has been UNTOUCHED for 5 seconds, + // which gives Illustrator/Photoshop time to finish their multi-step save. + _uploadDebounceTimers[localPath]?.cancel(); + // 5 s stable-file window: enough for Illustrator/Photoshop multi-step saves + _uploadDebounceTimers[localPath] = Timer(const Duration(seconds: 5), () { + _uploadDebounceTimers.remove(localPath); + _performFileUpload(localPath, folderPrefix); + }); + } + + Future _performFileUpload(String localPath, String folderPrefix) async { + final file = File(localPath); + if (!file.existsSync()) return; + if (_currentProjectDir == null) return; + + // Use relative path from project dir, preserving all subfolders + final relative = p.relative(localPath, from: _currentProjectDir!.path).replaceAll('\\', '/'); + // S3 key must preserve folder structure: folderPrefix + relative + final s3Key = (folderPrefix.endsWith('/') ? folderPrefix : '$folderPrefix/') + relative; + final contentType = guessContentType(localPath); + + // Get last modified and hash + final stat = await file.stat(); + final lastModified = stat.modified.millisecondsSinceEpoch; + final currHash = await _hashFile(localPath); + + // Check sync meta to avoid redundant upload + final meta = _syncMeta[localPath]; + if (meta != null && + meta['lastModified'] == lastModified && + meta['hash'] == currHash) { + // No change since last sync + return; + } + + try { + if (_knownS3Keys.contains(s3Key)) { + await _replaceExisting(localPath, s3Key, contentType); + } else { + // Always use relative (with subfolders) for upload + await _uploadNew(localPath, folderPrefix, relative, contentType); + _knownS3Keys.add(s3Key); + } + _lastUploadedHash[localPath] = currHash; + // Update sync meta + _syncMeta[localPath] = { + 'lastModified': lastModified, + 'hash': currHash, + }; + _saveSyncMeta(); // Persist + _checkForChanges(); // Refresh changes list + } catch (e) { + print('Upload error for $localPath: $e'); + try { + await _logEvent(eventType: 'upload_error', folder: folderPrefix, s3Key: s3Key, localPath: localPath, status: 'error', message: '$e'); + } catch (_) {} + } + } + + Future _hashFile(String path) async { + final f = File(path); + final bytes = await f.readAsBytes(); + final digest = crypto.sha256.convert(bytes); + return digest.toString(); + } + + Future _logEvent({ + required String eventType, + String? folder, + String? s3Key, + String? localPath, + int? size, + String? hash, + String? status, + String? message, + }) async { + try { + await _db.insertEvent( + eventType: eventType, + folder: folder, + s3Key: s3Key, + localPath: localPath, + size: size, + hash: hash, + status: status, + message: message, + ); + } catch (_) {} + } + + Future _refreshEvents() async { + setState(() { + _logLoading = true; + }); + try { + var rows = await _db.recentEvents(limit: 200); + final filterPrefix = _logFilterCurrentOnly ? _currentFolderPrefix : null; + if (filterPrefix != null) { + rows = rows.where((e) => (e['folder'] as String?) == filterPrefix).toList(); + } + setState(() { + _recentEvents = rows; + }); + } catch (e) { + _showSnack('Failed to load sync log: $e'); + } finally { + if (mounted) { + setState(() { + _logLoading = false; + }); + } + } + } + + String guessContentType(String path) { + final ext = p.extension(path).toLowerCase(); + switch (ext) { + case '.txt': + return 'text/plain'; + case '.json': + return 'application/json'; + case '.png': + return 'image/png'; + case '.jpg': + case '.jpeg': + return 'image/jpeg'; + case '.pdf': + return 'application/pdf'; + default: + return 'application/octet-stream'; + } + } + + Future _replaceExisting(String localPath, String s3Key, String contentType) async { + final envUrl = const String.fromEnvironment('ASSET_MANAGER_URL'); + final baseUrl = envUrl.isNotEmpty ? envUrl : assetManagerUrl; + final presignRes = await dio.post('$baseUrl/assets/presign-replace', data: { + 's3_key': s3Key, + 'owner_id': uniqueId, + 'content_type': contentType, + }); + + final uploadUrl = presignRes.data['upload_url']; + final assetId = presignRes.data['asset_id']; + + final file = File(localPath); + final bytes = await file.readAsBytes(); + + // Perform upload and capture full response for diagnostics (don't throw immediately on 500) + final putRes = await dio.put( + uploadUrl, + data: Stream.fromIterable([bytes]), + options: Options( + headers: { + 'Content-Type': contentType, + 'Content-Length': bytes.length.toString(), + }, + validateStatus: (status) => true, + ), + ); + + if (putRes.statusCode == null || putRes.statusCode! >= 400) { + print('Upload (replace) failed. status=${putRes.statusCode} statusMessage=${putRes.statusMessage}'); + print('Upload (replace) response data: ${putRes.data}'); + _showSnack('Upload failed (status ${putRes.statusCode}). See logs for details.'); + throw DioException(requestOptions: RequestOptions(path: uploadUrl), response: putRes); + } + + await dio.post('$baseUrl/assets/complete-replace', data: { + 'asset_id': assetId, + 'size': bytes.length, + 'owner_id': uniqueId, + }); + _showSnack('Updated $s3Key'); + + // Update files list locally to reflect changes immediately + setState(() { + final idx = files.indexWhere((f) => f.key == s3Key); + if (idx != -1) { + files[idx] = FileItem( + key: s3Key, + name: files[idx].name, + size: bytes.length, + ); + } + }); + + try { + await _logEvent(eventType: 'upload_replace', folder: _currentFolderPrefix, s3Key: s3Key, localPath: localPath, size: bytes.length, status: 'ok'); + } catch (_) {} + + // Debounce refresh: batch rapid uploads into a single refresh 3 s after the last one + _refreshDebounceTimer?.cancel(); + _refreshDebounceTimer = Timer(const Duration(seconds: 3), _fetchFileListHttpFallback); + } + + Future _uploadNew(String localPath, String folderPrefix, String relativePath, String contentType) async { + // baseUrl resolved from env or fallback constant + final envUrl = const String.fromEnvironment('ASSET_MANAGER_URL'); + final baseUrl = envUrl.isNotEmpty ? envUrl : assetManagerUrl; + final normalizedFolderPrefix = folderPrefix.endsWith('/') ? folderPrefix : '$folderPrefix/'; + + // preserve folder structure separators + final normalizedRelativePath = relativePath.replaceAll('\\', '/'); + + // final S3 key we intend + final s3Key = '$normalizedFolderPrefix$normalizedRelativePath'; + + // determine directory part of relativePath (may be "." for root) + final String fileDir = p.dirname(normalizedRelativePath); + final String folderForPresign = (fileDir == '.' || fileDir.isEmpty) + ? normalizedFolderPrefix + : (normalizedFolderPrefix + (fileDir.endsWith('/') ? fileDir : '$fileDir/')); + + // presign payload: folder contains subfolder, filename is basename, still provide explicit s3_key + final presignPayload = { + 'folder': folderForPresign, + 'filename': p.basename(normalizedRelativePath), + 's3_key': s3Key, + 'content_type': contentType, + 'owner_id': uniqueId, + }; + + // debug: log what we are about to send + print('presignPayload: $presignPayload'); + + Response presignRes; + try { + presignRes = await dio.post( + '$baseUrl/assets/presign-upload', + data: presignPayload, + ); + } catch (e) { + throw Exception('Presign request failed: $e'); + } + + print('presign response: ${presignRes.data}'); + + // Use server-returned s3_key (server may sanitize filename, e.g. spaces → underscores) + String effectiveS3Key = s3Key; + String effectiveFilename = p.basename(normalizedRelativePath); + try { + final returnedKey = presignRes.data is Map ? presignRes.data['s3_key'] as String? : null; + if (returnedKey != null && returnedKey.isNotEmpty) { + if (returnedKey != s3Key) { + print('Note: server sanitized s3_key: $returnedKey (requested $s3Key) — using server key'); + } + effectiveS3Key = returnedKey; + effectiveFilename = effectiveS3Key.split('/').last; + } + } catch (_) {} + + // tolerant extraction of upload URL (some APIs use 'upload_url' or 'url' or 'put_url') + final uploadUrl = presignRes.data is Map + ? (presignRes.data['upload_url'] ?? presignRes.data['url'] ?? presignRes.data['put_url']) + : null; + + if (uploadUrl == null || uploadUrl.toString().isEmpty) { + throw Exception('Presign response missing upload URL: ${presignRes.data}'); + } + + final file = File(localPath); + if (!await file.exists()) throw Exception('File not found: $localPath'); + final bytes = await file.readAsBytes(); + + Response putRes; + try { + putRes = await dio.put( + uploadUrl, + data: bytes, + options: Options( + headers: {'Content-Type': contentType}, + ), + ); + } catch (e) { + throw Exception('Upload to S3 failed: $e'); + } + + final status = putRes.statusCode ?? 0; + if (status >= 400) { + throw Exception('Failed to upload new file to S3 (status $status)'); + } + + // Confirm upload so MongoDB record moves from status:uploading → active + try { + final presignAssetId = presignRes.data is Map ? presignRes.data['asset_id'] as String? : null; + if (presignAssetId != null) { + await dio.post('$baseUrl/assets/complete-upload', data: { + 'asset_id': presignAssetId, + 'size': bytes.length, + }); + } + } catch (e) { + print('Warning: failed to confirm upload on backend: $e'); + } + + // Update local metadata using the effective (server-assigned) key + try { + _knownS3Keys.add(effectiveS3Key); + _lastUploadedHash[localPath] = crypto.sha256.convert(bytes).toString(); + final stat = await file.stat(); + final lastModified = stat.modified.millisecondsSinceEpoch; + _syncMeta[localPath] = { + 'lastModified': lastModified, + 'hash': _lastUploadedHash[localPath], + }; + + // Add to files list so UI updates immediately + setState(() { + final newItem = FileItem( + key: effectiveS3Key, + name: effectiveFilename, + size: bytes.length, + ); + files.removeWhere((f) => f.key == effectiveS3Key || f.key == s3Key); + files.add(newItem); + }); + + await _logEvent(eventType: 'upload_new', folder: folderForPresign, s3Key: effectiveS3Key, localPath: localPath, status: 'ok'); + + // Debounce refresh: batch rapid uploads into a single refresh 3 s after the last one + _refreshDebounceTimer?.cancel(); + _refreshDebounceTimer = Timer(const Duration(seconds: 3), _fetchFileListHttpFallback); + } catch (e) { + print('Warning: failed to update local sync metadata: $e'); + } + + print('Uploaded $localPath → $s3Key'); + } + + Future downloadFile(FileItem item) async { + final presigned = await fetchPresignedUrl(item.key); + if (presigned == null) return null; + + await _unlockStorage(); // lift immutable flag before writing + final base = _storageBasePath.isNotEmpty ? _storageBasePath : (Platform.environment['HOME'] ?? ''); + final downloadsDir = Directory(p.join(base, 'Downloads')); + if (!await downloadsDir.exists()) { + await downloadsDir.create(recursive: true); + } + + final targetPath = p.join(downloadsDir.path, item.name); + final tempPath = '$targetPath.part'; + + final token = CancelToken(); + item.cancelToken = token; + item.isDownloading = true; + item.received = 0; + item.total = 0; + + void updateState() => setState(() {}); + + try { + await dio.download( + presigned, + tempPath, + cancelToken: token, + options: Options(responseType: ResponseType.stream, followRedirects: true), + onReceiveProgress: (received, total) { + item.received = received; + item.total = total; + updateState(); + + // report progress to server via WebSocket (non-blocking) + if (_wsOpen) { + try { + _ws!.add(jsonEncode({ + 'type': 'download_progress', + 'data': {'key': item.key, 'received': received, 'total': total} + })); + } catch (e) { + // ignore WS send errors (non-fatal) + } + } + }, + ); + + final tmp = File(tempPath); + final finalFile = File(targetPath); + if (await finalFile.exists()) { + // overwrite + await finalFile.delete(); + } + await tmp.rename(finalFile.path); + item.localPath = finalFile.path; + _showSnack('Saved ${item.name} → ${finalFile.path}'); + + // notify server of completion + if (_wsOpen) { + try { + _ws!.add(jsonEncode({ + 'type': 'download_complete', + 'data': {'key': item.key, 'path': item.localPath} + })); + } catch (_) {} + } + + return finalFile; + } on DioException catch (e) { + if (CancelToken.isCancel(e)) { + _showSnack('Download cancelled: ${item.name}'); + } else { + _showSnack('Download failed: ${item.name} (${e.message})'); + } + return null; + } catch (e) { + _showSnack('Download error: $e'); + return null; + } finally { + item.isDownloading = false; + item.cancelToken = null; + item.received = 0; + item.total = 0; + updateState(); + await _lockStorage(); // re-apply hidden + immutable flag + } + } + + void cancelDownload(FileItem item) { + if (item.cancelToken != null && !item.cancelToken!.isCancelled) { + item.cancelToken!.cancel('user cancelled'); + } + } + + void openInFinder(String path) { + // macOS: open containing folder in Finder + Process.run('open', ['-R', path]); + } + + void _showSnack(String message) { + // Prefer global messenger key to avoid early-lifecycle issues + final messenger = rootMessengerKey.currentState; + if (messenger != null) { + messenger.showSnackBar(SnackBar(content: Text(message))); + return; + } + + // Fallback to context-based messenger when available + if (mounted) { + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(message))); + } else { + // Schedule after first frame if neither is ready + WidgetsBinding.instance.addPostFrameCallback((_) { + final m2 = rootMessengerKey.currentState; + m2?.showSnackBar(SnackBar(content: Text(message))); + }); + } + } + + String prettyBytes(int bytes) { + if (bytes < 1024) return '$bytes B'; + if (bytes < 1024 * 1024) return '${(bytes / 1024).toStringAsFixed(1)} KB'; + return '${(bytes / (1024 * 1024)).toStringAsFixed(1)} MB'; + } + + // ─── New 3-column Dropinside-style layout ─────────────────────────────────── + + /// Sidebar selection: null = All Files overview, non-null = selected folder + String? _selectedSidebarFolder; + /// Sub-folder navigation stack within the selected sidebar folder. + final List _folderNavStack = []; + /// Search text in center pane + String _searchQuery = ''; + /// Selected file for the right-panel file-details view + FileItem? _selectedFile; + /// Whether the right panel is showing file details (true) or sync status (false) + bool _showFileDetails = false; + + @override + Widget build(BuildContext context) { + return MaterialApp( + debugShowCheckedModeBanner: false, + title: 'Plan XO', + scaffoldMessengerKey: rootMessengerKey, + navigatorKey: rootNavigatorKey, + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFFE2601A)), + useMaterial3: true, + fontFamily: 'Inter', + ), + home: loading + ? const Scaffold(body: Center(child: CircularProgressIndicator())) + : !_isAuthenticated + ? _buildLoginScreen() + : _buildMainShell(), + ); + } + + // ── Main shell: top bar + 3 columns ───────────────────────────────────────── + Widget _buildMainShell() { + return Scaffold( + backgroundColor: const Color(0xFFF0F2F5), + body: Column( + children: [ + _buildTopBar(), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildLeftSidebar(), + Expanded(child: _buildCenterPane()), + _buildRightPanel(), + ], + ), + ), + ], + ), + ); + } + + // ── Brand colour ───────────────────────────────────────────────────────────── + static const _coral = Color(0xFFE2601A); + + // ── Top bar ────────────────────────────────────────────────────────────────── + Widget _buildTopBar() { + final pending = _changes.where((c) => c.status != 'synced').length; + final username = _userInfo != null + ? ((_userInfo!['username'] as String?) ?? 'U') + : (_clientName.isNotEmpty ? _clientName : 'U'); + final initial = username.substring(0, 1).toUpperCase(); + + return Container( + height: 52, + decoration: const BoxDecoration( + color: Colors.white, + border: Border(bottom: BorderSide(color: Color(0xFFEEEEEE))), + ), + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Row( + children: [ + Container( + width: 30, height: 30, + decoration: BoxDecoration(color: _coral, borderRadius: BorderRadius.circular(8)), + child: const Icon(Icons.folder_rounded, color: Colors.white, size: 17), + ), + const SizedBox(width: 10), + const Text('PlanXO', style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold, color: Color(0xFF1A1A2E))), + const Spacer(), + // WS status pill + Container( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4), + decoration: BoxDecoration( + color: _wsOpen ? const Color(0xFFEAF6EC) : const Color(0xFFFCECEC), + borderRadius: BorderRadius.circular(20), + ), + child: Row(mainAxisSize: MainAxisSize.min, children: [ + _buildWsIndicator(), + const SizedBox(width: 5), + Text( + _wsOpen ? 'Online' : (_wsConnecting ? 'Connecting…' : 'Offline'), + style: TextStyle( + fontSize: 11, fontWeight: FontWeight.w600, + color: _wsOpen ? Colors.green.shade700 : Colors.red.shade700, + ), + ), + ]), + ), + if (pending > 0) ...[ + const SizedBox(width: 8), + Container( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4), + decoration: BoxDecoration( + color: const Color(0xFFFFF3EC), + borderRadius: BorderRadius.circular(20), + border: Border.all(color: _coral.withValues(alpha: 0.3)), + ), + child: Row(mainAxisSize: MainAxisSize.min, children: [ + const Icon(Icons.sync_outlined, size: 12, color: _coral), + const SizedBox(width: 4), + Text('$pending pending', style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w600, color: _coral)), + ]), + ), + ], + const SizedBox(width: 12), + PopupMenuButton( + tooltip: '', + onSelected: (val) { + if (val == 'logout') { + WidgetsBinding.instance.addPostFrameCallback((_) async { + await _clearAuthKey(); + _showSnack('Logged out successfully'); + }); + } else if (val == 'storage') { + _showStorageDialog(); + } + }, + itemBuilder: (_) => [ + const PopupMenuItem(value: 'storage', child: Row(children: [Icon(Icons.folder_outlined, size: 16), SizedBox(width: 8), Text('Storage settings')])), + const PopupMenuDivider(), + const PopupMenuItem(value: 'logout', child: Row(children: [Icon(Icons.logout_rounded, size: 16), SizedBox(width: 8), Text('Logout')])), + ], + child: Row(mainAxisSize: MainAxisSize.min, children: [ + CircleAvatar(radius: 15, backgroundColor: _coral, child: Text(initial, style: const TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.bold))), + const SizedBox(width: 4), + const Icon(Icons.keyboard_arrow_down_rounded, size: 16, color: Color(0xFF888888)), + ]), + ), + ], + ), + ); + } + + Widget _topBarTab(String label, bool active) { + return InkWell( + onTap: () {}, + borderRadius: BorderRadius.circular(6), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(label, + style: TextStyle( + fontSize: 14, + fontWeight: active ? FontWeight.w600 : FontWeight.normal, + color: active ? const Color(0xFF1A1A2E) : const Color(0xFF888888), + )), + const SizedBox(height: 2), + if (active) + Container( + height: 2, width: 36, + decoration: BoxDecoration( + color: const Color(0xFF1A73E8), + borderRadius: BorderRadius.circular(2), + ), + ), + ], + ), + ), + ); + } + + // ── Left Sidebar ───────────────────────────────────────────────────────────── + Widget _buildLeftSidebar() { + final recent = files.take(6).toList(); + return Container( + width: 248, + decoration: const BoxDecoration( + color: Colors.white, + border: Border(right: BorderSide(color: Color(0xFFEEEEEE))), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Header + Padding( + padding: const EdgeInsets.fromLTRB(16, 16, 12, 10), + child: Row(children: [ + const Text('Files', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF1A1A2E))), + const Spacer(), + IconButton(icon: const Icon(Icons.open_in_full_rounded, size: 14, color: Color(0xFFAAAAAA)), onPressed: _showStorageDialog, visualDensity: VisualDensity.compact, tooltip: 'Storage'), + ]), + ), + // Search bar + Padding( + padding: const EdgeInsets.fromLTRB(12, 0, 12, 12), + child: Container( + height: 34, + decoration: BoxDecoration(color: const Color(0xFFF3F4F6), borderRadius: BorderRadius.circular(10)), + child: TextField( + onChanged: (v) => setState(() => _searchQuery = v.toLowerCase()), + style: const TextStyle(fontSize: 13), + decoration: const InputDecoration( + hintText: 'Search…', + hintStyle: TextStyle(fontSize: 13, color: Color(0xFFAAAAAA)), + prefixIcon: Icon(Icons.search, size: 16, color: Color(0xFFAAAAAA)), + border: InputBorder.none, + contentPadding: EdgeInsets.symmetric(vertical: 8), + ), + ), + ), + ), + // CATEGORIES label + Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 6), + child: Text('CATEGORIES', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.grey.shade500, letterSpacing: 0.8)), + ), + // All Files + _sidebarCategoryRow(icon: Icons.grid_view_rounded, label: 'All Files', count: folders.length + localFolders.length, + selected: _selectedSidebarFolder == null, onTap: () => setState(() { _selectedSidebarFolder = null; _folderNavStack.clear(); }), active: true), + // Remote folders + for (final folder in folders) + _sidebarCategoryRow(icon: Icons.folder_rounded, label: folder.replaceAll(RegExp(r'/$'), '').split('/').last, count: null, + selected: _selectedSidebarFolder == folder, onTap: () => setState(() { _selectedSidebarFolder = folder; _folderNavStack.clear(); }), active: false), + // Local folders + for (final full in localFolders) + _sidebarCategoryRow(icon: Icons.folder_open_rounded, label: p.basename(full), count: null, + selected: _selectedSidebarFolder == full, onTap: () => setState(() { _selectedSidebarFolder = full; _folderNavStack.clear(); }), active: false, isLocal: true), + + const SizedBox(height: 8), + const Padding(padding: EdgeInsets.symmetric(horizontal: 16), child: Divider(height: 1, color: Color(0xFFF0F0F0))), + const SizedBox(height: 8), + + // LATEST FILES label + Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 12, 8), + child: Row(children: [ + Text('LATEST FILES', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.grey.shade500, letterSpacing: 0.8)), + const Spacer(), + GestureDetector(onTap: fetchFileList, child: const Icon(Icons.add, size: 16, color: Color(0xFFAAAAAA))), + ]), + ), + + // Recent files list + Expanded( + child: SingleChildScrollView( + child: Column(children: [ + if (recent.isEmpty) + const Padding(padding: EdgeInsets.all(16), child: Text('No files yet', style: TextStyle(fontSize: 12, color: Color(0xFFAAAAAA)))) + else + for (final file in recent) _sidebarFileRow(file), + ]), + ), + ), + + // Footer: user info + if (_userInfo != null) + Container( + padding: const EdgeInsets.fromLTRB(16, 10, 16, 14), + decoration: const BoxDecoration(border: Border(top: BorderSide(color: Color(0xFFF0F0F0)))), + child: Row(children: [ + CircleAvatar(radius: 13, backgroundColor: _coral, child: Text( + ((_userInfo!['username'] as String?) ?? 'U').substring(0, 1).toUpperCase(), + style: const TextStyle(color: Colors.white, fontSize: 11, fontWeight: FontWeight.bold), + )), + const SizedBox(width: 8), + Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text((_userInfo!['username'] as String?) ?? '', style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis), + Text((_userInfo!['role'] as String?) ?? '', style: const TextStyle(fontSize: 10, color: Color(0xFFAAAAAA))), + ])), + ]), + ), + ], + ), + ); + } + + Widget _sidebarCategoryRow({required IconData icon, required String label, required int? count, required bool selected, required VoidCallback onTap, required bool active, bool isLocal = false}) { + final isSyncing = isLocal + ? localFolders.any((f) => p.basename(f) == label && _currentProjectDir?.path == f) + : (_currentFolderPrefix != null && _currentFolderPrefix!.contains(label)); + return GestureDetector( + onTap: onTap, + child: Container( + margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 1), + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), + decoration: BoxDecoration(color: selected ? _coral : Colors.transparent, borderRadius: BorderRadius.circular(10)), + child: Row(children: [ + Container( + width: 26, height: 26, + decoration: BoxDecoration(color: selected ? Colors.white.withValues(alpha: 0.25) : const Color(0xFFF0F0F0), borderRadius: BorderRadius.circular(7)), + child: Icon(icon, size: 14, color: selected ? Colors.white : (isLocal ? const Color(0xFFFBBC04) : const Color(0xFF888888))), + ), + const SizedBox(width: 10), + Expanded(child: Text(label, style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500, color: selected ? Colors.white : const Color(0xFF444444)), overflow: TextOverflow.ellipsis)), + if (isSyncing) Container(width: 6, height: 6, decoration: const BoxDecoration(color: Colors.green, shape: BoxShape.circle)), + if (count != null && count > 0) ...[ + const SizedBox(width: 4), + Container( + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + decoration: BoxDecoration(color: selected ? Colors.white.withValues(alpha: 0.25) : const Color(0xFFE5E7EB), borderRadius: BorderRadius.circular(10)), + child: Text('$count', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: selected ? Colors.white : const Color(0xFF666666))), + ), + ] else + Icon(active ? Icons.keyboard_arrow_down : Icons.chevron_right, size: 14, color: selected ? Colors.white.withValues(alpha: 0.7) : const Color(0xFFCCCCCC)), + ]), + ), + ); + } + + Widget _sidebarFileRow(FileItem file) { + final ext = file.name.contains('.') ? file.name.split('.').last.toLowerCase() : ''; + final sizeStr = file.size != null + ? (file.size! > 1024 * 1024 ? '${(file.size! / (1024 * 1024)).toStringAsFixed(1)} MB' : '${(file.size! / 1024).toStringAsFixed(1)} KB') + : '—'; + final isSelected = _selectedFile?.key == file.key; + return GestureDetector( + onTap: () => setState(() { _selectedFile = file; _showFileDetails = true; }), + child: Container( + margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 1), + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7), + decoration: BoxDecoration(color: isSelected ? const Color(0xFFFFF3EC) : Colors.transparent, borderRadius: BorderRadius.circular(10)), + child: Row(children: [ + Container(width: 32, height: 32, + decoration: BoxDecoration(color: _fileExtColor(ext).withValues(alpha: 0.12), borderRadius: BorderRadius.circular(8)), + child: Icon(_fileIcon(ext), size: 16, color: _fileExtColor(ext))), + const SizedBox(width: 8), + Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text(file.name, style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w500, color: Color(0xFF333333)), overflow: TextOverflow.ellipsis), + Text(sizeStr, style: const TextStyle(fontSize: 10, color: Color(0xFFAAAAAA))), + ])), + const Icon(Icons.more_horiz, size: 14, color: Color(0xFFCCCCCC)), + ]), + ), + ); + } + + Color _fileExtColor(String ext) { + switch (ext) { + case 'pdf': return const Color(0xFFD85A30); + case 'ai': case 'eps': return const Color(0xFF3B6D11); + case 'psd': case 'png': case 'jpg': case 'jpeg': return const Color(0xFF185FA5); + case 'xls': case 'xlsx': case 'csv': return const Color(0xFF0F6E56); + case 'doc': case 'docx': return const Color(0xFF2563EB); + default: return const Color(0xFF888888); + } + } + + Widget _sidebarSectionHeader(String label, String count) { + return Padding( + padding: const EdgeInsets.fromLTRB(12, 8, 12, 2), + child: Row( + children: [ + Text(label.toUpperCase(), style: const TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFFAAAAAA), letterSpacing: 0.5)), + const SizedBox(width: 4), + Text(count, style: const TextStyle(fontSize: 10, color: Color(0xFFAAAAAA))), + ], + ), + ); + } + + Widget _sidebarItem({required IconData icon, required Color iconColor, required String label, required bool selected, required VoidCallback onTap}) { + return InkWell( + onTap: onTap, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 7), + decoration: BoxDecoration( + color: selected ? const Color(0xFFE8F0FE) : Colors.transparent, + borderRadius: BorderRadius.circular(6), + ), + margin: const EdgeInsets.symmetric(horizontal: 4, vertical: 1), + child: Row( + children: [ + Icon(icon, size: 16, color: selected ? const Color(0xFF1A73E8) : iconColor), + const SizedBox(width: 8), + Expanded(child: Text(label, style: TextStyle(fontSize: 13, color: selected ? const Color(0xFF1A73E8) : const Color(0xFF333333), fontWeight: selected ? FontWeight.w600 : FontWeight.normal), overflow: TextOverflow.ellipsis)), + ], + ), + ), + ); + } + + Widget _sidebarFolderTile(String folderPath, {required bool isLocal}) { + final displayName = isLocal ? p.basename(folderPath) : folderPath.replaceAll(RegExp(r'/$'), '').split('/').last; + final fullLabel = isLocal ? folderPath : folderPath; + final selected = _selectedSidebarFolder == fullLabel; + final isSyncing = _currentFolderPrefix == folderPath || (isLocal && _currentProjectDir?.path == folderPath); + return InkWell( + onTap: () => setState(() { _selectedSidebarFolder = fullLabel; _folderNavStack.clear(); }), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 7), + decoration: BoxDecoration( + color: selected ? const Color(0xFFE8F0FE) : Colors.transparent, + borderRadius: BorderRadius.circular(6), + ), + margin: const EdgeInsets.symmetric(horizontal: 4, vertical: 1), + child: Row( + children: [ + Icon( + isLocal ? Icons.folder_open_rounded : Icons.folder_rounded, + size: 16, + color: selected ? const Color(0xFF1A73E8) : const Color(0xFFFBBC04), + ), + const SizedBox(width: 8), + Expanded(child: Text(displayName, style: TextStyle(fontSize: 13, color: selected ? const Color(0xFF1A73E8) : const Color(0xFF333333), fontWeight: selected ? FontWeight.w600 : FontWeight.normal), overflow: TextOverflow.ellipsis)), + if (isSyncing) + Container( + width: 7, height: 7, + decoration: const BoxDecoration(color: Colors.green, shape: BoxShape.circle), + ), + ], + ), + ), + ); + } + + // ── Center Pane ────────────────────────────────────────────────────────────── + Widget _buildCenterPane() { + // Current folder display name + final folderLabel = _selectedSidebarFolder == null + ? 'All Files' + : (_selectedSidebarFolder!.contains('/') + ? _selectedSidebarFolder!.replaceAll(RegExp(r'/$'), '').split('/').last + : p.basename(_selectedSidebarFolder!)); + final totalCount = folders.length + localFolders.length + files.length; + + return Column( + children: [ + // Folder header bar (matches screenshot) + Container( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12), + decoration: const BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: Color(0xFFEEEEEE)))), + child: Row( + children: [ + // Coral folder icon + Container( + width: 48, height: 48, + decoration: BoxDecoration(color: _coral, borderRadius: BorderRadius.circular(14)), + child: const Icon(Icons.folder_rounded, color: Colors.white, size: 26), + ), + const SizedBox(width: 14), + Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text(folderLabel, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Color(0xFF1A1A2E))), + Text('$totalCount items${_selectedSidebarFolder != null ? ' in folder' : ''}', + style: const TextStyle(fontSize: 12, color: Color(0xFFAAAAAA))), + ])), + // Refresh + IconButton(icon: const Icon(Icons.refresh, size: 18, color: Color(0xFFAAAAAA)), onPressed: fetchFileList, tooltip: 'Refresh'), + // Sync Now button (if folder selected) + if (_selectedSidebarFolder != null) + GestureDetector( + onTap: () async { + final isLocal = localFolders.contains(_selectedSidebarFolder); + if (isLocal) { _useLocalFolderAsProject(_selectedSidebarFolder!); } + else { await _downloadAndExtractFolder(_selectedSidebarFolder!); } + }, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8), + decoration: BoxDecoration(color: _coral, borderRadius: BorderRadius.circular(10)), + child: const Row(children: [ + Icon(Icons.sync, size: 14, color: Colors.white), + SizedBox(width: 5), + Text('Sync', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: Colors.white)), + ]), + ), + ), + ], + ), + ), + // Body + Expanded( + child: _selectedSidebarFolder == null + ? _buildOverviewContent() + : _buildFolderDetailContent(_selectedSidebarFolder!), + ), + ], + ); + } + + // Dummy LayoutBuilder row to avoid compile errors from removed toolbar: + + // Overview: recent folders grid + full folder table + Widget _buildOverviewContent() { + // Build (displayName, selectionKey) pairs so tapping a recent-folder card passes + // the correct value to _selectedSidebarFolder: + // • local folders → selectionKey = full disk path (so isLocal lookup works) + // • remote folders → selectionKey = S3 prefix key + final allFolderEntries = [ + ...localFolders.map((f) => (p.basename(f), f)), + ...folders.where((key) { + final base = key.replaceAll(RegExp(r'/$'), '').split('/').last; + return !localFolders.any((lf) => p.basename(lf) == base); + }).map((key) => (key.replaceAll(RegExp(r'/$'), '').split('/').last, key)), + ]; + final allFolderNames = [ + ...localFolders.map((f) => p.basename(f)), + ...folders, + ]; + final recentFolders = allFolderNames.take(5).toList(); + final recentEntries = allFolderEntries.take(5).toList(); + + return SingleChildScrollView( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Breadcrumb + Row(children: [ + const Text('Home', style: TextStyle(fontSize: 13, color: Color(0xFF888888))), + const Text(' / ', style: TextStyle(fontSize: 13, color: Color(0xFF888888))), + const Text('All Folders', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: Color(0xFF1A1A2E))), + const Spacer(), + IconButton( + icon: const Icon(Icons.refresh, size: 18), + onPressed: () => fetchFileList(), + tooltip: 'Refresh', + visualDensity: VisualDensity.compact, + ), + ]), + const SizedBox(height: 12), + // Recent folders grid + if (recentEntries.isNotEmpty) ...[ + const Text('Recent Files', style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600)), + const SizedBox(height: 10), + SizedBox( + height: 120, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: recentEntries.length, + separatorBuilder: (_, __) => const SizedBox(width: 10), + itemBuilder: (context, i) { + final (displayName, selectionKey) = recentEntries[i]; + return GestureDetector( + onTap: () => setState(() { _selectedSidebarFolder = selectionKey; _folderNavStack.clear(); }), + child: Container( + width: 100, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + border: Border.all(color: const Color(0xFFE5E7EB)), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.folder_rounded, color: Color(0xFFFBBC04), size: 40), + const SizedBox(height: 6), + Text(displayName, style: const TextStyle(fontSize: 11), textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, maxLines: 2), + ], + ), + ), + ); + }, + ), + ), + const SizedBox(height: 20), + ], + // Folders table + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + border: Border.all(color: const Color(0xFFE5E7EB)), + ), + child: Column( + children: [ + // Header + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + child: Row(children: [ + const SizedBox(width: 24), + const Expanded(flex: 4, child: Text('Name', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xFF888888)))), + const Expanded(flex: 2, child: Text('Type', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xFF888888)))), + const Expanded(flex: 2, child: Text('Status', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xFF888888)))), + const SizedBox(width: 100), + ]), + ), + const Divider(height: 1), + // Remote folders + ...folders.where((f) => _searchQuery.isEmpty || f.toLowerCase().contains(_searchQuery)).map((folder) { + final cfg = _syncSettings[folder] is Map ? _syncSettings[folder] as Map : null; + final enabled = cfg != null && cfg['enabled'] == true; + final interval = cfg != null && cfg['interval'] is int ? cfg['interval'] as int : 15; + return _folderTableRow( + name: folder.replaceAll(RegExp(r'/$'), '').split('/').last, + fullPath: folder, + type: 'Remote Folder', + enabled: enabled, + interval: interval, + isLocal: false, + ); + }), + // Local folders + ...localFolders.where((f) => _searchQuery.isEmpty || f.toLowerCase().contains(_searchQuery)).map((full) { + final cfg = _syncSettings[full] is Map ? _syncSettings[full] as Map : null; + final enabled = cfg != null && cfg['enabled'] == true; + final interval = cfg != null && cfg['interval'] is int ? cfg['interval'] as int : 15; + return _folderTableRow( + name: p.basename(full), + fullPath: full, + type: 'Local Folder', + enabled: enabled, + interval: interval, + isLocal: true, + ); + }), + if (folders.isEmpty && localFolders.isEmpty) + const Padding( + padding: EdgeInsets.all(32), + child: Center(child: Text('No folders found. Connect to sync.', style: TextStyle(color: Color(0xFF888888)))), + ), + ], + ), + ), + ], + ), + ); + } + + Widget _folderTableRow({required String name, required String fullPath, required String type, required bool enabled, required int interval, required bool isLocal}) { + final isSyncing = _currentFolderPrefix == fullPath || (isLocal && _currentProjectDir?.path == fullPath); + return InkWell( + onTap: () => setState(() { _selectedSidebarFolder = fullPath; _folderNavStack.clear(); }), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Color(0xFFF3F4F6)))), + child: Row( + children: [ + const SizedBox(width: 4), + Icon(Icons.folder_rounded, color: const Color(0xFFFBBC04), size: 18), + const SizedBox(width: 20), + Expanded(flex: 4, child: Text(name, style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis)), + Expanded(flex: 2, child: Text(type, style: const TextStyle(fontSize: 12, color: Color(0xFF888888)))), + Expanded( + flex: 2, + child: Row(children: [ + Container( + width: 7, height: 7, + decoration: BoxDecoration( + color: isSyncing ? Colors.green : (enabled ? const Color(0xFF1A73E8) : Colors.grey), + shape: BoxShape.circle, + ), + ), + const SizedBox(width: 6), + Text(isSyncing ? 'Syncing' : (enabled ? 'Auto ($interval min)' : 'Manual'), + style: const TextStyle(fontSize: 12, color: Color(0xFF888888))), + ]), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.sync, size: 16, color: Color(0xFF1A73E8)), + onPressed: () async { + if (isLocal) { + _useLocalFolderAsProject(fullPath); + } else { + await _downloadAndExtractFolder(fullPath); + } + }, + tooltip: 'Sync now', + visualDensity: VisualDensity.compact, + ), + IconButton( + icon: const Icon(Icons.settings_outlined, size: 16, color: Color(0xFF888888)), + onPressed: () => _showIntervalDialog(fullPath), + tooltip: 'Settings', + visualDensity: VisualDensity.compact, + ), + Switch.adaptive( + value: enabled, + onChanged: (v) => _toggleSyncForFolder(fullPath, v), + ), + ], + ), + ], + ), + ), + ); + } + + // Folder detail: browses the folder tree at the current nav level + Widget _buildFolderDetailContent(String folderPath) { + final isLocal = localFolders.contains(folderPath); + final folderBaseName = p.basename(folderPath.replaceAll(RegExp(r'/$'), '')); + + // Current browsed path: top of nav-stack (or the root folder itself) + final String currentBrowsePath = _folderNavStack.isNotEmpty + ? _folderNavStack.last + : folderPath; + + // Breadcrumb: root segment + one per nav-stack entry + final List crumbLabels = [ + folderBaseName, + ..._folderNavStack.map((seg) => + isLocal ? p.basename(seg) : seg.replaceAll(RegExp(r'/$'), '').split('/').last), + ]; + + final pendingChanges = _changes + .where((c) => + c.status != 'synced' && + (c.path.contains(folderBaseName) || + (c.remoteItem?.key.contains(folderBaseName) ?? false))) + .toList(); + + return SingleChildScrollView( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // ── Breadcrumb + actions ───────────────────────────────────────── + Row( + children: [ + GestureDetector( + onTap: () => setState(() { _selectedSidebarFolder = null; _folderNavStack.clear(); }), + child: const Text('Home', style: TextStyle(fontSize: 13, color: Color(0xFF1A73E8), decoration: TextDecoration.underline)), + ), + ...List.generate(crumbLabels.length, (i) { + final isLast = i == crumbLabels.length - 1; + final label = crumbLabels[i]; + return Row(mainAxisSize: MainAxisSize.min, children: [ + const Text(' / ', style: TextStyle(fontSize: 13, color: Color(0xFF888888))), + isLast + ? Text(label, style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: Color(0xFF1A1A2E))) + : GestureDetector( + onTap: () => setState(() { + if (i == 0) { + _folderNavStack.clear(); + } else { + while (_folderNavStack.length > i) _folderNavStack.removeLast(); + } + }), + child: Text(label, style: const TextStyle(fontSize: 13, color: Color(0xFF1A73E8), decoration: TextDecoration.underline)), + ), + ]); + }), + const Spacer(), + ElevatedButton.icon( + onPressed: () async { + if (isLocal) { + _useLocalFolderAsProject(folderPath); + } else { + await _downloadAndExtractFolder(folderPath); + } + }, + icon: const Icon(Icons.sync, size: 14), + label: const Text('Sync Folder'), + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFF1A73E8), + foregroundColor: Colors.white, + visualDensity: VisualDensity.compact, + textStyle: const TextStyle(fontSize: 12), + ), + ), + const SizedBox(width: 8), + OutlinedButton.icon( + onPressed: () { + final openPath = isLocal + ? currentBrowsePath + : (_storageBasePath.isNotEmpty ? p.join(_storageBasePath, folderBaseName) : folderPath); + Process.run('open', [openPath]); + }, + icon: const Icon(Icons.open_in_new, size: 14), + label: const Text('Open'), + style: OutlinedButton.styleFrom(visualDensity: VisualDensity.compact, textStyle: const TextStyle(fontSize: 12)), + ), + ], + ), + const SizedBox(height: 16), + + // ── Contents table ──────────────────────────────────────────────── + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + border: Border.all(color: const Color(0xFFE5E7EB)), + ), + child: FutureBuilder<_FolderListing>( + future: _listFolderLevel( + isLocal: isLocal, + currentBrowsePath: currentBrowsePath, + folderBaseName: folderBaseName, + ), + builder: (ctx, snap) { + if (snap.connectionState == ConnectionState.waiting) { + return const Padding( + padding: EdgeInsets.all(48), + child: Center(child: CircularProgressIndicator(strokeWidth: 2)), + ); + } + final listing = snap.data ?? _FolderListing(subFolders: [], fileRows: []); + final q = _searchQuery.toLowerCase(); + final filteredFolders = listing.subFolders.where((s) => q.isEmpty || s.name.toLowerCase().contains(q)).toList(); + final filteredFiles = listing.fileRows.where((r) => q.isEmpty || r.name.toLowerCase().contains(q)).toList(); + final hasContent = filteredFolders.isNotEmpty || filteredFiles.isNotEmpty; + + return Column(children: [ + // Header + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + child: Row(children: [ + const Expanded(flex: 4, child: Text('Name', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xFF888888)))), + const Expanded(flex: 2, child: Text('Type', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xFF888888)))), + const Expanded(flex: 1, child: Text('Size', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xFF888888)))), + const Expanded(flex: 2, child: Text('Status', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xFF888888)))), + const SizedBox(width: 40), + ]), + ), + const Divider(height: 1), + if (!hasContent) + const Padding( + padding: EdgeInsets.all(32), + child: Center(child: Text('This folder is empty.', style: TextStyle(color: Color(0xFF888888)))), + ) + else ...[ + ...filteredFolders.map((sub) => _subFolderRow(sub)), + ...filteredFiles.map((row) => _localFileRow(row)), + ], + ]); + }, + ), + ), + + // ── Pending changes ─────────────────────────────────────────────── + if (pendingChanges.isNotEmpty) ...[ + const SizedBox(height: 16), + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + border: Border.all(color: const Color(0xFFE5E7EB)), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 8), + child: Row(children: [ + const Icon(Icons.pending_outlined, size: 16, color: Color(0xFF1A73E8)), + const SizedBox(width: 8), + Text('Pending Changes (${pendingChanges.length})', style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w600)), + ]), + ), + const Divider(height: 1), + ...pendingChanges.map((change) => _pendingChangeRow(change)), + ], + ), + ), + ], + ], + ), + ); + } + + /// Lists sub-folders and files at the given browse level. + Future<_FolderListing> _listFolderLevel({ + required bool isLocal, + required String currentBrowsePath, + required String folderBaseName, + }) async { + if (isLocal) { + final dir = Directory(currentBrowsePath); + if (!await dir.exists()) return _FolderListing(subFolders: [], fileRows: []); + + final entities = await dir.list(recursive: false, followLinks: false).toList(); + entities.sort((a, b) { + final ad = a is Directory ? 0 : 1; + final bd = b is Directory ? 0 : 1; + if (ad != bd) return ad - bd; + return p.basename(a.path).toLowerCase().compareTo(p.basename(b.path).toLowerCase()); + }); + + final subFolders = <_SubFolderEntry>[]; + final fileRows = <_FileRow>[]; + for (final e in entities) { + final name = p.basename(e.path); + if (name.startsWith('.')) continue; + if (e is Directory) { + subFolders.add(_SubFolderEntry(name: name, fullPath: e.path)); + } else if (e is File) { + FileStat? stat; + try { stat = e.statSync(); } catch (_) {} + fileRows.add(_FileRow( + name: name, + ext: name.contains('.') ? name.split('.').last.toLowerCase() : '', + sizeBytes: stat?.size, + status: 'local', + )); + } + } + return _FolderListing(subFolders: subFolders, fileRows: fileRows); + } else { + // Remote: derive from in-memory files list + final prefix = currentBrowsePath.endsWith('/') ? currentBrowsePath : '$currentBrowsePath/'; + final matchingFiles = files.where((f) => + f.key.startsWith(prefix) || + f.key.contains('/$folderBaseName/') || + f.key.startsWith('$folderBaseName/')).toList(); + + final effectivePrefix = (matchingFiles.isNotEmpty && matchingFiles.first.key.startsWith(prefix)) + ? prefix + : ''; + + final subFolderNames = {}; + final fileRows = <_FileRow>[]; + for (final f in matchingFiles) { + final rel = effectivePrefix.isNotEmpty && f.key.startsWith(effectivePrefix) + ? f.key.substring(effectivePrefix.length) + : f.key; + final slash = rel.indexOf('/'); + if (slash > 0) { + subFolderNames.add(rel.substring(0, slash)); + } else if (slash == -1 && rel.isNotEmpty) { + final ext = f.name.contains('.') ? f.name.split('.').last.toLowerCase() : ''; + final change = _changes.where((c) => c.remoteItem?.key == f.key).firstOrNull; + fileRows.add(_FileRow( + name: f.name, + ext: ext, + sizeBytes: f.size, + status: change?.status ?? 'synced', + fileItem: f, + )); + } + } + + final sorted = subFolderNames.toList() + ..sort((a, b) => a.toLowerCase().compareTo(b.toLowerCase())); + return _FolderListing( + subFolders: sorted.map((name) => _SubFolderEntry( + name: name, + fullPath: '$effectivePrefix$name/', + fileCount: matchingFiles.where((f) { + final rel = effectivePrefix.isNotEmpty && f.key.startsWith(effectivePrefix) + ? f.key.substring(effectivePrefix.length) : f.key; + return rel.startsWith('$name/'); + }).length, + )).toList(), + fileRows: fileRows, + ); + } + } + + Widget _subFolderRow(_SubFolderEntry sub) { + return InkWell( + onTap: () => setState(() => _folderNavStack.add(sub.fullPath)), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Color(0xFFF3F4F6)))), + child: Row(children: [ + const Icon(Icons.folder_rounded, size: 18, color: Color(0xFFFBBC04)), + const SizedBox(width: 10), + Expanded( + flex: 4, + child: Text(sub.name, + style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500), + overflow: TextOverflow.ellipsis), + ), + const Expanded(flex: 2, child: Text('Folder', style: TextStyle(fontSize: 12, color: Color(0xFF888888)))), + Expanded( + flex: 1, + child: Text( + sub.fileCount != null ? '${sub.fileCount} items' : '—', + style: const TextStyle(fontSize: 12, color: Color(0xFF888888)), + ), + ), + const Expanded(flex: 2, child: SizedBox()), + const Icon(Icons.chevron_right, size: 16, color: Color(0xFFBBBBBB)), + const SizedBox(width: 8), + ]), + ), + ); + } + + Widget _localFileRow(_FileRow row) { + if (row.fileItem != null) return _fileTableRow(row.fileItem!); + final sizeStr = row.sizeBytes != null + ? (row.sizeBytes! > 1024 * 1024 + ? '${(row.sizeBytes! / (1024 * 1024)).toStringAsFixed(1)} MB' + : '${(row.sizeBytes! / 1024).toStringAsFixed(1)} KB') + : '—'; + return Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Color(0xFFF3F4F6)))), + child: Row(children: [ + Icon(_fileIcon(row.ext), size: 18, color: const Color(0xFF1A73E8)), + const SizedBox(width: 10), + Expanded(flex: 4, child: Text(row.name, style: const TextStyle(fontSize: 13), overflow: TextOverflow.ellipsis)), + Expanded(flex: 2, child: Text(row.ext.toUpperCase().isNotEmpty ? row.ext.toUpperCase() : 'File', style: const TextStyle(fontSize: 12, color: Color(0xFF888888)))), + Expanded(flex: 1, child: Text(sizeStr, style: const TextStyle(fontSize: 12, color: Color(0xFF888888)))), + Expanded( + flex: 2, + child: Row(children: [ + Container(width: 7, height: 7, decoration: BoxDecoration(color: _statusColor(row.status), shape: BoxShape.circle)), + const SizedBox(width: 6), + Text(_statusLabel(row.status), style: const TextStyle(fontSize: 12, color: Color(0xFF888888))), + ]), + ), + const SizedBox(width: 40), + ]), + ); + } + + Widget _fileTableRow(FileItem file) { + final ext = file.name.contains('.') ? file.name.split('.').last.toLowerCase() : ''; + final sizeStr = file.size != null ? '${(file.size! / 1024).toStringAsFixed(1)} KB' : '—'; + final change = _changes.where((c) => c.path.contains(file.name) || (c.remoteItem?.key == file.key)).firstOrNull; + final status = change?.status ?? 'synced'; + return Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Color(0xFFF3F4F6)))), + child: Row( + children: [ + Icon(_fileIcon(ext), size: 18, color: const Color(0xFF1A73E8)), + const SizedBox(width: 10), + Expanded(flex: 4, child: Text(file.name, style: const TextStyle(fontSize: 13), overflow: TextOverflow.ellipsis)), + Expanded(flex: 2, child: Text(ext.toUpperCase().isNotEmpty ? ext.toUpperCase() : 'File', style: const TextStyle(fontSize: 12, color: Color(0xFF888888)))), + Expanded(flex: 1, child: Text(sizeStr, style: const TextStyle(fontSize: 12, color: Color(0xFF888888)))), + Expanded( + flex: 2, + child: Row(children: [ + Container( + width: 7, height: 7, + decoration: BoxDecoration(color: _statusColor(status), shape: BoxShape.circle), + ), + const SizedBox(width: 6), + Text(_statusLabel(status), style: const TextStyle(fontSize: 12, color: Color(0xFF888888))), + ]), + ), + SizedBox( + width: 40, + child: change != null && status != 'synced' + ? IconButton( + icon: Icon(_changeActionIcon(status), size: 16, color: const Color(0xFF1A73E8)), + onPressed: () async { + if (status == 'new_local' || status == 'modified_local') { + await _uploadFile(change.localFile!, change.path); + } else if (status == 'new_remote' && change.remoteItem != null) { + await downloadFile(change.remoteItem!); + _checkForChanges(); + } + }, + tooltip: _changeActionLabel(status), + visualDensity: VisualDensity.compact, + ) + : const SizedBox.shrink(), + ), + ], + ), + ); + } + + Widget _pendingChangeRow(ChangeItem change) { + final status = change.status; + return Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Color(0xFFF3F4F6)))), + child: Row( + children: [ + Icon(_statusIcon(status), size: 16, color: _statusColor(status)), + const SizedBox(width: 10), + Expanded(child: Text(change.path, style: const TextStyle(fontSize: 12), overflow: TextOverflow.ellipsis)), + const SizedBox(width: 8), + Text(status.replaceAll('_', ' '), style: TextStyle(fontSize: 11, color: _statusColor(status))), + const SizedBox(width: 8), + if (status != 'synced') + TextButton( + onPressed: () async { + if (status == 'new_local' || status == 'modified_local') { + await _uploadFile(change.localFile!, change.path); + } else if (status == 'new_remote' && change.remoteItem != null) { + await downloadFile(change.remoteItem!); + _checkForChanges(); + } + }, + style: TextButton.styleFrom(visualDensity: VisualDensity.compact, textStyle: const TextStyle(fontSize: 11)), + child: Text(_changeActionLabel(status)), + ), + ], + ), + ); + } + + // ── Right Sync Panel ───────────────────────────────────────────────────────── + Widget _buildRightPanel() { + return _showFileDetails && _selectedFile != null + ? _buildFileDetailsPanel(_selectedFile!) + : _buildSyncStatusPanel(); + } + + // File Details panel — shown when user taps a file + Widget _buildFileDetailsPanel(FileItem file) { + final ext = file.name.contains('.') ? file.name.split('.').last.toLowerCase() : ''; + final sizeStr = file.size != null + ? (file.size! > 1024 * 1024 ? '${(file.size! / (1024 * 1024)).toStringAsFixed(1)} MB' : '${(file.size! / 1024).toStringAsFixed(1)} KB') + : '—'; + return Container( + width: 272, + decoration: const BoxDecoration(color: Colors.white, border: Border(left: BorderSide(color: Color(0xFFEEEEEE)))), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Panel header + Padding( + padding: const EdgeInsets.fromLTRB(16, 14, 14, 10), + child: Row(children: [ + const Icon(Icons.insert_drive_file_outlined, size: 14, color: Color(0xFFAAAAAA)), + const SizedBox(width: 6), + const Text('File Details', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600)), + const Spacer(), + // Toggle back to sync status + IconButton( + icon: const Icon(Icons.sync, size: 16, color: Color(0xFFAAAAAA)), + onPressed: () => setState(() => _showFileDetails = false), + tooltip: 'Sync Status', + visualDensity: VisualDensity.compact, + ), + IconButton( + icon: const Icon(Icons.close, size: 16, color: Color(0xFFAAAAAA)), + onPressed: () => setState(() { _selectedFile = null; _showFileDetails = false; }), + visualDensity: VisualDensity.compact, + ), + ]), + ), + const Divider(height: 1, color: Color(0xFFF0F0F0)), + + Expanded(child: SingleChildScrollView( + padding: const EdgeInsets.all(12), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + // Preview card + Container( + height: 120, + width: double.infinity, + decoration: BoxDecoration( + color: _fileExtColor(ext).withValues(alpha: 0.08), + borderRadius: BorderRadius.circular(12), + ), + child: Center(child: Icon(_fileIcon(ext), size: 52, color: _fileExtColor(ext))), + ), + const SizedBox(height: 12), + + // Name + size + Text(file.name, style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: Color(0xFF1A1A2E))), + const SizedBox(height: 2), + Text(sizeStr, style: const TextStyle(fontSize: 12, color: Color(0xFFAAAAAA))), + const SizedBox(height: 12), + + // Action buttons + Row(children: [ + Expanded(child: GestureDetector( + onTap: () async { + final presigned = await fetchPresignedUrl(file.key); + if (presigned != null) _openUrl(presigned); + }, + child: Container( + padding: const EdgeInsets.symmetric(vertical: 8), + decoration: BoxDecoration(color: const Color(0xFFFFF3EC), borderRadius: BorderRadius.circular(8)), + child: const Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Icon(Icons.download_outlined, size: 14, color: _coral), + SizedBox(width: 4), + Text('Download', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _coral)), + ]), + ), + )), + const SizedBox(width: 8), + GestureDetector( + onTap: () { + if (_currentProjectDir != null) { + final localPath = p.join(_currentProjectDir!.path, file.name); + if (File(localPath).existsSync()) openInFinder(localPath); + else _showSnack('File not found locally. Sync first.'); + } + }, + child: Container( + width: 36, height: 36, + decoration: BoxDecoration(border: Border.all(color: const Color(0xFFE5E7EB)), borderRadius: BorderRadius.circular(8)), + child: const Icon(Icons.folder_open_outlined, size: 16, color: Color(0xFF888888)), + ), + ), + ]), + const SizedBox(height: 16), + const Divider(height: 1, color: Color(0xFFF0F0F0)), + const SizedBox(height: 12), + + // Description section + Row(children: [ + const Icon(Icons.description_outlined, size: 14, color: Color(0xFFAAAAAA)), + const SizedBox(width: 6), + const Text('Details', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xFF444444))), + const Spacer(), + const Icon(Icons.keyboard_arrow_up, size: 16, color: Color(0xFFAAAAAA)), + ]), + const SizedBox(height: 10), + _detailRow('Type', ext.toUpperCase().isNotEmpty ? ext.toUpperCase() : 'File'), + _detailRow('Size', sizeStr), + _detailRow('S3 Key', file.key, small: true), + + // Sync status for this file + const SizedBox(height: 12), + const Divider(height: 1, color: Color(0xFFF0F0F0)), + const SizedBox(height: 12), + Row(children: [ + const Icon(Icons.sync_outlined, size: 14, color: Color(0xFFAAAAAA)), + const SizedBox(width: 6), + const Text('Sync Status', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xFF444444))), + ]), + const SizedBox(height: 8), + Builder(builder: (ctx) { + final change = _changes.where((c) => c.remoteItem?.key == file.key).firstOrNull; + final status = change?.status ?? 'synced'; + return Container( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6), + decoration: BoxDecoration( + color: _statusColor(status).withValues(alpha: 0.08), + borderRadius: BorderRadius.circular(8), + border: Border.all(color: _statusColor(status).withValues(alpha: 0.25)), + ), + child: Row(children: [ + Icon(_statusIcon(status), size: 13, color: _statusColor(status)), + const SizedBox(width: 6), + Text(_statusLabel(status), style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, color: _statusColor(status))), + ]), + ); + }), + ]), + )), + ], + ), + ); + } + + Widget _detailRow(String label, String value, {bool small = false}) { + return Padding( + padding: const EdgeInsets.only(bottom: 6), + child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox(width: 56, child: Text(label, style: const TextStyle(fontSize: 11, color: Color(0xFFAAAAAA)))), + Expanded(child: Text(value, style: TextStyle(fontSize: small ? 10 : 11, fontWeight: FontWeight.w500, color: const Color(0xFF444444)), overflow: TextOverflow.ellipsis, maxLines: small ? 2 : 1)), + ]), + ); + } + + // Sync Status panel — shown by default / when no file selected + Widget _buildSyncStatusPanel() { + final pending = _changes.where((c) => c.status != 'synced').toList(); + return Container( + width: 272, + decoration: const BoxDecoration( + color: Colors.white, + border: Border(left: BorderSide(color: Color(0xFFEEEEEE))), + ), + child: Column( + children: [ + // Panel header + Padding( + padding: const EdgeInsets.fromLTRB(16, 14, 14, 10), + child: Row(children: [ + Container(width: 6, height: 6, margin: const EdgeInsets.only(right: 8), + decoration: BoxDecoration(color: _currentProjectDir != null ? Colors.green : Colors.grey, shape: BoxShape.circle)), + const Text('Sync Status', style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600)), + const Spacer(), + IconButton( + icon: const Icon(Icons.refresh, size: 16), + onPressed: _refreshEvents, + tooltip: 'Refresh log', + visualDensity: VisualDensity.compact, + ), + ]), + ), + const Divider(height: 1), + Expanded( + child: SingleChildScrollView( + padding: const EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Active sync / paused card + if (_currentProjectDir != null && _currentFolderPrefix != null) + _syncStatusCard( + title: 'Syncing', + subtitle: _currentFolderPrefix!, + local: _currentProjectDir!.path, + color: Colors.green, + icon: Icons.sync, + onSync: () async { + setState(() { loading = true; }); + try { + await _performPeriodicSync(); + await _checkForChanges(); + _showSnack('✅ Sync completed'); + } catch (e) { + _showSnack('❌ Sync failed: $e'); + } finally { + setState(() { loading = false; }); + } + }, + onStop: () async { + await _watchSub?.cancel(); + _watchSub = null; + setState(() { + _currentProjectDir = null; + _currentFolderPrefix = null; + _changes.clear(); + }); + _showSnack('Stopped syncing'); + }, + ) + else if (_lastSyncedFolder != null && _lastSyncedLocalPath != null) + _syncStatusCard( + title: 'Paused', + subtitle: _lastSyncedFolder!, + local: _lastSyncedLocalPath!, + color: Colors.orange, + icon: Icons.pause_circle_outline, + onSync: () async { + final dir = Directory(_lastSyncedLocalPath!); + if (!await dir.exists()) { + _showSnack('Local folder no longer exists.'); + return; + } + _currentProjectDir = dir; + _currentFolderPrefix = _lastSyncedFolder; + await _primeKnownKeys(_currentFolderPrefix!); + _startWatcher(dir, _currentFolderPrefix!); + _showSnack('Resumed syncing $_lastSyncedFolder'); + setState(() {}); + }, + onStop: null, + ) + else + Container( + padding: const EdgeInsets.all(12), + decoration: BoxDecoration(color: const Color(0xFFF8F9FA), borderRadius: BorderRadius.circular(8), border: Border.all(color: const Color(0xFFE5E7EB))), + child: const Row(children: [ + Icon(Icons.info_outline, size: 16, color: Color(0xFF888888)), + SizedBox(width: 8), + Expanded(child: Text('No active sync. Select a folder to sync.', style: TextStyle(fontSize: 12, color: Color(0xFF888888)))), + ]), + ), + // const SizedBox(height: 16), + // // Storage path + // const Text('STORAGE', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFFAAAAAA), letterSpacing: 0.5)), + // const SizedBox(height: 6), + // Container( + // padding: const EdgeInsets.all(10), + // decoration: BoxDecoration(color: const Color(0xFFF8F9FA), borderRadius: BorderRadius.circular(8), border: Border.all(color: const Color(0xFFE5E7EB))), + // child: Row(children: [ + // const Icon(Icons.folder_outlined, size: 14, color: Color(0xFF888888)), + // const SizedBox(width: 6), + // Expanded(child: Text(_storageBasePath.isNotEmpty ? _storageBasePath : 'Not set', style: const TextStyle(fontSize: 11, color: Color(0xFF555555)), overflow: TextOverflow.ellipsis)), + // IconButton( + // icon: const Icon(Icons.edit_outlined, size: 14), + // onPressed: _showStorageDialog, + // visualDensity: VisualDensity.compact, + // tooltip: 'Change', + // ), + // ]), + // ), + const SizedBox(height: 16), + // Pending changes summary + Row(children: [ + const Text('PENDING', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFFAAAAAA), letterSpacing: 0.5)), + const SizedBox(width: 6), + Container( + padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 1), + decoration: BoxDecoration(color: pending.isNotEmpty ? const Color(0xFFE8F0FE) : const Color(0xFFF3F4F6), borderRadius: BorderRadius.circular(10)), + child: Text('${pending.length}', style: TextStyle(fontSize: 10, color: pending.isNotEmpty ? const Color(0xFF1A73E8) : const Color(0xFF888888), fontWeight: FontWeight.w600)), + ), + ]), + const SizedBox(height: 8), + if (pending.isEmpty) + const Text('All files synced ✓', style: TextStyle(fontSize: 12, color: Colors.green)) + else + ...pending.take(8).map((c) => Padding( + padding: const EdgeInsets.symmetric(vertical: 3), + child: Row(children: [ + Icon(_statusIcon(c.status), size: 13, color: _statusColor(c.status)), + const SizedBox(width: 6), + Expanded(child: Text(c.path.split('/').last, style: const TextStyle(fontSize: 11), overflow: TextOverflow.ellipsis)), + ]), + )), + if (pending.length > 8) + Text('+${pending.length - 8} more…', style: const TextStyle(fontSize: 11, color: Color(0xFF888888))), + const SizedBox(height: 16), + // Sync log + Row(children: [ + const Text('LOG', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFFAAAAAA), letterSpacing: 0.5)), + const Spacer(), + Row(children: [ + SizedBox( + height: 20, + child: Switch.adaptive( + value: _logFilterCurrentOnly, + onChanged: (v) async { + setState(() { _logFilterCurrentOnly = v; }); + await _refreshEvents(); + }, + ), + ), + const SizedBox(width: 4), + const Text('Current only', style: TextStyle(fontSize: 10, color: Color(0xFF888888))), + ]), + ]), + const SizedBox(height: 8), + if (_logLoading) + const Center(child: SizedBox(height: 24, width: 24, child: CircularProgressIndicator(strokeWidth: 2))) + else if (_recentEvents.isEmpty) + const Text('No events yet.', style: TextStyle(fontSize: 12, color: Color(0xFF888888))) + else + ...(_recentEvents.take(12).map((e) { + final ts = ((e['ts'] as String?) ?? '').split('T').join(' ').split('.').first; + final type = (e['event_type'] as String?) ?? ''; + final s3Key = (e['s3_key'] as String?) ?? (e['local_path'] as String?) ?? ''; + final short = s3Key.split('/').last; + final status = (e['status'] as String?) ?? ''; + Color dot = status == 'success' ? Colors.green : (status == 'error' ? Colors.red : Colors.orange); + return Padding( + padding: const EdgeInsets.symmetric(vertical: 4), + child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container(margin: const EdgeInsets.only(top: 4), width: 6, height: 6, decoration: BoxDecoration(color: dot, shape: BoxShape.circle)), + const SizedBox(width: 6), + Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text('$type${short.isNotEmpty ? ': $short' : ''}', style: const TextStyle(fontSize: 11), overflow: TextOverflow.ellipsis), + Text(ts, style: const TextStyle(fontSize: 10, color: Color(0xFF888888))), + ])), + ]), + ); + })), + ], + ), + ), + ), + ], + ), + ); + } + + Widget _syncStatusCard({ + required String title, + required String subtitle, + required String local, + required Color color, + required IconData icon, + required VoidCallback onSync, + VoidCallback? onStop, + }) { + return Container( + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: color.withValues(alpha: 0.06), + borderRadius: BorderRadius.circular(8), + border: Border.all(color: color.withValues(alpha: 0.3)), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row(children: [ + Icon(icon, color: color, size: 16), + const SizedBox(width: 6), + Text(title, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: color)), + ]), + const SizedBox(height: 6), + Text(subtitle, style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis), + Text(local, style: const TextStyle(fontSize: 10, color: Color(0xFF888888)), overflow: TextOverflow.ellipsis), + const SizedBox(height: 8), + Row(children: [ + Expanded( + child: SizedBox( + height: 28, + child: ElevatedButton.icon( + onPressed: onSync, + icon: Icon(icon, size: 12), + label: Text(onStop != null ? 'Sync Now' : 'Resume'), + style: ElevatedButton.styleFrom( + backgroundColor: color, + foregroundColor: Colors.white, + textStyle: const TextStyle(fontSize: 11), + visualDensity: VisualDensity.compact, + ), + ), + ), + ), + if (onStop != null) ...[ + const SizedBox(width: 6), + SizedBox( + height: 28, + child: OutlinedButton( + onPressed: onStop, + style: OutlinedButton.styleFrom(textStyle: const TextStyle(fontSize: 11), visualDensity: VisualDensity.compact), + child: const Text('Stop'), + ), + ), + ], + ]), + ], + ), + ); + } + + // ── Storage dialog ─────────────────────────────────────────────────────────── + void _showStorageDialog() { + showDialog( + context: rootNavigatorKey.currentContext!, + builder: (ctx) => AlertDialog( + title: const Row(children: [ + Icon(Icons.lock_outline, size: 18, color: Color(0xFF1A73E8)), + SizedBox(width: 8), + Text('Managed Storage'), + ]), + content: SizedBox( + width: 420, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: const Color(0xFFF0F4FF), + borderRadius: BorderRadius.circular(8), + border: Border.all(color: const Color(0xFFBDD0FF)), + ), + child: Row( + children: [ + const Icon(Icons.folder_special_outlined, color: Color(0xFF1A73E8), size: 20), + const SizedBox(width: 10), + Expanded( + child: Text( + _storageBasePath, + style: const TextStyle(fontSize: 13, fontFamily: 'monospace'), + ), + ), + IconButton( + icon: const Icon(Icons.copy_outlined, size: 16), + tooltip: 'Copy path', + visualDensity: VisualDensity.compact, + onPressed: () { + Clipboard.setData(ClipboardData(text: _storageBasePath)); + _showSnack('Path copied to clipboard'); + }, + ), + ], + ), + ), + const SizedBox(height: 12), + const Text( + 'This folder is managed automatically by PlanXO. It is hidden in Finder and protected against accidental deletion.', + style: TextStyle(fontSize: 12, color: Color(0xFF666666)), + ), + const SizedBox(height: 8), + OutlinedButton.icon( + onPressed: () { + Process.run('open', [p.dirname(_storageBasePath)]); + }, + icon: const Icon(Icons.open_in_new, size: 14), + label: const Text('Reveal in Finder'), + style: OutlinedButton.styleFrom( + visualDensity: VisualDensity.compact, + textStyle: const TextStyle(fontSize: 12), + ), + ), + ], + ), + ), + actions: [ + ElevatedButton( + onPressed: () => Navigator.pop(ctx), + child: const Text('Done'), + ), + ], + ), + ); + } + + // ── Helper methods for new UI ──────────────────────────────────────────────── + Color _statusColor(String status) { + switch (status) { + case 'synced': return Colors.green; + case 'new_local': return Colors.green; + case 'modified_local': return Colors.orange; + case 'new_remote': return const Color(0xFF1A73E8); + default: return Colors.grey; + } + } + + String _statusLabel(String status) { + switch (status) { + case 'synced': return 'Synced'; + case 'new_local': return 'Upload'; + case 'modified_local': return 'Modified'; + case 'new_remote': return 'Download'; + default: return status.replaceAll('_', ' '); + } + } + + IconData _statusIcon(String status) { + switch (status) { + case 'synced': return Icons.check_circle_outline; + case 'new_local': return Icons.upload_outlined; + case 'modified_local': return Icons.edit_outlined; + case 'new_remote': return Icons.download_outlined; + default: return Icons.help_outline; + } + } + + IconData _changeActionIcon(String status) { + switch (status) { + case 'new_local': return Icons.upload_outlined; + case 'modified_local': return Icons.upload_outlined; + case 'new_remote': return Icons.download_outlined; + default: return Icons.sync; + } + } + + String _changeActionLabel(String status) { + switch (status) { + case 'new_local': return 'Upload'; + case 'modified_local': return 'Upload Update'; + case 'new_remote': return 'Download'; + default: return 'Sync'; + } + } + + IconData _fileIcon(String ext) { + switch (ext) { + case 'pdf': return Icons.picture_as_pdf_outlined; + case 'jpg': case 'jpeg': case 'png': case 'gif': case 'webp': case 'svg': + return Icons.image_outlined; + case 'mp4': case 'mov': case 'avi': return Icons.video_file_outlined; + case 'mp3': case 'wav': case 'aac': return Icons.audio_file_outlined; + case 'zip': case 'rar': case 'tar': case 'gz': return Icons.folder_zip_outlined; + case 'doc': case 'docx': return Icons.description_outlined; + case 'xls': case 'xlsx': return Icons.table_chart_outlined; + case 'ppt': case 'pptx': return Icons.slideshow_outlined; + default: return Icons.insert_drive_file_outlined; + } + } + + // (Tab 2 logic kept — pending changes full view accessible via top bar later) + // Dummy shim so existing references compile + Widget _buildTitleBar() => const SizedBox.shrink(); + Widget _buildWsIndicator() { + Color color; + if (_wsOpen) { + color = Colors.green; + } else if (_wsConnecting) { + color = Colors.orange; + } else { + color = Colors.red; + } + return AnimatedContainer( + duration: const Duration(milliseconds: 300), + width: 12, + height: 12, + decoration: BoxDecoration( + color: color, + shape: BoxShape.circle, + boxShadow: [ + BoxShadow(color: color.withValues(alpha: 0.6), blurRadius: 4, spreadRadius: 1), + ], + ), + ); + } + + void _handleAuthRevoked(Map data) { + WidgetsBinding.instance.addPostFrameCallback((_) async { + await _clearAuthKey(); + _userInfo = null; + _isAuthenticated = false; + _authPollTimer?.cancel(); + _periodicSyncTimer?.cancel(); + for (final t in _syncTimers.values) { + if (t.isActive) t.cancel(); + } + _syncTimers.clear(); + _syncRunning.clear(); + _showSnack('Authentication revoked. Please log in again.'); + if (mounted) setState(() {}); + }); + } + + Widget _buildLoginScreen() { + final secretController = TextEditingController(text: _assetManagerSecret); + bool showAdvanced = _assetManagerSecret.isEmpty; // show on first run + + return StatefulBuilder(builder: (ctx, setLocal) { + return Scaffold( + backgroundColor: const Color(0xFFF5F6FA), + body: Center( + child: Container( + constraints: const BoxConstraints(maxWidth: 420), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: const EdgeInsets.all(32), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + boxShadow: [BoxShadow(color: Colors.black.withValues(alpha: 0.08), blurRadius: 24, offset: const Offset(0, 8))], + ), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Container(width: 38, height: 38, decoration: BoxDecoration(color: _coral, borderRadius: BorderRadius.circular(10)), + child: const Icon(Icons.folder_rounded, color: Colors.white, size: 22)), + const SizedBox(width: 10), + const Text('PlanXO', style: TextStyle(fontSize: 26, fontWeight: FontWeight.bold, color: Color(0xFF1A1A2E))), + ]), + const SizedBox(height: 6), + const Text('Asset Sync', textAlign: TextAlign.center, style: TextStyle(fontSize: 14, color: Color(0xFF888888))), + const SizedBox(height: 28), + TextField( + controller: _clientController, + decoration: InputDecoration( + labelText: 'Client Name', + hintText: 'e.g. cms', + border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)), + prefixIcon: const Icon(Icons.business_outlined), + ), + ), + const SizedBox(height: 12), + // Advanced / first-run section for asset manager secret + GestureDetector( + onTap: () => setLocal(() => showAdvanced = !showAdvanced), + child: Row(children: [ + Icon(showAdvanced ? Icons.expand_less : Icons.expand_more, size: 16, color: const Color(0xFF888888)), + const SizedBox(width: 4), + Text(showAdvanced ? 'Hide advanced settings' : 'Advanced settings', + style: const TextStyle(fontSize: 12, color: Color(0xFF888888))), + if (_assetManagerSecret.isEmpty) ...[ + const SizedBox(width: 6), + Container(padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + decoration: BoxDecoration(color: Colors.orange.shade50, borderRadius: BorderRadius.circular(6)), + child: Text('Setup required', style: TextStyle(fontSize: 10, color: Colors.orange.shade700, fontWeight: FontWeight.w600))), + ], + ]), + ), + if (showAdvanced) ...[ + const SizedBox(height: 10), + TextField( + controller: secretController, + obscureText: true, + decoration: InputDecoration( + labelText: 'Asset Manager Secret', + hintText: 'Matches ASSET_MANAGER_SECRET on server', + helperText: 'Ask your admin for this value', + border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)), + prefixIcon: const Icon(Icons.key_outlined), + ), + onChanged: (v) async { + _assetManagerSecret = v.trim(); + await _secureStorage.write(key: 'planxo_asset_manager_secret', value: _assetManagerSecret); + }, + ), + const SizedBox(height: 6), + Text('This machine\'s ID: $uniqueId', + style: const TextStyle(fontSize: 10, color: Color(0xFFAAAAAA))), + ], + const SizedBox(height: 16), + FilledButton.icon( + onPressed: () => _openLoginForClient(_clientController.text), + icon: const Icon(Icons.login), + label: const Text('Continue'), + style: FilledButton.styleFrom( + backgroundColor: _coral, + padding: const EdgeInsets.symmetric(vertical: 14), + textStyle: const TextStyle(fontSize: 15), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + ), + ], + ), + ), + const SizedBox(height: 20), + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + AnimatedContainer( + duration: const Duration(milliseconds: 300), + width: 8, height: 8, + decoration: BoxDecoration( + color: _wsOpen ? Colors.green : (_wsConnecting ? Colors.orange : Colors.red), + shape: BoxShape.circle, + ), + ), + const SizedBox(width: 8), + Text( + _wsOpen ? 'Connected to server' : (_wsConnecting ? 'Connecting…' : 'Offline'), + style: TextStyle(fontSize: 12, color: _wsOpen ? Colors.green : (_wsConnecting ? Colors.orange : Colors.red)), + ), + ]), + ], + ), + ), + ), + ); + }); // end StatefulBuilder + } +} + +// ── Data classes for folder browsing ───────────────────────────────────────── + +class _SubFolderEntry { + final String name; + /// Full path: absolute disk path (local) or S3 prefix ending with '/' (remote). + final String fullPath; + final int? fileCount; + _SubFolderEntry({required this.name, required this.fullPath, this.fileCount}); +} + +class _FileRow { + final String name; + final String ext; + final int? sizeBytes; + final String status; + /// Set when this row corresponds to a remote [FileItem]. + final FileItem? fileItem; + _FileRow({ + required this.name, + required this.ext, + this.sizeBytes, + required this.status, + this.fileItem, + }); +} + +class _FolderListing { + final List<_SubFolderEntry> subFolders; + final List<_FileRow> fileRows; + _FolderListing({required this.subFolders, required this.fileRows}); +} + diff --git a/development/planxo/lib/models/sync_data.dart b/development/planxo/lib/models/sync_data.dart new file mode 100644 index 0000000..4a46b93 --- /dev/null +++ b/development/planxo/lib/models/sync_data.dart @@ -0,0 +1,35 @@ +class SyncData { + final int? id; + final String folder; + final bool enabled; + final int interval; + final String? lastSynced; + + SyncData({ + this.id, + required this.folder, + required this.enabled, + required this.interval, + this.lastSynced, + }); + + Map toMap() { + return { + 'id': id, + 'folder': folder, + 'enabled': enabled ? 1 : 0, + 'interval': interval, + 'last_synced': lastSynced, + }; + } + + factory SyncData.fromMap(Map map) { + return SyncData( + id: map['id'], + folder: map['folder'], + enabled: map['enabled'] == 1, + interval: map['interval'], + lastSynced: map['last_synced'], + ); + } +} \ No newline at end of file diff --git a/development/planxo/linux/.gitignore b/development/planxo/linux/.gitignore new file mode 100644 index 0000000..d3896c9 --- /dev/null +++ b/development/planxo/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/development/planxo/linux/CMakeLists.txt b/development/planxo/linux/CMakeLists.txt new file mode 100644 index 0000000..1304aab --- /dev/null +++ b/development/planxo/linux/CMakeLists.txt @@ -0,0 +1,128 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "planxo") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.planxo") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(SET CMP0063 NEW) + +# Load bundled libraries from the lib/ directory relative to the binary. +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Define build configuration options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) + +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endforeach(bundled_library) + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/development/planxo/linux/flutter/CMakeLists.txt b/development/planxo/linux/flutter/CMakeLists.txt new file mode 100644 index 0000000..d5bd016 --- /dev/null +++ b/development/planxo/linux/flutter/CMakeLists.txt @@ -0,0 +1,88 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/development/planxo/linux/flutter/generated_plugins.cmake b/development/planxo/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000..9c56b4c --- /dev/null +++ b/development/planxo/linux/flutter/generated_plugins.cmake @@ -0,0 +1,27 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + file_selector_linux + flutter_secure_storage_linux + sqlite3_flutter_libs +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST + jni +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/development/planxo/linux/runner/CMakeLists.txt b/development/planxo/linux/runner/CMakeLists.txt new file mode 100644 index 0000000..e97dabc --- /dev/null +++ b/development/planxo/linux/runner/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the application ID. +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") diff --git a/development/planxo/linux/runner/main.cc b/development/planxo/linux/runner/main.cc new file mode 100644 index 0000000..e7c5c54 --- /dev/null +++ b/development/planxo/linux/runner/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/development/planxo/linux/runner/my_application.cc b/development/planxo/linux/runner/my_application.cc new file mode 100644 index 0000000..d1bb1b5 --- /dev/null +++ b/development/planxo/linux/runner/my_application.cc @@ -0,0 +1,144 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Called when first Flutter frame received. +static void first_frame_cb(MyApplication* self, FlView *view) +{ + gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view))); +} + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen* screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "planxo"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } else { + gtk_window_set_title(window, "planxo"); + } + + gtk_window_set_default_size(window, 1280, 720); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + GdkRGBA background_color; + // Background defaults to black, override it here if necessary, e.g. #00000000 for transparent. + gdk_rgba_parse(&background_color, "#000000"); + fl_view_set_background_color(view, &background_color); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + // Show the window when Flutter renders. + // Requires the view to be realized so we can start rendering. + g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb), self); + gtk_widget_realize(GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GApplication::startup. +static void my_application_startup(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application startup. + + G_APPLICATION_CLASS(my_application_parent_class)->startup(application); +} + +// Implements GApplication::shutdown. +static void my_application_shutdown(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application shutdown. + + G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject* object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_APPLICATION_CLASS(klass)->startup = my_application_startup; + G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + // Set the program name to the application ID, which helps various systems + // like GTK and desktop environments map this running application to its + // corresponding .desktop file. This ensures better integration by allowing + // the application to be recognized beyond its binary name. + g_set_prgname(APPLICATION_ID); + + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/development/planxo/linux/runner/my_application.h b/development/planxo/linux/runner/my_application.h new file mode 100644 index 0000000..72271d5 --- /dev/null +++ b/development/planxo/linux/runner/my_application.h @@ -0,0 +1,18 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/development/planxo/macos/.gitignore b/development/planxo/macos/.gitignore new file mode 100644 index 0000000..746adbb --- /dev/null +++ b/development/planxo/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/development/planxo/macos/Flutter/Flutter-Debug.xcconfig b/development/planxo/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 0000000..4b81f9b --- /dev/null +++ b/development/planxo/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/development/planxo/macos/Flutter/Flutter-Release.xcconfig b/development/planxo/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 0000000..5caa9d1 --- /dev/null +++ b/development/planxo/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/development/planxo/macos/Podfile b/development/planxo/macos/Podfile new file mode 100644 index 0000000..ff5ddb3 --- /dev/null +++ b/development/planxo/macos/Podfile @@ -0,0 +1,42 @@ +platform :osx, '10.15' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/development/planxo/macos/Runner.xcodeproj/project.pbxproj b/development/planxo/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..0d9c63c --- /dev/null +++ b/development/planxo/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,801 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 2479F6295B81210E9C2B5D74 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2FA5DC5F7716F4549CA0845 /* Pods_RunnerTests.framework */; }; + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + B83E32400CE0E63D937A3DB3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8B657E2B33DD591C0462181 /* Pods_Runner.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* planxo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = planxo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 39155466C2D1A9BF4CBAF461 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 6BB9321BF99BC8DEFDA2389B /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + CFA8E4396645FCD7AD79CF5A /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + D3E3EE0CB25D5CC763600C8C /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + D5029A70F57884515C070A87 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + D8B657E2B33DD591C0462181 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E48A63B423A1EEDAC33E7DF9 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + F2FA5DC5F7716F4549CA0845 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2479F6295B81210E9C2B5D74 /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B83E32400CE0E63D937A3DB3 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + 97CAACA72205D349F1A1B9FB /* Pods */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* planxo.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + 97CAACA72205D349F1A1B9FB /* Pods */ = { + isa = PBXGroup; + children = ( + E48A63B423A1EEDAC33E7DF9 /* Pods-Runner.debug.xcconfig */, + D3E3EE0CB25D5CC763600C8C /* Pods-Runner.release.xcconfig */, + CFA8E4396645FCD7AD79CF5A /* Pods-Runner.profile.xcconfig */, + D5029A70F57884515C070A87 /* Pods-RunnerTests.debug.xcconfig */, + 6BB9321BF99BC8DEFDA2389B /* Pods-RunnerTests.release.xcconfig */, + 39155466C2D1A9BF4CBAF461 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + D8B657E2B33DD591C0462181 /* Pods_Runner.framework */, + F2FA5DC5F7716F4549CA0845 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 81B9E979FD4EA9761F1ED876 /* [CP] Check Pods Manifest.lock */, + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 8FD316E523682FD9A5657E4A /* [CP] Check Pods Manifest.lock */, + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + 92743C4D8D09C696E1E6EEBC /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* planxo.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; + 81B9E979FD4EA9761F1ED876 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 8FD316E523682FD9A5657E4A /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 92743C4D8D09C696E1E6EEBC /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D5029A70F57884515C070A87 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.planxo.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/planxo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/planxo"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6BB9321BF99BC8DEFDA2389B /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.planxo.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/planxo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/planxo"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 39155466C2D1A9BF4CBAF461 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.planxo.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/planxo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/planxo"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/development/planxo/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/development/planxo/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/development/planxo/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/development/planxo/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/development/planxo/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..5337b54 --- /dev/null +++ b/development/planxo/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/development/planxo/macos/Runner.xcworkspace/contents.xcworkspacedata b/development/planxo/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..21a3cc1 --- /dev/null +++ b/development/planxo/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/development/planxo/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/development/planxo/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/development/planxo/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/development/planxo/macos/Runner/AppDelegate.swift b/development/planxo/macos/Runner/AppDelegate.swift new file mode 100644 index 0000000..3d22acc --- /dev/null +++ b/development/planxo/macos/Runner/AppDelegate.swift @@ -0,0 +1,19 @@ +import Cocoa +import FlutterMacOS + +@main +class AppDelegate: FlutterAppDelegate { + override func applicationDidFinishLaunching(_ aNotification: Notification) { + let window = NSApplication.shared.windows.first + window?.minSize = NSSize(width: 800, height: 700) // Set minimum width and height + super.applicationDidFinishLaunching(aNotification) + } + + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } +} diff --git a/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a2ec33f --- /dev/null +++ b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 0000000..86254a9 Binary files /dev/null and b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 0000000..f5f8d70 Binary files /dev/null and b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 0000000..949ffd6 Binary files /dev/null and b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 0000000..f8b1741 Binary files /dev/null and b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 0000000..8249668 Binary files /dev/null and b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 0000000..6bdbb6d Binary files /dev/null and b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 0000000..722ff62 Binary files /dev/null and b/development/planxo/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/development/planxo/macos/Runner/Base.lproj/MainMenu.xib b/development/planxo/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 0000000..80e867a --- /dev/null +++ b/development/planxo/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/development/planxo/macos/Runner/Configs/AppInfo.xcconfig b/development/planxo/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 0000000..4a1ba1b --- /dev/null +++ b/development/planxo/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = planxo + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.planxo + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2025 com.example. All rights reserved. diff --git a/development/planxo/macos/Runner/Configs/Debug.xcconfig b/development/planxo/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 0000000..36b0fd9 --- /dev/null +++ b/development/planxo/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/development/planxo/macos/Runner/Configs/Release.xcconfig b/development/planxo/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 0000000..dff4f49 --- /dev/null +++ b/development/planxo/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/development/planxo/macos/Runner/Configs/Warnings.xcconfig b/development/planxo/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 0000000..42bcbf4 --- /dev/null +++ b/development/planxo/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/development/planxo/macos/Runner/DebugProfile.entitlements b/development/planxo/macos/Runner/DebugProfile.entitlements new file mode 100644 index 0000000..15985ce --- /dev/null +++ b/development/planxo/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,28 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.assets.movies.read-write + + com.apple.security.assets.music.read-write + + com.apple.security.assets.pictures.read-write + + com.apple.security.cs.allow-jit + + com.apple.security.files.downloads.read-write + + com.apple.security.files.user-selected.read-write + + com.apple.security.network.client + + com.apple.security.network.server + + keychain-access-groups + + $(AppIdentifierPrefix)$(CFBundleIdentifier) + + + diff --git a/development/planxo/macos/Runner/Info.plist b/development/planxo/macos/Runner/Info.plist new file mode 100644 index 0000000..e6ce592 --- /dev/null +++ b/development/planxo/macos/Runner/Info.plist @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + NSLocalNetworkUsageDescription + This app needs access to the local network to connect to the WebSocket server. + + diff --git a/development/planxo/macos/Runner/MainFlutterWindow.swift b/development/planxo/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 0000000..379195f --- /dev/null +++ b/development/planxo/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,16 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = NSRect(x: self.frame.origin.x, y: self.frame.origin.y, width: 800, height: 700) + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + self.minSize = NSSize(width: 800, height: 700) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/development/planxo/macos/Runner/Release.entitlements b/development/planxo/macos/Runner/Release.entitlements new file mode 100644 index 0000000..acdeb9d --- /dev/null +++ b/development/planxo/macos/Runner/Release.entitlements @@ -0,0 +1,26 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.assets.movies.read-write + + com.apple.security.assets.music.read-write + + com.apple.security.assets.pictures.read-write + + com.apple.security.files.downloads.read-write + + com.apple.security.files.user-selected.read-write + + com.apple.security.network.client + + com.apple.security.network.server + + keychain-access-groups + + $(AppIdentifierPrefix)$(CFBundleIdentifier) + + + diff --git a/development/planxo/macos/Runner/entitlements.plist b/development/planxo/macos/Runner/entitlements.plist new file mode 100644 index 0000000..a027489 --- /dev/null +++ b/development/planxo/macos/Runner/entitlements.plist @@ -0,0 +1,12 @@ + + + + + + com.apple.security.network.client + + + com.apple.security.network.server + + + diff --git a/development/planxo/macos/RunnerTests/RunnerTests.swift b/development/planxo/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..61f3bd1 --- /dev/null +++ b/development/planxo/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Cocoa +import FlutterMacOS +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/development/planxo/pubspec.lock b/development/planxo/pubspec.lock new file mode 100644 index 0000000..fd6fbc3 --- /dev/null +++ b/development/planxo/pubspec.lock @@ -0,0 +1,618 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: "direct main" + description: + name: archive + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + url: "https://pub.dev" + source: hosted + version: "3.6.1" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "942a4791cd385a68ccb3b32c71c427aba508a1bb949b86dff2adbe4049f16239" + url: "https://pub.dev" + source: hosted + version: "0.3.5" + crypto: + dependency: "direct main" + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + dio: + dependency: "direct main" + description: + name: dio + sha256: d90ee57923d1828ac14e492ca49440f65477f4bb1263575900be731a3dac66a9 + url: "https://pub.dev" + source: hosted + version: "5.9.0" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + file_selector: + dependency: "direct main" + description: + name: file_selector + sha256: "5f1d15a7f17115038f433d1b0ea57513cc9e29a9d5338d166cb0bef3fa90a7a0" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + file_selector_android: + dependency: transitive + description: + name: file_selector_android + sha256: "2db9a2d05f66b49a3b45c4a7c2f040dd5fcd457ca30f39df7cdcf80b8cd7f2d4" + url: "https://pub.dev" + source: hosted + version: "0.5.2+1" + file_selector_ios: + dependency: transitive + description: + name: file_selector_ios + sha256: fc3c3fc567cd9bcae784dfeb98d37c46a8ded9e8757d37ea67e975c399bc14e0 + url: "https://pub.dev" + source: hosted + version: "0.5.3+3" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "54cbbd957e1156d29548c7d9b9ec0c0ebb6de0a90452198683a7d23aed617a33" + url: "https://pub.dev" + source: hosted + version: "0.9.3+2" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: "88707a3bec4b988aaed3b4df5d7441ee4e987f20b286cddca5d6a8270cab23f2" + url: "https://pub.dev" + source: hosted + version: "0.9.4+5" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: "35e0bd61ebcdb91a3505813b055b09b79dfdc7d0aee9c09a7ba59ae4bb13dc85" + url: "https://pub.dev" + source: hosted + version: "2.7.0" + file_selector_web: + dependency: transitive + description: + name: file_selector_web + sha256: c4c0ea4224d97a60a7067eca0c8fd419e708ff830e0c83b11a48faf566cec3e7 + url: "https://pub.dev" + source: hosted + version: "0.9.4+2" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: "320fcfb6f33caa90f0b58380489fc5ac05d99ee94b61aa96ec2bff0ba81d3c2b" + url: "https://pub.dev" + source: hosted + version: "0.9.3+4" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_secure_storage: + dependency: "direct main" + description: + name: flutter_secure_storage + sha256: "9cad52d75ebc511adfae3d447d5d13da15a55a92c9410e50f67335b6d21d16ea" + url: "https://pub.dev" + source: hosted + version: "9.2.4" + flutter_secure_storage_linux: + dependency: transitive + description: + name: flutter_secure_storage_linux + sha256: be76c1d24a97d0b98f8b54bce6b481a380a6590df992d0098f868ad54dc8f688 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + flutter_secure_storage_macos: + dependency: transitive + description: + name: flutter_secure_storage_macos + sha256: "6c0a2795a2d1de26ae202a0d78527d163f4acbb11cde4c75c670f3a0fc064247" + url: "https://pub.dev" + source: hosted + version: "3.1.3" + flutter_secure_storage_platform_interface: + dependency: transitive + description: + name: flutter_secure_storage_platform_interface + sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8 + url: "https://pub.dev" + source: hosted + version: "1.1.2" + flutter_secure_storage_web: + dependency: transitive + description: + name: flutter_secure_storage_web + sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + flutter_secure_storage_windows: + dependency: transitive + description: + name: flutter_secure_storage_windows + sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + http: + dependency: transitive + description: + name: http + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.dev" + source: hosted + version: "0.13.6" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + jni: + dependency: transitive + description: + name: jni + sha256: c2230682d5bc2362c1c9e8d3c7f406d9cbba23ab3f2e203a025dd47e0fb2e68f + url: "https://pub.dev" + source: hosted + version: "1.0.0" + jni_flutter: + dependency: transitive + description: + name: jni_flutter + sha256: "8b59e590786050b1cd866677dddaf76b1ade5e7bc751abe04b86e84d379d3ba6" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" + source: hosted + version: "1.16.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path: + dependency: "direct main" + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "6d13aece7b3f5c5a9731eaf553ff9dcbc2eff41087fd2df587fd0fed9a3eb0c4" + url: "https://pub.dev" + source: hosted + version: "2.5.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + sqflite: + dependency: "direct main" + description: + name: sqflite + sha256: e2297b1da52f127bc7a3da11439985d9b536f75070f3325e62ada69a5c585d03 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: ecd684501ebc2ae9a83536e8b15731642b9570dc8623e0073d227d0ee2bfea88 + url: "https://pub.dev" + source: hosted + version: "2.4.2+2" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6" + url: "https://pub.dev" + source: hosted + version: "2.5.6" + sqflite_common_ffi: + dependency: "direct main" + description: + name: sqflite_common_ffi + sha256: "1f3ef3888d3bfbb47785cc1dda0dc7dd7ebd8c1955d32a9e8e9dae1e38d1c4c1" + url: "https://pub.dev" + source: hosted + version: "2.3.5" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + sqlite3: + dependency: transitive + description: + name: sqlite3 + sha256: fde692580bee3379374af1f624eb3e113ab2865ecb161dbe2d8ac2de9735dbdb + url: "https://pub.dev" + source: hosted + version: "2.4.5" + sqlite3_flutter_libs: + dependency: "direct main" + description: + name: sqlite3_flutter_libs + sha256: eeb9e3a45207649076b808f8a5a74d68770d0b7f26ccef6d5f43106eee5375ad + url: "https://pub.dev" + source: hosted + version: "0.5.42" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0 + url: "https://pub.dev" + source: hosted + version: "3.4.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" + url: "https://pub.dev" + source: hosted + version: "0.7.6" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + url: "https://pub.dev" + source: hosted + version: "15.0.2" + watcher: + dependency: "direct main" + description: + name: watcher + sha256: "592ab6e2892f67760543fb712ff0177f4ec76c031f02f5b4ff8d3fc5eb9fb61a" + url: "https://pub.dev" + source: hosted + version: "1.1.4" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" + source: hosted + version: "0.5.1" + win32: + dependency: transitive + description: + name: win32 + sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e + url: "https://pub.dev" + source: hosted + version: "5.15.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" +sdks: + dart: ">=3.9.2 <4.0.0" + flutter: ">=3.35.6" diff --git a/development/planxo/pubspec.yaml b/development/planxo/pubspec.yaml new file mode 100644 index 0000000..f31eba9 --- /dev/null +++ b/development/planxo/pubspec.yaml @@ -0,0 +1,99 @@ +name: planxo +description: "A new Flutter project." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 0.0.1 + +environment: + sdk: ^3.9.2 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + dio: ^5.1.2 + archive: ^3.4.0 + sqflite: ^2.3.0 + sqflite_common_ffi: ^2.3.0+1 # required for macOS / Windows / Linux desktop + sqlite3_flutter_libs: ^0.5.0 # bundles the native SQLite library on desktop + path: ^1.8.2 + watcher: ^1.0.2 + file_selector: ^1.0.2 + crypto: ^3.0.3 + flutter_secure_storage: ^9.2.2 # OS keychain storage (macOS Keychain, Windows Credential Locker) + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/development/planxo/test/widget_test.dart b/development/planxo/test/widget_test.dart new file mode 100644 index 0000000..d3ab44f --- /dev/null +++ b/development/planxo/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:planxo/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +} diff --git a/development/planxo/web/favicon.png b/development/planxo/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/development/planxo/web/favicon.png differ diff --git a/development/planxo/web/index.html b/development/planxo/web/index.html new file mode 100644 index 0000000..710fdd1 --- /dev/null +++ b/development/planxo/web/index.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + planxo + + + + + + diff --git a/development/planxo/web/manifest.json b/development/planxo/web/manifest.json new file mode 100644 index 0000000..6545209 --- /dev/null +++ b/development/planxo/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "planxo", + "short_name": "planxo", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/development/planxo/windows/.gitignore b/development/planxo/windows/.gitignore new file mode 100644 index 0000000..d492d0d --- /dev/null +++ b/development/planxo/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/development/planxo/windows/CMakeLists.txt b/development/planxo/windows/CMakeLists.txt new file mode 100644 index 0000000..dea825a --- /dev/null +++ b/development/planxo/windows/CMakeLists.txt @@ -0,0 +1,108 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(planxo LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "planxo") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(VERSION 3.14...3.25) + +# Define build configuration option. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() +# Define settings for the Profile build mode. +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/development/planxo/windows/flutter/CMakeLists.txt b/development/planxo/windows/flutter/CMakeLists.txt new file mode 100644 index 0000000..903f489 --- /dev/null +++ b/development/planxo/windows/flutter/CMakeLists.txt @@ -0,0 +1,109 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.14) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + ${FLUTTER_TARGET_PLATFORM} $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/development/planxo/windows/flutter/generated_plugins.cmake b/development/planxo/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000..606b410 --- /dev/null +++ b/development/planxo/windows/flutter/generated_plugins.cmake @@ -0,0 +1,27 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + file_selector_windows + flutter_secure_storage_windows + sqlite3_flutter_libs +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST + jni +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/development/planxo/windows/runner/CMakeLists.txt b/development/planxo/windows/runner/CMakeLists.txt new file mode 100644 index 0000000..394917c --- /dev/null +++ b/development/planxo/windows/runner/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.14) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/development/planxo/windows/runner/Runner.rc b/development/planxo/windows/runner/Runner.rc new file mode 100644 index 0000000..fc91510 --- /dev/null +++ b/development/planxo/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD +#else +#define VERSION_AS_NUMBER 1,0,0,0 +#endif + +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "planxo" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "planxo" "\0" + VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "planxo.exe" "\0" + VALUE "ProductName", "planxo" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/development/planxo/windows/runner/flutter_window.cpp b/development/planxo/windows/runner/flutter_window.cpp new file mode 100644 index 0000000..955ee30 --- /dev/null +++ b/development/planxo/windows/runner/flutter_window.cpp @@ -0,0 +1,71 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(const flutter::DartProject& project) + : project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + + flutter_controller_->engine()->SetNextFrameCallback([&]() { + this->Show(); + }); + + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opportunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/development/planxo/windows/runner/flutter_window.h b/development/planxo/windows/runner/flutter_window.h new file mode 100644 index 0000000..6da0652 --- /dev/null +++ b/development/planxo/windows/runner/flutter_window.h @@ -0,0 +1,33 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/development/planxo/windows/runner/main.cpp b/development/planxo/windows/runner/main.cpp new file mode 100644 index 0000000..6eaac99 --- /dev/null +++ b/development/planxo/windows/runner/main.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.Create(L"planxo", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/development/planxo/windows/runner/resource.h b/development/planxo/windows/runner/resource.h new file mode 100644 index 0000000..66a65d1 --- /dev/null +++ b/development/planxo/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/development/planxo/windows/runner/resources/app_icon.ico b/development/planxo/windows/runner/resources/app_icon.ico new file mode 100644 index 0000000..c04e20c Binary files /dev/null and b/development/planxo/windows/runner/resources/app_icon.ico differ diff --git a/development/planxo/windows/runner/runner.exe.manifest b/development/planxo/windows/runner/runner.exe.manifest new file mode 100644 index 0000000..153653e --- /dev/null +++ b/development/planxo/windows/runner/runner.exe.manifest @@ -0,0 +1,14 @@ + + + + + PerMonitorV2 + + + + + + + + + diff --git a/development/planxo/windows/runner/utils.cpp b/development/planxo/windows/runner/utils.cpp new file mode 100644 index 0000000..3a0b465 --- /dev/null +++ b/development/planxo/windows/runner/utils.cpp @@ -0,0 +1,65 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + unsigned int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); + std::string utf8_string; + if (target_length == 0 || target_length > utf8_string.max_size()) { + return utf8_string; + } + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + input_length, utf8_string.data(), target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/development/planxo/windows/runner/utils.h b/development/planxo/windows/runner/utils.h new file mode 100644 index 0000000..3879d54 --- /dev/null +++ b/development/planxo/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/development/planxo/windows/runner/win32_window.cpp b/development/planxo/windows/runner/win32_window.cpp new file mode 100644 index 0000000..60608d0 --- /dev/null +++ b/development/planxo/windows/runner/win32_window.cpp @@ -0,0 +1,288 @@ +#include "win32_window.h" + +#include +#include + +#include "resource.h" + +namespace { + +/// Window attribute that enables dark mode window decorations. +/// +/// Redefined in case the developer's machine has a Windows SDK older than +/// version 10.0.22000.0. +/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 +#endif + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +/// Registry key for app theme preference. +/// +/// A value of 0 indicates apps should use dark mode. A non-zero or missing +/// value indicates apps should use light mode. +constexpr const wchar_t kGetPreferredBrightnessRegKey[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; +constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + } + FreeLibrary(user32_module); +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registrar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::Create(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + UpdateTheme(window); + + return OnCreate(); +} + +bool Win32Window::Show() { + return ShowWindow(window_handle_, SW_SHOWNORMAL); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + + case WM_DWMCOLORIZATIONCOLORCHANGED: + UpdateTheme(hwnd); + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} + +void Win32Window::UpdateTheme(HWND const window) { + DWORD light_mode; + DWORD light_mode_size = sizeof(light_mode); + LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, + kGetPreferredBrightnessRegValue, + RRF_RT_REG_DWORD, nullptr, &light_mode, + &light_mode_size); + + if (result == ERROR_SUCCESS) { + BOOL enable_dark_mode = light_mode == 0; + DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, + &enable_dark_mode, sizeof(enable_dark_mode)); + } +} diff --git a/development/planxo/windows/runner/win32_window.h b/development/planxo/windows/runner/win32_window.h new file mode 100644 index 0000000..e901dde --- /dev/null +++ b/development/planxo/windows/runner/win32_window.h @@ -0,0 +1,102 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates a win32 window with |title| that is positioned and sized using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size this function will scale the inputted width and height as + // as appropriate for the default monitor. The window is invisible until + // |Show| is called. Returns true if the window was created successfully. + bool Create(const std::wstring& title, const Point& origin, const Size& size); + + // Show the current window. Returns true if the window was successfully shown. + bool Show(); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + // Update the window frame's theme to match the system theme. + static void UpdateTheme(HWND const window); + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_