Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
2899d25
更新JCore332
LcTerry Aug 30, 2022
5b72910
Merge pull request #54 from LcTerry/master
LcTerry Aug 30, 2022
697f7f0
新增:testCountryCode API
LcTerry Aug 30, 2022
980ec61
遗漏
LcTerry Aug 30, 2022
c5fcb08
恢复
LcTerry Aug 30, 2022
e6b73aa
Merge pull request #55 from LcTerry/master
LcTerry Aug 30, 2022
ab39cbd
更新版本2.0.5
LcTerry Aug 30, 2022
3197b56
Merge pull request #56 from LcTerry/master
LcTerry Aug 30, 2022
e831bcd
修复奔溃更新版本2.0.6
LcTerry Aug 31, 2022
d83ca92
Merge pull request #58 from LcTerry/master
LcTerry Aug 31, 2022
3da0fe6
更新JCore 3.3.6和版本2.0.6
LcTerry Oct 11, 2022
2e609db
Merge remote-tracking branch 'main/master'
LcTerry Feb 15, 2023
24fd854
去掉PACKAGE_ADDED 和PACKAGE_REMOVED
LcTerry Feb 15, 2023
abc26f2
版本号2.0.8
LcTerry Feb 15, 2023
db0de9e
Merge pull request #59 from LcTerry/master
LcTerry Mar 1, 2023
35e8234
更新JCore 420 +版本号2.0.9
LcTerry Apr 11, 2023
26937b2
Merge pull request #60 from LcTerry/master
LcTerry Apr 11, 2023
c2746a7
【iOS】更新jcore版本为4.2.0
huangshuni Apr 11, 2023
0c8afe7
Merge pull request #61 from huangshuni/master
huangshuni Apr 11, 2023
cc4579c
对外暴露enableAutoWakeup,版本号2.1.0
LcTerry Apr 13, 2023
19c32ee
Merge pull request #62 from LcTerry/master
LcTerry Apr 13, 2023
bbd2fc1
更新JCore 423版本,对外版本号2.1.1
LcTerry May 29, 2023
cc7bbe1
Merge pull request #63 from LcTerry/master
LcTerry May 29, 2023
e5ede24
去掉:android.net.conn.CONNECTIVITY_CHANGE ,对外版本号2.1.2
LcTerry Jun 14, 2023
a41fd1b
Merge pull request #64 from LcTerry/master
LcTerry Jun 14, 2023
bb6eb06
更新JCore 4.2.4 ,对外版本号2.1.3
LcTerry Jul 3, 2023
fa02e43
Merge pull request #65 from LcTerry/master
LcTerry Jul 3, 2023
f665442
更新JCore 4.4.0
LcTerry Sep 21, 2023
0cad7e6
Merge pull request #66 from LcTerry/master
LcTerry Sep 21, 2023
ea42785
iOS 更新SDK到4.4.0
huangshuni Sep 22, 2023
ceaf4ed
Merge pull request #67 from huangshuni/master
huangshuni Sep 22, 2023
dff98a8
更新版本号:2.1.4
LcTerry Sep 25, 2023
097e336
更新版本号:2.1.5 +JCore 4.5.3
LcTerry Dec 8, 2023
6b37f6f
更新版本号:2.1.6 +JCore 4.5.7
LcTerry Feb 28, 2024
18fc95f
Merge pull request #69 from LcTerry/master
LcTerry Feb 28, 2024
7f9bd8b
更新iOS jcore为462版本,更新插件版本为2.1.4
huangshuni Apr 25, 2024
43948a2
Merge branch '22'
huangshuni Apr 25, 2024
b495adc
Merge pull request #70 from huangshuni/master
huangshuni Apr 25, 2024
ad77bb8
修改版本号为2.1.8
huangshuni Apr 25, 2024
7bed2f0
Merge pull request #71 from huangshuni/master
huangshuni Apr 25, 2024
5b8bc6e
更新版本号:2.1.9+适配 RN 0.74
May 30, 2024
6416b2f
Merge pull request #72 from LcTerry/master
LcTerry May 31, 2024
c90c19a
更新版本号:2.2.0+更新JCore 470
Jul 4, 2024
ebf6218
iOS 更新版本为4.7.0 ,修改插件版本号为2.2.0
huangshuni Jul 5, 2024
bab36a8
Merge pull request #73 from huangshuni/master
huangshuni Jul 5, 2024
ef7d4bb
Merge pull request #74 from LcTerry/master
LcTerry Jul 5, 2024
a8537eb
更新版本号为2.2.1
huangshuni Jul 5, 2024
84cc396
Merge pull request #75 from huangshuni/master
huangshuni Jul 5, 2024
0515774
iOS更新jcore为4.8.0
huangshuni Sep 29, 2024
76b8a09
Merge pull request #77 from huangshuni/master
huangshuni Sep 30, 2024
c147c0c
更新版本号:2.2.2+更新JCore 480
Oct 8, 2024
cc9b64d
开放setCountryCode+ 2.2.3版本
LcTerry Oct 30, 2024
a3c7751
2.2.3版本
LcTerry Oct 30, 2024
696d2bd
升级jcore 4.8.8
LcTerry Dec 30, 2024
220c673
升级iOS jcore490
huangshuni Jan 16, 2025
33e2e64
升级jcore 4.9.0
LcTerry Feb 11, 2025
058c8de
升级版本2.2.5
LcTerry Feb 11, 2025
5747345
新增ts 接口+ 升级版本2.2.6
LcTerry Mar 18, 2025
3022c10
升级iOS jcore501 , 修改 JCore.podsepc JCoreRN.podsepc. 更新插件版本号为 2.2.7
huangshuni Apr 22, 2025
9aad43c
修改版本号为2.2.8
huangshuni Apr 22, 2025
b5a04cf
android升级jcore 5.0.0 + 版本号2.2.9
huangshuni May 8, 2025
2584a65
升级安卓jcore5.0.3,新增enableSDKLocalLog和readNewLogs方法。修改插件版本号为2.3.0
huangshuni May 30, 2025
cd32fef
新增cursor快速更新模版文档
huangshuni Jul 7, 2025
00ca947
2.3.1: android ios jcore 5.1.0
Jul 22, 2025
d438787
2.3.2: android ios jcore 5.2.0
huangshuni Oct 21, 2025
c14618c
Merge branch 'jpush/master'
ByteZhang1024 Oct 22, 2025
4bfbbdd
chore: update JCore
ByteZhang1024 Oct 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
example/
cursor.md
Comment on lines +1 to +2
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Good start; prefer a whitelist.

