@kafudev/jcore-react-native
Advanced tools
| package cn.jiguang.plugins.core; | ||
| import android.app.Activity; | ||
| import android.app.Application; | ||
| import android.os.Bundle; | ||
| import android.text.TextUtils; | ||
| import android.util.Log; | ||
| import com.facebook.react.bridge.Arguments; | ||
| import com.facebook.react.bridge.Callback; | ||
| import com.facebook.react.bridge.ReactApplicationContext; | ||
| import com.facebook.react.bridge.ReactContextBaseJavaModule; | ||
| import com.facebook.react.bridge.ReactMethod; | ||
| import com.facebook.react.bridge.ReadableArray; | ||
| import com.facebook.react.bridge.ReadableMap; | ||
| import com.facebook.react.bridge.WritableMap; | ||
| import org.json.JSONObject; | ||
| import java.util.HashSet; | ||
| import java.util.Set; | ||
| import cn.jiguang.api.utils.JCollectionAuth; | ||
| public class JCoreModule extends ReactContextBaseJavaModule { | ||
| public static ReactApplicationContext reactContext; | ||
| public JCoreModule(ReactApplicationContext reactApplicationContext) { | ||
| super(reactContext); | ||
| reactContext = reactApplicationContext; | ||
| } | ||
| @Override | ||
| public String getName() { | ||
| return "JCoreModule"; | ||
| } | ||
| @ReactMethod | ||
| public void setAuth(boolean bool){ | ||
| JCollectionAuth.setAuth(reactContext,bool); | ||
| } | ||
| } |
| package cn.jiguang.plugins.core; | ||
| import java.util.Arrays; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import com.facebook.react.ReactPackage; | ||
| import com.facebook.react.bridge.NativeModule; | ||
| import com.facebook.react.bridge.ReactApplicationContext; | ||
| import com.facebook.react.uimanager.ViewManager; | ||
| import cn.jiguang.plugins.core.JCoreModule; | ||
| public class JCorePackage implements ReactPackage { | ||
| @Override | ||
| public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { | ||
| return Arrays.<NativeModule>asList(new JCoreModule(reactContext)); | ||
| } | ||
| @Override | ||
| public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { | ||
| return Collections.emptyList(); | ||
| } | ||
| } |
+16
| import { | ||
| DeviceEventEmitter, | ||
| NativeModules, | ||
| Platform | ||
| } from 'react-native' | ||
| const JCoreModule = NativeModules.JCoreModule | ||
| export default class JCore { | ||
| static setAuth(auth) { | ||
| JCoreModule.setAuth(auth) | ||
| } | ||
| } |
| // | ||
| // JGInforCollectionAuth.h | ||
| // JCore | ||
| // | ||
| // Created by 豆瓣 on 2021/10/27. | ||
| // Copyright © 2021 jiguang. All rights reserved. | ||
| // | ||
| #import <Foundation/Foundation.h> | ||
| NS_ASSUME_NONNULL_BEGIN | ||
| /// 合规接口,是否授权极光采集一定的设备信息 | ||
| @interface JGInforCollectionAuthItems : NSObject | ||
| /// 是否授权,默认YES | ||
| @property(nonatomic,assign)BOOL isAuth; | ||
| @end | ||
| @interface JGInforCollectionAuth : NSObject | ||
| /// 设备信息采集授权接口(合规接口) | ||
| /// 请务必在调用初始化、功能性接口前调用此接口进行合规授权 | ||
| /// @param authBlock auth:YES 则极光认为您同意极光采集一定的设备信息 | ||
| +(void)JCollectionAuth:(void(^_Nullable)(JGInforCollectionAuthItems *authInfo))authBlock; | ||
| @end | ||
| NS_ASSUME_NONNULL_END |
@@ -8,13 +8,10 @@ apply plugin: 'com.android.library' | ||
| android { | ||
| compileSdkVersion safeExtGet('jcore_compileSdkVersion', 29) | ||
| buildToolsVersion safeExtGet('jcore_buildToolsVersion', '29.0.2') | ||
| compileSdkVersion safeExtGet('compileSdkVersion', 29) | ||
| compileSdkVersion safeExtGet('buildToolsVersion', '29.0.2') | ||
| defaultConfig { | ||
| minSdkVersion safeExtGet('jcore_minSdkVersion', 21) | ||
| targetSdkVersion safeExtGet('jcore_targetSdkVersion', 29) | ||
| versionCode 1 | ||
| versionName "1.0" | ||
| minSdkVersion safeExtGet('minSdkVersion', 21) | ||
| targetSdkVersion safeExtGet('targetSdkVersion', 29) | ||
| versionCode 1 | ||
| versionName "1.0" | ||
| } | ||
| sourceSets { | ||
@@ -21,0 +18,0 @@ main { |
@@ -10,5 +10,17 @@ // | ||
| #import <Foundation/Foundation.h> | ||
| #if __has_include(<React/RCTBridge.h>) | ||
| #import <React/RCTEventEmitter.h> | ||
| #import <React/RCTRootView.h> | ||
| #import <React/RCTBridge.h> | ||
| #elif __has_include("RCTBridge.h") | ||
| #import "RCTEventEmitter.h" | ||
| #import "RCTRootView.h" | ||
| #import "RCTBridge.h" | ||
| #endif | ||
| @interface RCTJCoreModule : NSObject | ||
| #import <React/RCTRootView.h> | ||
| #import <React/RCTBundleURLProvider.h> | ||
| @interface RCTJCoreModule : RCTEventEmitter<RCTBridgeModule> | ||
| @end |
@@ -10,5 +10,26 @@ // | ||
| #import "RCTJCoreModule.h" | ||
| #import "JGInforCollectionAuth.h" | ||
| @implementation RCTJCoreModule | ||
| #define JgLog(fmt, ...) NSLog((@"| JGER | iOS | " fmt), ##__VA_ARGS__) | ||
| RCT_EXPORT_MODULE(JCoreModule); | ||
| #pragma mark --- 设备信息采集授权接口(合规接口) | ||
| RCT_EXPORT_METHOD(setAuth: (BOOL *)enable) | ||
| { | ||
| JgLog("JCollectionAuth %d",enable); | ||
| __block BOOL isAuth= enable; | ||
| [JGInforCollectionAuth JCollectionAuth:^(JGInforCollectionAuthItems * _Nonnull authInfo) { | ||
| authInfo.isAuth = isAuth; | ||
| }]; | ||
| } | ||
| //事件处理 | ||
| - (NSArray<NSString *> *)supportedEvents | ||
| { | ||
| return @[]; | ||
| } | ||
| @end |
+1
-1
@@ -8,3 +8,3 @@ { | ||
| "main" : "index.js", | ||
| "version" : "2.1.2", | ||
| "version" : "2.2.1", | ||
| "repository" : { | ||
@@ -11,0 +11,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
63708071
0.01%52
8.33%66
1550%18
-5.26%