Skip to content

fix: plugin install#1946

Merged
RohitKushvaha01 merged 1 commit intomainfrom
RohitKushvaha01-patch-2
Mar 14, 2026
Merged

fix: plugin install#1946
RohitKushvaha01 merged 1 commit intomainfrom
RohitKushvaha01-patch-2

Conversation

@RohitKushvaha01
Copy link
Copy Markdown
Member

No description provided.

@RohitKushvaha01 RohitKushvaha01 merged commit 47fe9bc into main Mar 14, 2026
8 checks passed
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 14, 2026

Greptile Summary

This PR fixes plugin installation by adding a missing "checksumText" routing case to the outer switch statement in System.java. Without it, checksumText action calls fell through to default: return false, meaning the SHA-256 checksum handler that already existed in the inner thread-pool switch was never reached.

Key changes:

  • Adds case "checksumText": to the routing switch (lines 183–206) so the action is recognised and dispatched to the background thread-pool executor.
  • No other logic is changed; the SHA-256 implementation was already present.

Notable pre-existing issue (not introduced by this PR):

  • The checksumText handler inside the inner switch unnecessarily submits a second cordova.getThreadPool().execute(...) task even though it is already running in a thread-pool thread. This is redundant overhead and should be cleaned up.

Confidence Score: 4/5

  • Safe to merge — the one-line routing fix is correct and the pre-existing SHA-256 implementation is sound.
  • The change is minimal (a single case label added to a routing switch) and directly enables a pre-existing, already-correct handler. SHA-256 via MessageDigest is standard and secure. The only concern is a pre-existing style inefficiency (nested thread pool submission) that does not affect correctness.
  • No files require special attention beyond the noted redundant nested thread pool call in System.java.

Important Files Changed

Filename Overview
src/plugins/system/android/com/foxdebug/system/System.java Adds "checksumText" to the routing switch so the pre-existing SHA-256 handler in the thread-pool executor is correctly reached; the fix is minimal and correct. Pre-existing style issue: the handler unnecessarily spawns a second thread-pool task while already executing in the thread pool.

Sequence Diagram

sequenceDiagram
    participant JS as JavaScript (WebView)
    participant CP as CordovaPlugin.execute()
    participant SW1 as Routing Switch
    participant TP as Thread Pool
    participant SW2 as Inner Switch
    participant MD as MessageDigest (SHA-256)

    JS->>CP: exec("checksumText", [text])
    CP->>SW1: switch(action)
    Note over SW1: Before fix: falls to default → return false
    Note over SW1: After fix: case "checksumText" → break
    SW1-->>CP: break (action recognized)
    CP->>TP: cordova.getThreadPool().execute(Runnable)
    TP->>SW2: switch(action) in background thread
    SW2->>TP: (redundant) getThreadPool().execute(lambda)
    TP->>MD: digest(text.getBytes("UTF-8"))
    MD-->>TP: SHA-256 hex string
    TP-->>JS: callbackContext.success(hexString)
Loading

Comments Outside Diff (1)

  1. src/plugins/system/android/com/foxdebug/system/System.java, line 569-595 (link)

    Redundant nested thread pool submission

    The checksumText case is already executing inside the outer cordova.getThreadPool().execute(new Runnable() {...}) block (the one starting at line ~396). Submitting another cordova.getThreadPool().execute(...) inside it is redundant — the SHA-256 computation can run directly in the already-running background thread, saving a task-queue round-trip.

Last reviewed commit: a05da2c

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.

1 participant