Skip to content

feat!: support previous non-E2E #1817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

erisu
Copy link
Member

@erisu erisu commented Jun 25, 2025

Motivation and Context

  • Support previous non-E2E design in SDK 35+ (including SDK 36)
  • Add an platform internal plugin called SystemBarPlugin
    • Statusbar (Include auto changing of font/icon color)
    • Nav/Gesture Bar
  • Add Core StatusBar JS APIs

Description

StatusBar JS API:

  • window.statusbar.visible = <true|false>
  • window.statusbar.setBackgroundColor('#AARRGGBB')

`config.xml preferences:

This PR reuses all of the previous preferences. Order of imports listed below

  • For StatusBar
    • StatusBarBackgroundColor
    • BackgroundColor
  • For Nav/Gesture Bar
    • BackgroundColor

Testing

  • npm t
  • Build testing

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

}
} else {
Window window = cordova.getActivity().getWindow();
int uiOptions = window.getDecorView().getSystemUiVisibility();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
View.getSystemUiVisibility
should be avoided because it has been deprecated.
uiOptions |= flags;
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
window.getDecorView().setSystemUiVisibility(uiOptions);

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
View.setSystemUiVisibility
should be avoided because it has been deprecated.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Allow custom navigation bar background color for SDK 26 and greater.
window.setNavigationBarColor(bgColor);

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
Window.setNavigationBarColor
should be avoided because it has been deprecated.
window.setNavigationBarColor(bgColor);
} else {
// Force navigation bar to black for SDK 25 and less.
window.setNavigationBarColor(Color.BLACK);

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
Window.setNavigationBarColor
should be avoided because it has been deprecated.
controllerCompat.setAppearanceLightStatusBars(isStatusBarBackgroundColorLight);

// Allow custom background color for StatusBar.
window.setStatusBarColor(bgColor);

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
Window.setStatusBarColor
should be avoided because it has been deprecated.
private View getStatusBarView(CordovaWebView webView) {
FrameLayout rootView = getRootLayout(webView);
for (int i = 0; i < (rootView != null ? rootView.getChildCount() : 0); i++) {
View child = rootView.getChildAt(i);

Check warning

Code scanning / CodeQL

Dereferenced variable may be null Warning

Variable
rootView
may be null at this access as suggested by
this
null guard.
@codecov-commenter
Copy link

codecov-commenter commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.63%. Comparing base (484c60e) to head (250a0c6).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1817      +/-   ##
==========================================
+ Coverage   72.12%   72.63%   +0.51%     
==========================================
  Files          23       23              
  Lines        1844     1831      -13     
==========================================
  Hits         1330     1330              
+ Misses        514      501      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erisu erisu added this to the 15.0.0 milestone Jun 25, 2025
}
}

private void setStatusBarBackgroundColor(final String colorPref) {
Copy link
Member

Choose a reason for hiding this comment

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

For iOS, I passed the colour values as 3 integers, which allowed a bit more flexibility in how it was specified on the JS side (i.e., to allow setting it to rgb(123 234 124) or maroon and using CSS.getComputedStyle to parse it and guarantee we'd get 3 RGB components)

Comment on lines +57 to +61
// Confirm if value is a valid hex code is before passing to native-side
if (!(/^#(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value))) {
console.error('Invalid color hex code. Valid format: #RRGGBB or #AARRGGBB');
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

The iOS side did some smart parsing using the getComputedStyle API to take any valid CSS colour specification and get back RGB components

@dpogue
Copy link
Member

dpogue commented Jun 27, 2025

You might be able to use @SuppressWarnings("deprecation") to bypass those code scanning warnings about deprecated API

@erisu erisu force-pushed the feat/non-e2e-and-improved-system-bar-theming branch from b4e4b54 to 250a0c6 Compare June 27, 2025 11:19
@erisu erisu changed the title feat!: non-e2e & improved theming feat!: support previous non-E2E Jun 27, 2025
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