You ignored example/ and cursor.md. With the files field in package.json, you can drop .npmignore entirely or expand it to exclude build artifacts (android/build, ios/build, .DS_Store).

🤖 Prompt for AI Agents
In .npmignore around lines 1 to 2: the current file ignores only example/ and
cursor.md but reviewer prefers a whitelist via package.json "files" or a more
complete ignore list; either remove .npmignore if you rely on package.json
"files" (and ensure package.json "files" lists only published files), or expand
.npmignore to explicitly exclude common build/artifact files such as
android/build, ios/build, node_modules, dist, .DS_Store, *.log, and other
generated artifacts so only source files are published.

4 changes: 2 additions & 2 deletions JCore.podspec → JCoreRN.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pjson = JSON.parse(File.read('package.json'))

Pod::Spec.new do |s|

s.name = "JCore"
s.name = "JCoreRN"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Pod rename is a breaking change; coordinate with semver and docs.

Changing s.name from "JCore" to "JCoreRN" will break existing Podfiles. Either:

  • keep the original name for 2.x, or
  • bump to 3.0.0 and add migration notes (Podfile changes, cache clean).

I can draft migration steps and a changelog entry.

🧰 Tools
🪛 RuboCop (1.81.1)

[convention] 5-6: Extra empty line detected at block body beginning.

(Layout/EmptyLinesAroundBlockBody)

🤖 Prompt for AI Agents
In JCoreRN.podspec around line 6, the pod name was changed from "JCore" to
"JCoreRN", which is a breaking change for existing consumers; either revert
s.name back to "JCore" for the 2.x release or, if you intend a breaking release,
set the podspec version to 3.0.0 (update s.version accordingly), update
README/changelog with explicit migration steps (how to update Podfiles, clear
CocoaPods cache, and any code changes), and add a release note in the repo
documenting the Pod rename and required consumer actions.

s.version = pjson["version"]
s.homepage = pjson["homepage"]
s.summary = pjson["description"]
Expand All @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/jpush/jcore-react-native.git", :tag => "#{s.version}" }
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Podspec source points to upstream, not this fork.

s.source uses https://github.com/jpush/jcore-react-native.git. If consumers don’t use :path, installs will fetch upstream without your changes/tags. Point it to this repo or publish to trunk accordingly.


🏁 Script executed:

#!/bin/bash
# Show the current podspec source and local repo remote.
rg -n "s\.source" JCoreRN.podspec
git remote -v

Length of output: 442


Update podspec source to point to this fork.

Line 15 currently fetches from upstream (jpush). Change it to your fork (OneKeyHQ) so consumers get your customizations:

s.source = { :git => "https://github.com/OneKeyHQ/jcore-react-native.git", :tag => "#{s.version}" }

Without this fix, CocoaPods installations bypass your changes entirely.

🧰 Tools
🪛 RuboCop (1.81.1)

[convention] 15-15: Prefer to_s over string interpolation.

(Style/RedundantInterpolation)

