Commit 7ed160c2 authored by zhuchuanyong's avatar zhuchuanyong

feat:极光推送

parent 060ca300
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zhuchuanyong * @Author: zhuchuanyong
* @Date: 2021-01-22 15:13:57 * @Date: 2021-01-22 15:13:57
* @LastEditors: zhuchuanyong * @LastEditors: zhuchuanyong
* @LastEditTime: 2021-01-28 13:30:36 * @LastEditTime: 2021-01-30 01:04:42
* @FilePath: \App.tsx * @FilePath: \App.tsx
*/ */
/** /**
...@@ -19,9 +19,21 @@ import React from 'react'; ...@@ -19,9 +19,21 @@ import React from 'react';
import Navigation from './src/router/index'; import Navigation from './src/router/index';
import {Provider} from 'react-redux'; import {Provider} from 'react-redux';
import store from './src/store/index'; import store from './src/store/index';
import JPush from 'jpush-react-native';
declare const global: {HermesInternal: null | {}}; declare const global: {HermesInternal: null | {}};
const App = () => { const App = () => {
JPush.init();
const connectListener = (result: any) => {
console.log('connectListener:' + JSON.stringify(result));
};
JPush.addConnectEventListener(connectListener);
//通知回调
const notificationListener = (result: any) => {
console.log('notificationListener:' + JSON.stringify(result));
};
JPush.addNotificationListener(notificationListener);
return ( return (
<Provider store={store}> <Provider store={store}>
<Navigation /> <Navigation />
......
...@@ -136,6 +136,11 @@ android { ...@@ -136,6 +136,11 @@ android {
versionName project.env.get('VERSIONNAME') versionName project.env.get('VERSIONNAME')
resValue "string", "build_config_package", "com.vtrnprestudy" resValue "string", "build_config_package", "com.vtrnprestudy"
manifestPlaceholders = [
JPUSH_APPKEY: "7b624c8b44d953578490416f", //在此替换你的APPKey
JPUSH_CHANNEL: "android" //在此替换你的channel
]
} }
splits { splits {
abi { abi {
...@@ -215,6 +220,9 @@ dependencies { ...@@ -215,6 +220,9 @@ dependencies {
} else { } else {
implementation jscFlavor implementation jscFlavor
} }
implementation project(':jpush-react-native') // 添加 jpush 依赖
implementation project(':jcore-react-native') // 添加 jcore 依赖
} }
// Run this once to be able to run the application with BUCK // Run this once to be able to run the application with BUCK
......
...@@ -22,6 +22,12 @@ ...@@ -22,6 +22,12 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data
android:name="JPUSH_CHANNEL"
android:value="${JPUSH_CHANNEL}" />
<meta-data
android:name="JPUSH_APPKEY"
android:value="${JPUSH_APPKEY}" />
</application> </application>
</manifest> </manifest>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
buildscript { buildscript {
ext { ext {
buildToolsVersion = "29.0.2" buildToolsVersion = "29.0.2"
minSdkVersion = 16 minSdkVersion = 21
compileSdkVersion = 29 compileSdkVersion = 29
targetSdkVersion = 29 targetSdkVersion = 29
} }
......
rootProject.name = 'VtRnPreStudy' rootProject.name = 'VtRnPreStudy'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app' include ':app'
include ':jpush-react-native'
project(':jpush-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jpush-react-native/android')
include ':jcore-react-native'
project(':jcore-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jcore-react-native/android')
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
"@react-navigation/native": "^5.9.2", "@react-navigation/native": "^5.9.2",
"@react-navigation/stack": "^5.14.1", "@react-navigation/stack": "^5.14.1",
"@rematch/core": "^1.4.0", "@rematch/core": "^1.4.0",
"jcore-react-native": "^1.9.1",
"jpush-react-native": "^2.8.2",
"react": "16.13.1", "react": "16.13.1",
"react-native": "0.63.4", "react-native": "0.63.4",
"react-native-config": "^1.4.2", "react-native-config": "^1.4.2",
......
...@@ -4674,6 +4674,11 @@ istanbul-reports@^3.0.2: ...@@ -4674,6 +4674,11 @@ istanbul-reports@^3.0.2:
html-escaper "^2.0.0" html-escaper "^2.0.0"
istanbul-lib-report "^3.0.0" istanbul-lib-report "^3.0.0"
jcore-react-native@^1.9.1:
version "1.9.1"
resolved "https://registry.yarnpkg.com/jcore-react-native/-/jcore-react-native-1.9.1.tgz#7353a8fd25391e62a9399a149459b0ca22e8b04e"
integrity sha512-L1UWP2yRHLhx+hmRI90jEYDb+ICaN3SLFpnPivYs0STtDxr/HXEGZfsaATeWer9QBqnA7MIcZkUj+VvacC2UaQ==
jest-changed-files@^25.5.0: jest-changed-files@^25.5.0:
version "25.5.0" version "25.5.0"
resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-25.5.0.tgz#141cc23567ceb3f534526f8614ba39421383634c" resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-25.5.0.tgz#141cc23567ceb3f534526f8614ba39421383634c"
...@@ -5131,6 +5136,11 @@ jetifier@^1.6.2: ...@@ -5131,6 +5136,11 @@ jetifier@^1.6.2:
resolved "https://registry.yarnpkg.com/jetifier/-/jetifier-1.6.6.tgz#fec8bff76121444c12dc38d2dad6767c421dab68" resolved "https://registry.yarnpkg.com/jetifier/-/jetifier-1.6.6.tgz#fec8bff76121444c12dc38d2dad6767c421dab68"
integrity sha512-JNAkmPeB/GS2tCRqUzRPsTOHpGDah7xP18vGJfIjZC+W2sxEHbxgJxetIjIqhjQ3yYbYNEELkM/spKLtwoOSUQ== integrity sha512-JNAkmPeB/GS2tCRqUzRPsTOHpGDah7xP18vGJfIjZC+W2sxEHbxgJxetIjIqhjQ3yYbYNEELkM/spKLtwoOSUQ==
jpush-react-native@^2.8.2:
version "2.8.2"
resolved "https://registry.yarnpkg.com/jpush-react-native/-/jpush-react-native-2.8.2.tgz#db7e91811ab5395a7d60a08d0092c780f8c14d3d"
integrity sha512-yyRPezx7symiC9d6vYc2dwLC0PqSuL/YrjtXHdUi4/bl3IZD95KQ4s8ZXJjZqx7ibqF+cp0ZDc5j7wUmX78j9A==
js-tokens@1.0.1: js-tokens@1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-1.0.1.tgz#cc435a5c8b94ad15acb7983140fc80182c89aeae" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-1.0.1.tgz#cc435a5c8b94ad15acb7983140fc80182c89aeae"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment