Release v3.5.1

This commit is contained in:
JoshLi 2018-11-16 14:31:47 +08:00
parent fa0ca5f335
commit 68bb0ebfdf
3 changed files with 35 additions and 33 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "jpush-phonegap-plugin", "name": "jpush-phonegap-plugin",
"version": "3.5.0", "version": "3.5.1",
"description": "JPush for cordova plugin", "description": "JPush for cordova plugin",
"cordova": { "cordova": {
"id": "jpush-phonegap-plugin", "id": "jpush-phonegap-plugin",

View File

@ -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.5.0"> version="3.5.1">
<name>JPush</name> <name>JPush</name>
<description>JPush for cordova plugin</description> <description>JPush for cordova plugin</description>

View File

@ -1,8 +1,8 @@
package cn.jiguang.cordova.push; package cn.jiguang.cordova.push;
import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.app.AppOpsManager; import android.app.AppOpsManager;
import android.app.NotificationManager;
import android.content.Context; import android.content.Context;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.os.Build; import android.os.Build;
@ -20,22 +20,17 @@ import org.json.JSONObject;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import cn.jpush.android.api.BasicPushNotificationBuilder; import cn.jpush.android.api.BasicPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface; import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.api.TagAliasCallback; import cn.jpush.android.api.TagAliasCallback;
import cn.jpush.android.data.JPushLocalNotification; import cn.jpush.android.data.JPushLocalNotification;
import cn.jpush.android.service.JPushMessageReceiver;
public class JPushPlugin extends CordovaPlugin { public class JPushPlugin extends CordovaPlugin {
@ -673,9 +668,14 @@ public class JPushPlugin extends CordovaPlugin {
} }
}; };
@TargetApi(Build.VERSION_CODES.KITKAT)
private boolean hasPermission(String appOpsServiceId) { private boolean hasPermission(String appOpsServiceId) {
Context context = cordova.getActivity().getApplicationContext(); Context context = cordova.getActivity().getApplicationContext();
if (Build.VERSION.SDK_INT >= 24) {
NotificationManager mNotificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
return mNotificationManager.areNotificationsEnabled();
} else {
AppOpsManager mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); AppOpsManager mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
ApplicationInfo appInfo = context.getApplicationInfo(); ApplicationInfo appInfo = context.getApplicationInfo();
@ -702,6 +702,8 @@ public class JPushPlugin extends CordovaPlugin {
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
return true; }
return false;
} }
} }