Skip to content

Releases: jpush/jpush-react-native

Fix Bug

08 Aug 07:27
Compare
Choose a tag to compare

Change Log

iOS

jpush-react-native 插件工程 移除 -ljcore-ios 编译选项,jcore 依赖改为 link jcore 工程的形式,如果提示 jcore 类库没有找到,需要更新到 jcore 1.1.8 以上版本。

npm install [email protected]
 react-native link 

新增接口 & Fix Bug

07 Aug 11:32
Compare
Choose a tag to compare

Change Log

Fix bug

Android

  • 新增接口 crashLogOFF
  • 新增接口 crashLogON

修复 bug & 适配 RN

04 Aug 05:38
Compare
Choose a tag to compare

Change Log

  • 适配 RN 0.47.1
  • 修复 #295

Warnings

升级此版本会导致和 RN 0.47 以下版本不兼容。原因在于 RN 0.47 版本去掉了 ReactPackage 中的 createJSModules 接口方法,而不是标注过期。兼容 RN 0.47 以下解决方案:在 JPushPackage 中加入 createJSModules 的实现:

    @Override
    public List<ViewManager> createJSModules(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }

Relese 2.0.0

31 Jul 06:11
Compare
Choose a tag to compare

升级指南

iOS

  • npm install [email protected] --save
  • 重新 link,2.0.0 新版本开始改变了 iOS 的工程结构所以需要重新 link,如果 unlink 失败重新打开工程 手动删除 自己工程中的 RCTJPushModule 这个子工程
react-native unlink jpush-react-native
react-native link jpush-react-native
  • 在 iOS 工程中 TARGETS-> BUILD SETTINGS -> Search Paths -> Header Search Paths 添加如下路径(由于工程结构变更,需要修改头文件搜索路径)
$(SRCROOT)/../node_modules/jpush-react-native/ios/RCTJPushModule

接口变更

统一部分接口 iOS 、Android

所有 iOS 的事件的监听方式统一改成和 Android 一样的接口调用形式,变动如下(下面接口如没有特别说明,iOS 、Android 通用)

改动前的事件 改动后,通过调用接口的方式来监听该事件
ReceiveNotification JPushModule.addReceiveNotificationListener
networkDidReceiveMessage JPushModule.addReceiveCustomMsgListener
OpenNotification JPushModule.addReceiveOpenNotificationListener
OpenNotificationToLaunchApp(iOS Only) JPushModule.openNotificationLaunchAppEvent (iOS Only)
networkDidSetup、 networkDidClose JPushModule.addConnectionChangeListener
networkDidLogin JPushModule.addnetworkDidLoginListener

新增 API,参数说明详情参考 index.js

Android 和 iOS
  • setTags(tags, cb)
  • addTags(tags, cb)
  • deleteTags(tags, cb)
  • cleanTags(cb)
  • getAllTags(cb)
  • checkTagBindState(tag, cb)
  • setAlias(alias, cb)
  • deleteAlias(cb)
  • getAlias(cb)
  • getConnectionState(cb) Android Only

删除 API

  • setTagsAndAlias()

Upgrade Android JPush SDK

13 Jul 07:35
Compare
Choose a tag to compare

Change Log

  • Android
    Upgrade JPush SDK to v3.0.7, requires jcore-react-native v1.1.5

Release 1.7.0 iOS 分离 OpenNotification 事件

11 Jul 09:54
Compare
Choose a tag to compare

Change Log:

iOS:

OpenNotification event Separated into OpenNotificationToLaunchApp and OpenNotification

OpenNotificationToLaunchApp event,fire when open notification and launch app。
OpenNotification event,fire when user click notification (available in iOS 10)。

var subscription = NativeAppEventEmitter.addListener(
  'OpenNotificationToLaunchApp',
  (notification) => console.log(notification)
);

修改 API & 调整 demo

06 Jul 07:50
Compare
Choose a tag to compare

Change Log

Android

  • 调整 clearNotificationById,参数由 string 改为 number
  • 修改 notifyJSDidLoad 为异步接口
  • 新增 jumpToPushActivity,在收到通知后,点击跳转到指定界面。详情请参考 demo 的使用。

fix bug

v1.6.6 增加接口

18 May 06:53
Compare
Choose a tag to compare

更新日志

  • Android
    增加一个新的接口:JPushModule.notifyJSDidLoad();
    使用方法:
    在你想要接收通知类事件之前调用:
componentDidMount() {
		JPushModule.notifyJSDidLoad();
		JPushModule.addReceiveCustomMsgListener((map) => {
			this.setState({
				pushMsg: map.message
			});
			console.log("extras: " + map.extras);
		});
		JPushModule.addReceiveNotificationListener((map) => {
			console.log("alertContent: " + map.alertContent);
			console.log("extras: " + map.extras);
			// var extra = JSON.parse(map.extras);
			// console.log(extra.key + ": " + extra.value);
		});
		JPushModule.addReceiveOpenNotificationListener((map) => {
			console.log("Opening notification!");
			console.log("map.extra: " + map.key);
		});
		JPushModule.addGetRegistrationIdListener((registrationId) => {
			console.log("Device register succeed, registrationId " + registrationId);
		});
	}

Change Log

  • Android
    Add new API: JPushModule.notifyJSDidLoad();
    Usage: before you add listeners call this method first:
componentDidMount() {
		JPushModule.notifyJSDidLoad();
		JPushModule.addReceiveCustomMsgListener((map) => {
			this.setState({
				pushMsg: map.message
			});
			console.log("extras: " + map.extras);
		});
		JPushModule.addReceiveNotificationListener((map) => {
			console.log("alertContent: " + map.alertContent);
			console.log("extras: " + map.extras);
			// var extra = JSON.parse(map.extras);
			// console.log(extra.key + ": " + extra.value);
		});
		JPushModule.addReceiveOpenNotificationListener((map) => {
			console.log("Opening notification!");
			console.log("map.extra: " + map.key);
		});
		JPushModule.addGetRegistrationIdListener((registrationId) => {
			console.log("Device register succeed, registrationId " + registrationId);
		});
	}

v1.6.4 Release, Updated JPush SDK

11 May 06:50
Compare
Choose a tag to compare

更新日志

  • Android
    升级 JPush SDK 至 v3.0.6,v1.6.4 版本需要同步升级 jcore-react-native 至 v1.1.3。

Change Log

  • Android
    Updated JPush SDK to v3.0.6, jpush-react-native v1.6.4 requires upgrade jcore-react-native to v1.1.3.

v1.6.3 New Feature

09 May 09:31
Compare
Choose a tag to compare

更新日志

用法:

                JPushModule.setAliasAndTags(alias, [], () => {
			console.log("Set alias and tags succeed");
		}, () => {
			console.log("Set alias and tags failed");
		})

Change Log

usage:

                JPushModule.setAliasAndTags(alias, [], () => {
			console.log("Set alias and tags succeed");
		}, () => {
			console.log("Set alias and tags failed");
		})