🤖 Prompt for AI Agents
In JCoreRN.podspec around line 15 the pod source points to the upstream jpush
repository; change the s.source entry to point to the OneKeyHQ fork
(https://github.com/OneKeyHQ/jcore-react-native.git) so CocoaPods fetches this
repo's customizations instead of the upstream one; update the git URL in the
s.source hash to the OneKeyHQ repository while keeping the tag interpolation
"#{s.version}" unchanged.

s.source_files = 'ios/RCTJCoreModule/*.{h,m}'
s.preserve_paths = "**/*.js"
s.vendored_libraries = "ios/RCTJCoreModule/*.a"
s.vendored_frameworks = "ios/RCTJCoreModule/*.xcframework"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Style nit and completeness.

Looks good to use vendored_frameworks. Also remove the extra blank line after the do |s| per RuboCop, and verify if any system frameworks are required by jcore (e.g., Security, SystemConfiguration); add via s.frameworks if needed.

Apply this diff to remove the blank line:

 Pod::Spec.new do |s|
-
   s.name            = "JCoreRN"

Please confirm whether jcore-ios-5.2.1 requires additional system frameworks; if yes, add them with:

s.frameworks = 'Security', 'SystemConfiguration', 'UserNotifications' # example

I'll verify the review concerns by checking the podspec file and researching jcore framework requirements.<!-- [scratchpad_update]
[observations]

  • First web search returned general iOS framework info, not specific to jcore-ios
  • Need more targeted search for jcore iOS library specifics
    [pending]
  1. Inspect JCoreRN.podspec file for blank line issue
  2. Search specifically for jcore iOS library documentation
    [actions]
  3. Script: check podspec file content
  4. Web search: "jcore ios" or "jcore-ios github" for documentation
    [scratchpad_end] -->

[/run_scripts]

[/web_search]


🏁 Script executed:

#!/bin/bash
# Check the JCoreRN.podspec file content around "do |s|"
find . -name "JCoreRN.podspec" -type f | head -1 | xargs cat

Length of output: 695


🌐 Web query:

jcore iOS library system frameworks requirements

💡 Result:

Here are the iOS system frameworks / libs commonly required when integrating the JCore (JiGuang) iOS SDK (manual integration). Add these to "Linked Frameworks and Libraries" (and set Optional where noted):

  • AdSupport.framework (only if using IDFA). [1]
  • CoreLocation.framework. [1]
  • CFNetwork.framework. [1]
  • CoreFoundation.framework. [1]
  • libresolv.tbd. [1]
  • libz.tbd. [1]
  • libc++.1.tbd. (or libc++.tbd) [1]
  • CoreTelephony.framework. [1]
  • SystemConfiguration.framework. [1]
  • Security.framework. [1]
  • CoreGraphics.framework. [1]
  • libsqlite3.tbd. [1]
  • MobileCoreServices.framework. [1]
  • AVFoundation.framework. [1]
  • WebKit.framework (may be required by some JPush/JCore versions). [2]
  • StoreKit.framework (required by some JPush features/versions). [2]
  • UserNotifications.framework (for push notifications / extensions). [3]
  • Network.framework — add & mark Optional if you need iOS 12 and earlier HTTPS support. [1]

Also note: JCore is distributed as an xcframework (jcore-ios-*.xcframework); when using JPush/JCore together follow the version compatibility notes in the JiGuang docs (upgrade guidance may require specific JCore versions and Xcode minimums). [2]

Sources: JiGuang (JCore / JPush) integration docs. [1][2][3]

References
[1] JiGuang JCore iOS integration (manual frameworks list). (docs.jiguang.cn)
[2] JiGuang JPush / JCore SDK guide & upgrade notes (WebKit/StoreKit/version notes). (docs.jiguang.cn)
[3] Cordova / React Native plugin docs referencing required iOS libs (libz, libresolv, UserNotifications). (npm.io)

Citations:


Remove blank line after do |s| and add required system frameworks.

The blank line after do |s| needs removal per RuboCop. Apply this diff:

 Pod::Spec.new do |s|
-
   s.name            = "JCoreRN"

JCore iOS requires multiple system frameworks including Security, SystemConfiguration, CoreLocation, CFNetwork, CoreTelephony, CoreGraphics, MobileCoreServices, AVFoundation, and UserNotifications. Add these frameworks to the podspec:

s.frameworks = 'Security', 'SystemConfiguration', 'CoreLocation', 'CFNetwork', 'CoreTelephony', 'CoreGraphics', 'MobileCoreServices', 'AVFoundation', 'UserNotifications'

Place this after the s.libraries line to ensure all required system dependencies are linked.

🤖 Prompt for AI Agents
In JCoreRN.podspec around line 18, remove the blank line immediately after the
`do |s|` block start and add the required iOS system frameworks after the
existing `s.libraries` line; specifically add entries for Security,
SystemConfiguration, CoreLocation, CFNetwork, CoreTelephony, CoreGraphics,
MobileCoreServices, AVFoundation, and UserNotifications so they are declared via
`s.frameworks` to ensure those system dependencies are linked.

s.libraries = 'z','resolv', 'sqlite3', 'c++.1'
s.dependency 'React'
end
7 changes: 4 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ def safeExtGet(prop, fallback) {
}

android {
compileSdkVersion safeExtGet('compileSdkVersion', 27)
compileSdkVersion safeExtGet('compileSdkVersion', 34)
namespace 'cn.jiguang.plugins.core'
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 27)
minSdkVersion safeExtGet('minSdkVersion', 23)
targetSdkVersion safeExtGet('targetSdkVersion', 34)
Comment on lines +8 to +12
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Set Java/Kotlin compatibility to avoid toolchain drift.

AGP 8+ defaults to Java 17; older RN apps may still compile with 11. Be explicit.

Apply this diff inside android { }:

 android {
   compileSdkVersion safeExtGet('compileSdkVersion', 34)
   namespace 'cn.jiguang.plugins.core'
   defaultConfig {
     minSdkVersion safeExtGet('minSdkVersion', 23)
     targetSdkVersion safeExtGet('targetSdkVersion', 34)
     versionCode 1
     versionName "1.0"
   }
+  compileOptions {
+    sourceCompatibility JavaVersion.VERSION_11
+    targetCompatibility JavaVersion.VERSION_11
+  }
+  // If Kotlin is used elsewhere in the module
+  // kotlinOptions { jvmTarget = '11' }
 }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In android/build.gradle around lines 8-12, the project doesn't set Java/Kotlin
compatibility which can cause toolchain drift with AGP 8+; inside the android {
} block add explicit Java/Kotlin targets: set compileOptions.sourceCompatibility
and compileOptions.targetCompatibility to JavaVersion.VERSION_17 (or 11 if you
must stay on 11), add a java { toolchain {
languageVersion.set(JavaLanguageVersion.of(17)) } } block if using the Java
toolchain, and set kotlinOptions.jvmTarget = "17" (or "11" to match your chosen
Java version) so both Java and Kotlin compile targets are explicit and
consistent.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

namespace requires AGP 7+; document and gate support.

With namespace and minSdk 23/target 34, projects on RN < 0.69 (AGP < 7) will fail. Update docs and peer range (see package.json), or keep AndroidManifest package for backward compatibility.


🏁 Script executed:

#!/bin/bash
# Check if AndroidManifest still declares a package (compat for older AGP).
fd -a AndroidManifest.xml android | while read f; do echo "==> $f"; rg -n 'package=' "$f" || echo "No package attr"; done

Length of output: 75



🏁 Script executed:

#!/bin/bash
# Check package.json for React Native and peerDependencies
fd -a package.json | head -5 | while read f; do echo "==> $f"; cat "$f" | head -30; done

Length of output: 552


🏁 Script executed:

#!/bin/bash
# Search for AGP/Android Gradle Plugin version requirements in docs
fd -a -e md -e txt | xargs rg -l 'AGP|Android Gradle Plugin|minSdk|targetSdk|react-native' | head -10

Length of output: 28


🏁 Script executed:

#!/bin/bash
# Check build.gradle for any comments about AGP or RN version requirements
cat android/build.gradle | head -30

Length of output: 612



🏁 Script executed:

#!/bin/bash
# Check README content for version/AGP requirements
cat /home/jailuser/git/README.md | grep -A 20 -B 5 -i 'react-native\|version\|AGP\|gradle\|compatibility'

Length of output: 75


Tighten peerDependencies or restore AndroidManifest compatibility layer.

Namespace requires AGP 7+, but peerDependencies allows react-native >= 0.60 (includes 0.60-0.68 with AGP < 7). Builds fail for users on older RN versions within your peer range. Either raise the minimum to react-native >= 0.69, add a strong README warning with version requirements, or restore the package attribute in AndroidManifest.xml to support older AGP versions.

🤖 Prompt for AI Agents
In android/build.gradle around lines 8-12 the use of the namespace property
requires AGP 7+, but the package's peerDependencies still allow react-native >=
0.60 (which can use older AGP), causing build failures for those users; fix by
either (A) bumping the peerDependency for react-native to >=0.69 in package.json
and update release notes/README to state the new minimum, or (B) restore
AndroidManifest compatibility by adding the package attribute back into
AndroidManifest.xml (e.g., add package="cn.jiguang.plugins.core" on the
<manifest> root) so older AGP/RN versions work, and include a clear README
warning about supported RN/AGP versions if you choose to maintain the wider peer
range.

versionCode 1
versionName "1.0"
}
Expand Down
Binary file removed android/libs/arm64-v8a/libjcore330.so
Binary file not shown.
Binary file removed android/libs/armeabi-v7a/libjcore330.so
Binary file not shown.
Binary file removed android/libs/armeabi/libjcore330.so
Binary file not shown.
Binary file removed android/libs/jcore-android-3.3.0.jar
Binary file not shown.
Binary file added android/libs/jcore-android-5.2.0.jar
Binary file not shown.
Binary file removed android/libs/mips/libjcore330.so
Binary file not shown.
Binary file removed android/libs/mips64/libjcore330.so
Binary file not shown.
Binary file removed android/libs/x86/libjcore330.so
Binary file not shown.
Binary file removed android/libs/x86_64/libjcore330.so
Binary file not shown.
11 changes: 1 addition & 10 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cn.jiguang.plugins.core">
>

