Skip to content

Conversation

@xieyanghui
Copy link

@xieyanghui xieyanghui commented Mar 23, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced the Android splash screen with an option for full-screen display, allowing better adaptation for devices with display cutouts and smoother animation handling.
  • Chores

    • Upgraded the package version to 1.1.2 and removed outdated example, configuration, and documentation files to streamline the project.

@google-cla
Copy link

google-cla bot commented Mar 23, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2025

Walkthrough

This pull request primarily removes many configuration, documentation, build, and example files—including various ignore files, project-specific configurations for Android and iOS, and testing templates—to streamline the repository. The most significant functional change is in the Android splash screen implementation, where the SplashScreen class has been updated to support a full-screen mode through an additional parameter and a new method. Additionally, the root package.json has been bumped to version 1.1.2 with added mappings for stream and cryptographic modules tailored for React Native.

Changes

File(s) Change Summary
.gitignore, .npmignore, CONTRIBUTING.md, add-LaunchScreen-tutorial-for-ios.md Deleted root configuration, ignore, and contribution guideline files.
android/.npmignore, android/proguard-rules.pro Removed Android-specific npm ignore rules and ProGuard configuration files.
android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java Updated splash screen functions: added a fullScreen parameter to show, introduced setActivityAndroidP for full-screen support, and refined dialog dismissal logic.
examples/... Removed an extensive set of examples, configuration, build, test, and asset files (including Buck, Gradle, Xcode project settings, ESLint, Flow, and others).
issue_template.md Deleted the issue report template file.
package.json Updated version from 1.1.1 to 1.1.2 and added new mappings for React Native modules handling streams and cryptographic functions.

Sequence Diagram(s)

sequenceDiagram
    participant A as Activity
    participant S as SplashScreen
    participant D as Dialog
    A->>S: show(activity, themeResId, lottieId, fullScreen)
    alt fullScreen true
        S->>S: setActivityAndroidP(dialog)
    end
    S->>D: Display splash screen
    D-->>S: Animation finished? (isAnimationFinished)
    S->>A: Dismiss splash dialog
Loading

Poem

Hopping through the code I roam,
Seeing files bid a fond goodbye,
Old configs and tests no longer foam,
Now a full-screen splash lights the sky.
With version bump and mappings anew,
I nibble on changes—oh so true! 🐇

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
package.json (1)

56-64: Examine Browser Field Mappings.
The "browser" field contains similar mappings to the "react-native" section. If both fields are required to support different bundler behaviors or environments, please ensure that the duplication is intentional and documented. Otherwise, consider consolidating or clarifying the necessity for both to simplify future maintenance.

android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java (4)

22-25: Consider thread safety for static boolean flags.

The boolean flags isAnimationFinished and waiting are accessed from different threads without synchronization, which could lead to race conditions.

Consider making these flags volatile:

-    private static Boolean isAnimationFinished = false;
-    private static Boolean waiting = false;
+    private static volatile boolean isAnimationFinished = false;
+    private static volatile boolean waiting = false;

Also, use primitive boolean instead of Boolean object for better performance.


46-46: Remove debug print statement.

The System.out.println("asdf") looks like debugging code that should be removed or replaced with proper logging.

-                            System.out.println("asdf");
+                            // Animation started

73-99: Consider refactoring dialog dismissal logic.

There's duplicate code between setAnimationFinished and hide methods for dismissing the dialog. Consider extracting this logic into a separate method.

+    private static void tryDismissDialog(Activity activity) {
+        if (mSplashDialog != null && mSplashDialog.isShowing()) {
+            boolean isDestroyed = false;
+
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+                isDestroyed = activity.isDestroyed();
+            }
+
+            if (!activity.isFinishing() && !isDestroyed && 
+                (isAnimationFinished && waiting)) {
+                mSplashDialog.dismiss();
+                mSplashDialog = null;
+            }
+        }
+    }

Then update both methods to call this shared implementation.


143-153: Improve method documentation and naming.

The method name setActivityAndroidP doesn't clearly indicate its purpose. Consider renaming to something more descriptive like configureFullScreenDialog.

