mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2026-04-19 00:03:45 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8de93a3a07 | ||
|
|
a4c17d3882 | ||
|
|
1d420b5bb6 | ||
|
|
d69f50915c | ||
|
|
e26d8448a0 | ||
|
|
387eaa1aff | ||
|
|
45785a569c | ||
|
|
0c8a6d25a6 | ||
|
|
529f08df88 | ||
|
|
e60d7c2b8c | ||
|
|
265d88e766 | ||
|
|
894c7d7ac1 | ||
|
|
aabc1453b8 | ||
|
|
6f78522cca | ||
|
|
ff735854ec | ||
|
|
e63f9d1774 | ||
|
|
f9a5cef603 | ||
|
|
ef8b1a7b4c | ||
|
|
82d68c3562 |
@@ -13,10 +13,10 @@
|
|||||||
|
|
||||||
>注意:插件从 v3.4.0 开始支持 cordova-android 7.0.0,因 cordova-android 7.0.0 修改了 Android 项目结构,因此不兼容之前的版本,升级前请务必注意。
|
>注意:插件从 v3.4.0 开始支持 cordova-android 7.0.0,因 cordova-android 7.0.0 修改了 Android 项目结构,因此不兼容之前的版本,升级前请务必注意。
|
||||||
>
|
>
|
||||||
>如果需要安装之前版本的插件,请先安装 v1.2.0 以下版本(建议安装 v1.1.12)的 [cordova-plugin-jcore](https://github.com/jpush/cordova-plugin-jcore),再安装旧版本插件(比如 v3.3.2),否则运行会报错。
|
|
||||||
>
|
|
||||||
>如果需要在cordova-android 7.0.0之前版本集成最新插件,参照[这篇文章](https://www.jianshu.com/p/23b117ca27a6)
|
>如果需要在cordova-android 7.0.0之前版本集成最新插件,参照[这篇文章](https://www.jianshu.com/p/23b117ca27a6)
|
||||||
>
|
>
|
||||||
|
>如果需要安装之前版本的插件,请先安装 v1.2.0 以下版本(建议安装 v1.1.12)的 [cordova-plugin-jcore](https://github.com/jpush/cordova-plugin-jcore),再安装旧版本插件(比如 v3.3.2),否则运行会报错。
|
||||||
|
>
|
||||||
>[Cordova Android版本与原生版本对应表](http://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#requirements-and-support)
|
>[Cordova Android版本与原生版本对应表](http://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#requirements-and-support)
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
- [通知栏样式定制](#通知栏样式定制)
|
- [通知栏样式定制](#通知栏样式定制)
|
||||||
- [设置保留最近通知条数](#设置保留最近通知条数)
|
- [设置保留最近通知条数](#设置保留最近通知条数)
|
||||||
- [本地通知](#本地通知)
|
- [本地通知](#本地通知)
|
||||||
|
- [获取推送连接状态](#获取推送连接状态)
|
||||||
|
|
||||||
|
|
||||||
## 获取集成日志(同时适用于 iOS)
|
## 获取集成日志(同时适用于 iOS)
|
||||||
|
|
||||||
@@ -185,4 +187,32 @@ window.JPush.clearLocalNotifications() // 同时适用于 iOS
|
|||||||
- title: 设置本地通知的 title。
|
- title: 设置本地通知的 title。
|
||||||
- notificationID: 设置本地通知的 ID(不要为 0)。
|
- notificationID: 设置本地通知的 ID(不要为 0)。
|
||||||
- broadcastTime: 设置本地通知触发时间,为距离当前时间的数值,单位是毫秒。
|
- broadcastTime: 设置本地通知触发时间,为距离当前时间的数值,单位是毫秒。
|
||||||
- extras: 设置额外的数据信息 extras 为 json 字符串。
|
- extras: 设置额外的数据信息 extras 为 json 字符串。
|
||||||
|
|
||||||
|
## 获取推送连接状态
|
||||||
|
|
||||||
|
### API - getConnectionState
|
||||||
|
|
||||||
|
开发者可以使用此功能获取当前 Push 服务的连接状态
|
||||||
|
|
||||||
|
#### 接口定义
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.JPush.getConnectionState(callback)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 参数说明
|
||||||
|
|
||||||
|
- callback: 回调函数,用来通知 JPush 的推送服务是否开启。
|
||||||
|
|
||||||
|
#### 代码示例
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.JPush.getConnectionState(function (result) {
|
||||||
|
if (result == 0) {
|
||||||
|
// 链接状态
|
||||||
|
} else {
|
||||||
|
// 断开状态
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
@@ -47,14 +47,6 @@ window.JPush.startJPushSDK()
|
|||||||
|
|
||||||
调用此 API,用来开启 JPush SDK 提供的推送服务。
|
调用此 API,用来开启 JPush SDK 提供的推送服务。
|
||||||
|
|
||||||
开发者 App 可以通过调用停止推送服务 API 来停止极光推送服务,当又需要使用极光推送服务时,则必须要调用恢复推送服务 API。
|
|
||||||
|
|
||||||
本功能是一个完全本地的状态操作。也就是说:停止推送服务的状态不会保存到服务器上。
|
|
||||||
如果停止推送服务后,开发者 App 被重新安装,或者被清除数据,
|
|
||||||
JPush SDK 会恢复正常的默认行为。(因为保存在本地的状态数据被清除掉了)。
|
|
||||||
本功能其行为类似于网络中断的效果,即:推送服务停止期间推送的消息,
|
|
||||||
恢复推送服务后,如果推送的消息还在保留的时长范围内,则客户端是会收到离线消息。
|
|
||||||
|
|
||||||
#### 接口定义
|
#### 接口定义
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@@ -63,6 +55,14 @@ window.JPush.init()
|
|||||||
|
|
||||||
### API - stopPush
|
### API - stopPush
|
||||||
|
|
||||||
|
开发者 App 可以通过调用停止推送服务 API 来停止极光推送服务,当又需要使用极光推送服务时,则必须要调用恢复推送服务 API。
|
||||||
|
|
||||||
|
本功能是一个完全本地的状态操作。也就是说:停止推送服务的状态不会保存到服务器上。
|
||||||
|
如果停止推送服务后,开发者 App 被重新安装,或者被清除数据,
|
||||||
|
JPush SDK 会恢复正常的默认行为。(因为保存在本地的状态数据被清除掉了)。
|
||||||
|
本功能其行为类似于网络中断的效果,即:推送服务停止期间推送的消息,
|
||||||
|
恢复推送服务后,如果推送的消息还在保留的时长范围内,则客户端是会收到离线消息。
|
||||||
|
|
||||||
- 不推荐调用,因为这个 API 只是让你的 DeviceToken 失效,在 设置-通知 中您的应用程序没有任何变化。
|
- 不推荐调用,因为这个 API 只是让你的 DeviceToken 失效,在 设置-通知 中您的应用程序没有任何变化。
|
||||||
- 推荐:设置一个 UI 界面,提醒用户在 设置-通知 中关闭推送服务。
|
- 推荐:设置一个 UI 界面,提醒用户在 设置-通知 中关闭推送服务。
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jpush-phonegap-plugin",
|
"name": "jpush-phonegap-plugin",
|
||||||
"version": "3.4.3",
|
"version": "3.5.0",
|
||||||
"description": "JPush for cordova plugin",
|
"description": "JPush for cordova plugin",
|
||||||
"cordova": {
|
"cordova": {
|
||||||
"id": "jpush-phonegap-plugin",
|
"id": "jpush-phonegap-plugin",
|
||||||
|
|||||||
128
plugin.xml
128
plugin.xml
@@ -2,7 +2,7 @@
|
|||||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
id="jpush-phonegap-plugin"
|
id="jpush-phonegap-plugin"
|
||||||
version="3.4.3">
|
version="3.5.0">
|
||||||
|
|
||||||
<name>JPush</name>
|
<name>JPush</name>
|
||||||
<description>JPush for cordova plugin</description>
|
<description>JPush for cordova plugin</description>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<source-file src="src/ios/Plugins/AppDelegate+JPush.m" />
|
<source-file src="src/ios/Plugins/AppDelegate+JPush.m" />
|
||||||
|
|
||||||
<header-file src="src/ios/lib/JPUSHService.h" />
|
<header-file src="src/ios/lib/JPUSHService.h" />
|
||||||
<source-file src="src/ios/lib/jpush-ios-3.1.0.a" framework="true" />
|
<source-file src="src/ios/lib/jpush-ios-3.1.1.a" framework="true" />
|
||||||
<resource-file src="src/ios/JPushConfig.plist" />
|
<resource-file src="src/ios/JPushConfig.plist" />
|
||||||
|
|
||||||
<framework src="CFNetwork.framework" weak="true" />
|
<framework src="CFNetwork.framework" weak="true" />
|
||||||
@@ -85,40 +85,20 @@
|
|||||||
|
|
||||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
|
||||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<config-file target="AndroidManifest.xml" parent="/manifest/application" mode="merge">
|
<config-file target="AndroidManifest.xml" parent="/manifest/application" mode="merge">
|
||||||
<!-- Required SDK核心功能 -->
|
|
||||||
<activity android:name="cn.jpush.android.ui.PushActivity"
|
|
||||||
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
|
||||||
android:configChanges="orientation|keyboardHidden">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="cn.jpush.android.ui.PushActivity" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<category android:name="$PACKAGE_NAME" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<!-- Rich push 核心功能 since 2.0.6 -->
|
|
||||||
<activity android:name="cn.jpush.android.ui.PopWinActivity"
|
|
||||||
android:theme="@style/MyDialogStyle"
|
|
||||||
android:exported="false">
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<!-- Required SDK 核心功能 -->
|
|
||||||
<service android:name="cn.jpush.android.service.DownloadService"
|
|
||||||
android:enabled="true"
|
|
||||||
android:exported="false">
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<!-- Required SDK 核心功能-->
|
<!-- Required SDK 核心功能-->
|
||||||
<service android:name="cn.jpush.android.service.PushService"
|
<service android:name="cn.jpush.android.service.PushService"
|
||||||
@@ -133,10 +113,33 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
<!-- since 3.0.9 Required SDK 核心功能-->
|
||||||
|
<provider
|
||||||
|
android:authorities="$PACKAGE_NAME.DataProvider"
|
||||||
|
android:name="cn.jpush.android.service.DataProvider"
|
||||||
|
android:exported="true" />
|
||||||
|
|
||||||
|
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的 JPush 服务相互拉起的功能。 -->
|
||||||
|
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
|
||||||
|
<service android:name="cn.jpush.android.service.DaemonService"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="cn.jpush.android.intent.DaemonService" />
|
||||||
|
<category android:name="$PACKAGE_NAME" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<!-- since 3.1.0 Required SDK 核心功能-->
|
||||||
|
<provider
|
||||||
|
android:authorities="$PACKAGE_NAME.DownloadProvider"
|
||||||
|
android:name="cn.jpush.android.service.DownloadProvider"
|
||||||
|
android:exported="true"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Required SDK核心功能-->
|
<!-- Required SDK核心功能-->
|
||||||
<receiver android:name="cn.jpush.android.service.PushReceiver"
|
<receiver android:name="cn.jpush.android.service.PushReceiver"
|
||||||
android:enabled="true"
|
android:enabled="true">
|
||||||
android:exported="false">
|
|
||||||
<intent-filter android:priority="1000">
|
<intent-filter android:priority="1000">
|
||||||
<!--Required 显示通知栏 -->
|
<!--Required 显示通知栏 -->
|
||||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
|
||||||
@@ -154,18 +157,46 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的 JPush 服务相互拉起的功能。 -->
|
<!-- Required SDK核心功能 -->
|
||||||
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
|
<activity android:name="cn.jpush.android.ui.PushActivity"
|
||||||
<service android:name="cn.jpush.android.service.DaemonService"
|
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||||
android:enabled="true"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
android:exported="true">
|
android:exported="false" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="cn.jpush.android.intent.DaemonService" />
|
<action android:name="cn.jpush.android.ui.PushActivity" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="$PACKAGE_NAME" />
|
<category android:name="$PACKAGE_NAME" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</activity>
|
||||||
|
|
||||||
<!-- 通知广播接收器 -->
|
<!-- SDK 核心功能-->
|
||||||
|
<activity
|
||||||
|
android:name="cn.jpush.android.ui.PopWinActivity"
|
||||||
|
android:configChanges="orientation|keyboardHidden"
|
||||||
|
android:exported="false"
|
||||||
|
android:theme="@style/MyDialogStyle">
|
||||||
|
<intent-filter>
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="$PACKAGE_NAME" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<!-- Required SDK 核心功能 -->
|
||||||
|
<service android:name="cn.jpush.android.service.DownloadService"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="false">
|
||||||
|
</service>
|
||||||
|
<!-- Required SDK核心功能-->
|
||||||
|
<receiver android:name="cn.jpush.android.service.AlarmReceiver" />
|
||||||
|
|
||||||
|
<receiver android:name="cn.jiguang.cordova.push.JPushEventReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
|
||||||
|
<category android:name="$PACKAGE_NAME" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<!-- 插件通知广播接收器 -->
|
||||||
<receiver
|
<receiver
|
||||||
android:name="cn.jiguang.cordova.push.JPushReceiver"
|
android:name="cn.jiguang.cordova.push.JPushReceiver"
|
||||||
android:enabled="true">
|
android:enabled="true">
|
||||||
@@ -179,34 +210,17 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<!-- Required SDK核心功能-->
|
|
||||||
<receiver
|
|
||||||
android:name="cn.jpush.android.service.AlarmReceiver"
|
|
||||||
android:exported="false" />
|
|
||||||
|
|
||||||
<!-- since 3.0.9 Required SDK 核心功能-->
|
|
||||||
<provider
|
|
||||||
android:authorities="$PACKAGE_NAME.DataProvider"
|
|
||||||
android:name="cn.jpush.android.service.DataProvider"
|
|
||||||
android:exported="true" />
|
|
||||||
|
|
||||||
<receiver android:name="cn.jiguang.cordova.push.JPushEventReceiver">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
|
|
||||||
<category android:name="$PACKAGE_NAME" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<!-- Required. Enable it you can get statistics data with channel -->
|
<!-- Required. Enable it you can get statistics data with channel -->
|
||||||
<meta-data android:name="JPUSH_CHANNEL" android:value="developer-default" />
|
<meta-data android:name="JPUSH_CHANNEL" android:value="developer-default" />
|
||||||
<meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" />
|
<meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" />
|
||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<lib-file src="src/android/libs/jpush-android-3.1.5.jar" />
|
<lib-file src="src/android/libs/jpush-android-3.1.7.jar" />
|
||||||
|
|
||||||
<source-file src="src/android/JPushReceiver.java" target-dir="app/src/main/java/cn/jiguang/cordova/push" />
|
<source-file src="src/android/JPushReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
|
||||||
<source-file src="src/android/JPushPlugin.java" target-dir="app/src/main/java/cn/jiguang/cordova/push" />
|
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />
|
||||||
<source-file src="src/android/JPushEventReceiver.java" target-dir="app/src/main/java/cn/jiguang/cordova/push" />
|
<source-file src="src/android/JPushEventReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
|
||||||
|
|
||||||
<resource-file src="src/android/res/drawable-hdpi/jpush_richpush_btn_selector.xml"
|
<resource-file src="src/android/res/drawable-hdpi/jpush_richpush_btn_selector.xml"
|
||||||
target="res/drawable/jpush_richpush_btn_selector.xml" />
|
target="res/drawable/jpush_richpush_btn_selector.xml" />
|
||||||
|
|||||||
@@ -523,7 +523,11 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
|
|
||||||
void getConnectionState(JSONArray data, CallbackContext callback) {
|
void getConnectionState(JSONArray data, CallbackContext callback) {
|
||||||
boolean isConnected = JPushInterface.getConnectionState(cordovaActivity.getApplicationContext());
|
boolean isConnected = JPushInterface.getConnectionState(cordovaActivity.getApplicationContext());
|
||||||
callback.success(String.valueOf(isConnected));
|
if (isConnected) {
|
||||||
|
callback.success(1);
|
||||||
|
} else {
|
||||||
|
callback.success(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Binary file not shown.
BIN
src/android/libs/jpush-android-3.1.7.jar
Executable file
BIN
src/android/libs/jpush-android-3.1.7.jar
Executable file
Binary file not shown.
0
src/android/res/drawable-hdpi/jpush_richpush_btn_selector.xml
Normal file → Executable file
0
src/android/res/drawable-hdpi/jpush_richpush_btn_selector.xml
Normal file → Executable file
0
src/android/res/drawable-hdpi/jpush_richpush_progressbar.xml
Normal file → Executable file
0
src/android/res/drawable-hdpi/jpush_richpush_progressbar.xml
Normal file → Executable file
0
src/android/res/layout/jpush_popwin_layout.xml
Normal file → Executable file
0
src/android/res/layout/jpush_popwin_layout.xml
Normal file → Executable file
0
src/android/res/layout/jpush_webview_layout.xml
Normal file → Executable file
0
src/android/res/layout/jpush_webview_layout.xml
Normal file → Executable file
0
src/android/res/values/jpush_style.xml
Normal file → Executable file
0
src/android/res/values/jpush_style.xml
Normal file → Executable file
@@ -395,13 +395,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
JPushNotificationTrigger *trigger = [[JPushNotificationTrigger alloc] init];
|
JPushNotificationTrigger *trigger = [[JPushNotificationTrigger alloc] init];
|
||||||
|
// 由于 不支持 0 作为传入参数,在传入参数基础上添加一个极小的时间于 android 端保持一致。
|
||||||
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0) {
|
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0) {
|
||||||
if (delay) {
|
if (delay) {
|
||||||
trigger.timeInterval = [delay doubleValue];
|
trigger.timeInterval = [delay doubleValue] + 0.000001;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (delay) {
|
if (delay) {
|
||||||
trigger.fireDate = [NSDate dateWithTimeIntervalSinceNow:[[command argumentAtIndex:0] intValue]];
|
trigger.fireDate = [NSDate dateWithTimeIntervalSinceNow:[[command argumentAtIndex:0] doubleValue] + 0.001];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
* Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
|
* Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define JPUSH_VERSION_NUMBER 3.1.0
|
#define JPUSH_VERSION_NUMBER 3.1.1
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
@@ -40,6 +40,11 @@ typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) {
|
|||||||
JPAuthorizationOptionBadge = (1 << 0), // the application may badge its icon upon a notification being received
|
JPAuthorizationOptionBadge = (1 << 0), // the application may badge its icon upon a notification being received
|
||||||
JPAuthorizationOptionSound = (1 << 1), // the application may play a sound upon a notification being received
|
JPAuthorizationOptionSound = (1 << 1), // the application may play a sound upon a notification being received
|
||||||
JPAuthorizationOptionAlert = (1 << 2), // the application may display an alert upon a notification being received
|
JPAuthorizationOptionAlert = (1 << 2), // the application may display an alert upon a notification being received
|
||||||
|
JPAuthorizationOptionCarPlay = (1 << 3), // The ability to display notifications in a CarPlay environment.
|
||||||
|
JPAuthorizationOptionCriticalAlert NS_AVAILABLE_IOS(12.0) = (1 << 4) , //The ability to play sounds for critical alerts.
|
||||||
|
JPAuthorizationOptionProvidesAppNotificationSettings NS_AVAILABLE_IOS(12.0) = (1 << 5) , //An option indicating the system should display a button for in-app notification settings.
|
||||||
|
JPAuthorizationOptionProvisional NS_AVAILABLE_IOS(12.0) = (1 << 6) , //The ability to post noninterrupting notifications provisionally to the Notification Center.
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -72,6 +77,17 @@ typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) {
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* 推送通知声音实体类
|
||||||
|
* iOS10以上有效
|
||||||
|
*/
|
||||||
|
@interface JPushNotificationSound : NSObject <NSCopying, NSCoding>
|
||||||
|
@property (nonatomic, copy) NSString *soundName; //普通通知铃声
|
||||||
|
@property (nonatomic, copy) NSString *criticalSoundName NS_AVAILABLE_IOS(12.0); //警告通知铃声
|
||||||
|
@property (nonatomic, assign) float criticalSoundVolume NS_AVAILABLE_IOS(12.0); //警告通知铃声音量,有效值在0~1之间,默认为1
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* 推送内容实体类
|
* 推送内容实体类
|
||||||
*/
|
*/
|
||||||
@@ -85,12 +101,16 @@ typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) {
|
|||||||
@property (nonatomic, copy) NSString *categoryIdentifier; // 行为分类标识
|
@property (nonatomic, copy) NSString *categoryIdentifier; // 行为分类标识
|
||||||
@property (nonatomic, copy) NSDictionary *userInfo; // 本地推送时可以设置userInfo来增加附加信息,远程推送时设置的payload推送内容作为此userInfo
|
@property (nonatomic, copy) NSDictionary *userInfo; // 本地推送时可以设置userInfo来增加附加信息,远程推送时设置的payload推送内容作为此userInfo
|
||||||
@property (nonatomic, copy) NSString *sound; // 声音名称,不设置则为默认声音
|
@property (nonatomic, copy) NSString *sound; // 声音名称,不设置则为默认声音
|
||||||
|
@property (nonatomic, copy) JPushNotificationSound *soundSetting NS_AVAILABLE_IOS(10.0); //推送声音实体
|
||||||
@property (nonatomic, copy) NSArray *attachments NS_AVAILABLE_IOS(10_0); // 附件,iOS10以上有效,需要传入UNNotificationAttachment对象数组类型
|
@property (nonatomic, copy) NSArray *attachments NS_AVAILABLE_IOS(10_0); // 附件,iOS10以上有效,需要传入UNNotificationAttachment对象数组类型
|
||||||
@property (nonatomic, copy) NSString *threadIdentifier NS_AVAILABLE_IOS(10_0); // 线程或与推送请求相关对话的标识,iOS10以上有效,可用来对推送进行分组
|
@property (nonatomic, copy) NSString *threadIdentifier NS_AVAILABLE_IOS(10_0); // 线程或与推送请求相关对话的标识,iOS10以上有效,可用来对推送进行分组
|
||||||
@property (nonatomic, copy) NSString *launchImageName NS_AVAILABLE_IOS(10_0); // 启动图片名,iOS10以上有效,从推送启动时将会用到
|
@property (nonatomic, copy) NSString *launchImageName NS_AVAILABLE_IOS(10_0); // 启动图片名,iOS10以上有效,从推送启动时将会用到
|
||||||
|
@property (nonatomic, copy) NSString *summaryArgument NS_AVAILABLE_IOS(12.0); //插入到通知摘要中的部分参数。iOS12以上有效。
|
||||||
|
@property (nonatomic, assign) NSUInteger summaryArgumentCount NS_AVAILABLE_IOS(12.0); //插入到通知摘要中的项目数。iOS12以上有效。
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* 推送触发方式实体类
|
* 推送触发方式实体类
|
||||||
* 注:dateComponents、timeInterval、region在iOS10以上可选择其中一个参数传入有效值,如果同时传入值会根据优先级I、II、III使其中一种触发方式生效,fireDate为iOS10以下根据时间触发时须传入的参数
|
* 注:dateComponents、timeInterval、region在iOS10以上可选择其中一个参数传入有效值,如果同时传入值会根据优先级I、II、III使其中一种触发方式生效,fireDate为iOS10以下根据时间触发时须传入的参数
|
||||||
@@ -608,4 +628,11 @@ callbackSelector:(SEL)cbSelector
|
|||||||
*/
|
*/
|
||||||
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler;
|
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief handle UserNotifications.framework [openSettingsForNotification:]
|
||||||
|
* @param center [UNUserNotificationCenter currentNotificationCenter] 新特性用户通知中心
|
||||||
|
* @param notification 当前管理的通知对象
|
||||||
|
*/
|
||||||
|
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(nullable UNNotification *)notification NS_AVAILABLE_IOS(12.0);
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user