-
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
Changes from all commits
2899d25
5b72910
697f7f0
980ec61
c5fcb08
e6b73aa
ab39cbd
3197b56
e831bcd
d83ca92
3da0fe6
2e609db
24fd854
abc26f2
db0de9e
35e8234
26937b2
c2746a7
0c8afe7
cc4579c
19c32ee
bbd2fc1
cc7bbe1
e5ede24
a41fd1b
bb6eb06
fa02e43
f665442
0cad7e6
ea42785
ceaf4ed
dff98a8
097e336
6b37f6f
18fc95f
7f9bd8b
43948a2
b495adc
ad77bb8
7bed2f0
5b8bc6e
6416b2f
c90c19a
ebf6218
bab36a8
ef7d4bb
a8537eb
84cc396
0515774
76b8a09
c147c0c
cc9b64d
a3c7751
696d2bd
220c673
33e2e64
058c8de
5747345
3022c10
9aad43c
b5a04cf
2584a65
cd32fef
00ca947
d438787
c14618c
4bfbbdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| example/ | ||
| cursor.md | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ pjson = JSON.parse(File.read('package.json')) | |
|
|
||
| Pod::Spec.new do |s| | ||
|
|
||
| s.name = "JCore" | ||
| s.name = "JCoreRN" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
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 |
||
| s.version = pjson["version"] | ||
| s.homepage = pjson["homepage"] | ||
| s.summary = pjson["description"] | ||
|
|
@@ -15,7 +15,7 @@ Pod::Spec.new do |s| | |
| 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 commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainPodspec 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: Without this fix, CocoaPods installations bypass your changes entirely. 🧰 Tools🪛 RuboCop (1.81.1)[convention] 15-15: Prefer (Style/RedundantInterpolation) 🤖 Prompt for AI Agents |
||
| 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 commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainStyle 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]
[/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: 💡 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):
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 Citations:
Remove blank line after The blank line after 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 🤖 Prompt for AI Agents |
||
| s.libraries = 'z','resolv', 'sqlite3', 'c++.1' | ||
| s.dependency 'React' | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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' }
}
🤖 Prompt for AI Agents🧩 Analysis chainnamespace 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 |
||
| versionCode 1 | ||
| versionName "1.0" | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Apply this diff: boolean uploadJgToServer = false;
- if (readableMap.hasKey("uploadJgToServer")) {
+ if (readableMap.hasKey("uploadJgToServer")) {
uploadJgToServer = readableMap.getBoolean("uploadJgToServer");
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @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); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
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 (MD009, no-trailing-spaces) 12-12: Fenced code blocks should have a language specified (MD040, fenced-code-language) 14-14: Trailing spaces (MD009, no-trailing-spaces) 16-16: Trailing spaces (MD009, no-trailing-spaces) 17-17: Fenced code blocks should have a language specified (MD040, fenced-code-language) 19-19: Trailing spaces (MD009, no-trailing-spaces) 21-21: Trailing spaces (MD009, no-trailing-spaces) 🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Document platform-specific methods. Methods 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
Suggested change
🤖 Prompt for AI AgentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Define or import the Callback type. Line 33 references Apply this diff to import from React Native: +import { Callback } from 'react-native';
+
// 定义 JCore 类的类型声明
export default class JCore {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,5 +12,27 @@ export default class JCore { | |
| static setAuth(auth) { | ||
| JCoreModule.setAuth(auth) | ||
| } | ||
| static setCountryCode(params) { | ||
| if (Platform.OS == "android") { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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)
}
}
🤖 Prompt for AI Agents |
||
| 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) | ||
| } | ||
| } | ||
|
|
||
| } | ||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @interface JGCOREAPI : NSObject | ||
|
|
||
| + (void)ci:(BOOL)enable; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END | ||
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