<application>

Expand All @@ -15,15 +15,6 @@
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
<category android:name="${applicationId}" />
</intent-filter>
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />

<data android:scheme="package" />
</intent-filter>
</receiver>

<service
Expand Down
45 changes: 43 additions & 2 deletions android/src/main/java/cn/jiguang/plugins/core/JCoreModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@

import java.util.HashSet;
import java.util.Set;

import cn.jiguang.api.utils.JCollectionAuth;

import cn.jiguang.api.JCoreInterface;

public class JCoreModule extends ReactContextBaseJavaModule {

Expand All @@ -43,6 +42,48 @@ public String getName() {
public void setAuth(boolean bool){
JCollectionAuth.setAuth(reactContext,bool);
}
@ReactMethod
public void enableAutoWakeup(boolean bool) {
JCollectionAuth.enableAutoWakeup(reactContext,bool);
}
@ReactMethod
public void setCountryCode(ReadableMap readableMap){
if (readableMap == null) {
return;
}
String code = readableMap.getString("code");
if (TextUtils.isEmpty(code)) {
} else {
JCoreInterface.setCountryCode(reactContext,code);
}
}
Comment on lines +50 to +59
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Remove the empty else block.

Lines 56-57 have an empty else block after the isEmpty check. Either add logic or remove the block.

Apply this diff:

 @ReactMethod
 public void setCountryCode(ReadableMap readableMap){
     if (readableMap == null) {
         return;
     }
     String code = readableMap.getString("code");
-    if (TextUtils.isEmpty(code)) {
-    } else {
+    if (!TextUtils.isEmpty(code)) {
         JCoreInterface.setCountryCode(reactContext,code);
     }
 }
📝 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.

Suggested change
public void setCountryCode(ReadableMap readableMap){
if (readableMap == null) {
return;
}
String code = readableMap.getString("code");
if (TextUtils.isEmpty(code)) {
} else {
JCoreInterface.setCountryCode(reactContext,code);
}
}
public void setCountryCode(ReadableMap readableMap){
if (readableMap == null) {
return;
}
String code = readableMap.getString("code");
if (!TextUtils.isEmpty(code)) {
JCoreInterface.setCountryCode(reactContext,code);
}
}
🤖 Prompt for AI Agents
In android/src/main/java/cn/jiguang/plugins/core/JCoreModule.java around lines
50 to 59, there is an empty else block after checking TextUtils.isEmpty(code);
remove the empty else block and directly call
JCoreInterface.setCountryCode(reactContext, code) in the non-empty path (i.e.,
invert or restructure the conditional so you return or skip when code is empty
and otherwise invoke setCountryCode), ensuring no empty branches remain.


@ReactMethod
public void enableSDKLocalLog(ReadableMap readableMap){
if (readableMap == null) {
return;
}
boolean enable = false;
if (readableMap.hasKey("enable")) {
enable = readableMap.getBoolean("enable");
}
boolean uploadJgToServer = false;
if (readableMap.hasKey("uploadJgToServer")) {
uploadJgToServer = readableMap.getBoolean("uploadJgToServer");
}
JCoreInterface.enableSDKLocalLog(reactContext,enable,uploadJgToServer);
}
Comment on lines +62 to +75
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Fix indentation on line 71.

Line 71 has inconsistent indentation (extra leading space before if).

Apply this diff:

     boolean uploadJgToServer = false;
-   if (readableMap.hasKey("uploadJgToServer")) {
+    if (readableMap.hasKey("uploadJgToServer")) {
         uploadJgToServer = readableMap.getBoolean("uploadJgToServer");
     }
📝 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.

Suggested change
public void enableSDKLocalLog(ReadableMap readableMap){
if (readableMap == null) {
return;
}
boolean enable = false;
if (readableMap.hasKey("enable")) {
enable = readableMap.getBoolean("enable");
}
boolean uploadJgToServer = false;
if (readableMap.hasKey("uploadJgToServer")) {
uploadJgToServer = readableMap.getBoolean("uploadJgToServer");
}
JCoreInterface.enableSDKLocalLog(reactContext,enable,uploadJgToServer);
}
public void enableSDKLocalLog(ReadableMap readableMap){
if (readableMap == null) {
return;
}
boolean enable = false;
if (readableMap.hasKey("enable")) {
enable = readableMap.getBoolean("enable");
}
boolean uploadJgToServer = false;
if (readableMap.hasKey("uploadJgToServer")) {
uploadJgToServer = readableMap.getBoolean("uploadJgToServer");
}
JCoreInterface.enableSDKLocalLog(reactContext,enable,uploadJgToServer);
}
🤖 Prompt for AI Agents
In android/src/main/java/cn/jiguang/plugins/core/JCoreModule.java around lines
62 to 75, line 71 has an extra leading space before the "if
(readableMap.hasKey("uploadJgToServer")) {" causing inconsistent indentation;
remove the extra space so the "if" aligns with the previous "if
(readableMap.hasKey("enable")) {" and the surrounding code, keeping the same
four-space (or project-standard) indentation level for the block.


@ReactMethod
public void readNewLogs(Callback callback) {
if (callback == null) {
return;
}
String logs = JCoreInterface.readNewLogs(reactContext);
WritableMap writableMap = Arguments.createMap();
writableMap.putString("logs", logs);
callback.invoke(writableMap);
}


}
32 changes: 32 additions & 0 deletions cursor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

使用方法:修改需求里的内容,将需求和步骤内容作为指令让cursor进行执行。


需求:
1. 更新iOS JCore SDK 到 x.x.x 版本。JCore SDK 包的路径是:xxx
2. 更新Android JCore SDK 到 x.x.x 版本, JCore SDK 包的路径是:xxx
3. 将原生iOS、Android SDK 新增的方法,封装在插件中。
原生SDK新增方法一:
iOS :

```
```

Android:

```
```

统一封装为 方法名为 "" 的对外方法。


请按照以下步骤完成:

1. 找到需要升级的iOS JPush SDK,替换ios/RCTJPushModule/jcore-ios-x.x.x.xcframework 为需要更新的版本。
2. 将ios/RCTJCoreModule.xcodeproj/project.pbxproj中关于jcore-ios-x.x.x.xcframework相关的引用,替换为需要更新的版本。
3. 找到需要升级的Android JPush SDK,替换android/libs/jcore-android-x.x.x.jar 为需要更新的版本。
4. 在插件中封装需求中需要封装的SDK方法,并在插件示例demo中提供示例调用代码,注意rn插件新增方法还需要再index.js和index.d.ts文件中声明哦。(如果没有需求中没有需要新增的方法,则跳过该步骤)
5. 在package.json中更新插件版本号,在现有版本号上 + 0.0.1

Comment on lines +1 to +30
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Fix markdown formatting issues.

The file has several markdown linting issues:

  • Missing top-level heading (line 2)
  • Fenced code blocks without language specifiers (lines 12, 17)
  • Trailing spaces (lines 11, 14, 16, 19, 21)

Apply these fixes:

+# JCore SDK 升级指南
+
 使用方法:修改需求里的内容,将需求和步骤内容作为指令让cursor进行执行。
 
 
 需求:
 1. 更新iOS JCore SDK 到 x.x.x 版本。JCore SDK 包的路径是:xxx
 2. 更新Android JCore SDK 到 x.x.x 版本, JCore SDK 包的路径是:xxx
 3. 将原生iOS、Android SDK 新增的方法,封装在插件中。
    原生SDK新增方法一:
    iOS :
-   
-   ```
+
+   ```swift
    ```
-   
+
    Android:
-   
-   ```
+
+   ```java
    ```
-   
-    统一封装为 方法名为 "" 的对外方法。
-    
+
+   统一封装为 方法名为 "" 的对外方法。
+
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

2-2: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)


11-11: Trailing spaces
Expected: 0 or 2; Actual: 3

(MD009, no-trailing-spaces)


12-12: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


14-14: Trailing spaces
Expected: 0 or 2; Actual: 3

(MD009, no-trailing-spaces)


16-16: Trailing spaces
Expected: 0 or 2; Actual: 3

(MD009, no-trailing-spaces)


17-17: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


19-19: Trailing spaces
Expected: 0 or 2; Actual: 3

(MD009, no-trailing-spaces)


21-21: Trailing spaces
Expected: 0 or 2; Actual: 4

(MD009, no-trailing-spaces)

🤖 Prompt for AI Agents
In cursor.md around lines 1 to 30, the document lacks a top-level heading, has
unlabeled fenced code blocks and trailing spaces; to fix it add a top-level
heading at the top (e.g., "Usage" or appropriate Chinese heading), change the
empty fenced blocks for iOS and Android to include language specifiers (replace
the iOS ``` with ```swift and the Android ``` with ```java), remove all trailing
spaces on lines indicated (11,14,16,19,21) and normalize surrounding blank lines
so the "统一封装为 方法名为 "" 的对外方法。" line is correctly separated and not duplicated or
indented incorrectly; ensure markdown is valid and lint-free before committing.



34 changes: 34 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 定义 JCore 类的类型声明
export default class JCore {
/**
* 设置认证信息
* @param auth 是否启用认证
*/
static setAuth(auth: boolean): void;

/**
* 设置国家代码
* @param params 包含国家代码的对象,字段为 { code: string }
*/
static setCountryCode(params: { code: string }): void;

/**
* 启用自动唤醒功能
* @param enable 是否启用自动唤醒
*/
static enableAutoWakeup(enable: boolean): void;

/**
* 启用SDK本地日志,启动用SDK日志缓存本设备
* @param enable 是否启用日志(true表示启用,false表示禁用)
* @param uploadJgToServer 是否将日志上传到极光服务器(true表示上传,false表示不上传)
*/
static enableSDKLocalLog(params: {enable: boolean, uploadJgToServer: boolean}): void;

/**
* 获取所有进程的新增SDK日志
*
* @param {Function} callback = (result) => {"logs":String}
*/
static readNewLogs(callback: Callback<{ logs: string }>): void;
Comment on lines +9 to +33
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Document platform-specific methods.

Methods setCountryCode, enableAutoWakeup, enableSDKLocalLog, and readNewLogs are Android-only (per index.js). Add platform annotations to the JSDoc comments.

Apply this diff:

     /**
      * 设置国家代码
+     * @platform android
      * @param params 包含国家代码的对象,字段为 { code: string }
      */
     static setCountryCode(params: { code: string }): void;

     /**
      * 启用自动唤醒功能
+     * @platform android
      * @param enable 是否启用自动唤醒
      */
     static enableAutoWakeup(enable: boolean): void;

     /**
       * 启用SDK本地日志,启动用SDK日志缓存本设备
+      * @platform android
       * @param enable 是否启用日志(true表示启用,false表示禁用)
       * @param uploadJgToServer 是否将日志上传到极光服务器(true表示上传,false表示不上传)
     */
     static enableSDKLocalLog(params: {enable: boolean, uploadJgToServer: boolean}): void;

     /**
       * 获取所有进程的新增SDK日志
+      * @platform android
       *
       * @param {Function} callback = (result) => {"logs":String}
     */
     static readNewLogs(callback: Callback<{ logs: string }>): void;
📝 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.

Suggested change
/**
* 设置国家代码
* @param params 包含国家代码的对象,字段为 { code: string }
*/
static setCountryCode(params: { code: string }): void;
/**
* 启用自动唤醒功能
* @param enable 是否启用自动唤醒
*/
static enableAutoWakeup(enable: boolean): void;
/**
* 启用SDK本地日志,启动用SDK日志缓存本设备
* @param enable 是否启用日志(true表示启用,false表示禁用)
* @param uploadJgToServer 是否将日志上传到极光服务器(true表示上传,false表示不上传)
*/
static enableSDKLocalLog(params: {enable: boolean, uploadJgToServer: boolean}): void;
/**
* 获取所有进程的新增SDK日志
*
* @param {Function} callback = (result) => {"logs":String}
*/
static readNewLogs(callback: Callback<{ logs: string }>): void;
/**
* 设置国家代码
* @platform android
* @param params 包含国家代码的对象,字段为 { code: string }
*/
static setCountryCode(params: { code: string }): void;
/**
* 启用自动唤醒功能
* @platform android
* @param enable 是否启用自动唤醒
*/
static enableAutoWakeup(enable: boolean): void;
/**
* 启用SDK本地日志,启动用SDK日志缓存本设备
* @platform android
* @param enable 是否启用日志(true表示启用,false表示禁用)
* @param uploadJgToServer 是否将日志上传到极光服务器(true表示上传,false表示不上传)
*/
static enableSDKLocalLog(params: {enable: boolean, uploadJgToServer: boolean}): void;
/**
* 获取所有进程的新增SDK日志
* @platform android
*
* @param {Function} callback = (result) => {"logs":String}
*/
static readNewLogs(callback: Callback<{ logs: string }>): void;
🤖 Prompt for AI Agents
index.d.ts lines 9-33: The JSDoc for setCountryCode, enableAutoWakeup,
enableSDKLocalLog, and readNewLogs lacks platform annotations; update each
method's JSDoc to indicate they are Android-only (e.g., add a clear platform tag
such as "@platform Android" or "@android only" to the top or end of each comment
block), keeping the existing param/type descriptions intact so the TypeScript
declarations remain unchanged.

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Define or import the Callback type.

Line 33 references Callback<T> but it's not defined or imported. This will cause a TypeScript error.

Apply this diff to import from React Native:

+import { Callback } from 'react-native';
+
 // 定义 JCore 类的类型声明
 export default class JCore {
📝 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.

Suggested change
static readNewLogs(callback: Callback<{ logs: string }>): void;
import { Callback } from 'react-native';
// 定义 JCore 类的类型声明
export default class JCore {
static readNewLogs(callback: Callback<{ logs: string }>): void;
}
🤖 Prompt for AI Agents
In index.d.ts around line 33, the type Callback<T> is referenced but not defined
or imported; add an import for Callback from 'react-native' at the top of the
file so the declaration static readNewLogs(callback: Callback<{ logs: string
}>): void; has a resolved type, ensuring the import is placed with other imports
and exported types remain untouched.

}
22 changes: 22 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,27 @@ export default class JCore {
static setAuth(auth) {
JCoreModule.setAuth(auth)
}
static setCountryCode(params) {
if (Platform.OS == "android") {
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Use strict equality operator.

Line 16 (and lines 21, 27, 33) use loose equality ==. Use strict equality === instead.

Apply this diff:

  static setCountryCode(params) {
-   if (Platform.OS == "android") {
+   if (Platform.OS === "android") {
       JCoreModule.setCountryCode(params)
    }
  }
  static enableAutoWakeup(enable) {
-   if (Platform.OS == "android") {
+   if (Platform.OS === "android") {
       JCoreModule.enableAutoWakeup(enable)
    }
  }

  static enableSDKLocalLog(params) {
-   if (Platform.OS == "android") {
+   if (Platform.OS === "android") {
       JCoreModule.enableSDKLocalLog(params)
    }
  }

   static readNewLogs(callback) {
-   if (Platform.OS == "android") {
+   if (Platform.OS === "android") {
       JCoreModule.readNewLogs(callback)
    }
  }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In index.js around lines 16, 21, 27 and 33, replace the loose equality
comparisons using == with strict equality === (e.g., change Platform.OS ==
"android" to Platform.OS === "android") for all four occurrences; update each
conditional to use === to ensure type-safe comparisons and run tests/lint to
confirm no other == usages remain.

JCoreModule.setCountryCode(params)
}
}
static enableAutoWakeup(enable) {
if (Platform.OS == "android") {
JCoreModule.enableAutoWakeup(enable)
}
}

static enableSDKLocalLog(params) {
if (Platform.OS == "android") {
JCoreModule.enableSDKLocalLog(params)
}
}

static readNewLogs(callback) {
if (Platform.OS == "android") {
JCoreModule.readNewLogs(callback)
}
}

}
12 changes: 5 additions & 7 deletions ios/RCTJCoreModule.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
08166A7B27EC622A00C7233B /* RCTJCoreModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6212E9EF1F3991D500BDF51A /* RCTJCoreModule.h */; };
08166A7E27EC62A900C7233B /* jcore-ios-3.2.1.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 08166A7D27EC62A900C7233B /* jcore-ios-3.2.1.a */; };
6212E9F11F3991D500BDF51A /* RCTJCoreModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 6212E9F01F3991D500BDF51A /* RCTJCoreModule.m */; };
62A780B02EA728CB0065922E /* jcore-ios-5.2.1.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62A780AF2EA728CB0065922E /* jcore-ios-5.2.1.xcframework */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -26,19 +26,18 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
08166A7C27EC628200C7233B /* Lib */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Lib; sourceTree = "<group>"; };
08166A7D27EC62A900C7233B /* jcore-ios-3.2.1.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "jcore-ios-3.2.1.a"; path = "RCTJCoreModule/Lib/jcore-ios-3.2.1.a"; sourceTree = "<group>"; };
6212E9B41F3990DC00BDF51A /* libRCTJCoreModule.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTJCoreModule.a; sourceTree = BUILT_PRODUCTS_DIR; };
6212E9EF1F3991D500BDF51A /* RCTJCoreModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJCoreModule.h; sourceTree = "<group>"; };
6212E9F01F3991D500BDF51A /* RCTJCoreModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJCoreModule.m; sourceTree = "<group>"; };
62A780AF2EA728CB0065922E /* jcore-ios-5.2.1.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "jcore-ios-5.2.1.xcframework"; path = "RCTJCoreModule/jcore-ios-5.2.1.xcframework"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
6212E9B11F3990DC00BDF51A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
08166A7E27EC62A900C7233B /* jcore-ios-3.2.1.a in Frameworks */,
62A780B02EA728CB0065922E /* jcore-ios-5.2.1.xcframework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -48,7 +47,7 @@
5CE8168A22FC0295007D710C /* Frameworks */ = {
isa = PBXGroup;
children = (
08166A7D27EC62A900C7233B /* jcore-ios-3.2.1.a */,
62A780AF2EA728CB0065922E /* jcore-ios-5.2.1.xcframework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -73,7 +72,6 @@
6212E9B61F3990DC00BDF51A /* RCTJCoreModule */ = {
isa = PBXGroup;
children = (
08166A7C27EC628200C7233B /* Lib */,
6212E9EF1F3991D500BDF51A /* RCTJCoreModule.h */,
6212E9F01F3991D500BDF51A /* RCTJCoreModule.m */,
);
Expand Down
44 changes: 44 additions & 0 deletions ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>HeadersPath</key>
<string>Headers</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>libJCore.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>HeadersPath</key>
<string>Headers</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>libJCore.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// JGCOREService.h
// JCore
//
// Created by Shuni Huang on 2024/3/19.
// Copyright © 2024 jiguang. All rights reserved.
//

Comment on lines +1 to +8
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Header comment has wrong filename.

The comment block says "JGCOREService.h" but the file is "JGCOREAPI.h". This is a vendor SDK file, so you can't fix it directly. Consider logging this with the vendor if it causes confusion.

🤖 Prompt for AI Agents
In ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64/Headers/JGCOREAPI.h
around lines 1–8 the header block incorrectly names the file "JGCOREService.h"
instead of "JGCOREAPI.h"; since this is a vendored SDK file you should not
modify it in-tree — report the mismatch to the vendor with the file path and
sample header text, and work around locally by either documenting the
discrepancy in your repo (e.g., a short note in the module README or a changelog
entry) or by adding a thin wrapper/header in your codebase that defines the
correct filename/description and forwards to the vendored header so consumers
are not confused.

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface JGCOREAPI : NSObject

+ (void)ci:(BOOL)enable;

@end

NS_ASSUME_NONNULL_END
Loading