@norcy/react-native-toolkit 0.1.139 → 0.1.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/android/build.gradle +4 -0
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/norcy/reactnativetoolkit/NCYReport.java +48 -0
- package/android/src/main/java/com/{norcyreactnativetoolkit → norcy/reactnativetoolkit}/ReactNativeToolkitModule.kt +2 -1
- package/android/src/main/java/com/{norcyreactnativetoolkit → norcy/reactnativetoolkit}/ReactNativeToolkitPackage.kt +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
@@ -8,6 +8,18 @@ App 工厂核心组件
|
|
8
8
|
yarn add @norcy/react-native-toolkit
|
9
9
|
```
|
10
10
|
|
11
|
+
## Android 引入
|
12
|
+
|
13
|
+
App 端需要在 `android/app/build.gradle` 中添加:
|
14
|
+
|
15
|
+
```gradle
|
16
|
+
dependencies {
|
17
|
+
implementation 'com.umeng.umsdk:common:9.6.3'
|
18
|
+
implementation 'com.umeng.umsdk:asms:1.8.0'
|
19
|
+
}
|
20
|
+
```
|
21
|
+
|
22
|
+
|
11
23
|
## 维护
|
12
24
|
【重要】TS 校验和 ESLint 校验
|
13
25
|
|
package/android/build.gradle
CHANGED
@@ -127,4 +127,8 @@ dependencies {
|
|
127
127
|
// noinspection GradleDynamicVersion
|
128
128
|
api 'com.facebook.react:react-native:+'
|
129
129
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
130
|
+
|
131
|
+
// 友盟统计
|
132
|
+
compileOnly 'com.umeng.umsdk:common:9.6.3'
|
133
|
+
compileOnly 'com.umeng.umsdk:asms:1.8.0'
|
130
134
|
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
package com.norcy.reactnativetoolkit;
|
2
|
+
|
3
|
+
import com.facebook.react.bridge.Arguments;
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
5
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
6
|
+
import com.facebook.react.bridge.ReactMethod;
|
7
|
+
import com.facebook.react.bridge.ReadableMap;
|
8
|
+
import com.facebook.react.bridge.WritableMap;
|
9
|
+
import com.umeng.analytics.MobclickAgent;
|
10
|
+
|
11
|
+
public class NCYReport extends ReactContextBaseJavaModule {
|
12
|
+
public NCYReport(ReactApplicationContext reactContext) {
|
13
|
+
super(reactContext);
|
14
|
+
}
|
15
|
+
|
16
|
+
@Override
|
17
|
+
public String getName() {
|
18
|
+
return "NCYReport";
|
19
|
+
}
|
20
|
+
|
21
|
+
@ReactMethod
|
22
|
+
public void report(String key, ReadableMap params) {
|
23
|
+
WritableMap attributes = Arguments.createMap();
|
24
|
+
attributes.merge(params);
|
25
|
+
MobclickAgent.onEventObject(getReactApplicationContext(), key, attributes.toHashMap());
|
26
|
+
}
|
27
|
+
|
28
|
+
@ReactMethod
|
29
|
+
public void signIn(String userId) {
|
30
|
+
MobclickAgent.onProfileSignIn(userId);
|
31
|
+
}
|
32
|
+
|
33
|
+
@ReactMethod
|
34
|
+
public void signOut() {
|
35
|
+
MobclickAgent.onProfileSignOff();
|
36
|
+
}
|
37
|
+
|
38
|
+
@ReactMethod
|
39
|
+
public void enterPage(String pageName) {
|
40
|
+
MobclickAgent.onPageStart(pageName);
|
41
|
+
}
|
42
|
+
|
43
|
+
@ReactMethod
|
44
|
+
public void leavePage(String pageName) {
|
45
|
+
MobclickAgent.onPageEnd(pageName);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
package com.
|
1
|
+
package com.norcy.reactnativetoolkit
|
2
2
|
|
3
3
|
import com.facebook.react.bridge.ReactApplicationContext
|
4
4
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
@@ -22,3 +22,4 @@ class ReactNativeToolkitModule(reactContext: ReactApplicationContext) : ReactCon
|
|
22
22
|
|
23
23
|
|
24
24
|
}
|
25
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
package com.
|
1
|
+
package com.norcy.reactnativetoolkit
|
2
2
|
|
3
3
|
import java.util.Arrays
|
4
4
|
import java.util.Collections
|
@@ -11,10 +11,14 @@ import com.facebook.react.bridge.JavaScriptModule
|
|
11
11
|
|
12
12
|
class ReactNativeToolkitPackage : ReactPackage {
|
13
13
|
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
14
|
-
return Arrays.asList<NativeModule>(
|
14
|
+
return Arrays.asList<NativeModule>(
|
15
|
+
ReactNativeToolkitModule(reactContext),
|
16
|
+
NCYReport(reactContext)
|
17
|
+
)
|
15
18
|
}
|
16
19
|
|
17
20
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
18
21
|
return emptyList<ViewManager<*, *>>()
|
19
22
|
}
|
20
23
|
}
|
24
|
+
|