Skip to content

fix: add fallback and min webview#2089

Merged
bajrangCoder merged 5 commits intoAcode-Foundation:mainfrom
bajrangCoder:fix/compat-issue
May 8, 2026
Merged

fix: add fallback and min webview#2089
bajrangCoder merged 5 commits intoAcode-Foundation:mainfrom
bajrangCoder:fix/compat-issue

Conversation

@bajrangCoder
Copy link
Copy Markdown
Member

No description provided.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 8, 2026

Greptile Summary

This PR adds compatibility fixes for older Android WebView versions, addresses three related gaps: a ResizeObserver fallback in the terminal manager, a Cordova clipboard plugin fallback in the file browser, and a startup WebView version check with user-visible messaging.

  • WebView version gate (www/index.html, src/main.js): Detects the WebView major version at startup and shows a hint message when it is below the configured minimum (84), also annotating the debug info panel.
  • ResizeObserver fallback (terminalManager.js): When ResizeObserver is absent, a 500 ms polling interval replaces it; the mock disconnect() object ensures the interval is properly cleared on terminal close.
  • Clipboard fallback (fileBrowser.js): Tries the Cordova clipboard plugin first, then navigator.clipboard, and finally shows an i18n-keyed error — the "clipboard not available" key is added to all 32 locale files (with English placeholder text for non-English locales) and the web path is now properly awaited.

Confidence Score: 5/5

All three fallback paths are correctly guarded and cleaned up; no changed code path introduces wrong behavior or data loss.

The changes are defensive compatibility shims. The ResizeObserver fallback correctly mimics the disconnect interface, the clipboard fallback properly falls through to an error alert, and the WebView check is read-only and display-only. No logic errors or data mutations were found on any of the new paths.

No files require special attention.

Important Files Changed

Filename Overview
src/components/terminal/terminalManager.js Adds a setInterval-based fallback when ResizeObserver is unavailable; the mock disconnect object correctly clears the interval on terminal close.
src/pages/fileBrowser/fileBrowser.js Adds a Cordova clipboard plugin path before the web Clipboard API, and shows a translated error string when neither is available; navigator.clipboard.writeText is now properly awaited.
src/utils/polyfill.js Adds a standard queueMicrotask polyfill that re-throws errors via setTimeout to avoid swallowing them.
www/index.html Adds WebView version gate, startup error handlers with isStartupLoading() guard to prevent stale messages, and CSS top/right/bottom/left fallbacks alongside inset.
src/main.js Appends a "(minimum supported: N)" annotation to the WebView version in debug info when the detected major is below the threshold.
src/lang/en-us.json Adds the clipboard not available i18n key; all other locale files include the same English placeholder text pending translation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[App startup - index.html] --> B{WebView major >= 84?}
    B -- No --> C[setStartupMessage: WebView too old]
    B -- Yes --> D[Load app normally]
    C --> D
    D --> E[terminalManager: open terminal]
    E --> F{typeof ResizeObserver === 'function'?}
    F -- Yes --> G[new ResizeObserver - handleResize]
    F -- No --> H[setInterval 500ms - handleResize fallback]
    G --> I[terminalFile._resizeObserver = observer]
    H --> J[terminalFile._resizeObserver = mock disconnect]
    D --> K[fileBrowser: copyuri action]
    K --> L{cordova.plugins.clipboard available?}
    L -- Yes --> M[cordova clipboard.copy url]
    L -- No --> N{navigator.clipboard.writeText available?}
    N -- Yes --> O[await navigator.clipboard.writeText url]
    N -- No --> P[alert: clipboard not available]
    M --> Q[alert: copied to clipboard]
    O --> Q
Loading

Reviews (2): Last reviewed commit: "fix" | Re-trigger Greptile

Comment thread www/index.html
Comment thread www/index.html
Comment thread src/pages/fileBrowser/fileBrowser.js
@bajrangCoder

This comment was marked as outdated.

@UnschooledGamer
Copy link
Copy Markdown
Member

Some Translation files are missing keys I think 🤔, they are unsynchronized probably.

Copy link
Copy Markdown
Member

@RohitKushvaha01 RohitKushvaha01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bajrangCoder
Copy link
Copy Markdown
Member Author

Some Translation files are missing keys I think 🤔, they are unsynchronized probably.

Hm, Btw thats not introduced in this pr

@bajrangCoder bajrangCoder merged commit d13b25e into Acode-Foundation:main May 8, 2026
6 checks passed
@bajrangCoder bajrangCoder deleted the fix/compat-issue branch May 8, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants