Skip to content

fix: systembar colors#1976

Merged
RohitKushvaha01 merged 4 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:fix_system_bars
Mar 24, 2026
Merged

fix: systembar colors#1976
RohitKushvaha01 merged 4 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:fix_system_bars

Conversation

@RohitKushvaha01
Copy link
Member

No description provided.

@RohitKushvaha01 RohitKushvaha01 marked this pull request as draft March 24, 2026 08:42
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 24, 2026

Greptile Summary

This PR refactors the system bar color-update path. Instead of directly calling setNavigationBarColor/setStatusBarColor via reflection, System.java now saves the desired color to the Cordova BackgroundColor preference and dispatches a postMessage("updateSystemBars") to let the Cordova-internal SystemBarPlugin apply the change. On the JS side, a window.statusbar.setBackgroundColor() call is added to the success callback of setUiTheme.

Key points:

  • The simplification in System.java is clean and the exception handling is appropriate for the new code path (IllegalArgumentException from Color.parseColor is the only realistic failure mode).
  • setStatusBarStyle() and setNavigationBarStyle() are now dead code — they are private and no longer invoked anywhere. If the delegated Cordova plugin correctly handles icon appearance (light/dark icons), these can simply be removed; if it does not, icon visibility against the background will be broken across theme switches.
  • The preferences.set / postMessage ordering is correct: the preference is written before the message is posted, so the receiving plugin will always read the updated value.

Confidence Score: 3/5

  • Mergeable after confirming that the delegated SystemBarPlugin handles icon appearance (light/dark icons), otherwise theme switches will produce invisible system-bar icons.
  • The core color-saving and message-dispatch logic is correct, and the previous concerns (window.statusbar definition, SystemBarPlugin availability) have been acknowledged by the developer. The open question is whether the icon-style update (previously done by setStatusBarStyle/setNavigationBarStyle, now dead code) is handled by the receiving plugin — this is a visible regression if it isn't.
  • src/plugins/system/android/com/foxdebug/system/System.java — confirm whether SystemBarPlugin's updateSystemBars handler applies icon style, and remove or re-wire the now-dead setStatusBarStyle/setNavigationBarStyle methods.

Important Files Changed

Filename Overview
src/plugins/system/android/com/foxdebug/system/System.java Refactors setUiTheme to delegate bar color application to Cordova's SystemBarPlugin via postMessage; removes direct reflection-based color and icon-style calls, leaving setStatusBarStyle/setNavigationBarStyle as dead code.
src/plugins/system/www/plugin.js Adds a window.statusbar.setBackgroundColor() call in the setUiTheme success callback; remainder of changes are whitespace-only reformatting.

Sequence Diagram

sequenceDiagram
    participant JS as JS (plugin.js)
    participant Bridge as Cordova Bridge
    participant SysJava as System.java
    participant Prefs as CordovaPreferences
    participant SBPlugin as SystemBarPlugin (Cordova internal)
    participant StatusBar as window.statusbar

    JS->>Bridge: cordova.exec('set-ui-theme', [color, theme])
    Bridge->>SysJava: setUiTheme(color, scheme, callback)
    SysJava->>SysJava: Color.parseColor(color)
    SysJava->>Prefs: preferences.set("BackgroundColor", color)
    SysJava->>SBPlugin: postMessage("updateSystemBars", null)
    SBPlugin->>Prefs: read BackgroundColor
    SBPlugin-->>SBPlugin: apply bar colors to Window
    SysJava->>Bridge: callback.success()
    Bridge->>JS: success callback
    JS->>StatusBar: window.statusbar.setBackgroundColor(color)
    StatusBar-->>StatusBar: update status bar color
Loading

Reviews (3): Last reviewed commit: "feat: improvements" | Re-trigger Greptile

@RohitKushvaha01
Copy link
Member Author

@greptileai

@RohitKushvaha01 RohitKushvaha01 changed the title fix: system bar colors fix: systembar colors Mar 24, 2026
@RohitKushvaha01 RohitKushvaha01 marked this pull request as ready for review March 24, 2026 09:41
@UnschooledGamer
Copy link
Member

↪️ “Mergeable after confirming that the delegated SystemBarPlugin handles icon appearance (light/dark icons), otherwise theme switches will produce invisible system-bar icons.”

@RohitKushvaha01 RohitKushvaha01 merged commit 29bd2fb into Acode-Foundation:main Mar 24, 2026
6 checks passed
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.

2 participants