mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2026-01-28 00:00:03 +08:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85e3a23f88 | ||
|
|
206f2ac89e | ||
|
|
57b9364279 | ||
|
|
e0db803818 | ||
|
|
e140dc3b77 | ||
|
|
a26822b894 | ||
|
|
7dd7a4a86c | ||
|
|
b7a2a74d88 | ||
|
|
2f8234c29f | ||
|
|
a9b5af06a5 | ||
|
|
ddfb952bcf | ||
|
|
74fea46b1c | ||
|
|
b2f79c6234 | ||
|
|
9e23995555 | ||
|
|
a7455240a1 |
@@ -245,4 +245,19 @@ window.JPush.setMaxGeofenceNumber(maxNumber)
|
||||
|
||||
#### 参数说明
|
||||
|
||||
- maxNumber: 最多允许保存的地理围栏个数
|
||||
- maxNumber: 最多允许保存的地理围栏个数
|
||||
|
||||
|
||||
### API - setBadgeNumber
|
||||
|
||||
设置App角标,目前仅华为系手机支持。
|
||||
|
||||
#### 接口定义
|
||||
|
||||
```js
|
||||
window.JPush.setBadgeNumber(badgeNumb)
|
||||
```
|
||||
|
||||
#### 参数说明
|
||||
|
||||
- badgeNumb: 角标显示数字,小于或等0,角标显示数字清楚
|
||||
@@ -49,6 +49,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
var badgeNumb = 0;
|
||||
var onOpenNotification = function(event) {
|
||||
try {
|
||||
var alertContent;
|
||||
@@ -57,6 +58,11 @@
|
||||
} else {
|
||||
alertContent = event.aps.alert;
|
||||
}
|
||||
|
||||
badgeNumb = badgeNumb - 1;
|
||||
badgeNumb = badgeNumb<=0 ? 0 : badgeNumb;
|
||||
window.JPush.setBadgeNumber(badgeNumb);
|
||||
|
||||
alert("open Notification:" + alertContent);
|
||||
} catch (exception) {
|
||||
console.log("JPushPlugin:onOpenNotification" + exception);
|
||||
@@ -72,6 +78,9 @@
|
||||
alertContent = event.aps.alert;
|
||||
}
|
||||
$("#notificationResult").html(alertContent);
|
||||
|
||||
badgeNumb = badgeNumb + 1;
|
||||
window.JPush.setBadgeNumber(badgeNumb);
|
||||
} catch (exception) {
|
||||
console.log(exception)
|
||||
}
|
||||
@@ -86,11 +95,24 @@
|
||||
message = event.content;
|
||||
}
|
||||
$("#messageResult").html(message);
|
||||
|
||||
badgeNumb = badgeNumb + 1;
|
||||
window.JPush.setBadgeNumber(badgeNumb);
|
||||
} catch (exception) {
|
||||
console.log("JPushPlugin:onReceiveMessage-->" + exception);
|
||||
}
|
||||
};
|
||||
|
||||
var onResume = function(event){
|
||||
try {
|
||||
badgeNumb = 0
|
||||
window.JPush.setBadgeNumber(0);
|
||||
|
||||
} catch (exception) {
|
||||
console.log("onResume-->" + exception);
|
||||
}
|
||||
}
|
||||
|
||||
var initiateUI = function() {
|
||||
try {
|
||||
window.JPush.init();
|
||||
@@ -184,6 +206,7 @@
|
||||
document.addEventListener("jpush.openNotification", onOpenNotification, false);
|
||||
document.addEventListener("jpush.receiveNotification", onReceiveNotification, false);
|
||||
document.addEventListener("jpush.receiveMessage", onReceiveMessage, false);
|
||||
document.addEventListener("resume", onResume, false);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jpush-phonegap-plugin",
|
||||
"version": "3.7.2",
|
||||
"version": "3.7.4",
|
||||
"description": "JPush for cordova plugin",
|
||||
"cordova": {
|
||||
"id": "jpush-phonegap-plugin",
|
||||
|
||||
12
plugin.xml
12
plugin.xml
@@ -2,7 +2,7 @@
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="jpush-phonegap-plugin"
|
||||
version="3.7.2">
|
||||
version="3.7.4">
|
||||
|
||||
<name>JPush</name>
|
||||
<description>JPush for cordova plugin</description>
|
||||
@@ -49,7 +49,7 @@
|
||||
<source-file src="src/ios/Plugins/AppDelegate+JPush.m" />
|
||||
|
||||
<header-file src="src/ios/lib/JPUSHService.h" />
|
||||
<source-file src="src/ios/lib/jpush-ios-3.2.1.a" framework="true" />
|
||||
<source-file src="src/ios/lib/jpush-ios-3.2.6.a" framework="true" />
|
||||
<resource-file src="src/ios/JPushConfig.plist" />
|
||||
|
||||
<framework src="CFNetwork.framework" weak="true" />
|
||||
@@ -105,6 +105,9 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
|
||||
<!--华为角标-->
|
||||
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE "/>
|
||||
</config-file>
|
||||
|
||||
<config-file target="AndroidManifest.xml" parent="/manifest/application" mode="merge">
|
||||
@@ -196,6 +199,9 @@
|
||||
|
||||
<!-- Required SDK核心功能-->
|
||||
<receiver android:name="cn.jpush.android.service.AlarmReceiver" android:exported="false"/>
|
||||
|
||||
<!-- 3.5.0新增,用于定时展示功能 -->
|
||||
<receiver android:name="cn.jpush.android.service.SchedulerReceiver" android:exported="false"/>
|
||||
|
||||
<!--since 3.3.0 接收JPush相关事件-->
|
||||
<receiver android:name="cn.jiguang.cordova.push.JPushEventReceiver">
|
||||
@@ -249,7 +255,7 @@
|
||||
|
||||
</config-file>
|
||||
|
||||
<lib-file src="src/android/libs/jpush-android-3.3.4.jar" />
|
||||
<lib-file src="src/android/libs/jpush-android-3.3.8.jar" />
|
||||
|
||||
<source-file src="src/android/PushService.java" target-dir="src/cn/jiguang/cordova/push" />
|
||||
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />
|
||||
|
||||
@@ -637,6 +637,11 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
JPushInterface.setMaxGeofenceNumber(mContext, maxNumber);
|
||||
}
|
||||
|
||||
void setBadgeNumber(JSONArray data, CallbackContext callbackContext) throws JSONException {
|
||||
int badgeNumb = data.getInt(0);
|
||||
JPushInterface.setBadgeNumber(mContext, badgeNumb);
|
||||
}
|
||||
|
||||
private boolean isValidHour(int hour) {
|
||||
return !(hour < 0 || hour > 23);
|
||||
}
|
||||
|
||||
Binary file not shown.
BIN
src/android/libs/jpush-android-3.5.8.jar
Normal file
BIN
src/android/libs/jpush-android-3.5.8.jar
Normal file
Binary file not shown.
11
src/ios/lib/JPUSHService.h
Executable file → Normal file
11
src/ios/lib/JPUSHService.h
Executable file → Normal file
@@ -9,7 +9,7 @@
|
||||
* Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
|
||||
*/
|
||||
|
||||
#define JPUSH_VERSION_NUMBER 3.2.1
|
||||
#define JPUSH_VERSION_NUMBER 3.2.6
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@@ -45,7 +45,7 @@ typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) {
|
||||
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.
|
||||
|
||||
JPAuthorizationOptionAnnouncement NS_AVAILABLE_IOS(13.0) = (1 << 7) , //The ability for Siri to automatically read out messages over AirPods.
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -108,6 +108,7 @@ typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) {
|
||||
@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以上有效。
|
||||
@property (nonatomic, copy) NSString *targetContentIdentifier NS_AVAILABLE_IOS(13.0); // An identifier for the content of the notification used by the system to customize the scene to be activated when tapping on a notification.
|
||||
|
||||
@end
|
||||
|
||||
@@ -659,7 +660,7 @@ callbackSelector:(SEL)cbSelector
|
||||
* @param center [UNUserNotificationCenter currentNotificationCenter] 新特性用户通知中心
|
||||
* @param notification 当前管理的通知对象
|
||||
*/
|
||||
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(nullable UNNotification *)notification NS_AVAILABLE_IOS(12.0);
|
||||
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(UNNotification *)notification NS_AVAILABLE_IOS(12.0);
|
||||
|
||||
@end
|
||||
|
||||
@@ -672,7 +673,7 @@ callbackSelector:(SEL)cbSelector
|
||||
@param userInfo 地理围栏触发时返回的信息
|
||||
@param error 错误信息
|
||||
*/
|
||||
- (void)jpushGeofenceIdentifer:(NSString * _Nonnull)geofenceId didEnterRegion:(NSDictionary * _Nullable)userInfo error:(NSError * _Nullable)error;
|
||||
- (void)jpushGeofenceIdentifer:(NSString *)geofenceId didEnterRegion:(NSDictionary *)userInfo error:(NSError *)error;
|
||||
|
||||
/**
|
||||
离开地理围栏区域
|
||||
@@ -681,6 +682,6 @@ callbackSelector:(SEL)cbSelector
|
||||
@param userInfo 地理围栏触发时返回的信息
|
||||
@param error 错误信息
|
||||
*/
|
||||
- (void)jpushGeofenceIdentifer:(NSString * _Nonnull)geofenceId didExitRegion:(NSDictionary * _Nullable)userInfo error:(NSError * _Nullable)error;
|
||||
- (void)jpushGeofenceIdentifer:(NSString *)geofenceId didExitRegion:(NSDictionary *)userInfo error:(NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
BIN
src/ios/lib/jpush-ios-3.2.1.a → src/ios/lib/jpush-ios-3.2.6.a
Executable file → Normal file
BIN
src/ios/lib/jpush-ios-3.2.1.a → src/ios/lib/jpush-ios-3.2.6.a
Executable file → Normal file
Binary file not shown.
@@ -475,6 +475,13 @@ JPushPlugin.prototype.setMaxGeofenceNumber = function(maxNumber) {
|
||||
}
|
||||
};
|
||||
|
||||
//设置角标
|
||||
JPushPlugin.prototype.setBadgeNumber = function(badgeNumb) {
|
||||
if (device.platform === "Android") {
|
||||
this.callNative("setBadgeNumber", [badgeNumb], null);
|
||||
}
|
||||
};
|
||||
|
||||
if (!window.plugins) {
|
||||
window.plugins = {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user