-
Notifications
You must be signed in to change notification settings - Fork 5
Feat/update jpush #2
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
Conversation
更新JCore332
更新JCore332
更新版本2.0.5
修复奔溃更新版本2.0.6
去掉PACKAGE_ADDED 和PACKAGE_REMOVED 版本号2.0.8
更新JCore 420 +版本号2.0.9
【iOS】更新jcore版本为4.2.0
对外暴露enableAutoWakeup,版本号2.1.0
更新JCore 423版本,对外版本号2.1.1
去掉:android.net.conn.CONNECTIVITY_CHANGE ,对外版本号2.1.2
更新JCore 4.2.4 ,对外版本号2.1.3
更新JCore 4.4.0
iOS 更新版本为4.7.0 ,修改插件版本号为2.2.0
更新版本号:2.2.0+更新JCore 470
更新版本号为2.2.1
iOS更新jcore为4.8.0
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
WalkthroughThis PR upgrades JCore and JPush native SDKs across iOS and Android platforms. iOS framework migrates from static libraries (.a) to xcframework format (version 3.2.1→5.2.1). Android updates target APIs (27→34). Four new React Native wrapper methods expose SDK capabilities: enableAutoWakeup, setCountryCode, enableSDKLocalLog, and readNewLogs. Changes
Sequence DiagramsequenceDiagram
participant App as React App
participant Bridge as index.js
participant Android as JCoreModule
participant SDK as JCoreInterface
rect rgb(220, 240, 255)
note over App,SDK: enableAutoWakeup(true)
App->>Bridge: enableAutoWakeup(true)
alt Platform.OS === "android"
Bridge->>Android: enableAutoWakeup(true)
Android->>SDK: JCollectionAuth.enableAutoWakeup(true)
SDK-->>Android: ✓
Android-->>Bridge: ✓
end
Bridge-->>App: ✓
end
rect rgb(240, 220, 255)
note over App,SDK: setCountryCode({code: "US"})
App->>Bridge: setCountryCode({code: "US"})
alt Platform.OS === "android"
Bridge->>Android: setCountryCode({code: "US"})
Android->>SDK: JCoreInterface.setCountryCode("US")
SDK-->>Android: ✓
Android-->>Bridge: ✓
end
Bridge-->>App: ✓
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes The changes span multiple systems (Android/iOS build config, native modules, React Native bridge, SDK framework upgrades) with distinct reasoning needed for each area. However, the individual edits follow consistent patterns: SDK version bumps, method wrapper additions, and framework replacement. The iOS xcframework migration and new native method implementations warrant careful inspection, but there's moderate repetition across the wrapper layers. Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
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: 16
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
package.json (1)
19-20: Tighten RN peer range to match AGP 7+ and Android namespace.namespace in Android requires AGP 7+ (RN ≈ ≥0.69). Current ">= 0.60" will break older apps.
Apply this diff:
"peerDependencies": { - "react-native": ">= 0.60" + "react-native": ">= 0.69" }android/build.gradle (1)
25-25: Avoid dynamic '+' for react-native dependency.Lock to the consuming app’s version via safeExtGet to reduce surprise upgrades.
Apply this diff:
- implementation 'com.facebook.react:react-native:+' + implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"ios/RCTJCoreModule.xcodeproj/project.pbxproj (3)
188-193: Align IPHONEOS_DEPLOYMENT_TARGET with the podspec.Project sets 10.3; podspec currently says 7.0. After fixing the podspec, ensure both target the same iOS version (recommend ≥ 10).
Please confirm the chosen minimum (10.0/10.3/11.0) after checking the XCFramework’s MinimumOSVersion (see earlier script).
I can submit a follow-up patch to sync both files.
Also applies to: 230-234
240-253: Optional: drop DEVELOPMENT_TEAM from a library target.A static library doesn’t need signing. Removing DEVELOPMENT_TEAM avoids spurious signing prompts in consumers.
- DEVELOPMENT_TEAM = RL64Y54S9V; + // DEVELOPMENT_TEAM not required for static library targetsAlso applies to: 259-272
241-249: Remove stale Lib search paths to prevent Xcode warnings.The Lib directory no longer exists; these search paths are outdated and must be removed.
Apply this diff at lines 241-249 and also at lines 264-268:
HEADER_SEARCH_PATHS = ( - "$(PROJECT_DIR)/RCTJCoreModule/Lib/**", "$(SRCROOT)/../../react-native/React/**", ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/RCTJCoreModule", - "$(PROJECT_DIR)/RCTJCoreModule/Lib", );JCoreRN.podspec (1)
13-13: Update JCoreRN.podspec to match Xcode project deployment target.The podspec currently sets iOS 7.0, which conflicts with:
- Xcode project: 10.3
- XCFramework requirement: iOS 10+ minimum
iOS 7.0 is unsupported in modern Xcode and incompatible with XCFrameworks. Update line 13 to
s.ios.deployment_target = '10.3'.- s.ios.deployment_target = '7.0' + s.ios.deployment_target = '10.3'
♻️ Duplicate comments (1)
ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64_x86_64-simulator/Headers/JGCOREAPI.h (1)
1-19: Duplicate header for simulator architecture.This file is identical to the device variant. This is expected for XCFramework structure. Same issues noted in the device header apply here.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (9)
android/libs/arm64-v8a/libjcore330.sois excluded by!**/*.soandroid/libs/armeabi-v7a/libjcore330.sois excluded by!**/*.soandroid/libs/armeabi/libjcore330.sois excluded by!**/*.soandroid/libs/jcore-android-3.3.0.jaris excluded by!**/*.jarandroid/libs/jcore-android-5.2.0.jaris excluded by!**/*.jarandroid/libs/mips/libjcore330.sois excluded by!**/*.soandroid/libs/mips64/libjcore330.sois excluded by!**/*.soandroid/libs/x86/libjcore330.sois excluded by!**/*.soandroid/libs/x86_64/libjcore330.sois excluded by!**/*.so
📒 Files selected for processing (16)
.npmignore(1 hunks)JCoreRN.podspec(2 hunks)android/build.gradle(1 hunks)android/src/main/AndroidManifest.xml(1 hunks)android/src/main/java/cn/jiguang/plugins/core/JCoreModule.java(2 hunks)cursor.md(1 hunks)index.d.ts(1 hunks)index.js(1 hunks)ios/RCTJCoreModule.xcodeproj/project.pbxproj(3 hunks)ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/Info.plist(1 hunks)ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64/Headers/JGCOREAPI.h(1 hunks)ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64/PrivacyInfo.xcprivacy(1 hunks)ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64_x86_64-simulator/Headers/JGCOREAPI.h(1 hunks)ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64_x86_64-simulator/Headers/JGInforCollectionAuth.h(1 hunks)ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64_x86_64-simulator/PrivacyInfo.xcprivacy(1 hunks)package.json(1 hunks)
🧰 Additional context used
🪛 Clang (14.0.6)
ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64/Headers/JGCOREAPI.h
[error] 9-9: 'Foundation/Foundation.h' file not found
(clang-diagnostic-error)
ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64_x86_64-simulator/Headers/JGInforCollectionAuth.h
[error] 9-9: 'Foundation/Foundation.h' file not found
(clang-diagnostic-error)
ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64_x86_64-simulator/Headers/JGCOREAPI.h
[error] 9-9: 'Foundation/Foundation.h' file not found
(clang-diagnostic-error)
🪛 markdownlint-cli2 (0.18.1)
cursor.md
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)
🪛 RuboCop (1.81.1)
JCoreRN.podspec
[convention] 5-6: Extra empty line detected at block body beginning.
(Layout/EmptyLinesAroundBlockBody)
🔇 Additional comments (11)
ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64_x86_64-simulator/PrivacyInfo.xcprivacy (1)
1-74: API reason codes verified—confirm framework behavior matches declarations.All three reason codes are valid and current per Apple's PrivacyInfo.xcprivacy documentation:
- E174.1 correctly maps to DiskSpace APIs
- CA92.1 correctly maps to UserDefaults API
- C617.1 correctly maps to FileTimestamp APIs
The privacy manifest structure and declarations are sound. Before merging, manually confirm that jcore-ios 5.2.1 actually accesses these APIs as declared—that no additional APIs are used and no declared APIs are unused.
ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64/Headers/JGCOREAPI.h (1)
15-15: Document theci:method purpose in your integration guide.The cryptic name "ci" isn't explained in public JCore SDK documentation. Since you can't rename a vendor method, add a comment in your wrapper layer explaining what this parameter controls. Check your SDK vendor documentation or release notes for the exact purpose, then document it for future maintainers.
ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64_x86_64-simulator/Headers/JGInforCollectionAuth.h (3)
1-8: LGTM!Standard header comment. No issues.
9-11: LGTM!Foundation import and nullability annotations are correct. The static analysis error is a false positive—xcframework headers compile within iOS project context where Foundation is available.
19-25: ****The file under review is a vendored framework header (
jcore-ios-5.2.1.xcframework), not production code. Don't modify third-party dependencies.The React Native wrapper already abstracts the callback pattern perfectly—consumers see a simple
setAuth(boolean)API. The implementation correctly handles the native SDK's callback design without exposing complexity to end users. No changes needed here.The suggestion to future-proof the API should go to the JCore team, not this codebase.
Likely an incorrect or invalid review comment.
android/src/main/AndroidManifest.xml (1)
2-2: LGTM! Manifest modernization is correct.Removing the package attribute aligns with modern Android practices. The namespace now lives in build.gradle, which is the recommended approach for AGP 7.0+.
ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/Info.plist (1)
1-44: LGTM! Standard XCFramework structure.The Info.plist correctly declares both device (arm64) and simulator (arm64 + x86_64) binaries. The structure follows Apple's XCFramework format requirements.
android/src/main/java/cn/jiguang/plugins/core/JCoreModule.java (2)
45-48: LGTM! Method implementation is correct.The
enableAutoWakeupmethod properly delegates to the native SDK with null safety.
78-86: LGTM! Callback handling is correct.The
readNewLogsmethod properly checks for null callback and returns logs in a WritableMap.index.js (1)
12-14: No changes needed. The code is correct.
setAuthsupports both platforms. The iOS implementation exists (ios/RCTJCoreModule/RCTJCoreModule.m:19), so the method correctly calls the native implementation without a platform check. The new Android-only methods (setCountryCode,enableAutoWakeup,enableSDKLocalLog,readNewLogs) all have platform guards because they're Android-only.setAuthis different—it's cross-platform and doesn't need one.Likely an incorrect or invalid review comment.
ios/RCTJCoreModule/jcore-ios-5.2.1.xcframework/ios-arm64/PrivacyInfo.xcprivacy (1)
33-44: Privacy manifest declaration is accurate — no changes needed.Verification confirms that JPush JCore SDK version 5.2.1 does collect precise location data when location permissions are granted. The SDK transmits precise geolocation to Jiguang's servers once location permission is available. The
NSPrivacyCollectedDataTypePreciseLocationdeclaration in the manifest is correct and should remain as-is.
| example/ | ||
| cursor.md |
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.
🧹 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.
| 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) |
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.
🧹 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.
🧩 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"; doneLength 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; doneLength 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 -10Length of output: 28
🏁 Script executed:
#!/bin/bash
# Check build.gradle for any comments about AGP or RN version requirements
cat android/build.gradle | head -30Length 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.
| public void setCountryCode(ReadableMap readableMap){ | ||
| if (readableMap == null) { | ||
| return; | ||
| } | ||
| String code = readableMap.getString("code"); | ||
| if (TextUtils.isEmpty(code)) { | ||
| } else { | ||
| JCoreInterface.setCountryCode(reactContext,code); | ||
| } | ||
| } |
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.
🧹 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.
| 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.
| 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); | ||
| } |
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.
🧹 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.
| 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.
|
|
||
| 使用方法:修改需求里的内容,将需求和步骤内容作为指令让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 | ||
|
|
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.
🧹 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.
| // | ||
| // JGCOREService.h | ||
| // JCore | ||
| // | ||
| // Created by Shuni Huang on 2024/3/19. | ||
| // Copyright © 2024 jiguang. All rights reserved. | ||
| // | ||
|
|
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.
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.
| Pod::Spec.new do |s| | ||
|
|
||
| s.name = "JCore" | ||
| s.name = "JCoreRN" |
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.
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.ios.deployment_target = '7.0' | ||
|
|
||
| s.source = { :git => "https://github.com/jpush/jcore-react-native.git", :tag => "#{s.version}" } |
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.
🧩 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 -vLength 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" |
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.
🧩 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' # exampleI'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]
- Inspect JCoreRN.podspec file for blank line issue
- Search specifically for jcore iOS library documentation
[actions] - Script: check podspec file content
- 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 catLength 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:
- 1: https://docs.jiguang.cn/jverification/client/ios_guide?utm_source=openai
- 2: https://docs.jiguang.cn/jpush/client/iOS/ios_guide_new?utm_source=openai
- 3: https://npm.io/package/igen-jpush-react-native-gp?utm_source=openai
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.
| "license" : "ISC", | ||
| "main" : "index.js", | ||
| "version" : "2.0.3", | ||
| "version" : "2.3.2", |
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.
🧩 Analysis chain
Align versioning with release artifacts (tagging).
CocoaPods uses s.version for :tag. Please push a git tag 2.3.2 on merge so pod installs don’t 404.
🏁 Script executed:
#!/bin/bash
# Expect to see refs/tags/2.3.2 after tagging.
git ls-remote --tags origin | rg 'refs/tags/2\.3\.2$' || echo "Tag 2.3.2 not found on origin"Length of output: 29
Push git tag 2.3.2 before or upon merge.
Verification confirms the tag doesn't exist on origin. CocoaPods will use s.version (2.3.2) to fetch :tag during pod install. Without this tag, installation fails with 404. Create and push the tag to complete the release.
🤖 Prompt for AI Agents
In package.json at line 8 (version "2.3.2"), the Git tag for this release is
missing on origin; create and push a matching tag so CocoaPods can fetch :tag
during pod install. Locally create an annotated tag named 2.3.2 (e.g. git tag -a
2.3.2 -m "release 2.3.2") and push it to the remote (git push origin 2.3.2), or
create and push the tag in your CI/release job so the tag exists on origin at
merge time.
🧹 Nitpick | 🔵 Trivial
Ship only what consumers need.
Add a files whitelist to shrink the npm tarball and avoid leaking examples/build output.
Apply this diff:
"main" : "index.js",
"version" : "2.3.2",
+ "files": [
+ "index.js",
+ "index.d.ts",
+ "android/**",
+ "ios/**",
+ "JCoreRN.podspec",
+ "README.md",
+ "LICENSE"
+ ],📝 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.
| "version" : "2.3.2", | |
| "main" : "index.js", | |
| "version" : "2.3.2", | |
| "files": [ | |
| "index.js", | |
| "index.d.ts", | |
| "android/**", | |
| "ios/**", | |
| "JCoreRN.podspec", | |
| "README.md", | |
| "LICENSE" | |
| ], |
🤖 Prompt for AI Agents
In package.json around line 8, the package currently lacks a "files" whitelist
which causes npm to include unnecessary files (examples, build output) in the
published tarball; add a top-level "files" array listing only the runtime
artifacts consumers need (for example: "dist/", "lib/", "index.js",
"package.json", "README.md", "LICENSE") and remove build/examples directories
from the package by ensuring they are not listed; also verify .npmignore is
consistent or remove it if using "files" to control publication so the tarball
size and leaked artifacts are minimized.
Summary by CodeRabbit
Release Notes
New Features
enableAutoWakeup()to enable/disable auto-wakeup functionalitysetCountryCode()to configure country settingsenableSDKLocalLog()with optional server upload capabilityreadNewLogs()callback to retrieve SDK logsChores