Also, add more detailed documentation about what this method does and its API level requirements:

-    private static void setActivityAndroidP(Dialog dialog) {
-        //设置全屏展示
+    /**
+     * Configures dialog for full-screen display including display cutout areas
+     * for devices running Android P (API 28) and above.
+     *
+     * @param dialog The dialog to configure for full-screen display
+     */
+    private static void configureFullScreenDialog(Dialog dialog) {
+        // Configure for full-screen display
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c20700d and 9ebd229.

⛔ Files ignored due to path filters (20)
  • examples/android/app/src/main/res/mipmap-hdpi/ic_launcher.png is excluded by !**/*.png
  • examples/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png is excluded by !**/*.png
  • examples/android/app/src/main/res/mipmap-mdpi/ic_launcher.png is excluded by !**/*.png
  • examples/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png is excluded by !**/*.png
  • examples/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png is excluded by !**/*.png
  • examples/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png is excluded by !**/*.png
  • examples/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png is excluded by !**/*.png
  • examples/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png is excluded by !**/*.png
  • examples/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png is excluded by !**/*.png
  • examples/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png is excluded by !**/*.png
  • examples/ios/Podfile.lock is excluded by !**/*.lock
  • examples/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
  • ios/.DS_Store is excluded by !**/.DS_Store
  • screenshot/Lottie-Splash-Screen-Android.gif is excluded by !**/*.gif
  • screenshot/Lottie-Splash-Screen-IOS.gif is excluded by !**/*.gif
  • screenshot/apply-Launchscreen.jpg is excluded by !**/*.jpg
  • screenshot/apply-image-set.jpg is excluded by !**/*.jpg
  • screenshot/new-LaunchScreen-image-set.jpg is excluded by !**/*.jpg
  • screenshot/new-LaunchScreen-storyboard.jpg is excluded by !**/*.jpg
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (74)
  • .gitignore (0 hunks)
  • .npmignore (0 hunks)
  • CONTRIBUTING.md (0 hunks)
  • add-LaunchScreen-tutorial-for-ios.md (0 hunks)
  • android/.npmignore (0 hunks)
  • android/proguard-rules.pro (0 hunks)
  • android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java (2 hunks)
  • examples/.buckconfig (0 hunks)
  • examples/.bundle/config (0 hunks)
  • examples/.eslintrc.js (0 hunks)
  • examples/.flowconfig (0 hunks)
  • examples/.gitignore (0 hunks)
  • examples/.prettierrc.js (0 hunks)
  • examples/.ruby-version (0 hunks)
  • examples/.watchmanconfig (0 hunks)
  • examples/App.js (0 hunks)
  • examples/Gemfile (0 hunks)
  • examples/__tests__/App-test.js (0 hunks)
  • examples/android/app/_BUCK (0 hunks)
  • examples/android/app/build.gradle (0 hunks)
  • examples/android/app/build_defs.bzl (0 hunks)
  • examples/android/app/proguard-rules.pro (0 hunks)
  • examples/android/app/src/debug/AndroidManifest.xml (0 hunks)
  • examples/android/app/src/debug/java/com/examples/ReactNativeFlipper.java (0 hunks)
  • examples/android/app/src/main/AndroidManifest.xml (0 hunks)
  • examples/android/app/src/main/java/com/examples/MainActivity.java (0 hunks)
  • examples/android/app/src/main/java/com/examples/MainApplication.java (0 hunks)
  • examples/android/app/src/main/java/com/examples/newarchitecture/MainApplicationReactNativeHost.java (0 hunks)
  • examples/android/app/src/main/java/com/examples/newarchitecture/components/MainComponentsRegistry.java (0 hunks)
  • examples/android/app/src/main/java/com/examples/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java (0 hunks)
  • examples/android/app/src/main/jni/Android.mk (0 hunks)
  • examples/android/app/src/main/jni/MainApplicationModuleProvider.cpp (0 hunks)
  • examples/android/app/src/main/jni/MainApplicationModuleProvider.h (0 hunks)
  • examples/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp (0 hunks)
  • examples/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h (0 hunks)
  • examples/android/app/src/main/jni/MainComponentsRegistry.cpp (0 hunks)
  • examples/android/app/src/main/jni/MainComponentsRegistry.h (0 hunks)
  • examples/android/app/src/main/jni/OnLoad.cpp (0 hunks)
  • examples/android/app/src/main/res/drawable/rn_edit_text_material.xml (0 hunks)
  • examples/android/app/src/main/res/layout/launch_screen.xml (0 hunks)
  • examples/android/app/src/main/res/raw/loading.json (0 hunks)
  • examples/android/app/src/main/res/values/colors.xml (0 hunks)
  • examples/android/app/src/main/res/values/strings.xml (0 hunks)
  • examples/android/app/src/main/res/values/styles.xml (0 hunks)
  • examples/android/build.gradle (0 hunks)
  • examples/android/gradle.properties (0 hunks)
  • examples/android/settings.gradle (0 hunks)
  • examples/app.json (0 hunks)
  • examples/babel.config.js (0 hunks)
  • examples/index.js (0 hunks)
  • examples/ios/.xcode.env (0 hunks)
  • examples/ios/Dynamic.swift (0 hunks)
  • examples/ios/Podfile (0 hunks)
  • examples/ios/examples-Bridging-Header.h (0 hunks)
  • examples/ios/examples.xcodeproj/project.pbxproj (0 hunks)
  • examples/ios/examples.xcodeproj/xcshareddata/xcschemes/examples.xcscheme (0 hunks)
  • examples/ios/examples.xcworkspace/contents.xcworkspacedata (0 hunks)
  • examples/ios/examples.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (0 hunks)
  • examples/ios/examples/AppDelegate.h (0 hunks)
  • examples/ios/examples/AppDelegate.mm (0 hunks)
  • examples/ios/examples/Images.xcassets/AppIcon.appiconset/Contents.json (0 hunks)
  • examples/ios/examples/Images.xcassets/Contents.json (0 hunks)
  • examples/ios/examples/Info.plist (0 hunks)
  • examples/ios/examples/LaunchScreen.storyboard (0 hunks)
  • examples/ios/examples/main.m (0 hunks)
  • examples/ios/examplesTests/Info.plist (0 hunks)
  • examples/ios/examplesTests/examplesTests.m (0 hunks)
  • examples/metro.config.js (0 hunks)
  • examples/package.json (0 hunks)
  • ios/SplashScreen.xcodeproj/xcuserdata/penn.xcuserdatad/xcschemes/SplashScreen.xcscheme (0 hunks)
  • ios/SplashScreen.xcodeproj/xcuserdata/penn.xcuserdatad/xcschemes/xcschememanagement.plist (0 hunks)
  • ios/SplashScreen.xcodeproj/xcuserdata/taehyun.xcuserdatad/xcschemes/xcschememanagement.plist (0 hunks)
  • issue_template.md (0 hunks)
  • package.json (2 hunks)
💤 Files with no reviewable changes (72)
  • examples/app.json
  • examples/.watchmanconfig
  • examples/ios/examples.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  • android/proguard-rules.pro
  • examples/babel.config.js
  • android/.npmignore
  • examples/ios/examples-Bridging-Header.h
  • examples/metro.config.js
  • examples/ios/examples/AppDelegate.h
  • examples/ios/examples/Images.xcassets/Contents.json
  • examples/android/app/src/main/res/values/colors.xml
  • examples/.eslintrc.js
  • examples/.buckconfig
  • examples/android/app/src/main/res/values/styles.xml
  • examples/ios/examplesTests/Info.plist
  • .npmignore
  • examples/android/build.gradle
  • ios/SplashScreen.xcodeproj/xcuserdata/taehyun.xcuserdatad/xcschemes/xcschememanagement.plist
  • examples/Gemfile
  • examples/tests/App-test.js
  • examples/index.js
  • .gitignore
  • examples/ios/examples.xcworkspace/contents.xcworkspacedata
  • examples/android/app/src/main/jni/Android.mk
  • examples/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h
  • examples/android/app/proguard-rules.pro
  • examples/ios/examples/Images.xcassets/AppIcon.appiconset/Contents.json
  • examples/.ruby-version
  • examples/ios/examples/main.m
  • issue_template.md
  • examples/android/app/src/main/jni/MainApplicationModuleProvider.h
  • examples/android/app/src/main/AndroidManifest.xml
  • examples/.bundle/config
  • examples/android/app/src/main/jni/MainApplicationModuleProvider.cpp
  • ios/SplashScreen.xcodeproj/xcuserdata/penn.xcuserdatad/xcschemes/xcschememanagement.plist
  • CONTRIBUTING.md
  • examples/ios/Dynamic.swift
  • examples/.gitignore
  • examples/android/app/src/debug/AndroidManifest.xml
  • examples/android/app/src/main/res/layout/launch_screen.xml
  • examples/android/settings.gradle
  • examples/.prettierrc.js
  • examples/android/app/src/main/res/values/strings.xml
  • examples/ios/examples.xcodeproj/xcshareddata/xcschemes/examples.xcscheme
  • ios/SplashScreen.xcodeproj/xcuserdata/penn.xcuserdatad/xcschemes/SplashScreen.xcscheme
  • examples/android/app/src/main/jni/OnLoad.cpp
  • examples/ios/Podfile
  • examples/package.json
  • examples/android/gradle.properties
  • examples/ios/examples/LaunchScreen.storyboard
  • examples/ios/examples/AppDelegate.mm
  • examples/android/app/build.gradle
  • examples/android/app/src/main/java/com/examples/MainApplication.java
  • examples/android/app/src/main/res/drawable/rn_edit_text_material.xml
  • examples/ios/.xcode.env
  • examples/android/app/_BUCK
  • examples/ios/examplesTests/examplesTests.m
  • add-LaunchScreen-tutorial-for-ios.md
  • examples/App.js
  • examples/android/app/src/main/res/raw/loading.json
  • examples/android/app/src/main/java/com/examples/newarchitecture/MainApplicationReactNativeHost.java
  • examples/android/app/src/debug/java/com/examples/ReactNativeFlipper.java
  • examples/android/app/src/main/java/com/examples/newarchitecture/components/MainComponentsRegistry.java
  • examples/ios/examples/Info.plist
  • examples/android/app/build_defs.bzl
  • examples/android/app/src/main/java/com/examples/MainActivity.java
  • examples/ios/examples.xcodeproj/project.pbxproj
  • examples/android/app/src/main/java/com/examples/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java
  • examples/.flowconfig
  • examples/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp
  • examples/android/app/src/main/jni/MainComponentsRegistry.h
  • examples/android/app/src/main/jni/MainComponentsRegistry.cpp
🔇 Additional comments (6)
package.json (2)

3-3: Version Bump Verified.
The version has been updated to "1.1.2". Please ensure that the changelog and any release notes are updated accordingly to reflect all new changes and potential impacts from this version bump.


46-55: Review React Native Module Mappings.
The new "react-native" field now adds explicit mappings for modules like "crypto" and several stream components. Verify that these mappings properly provide polyfills for Node.js modules in React Native environments. Additionally, confirm that these changes are fully tested across the target platforms to avoid runtime issues.

android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java (4)

7-8: LGTM: Added necessary import for full-screen functionality.

The WindowManager import is correctly added to support the new full-screen display mode.


62-64: LGTM: Proper implementation of full-screen mode.

Good approach to conditionally apply full-screen settings only when requested.


101-104: LGTM: Good method overload with theme selection.

This method provides a convenient way to show the splash screen with appropriate theme selection based on the full-screen parameter.


134-137: Verify animation finish condition.

The dialog is only dismissed if isAnimationFinished is true, which is good for ensuring the animation completes before dismissal. However, consider adding a timeout mechanism in case the animation never completes or fails.

Does the animation have a fixed duration? If not, consider adding a timeout to prevent the splash screen from staying indefinitely if animation fails to complete.

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