-
-
Notifications
You must be signed in to change notification settings - Fork 6
Android update #130
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
base: main
Are you sure you want to change the base?
Android update #130
Conversation
WalkthroughThe pull request introduces new version entries and updates to the CHANGELOG, including breaking changes and dependency updates. It modifies the return type of the Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant NavigationBarPlugin
participant AndroidOS
App->>NavigationBarPlugin: setNavigationBarColor(buttonStyle)
alt Device API level >= 30
NavigationBarPlugin->>AndroidOS: Get WindowInsetsController
alt buttonStyle equals "#000000"
NavigationBarPlugin->>AndroidOS: Set light navigation bars
else buttonStyle not "#000000"
NavigationBarPlugin->>AndroidOS: Reset system bar appearance
end
else Device API level < 30
NavigationBarPlugin->>AndroidOS: Apply fallback UI flags based on buttonStyle
end
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@capacitor/[email protected], npm/@capacitor/[email protected] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
CHANGELOG.md (1)
5-58
: Consider adjusting heading levels to satisfy markdown lint rules.The markdown lint tool flags these lines for skipping a heading level (MD001). If desired, you may align the headings by promoting them from H3 (
###
) to H2 (##
) or inserting an intermediate H2 heading. Example fix:-### [8.0.5](...) +## [8.0.5](...)🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
5-5: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3(MD001, heading-increment)
README.md (1)
47-51
: Documentation Update: Clear Optional Property DefinitionThe updated function signature for
getNavigationBarColor()
now reflects thatbuttonStyle
is optional with the addition of the question mark. This aligns well with the changes made in the plugin interface and helps clarify to users that while acolor
is always returned,buttonStyle
might not be provided.If there are additional documentation references or usage examples that rely on the previous return type, please double-check and update them accordingly.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (4)
CHANGELOG.md
(1 hunks)README.md
(1 hunks)android/src/main/java/ee/forgr/capacitor_navigation_bar/NavigationBarPlugin.java
(2 hunks)src/definitions.ts
(1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
CHANGELOG.md
5-5: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
🔇 Additional comments (2)
src/definitions.ts (1)
19-19
: MarkingbuttonStyle
as optional looks good.This aligns well with the default value in your Android implementation (i.e.,
#FFFFFF
) whenbuttonStyle
is not provided.android/src/main/java/ee/forgr/capacitor_navigation_bar/NavigationBarPlugin.java (1)
6-6
: Import addition acknowledged.Adding
WindowInsetsController
is necessary for managing system bars on newer Android versions.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
WindowInsetsController insetsController = getActivity() | ||
.getWindow() | ||
.getInsetsController(); | ||
if (insetsController != null) { | ||
if (buttonStyle.equals("#000000")) { | ||
insetsController.setSystemBarsAppearance( | ||
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS, | ||
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS | ||
); | ||
} else { | ||
insetsController.setSystemBarsAppearance( | ||
0, | ||
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS | ||
); | ||
} | ||
} | ||
} else { | ||
// Fallback for devices running below Android 11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct API level check for WindowInsetsController
.
getWindow().getInsetsController()
is introduced in API 30 (Android 11), but you are gating with Build.VERSION_CODES.O
(Android 8.0). This can cause runtime issues on devices between API levels 26 and 29. Consider using Build.VERSION_CODES.R
instead:
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | |
WindowInsetsController insetsController = getActivity() | |
.getWindow() | |
.getInsetsController(); | |
if (insetsController != null) { | |
if (buttonStyle.equals("#000000")) { | |
insetsController.setSystemBarsAppearance( | |
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS, | |
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS | |
); | |
} else { | |
insetsController.setSystemBarsAppearance( | |
0, | |
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS | |
); | |
} | |
} | |
} else { | |
// Fallback for devices running below Android 11 | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { | |
WindowInsetsController insetsController = getActivity() | |
.getWindow() | |
.getInsetsController(); | |
if (insetsController != null) { | |
if (buttonStyle.equals("#000000")) { | |
insetsController.setSystemBarsAppearance( | |
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS, | |
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS | |
); | |
} else { | |
insetsController.setSystemBarsAppearance( | |
0, | |
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS | |
); | |
} | |
} | |
} else { | |
// Fallback for devices running below Android 11 |
As it stands
7.1.6
isn't compatible with the latest version of android so this PR aims to fix that.I am not an experienced java developer so please let me know if there are any issues with my solution. I also found an error in
web.ts
which I solved by makingbuttonStyle
optional.Summary by CodeRabbit