Mike %!s(int64=7) %!d(string=hai) anos
pai
achega
6d3ad0bd18

+ 1 - 1
miaomiao/plugins/fetch.json

xqd
@@ -150,7 +150,7 @@
         },
         "is_top_level": true,
         "variables": {
-            "APP_KEY": "041b70b4c7eee686870a32cd"
+            "APP_KEY": "69838317211448192366f9d8"
         }
     }
 }

+ 0 - 0
miaomiao/plugins/jpush-phonegap-plugin/example/css/index.css


+ 0 - 0
miaomiao/plugins/jpush-phonegap-plugin/example/css/jquery.mobile-1.1.1.css


+ 276 - 276
miaomiao/plugins/jpush-phonegap-plugin/example/css/mobiscroll.core-2.0.1.css

xqd
@@ -1,276 +1,276 @@
-/* Datewheel overlay */
-.dw {
-    min-width:170px;
-    padding: 0 10px;
-    position: absolute;
-    top: 5%;
-    left: 0;
-    z-index: 1001;
-    color: #000;
-    font-family: arial, verdana, sans-serif;
-    font-size: 12px;
-    text-shadow: none;
-}
-.dwi {
-    position: static;
-    margin: 5px;
-    display: inline-block;
-}
-.dwwr {
-    zoom: 1;
-}
-/* Datewheel overlay background */
-.dwo {
-    width: 100%;
-    background: #000;
-    position: absolute;
-    top: 0;
-    left: 0;
-    z-index: 1000;
-    opacity: .7;
-    filter:Alpha(Opacity=70);
-}
-/* Datewheel wheel container wrapper */
-.dwc {
-    float: left;
-    margin: 0 2px 5px 2px;
-    padding-top: 30px;
-}
-.dwcc {
-    clear: both;
-}
-/* Datewheel label */
-.dwl {
-    /*margin: 0 2px;*/
-    text-align: center;
-    line-height: 30px;
-    height: 30px;
-    white-space: nowrap;
-    position: absolute;
-    top: -30px;
-    width: 100%;
-}
-/* Datewheel value */
-.dwv {
-    padding: 10px 0;
-    border-bottom: 1px solid #000;
-}
-/* Datewheel wheel container */
-.dwrc {
-    -webkit-border-radius: 3px;
-    -moz-border-radius: 3px;
-    border-radius: 3px;
-}
-.dwwc {
-    margin: 0;
-    padding: 0 2px;
-    position: relative;
-    background: #000;
-    zoom:1;
-}
-/* Datewheel wheels */
-.dwwl {
-    margin: 4px 2px;
-    position: relative;
-    background: #888;
-    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #000),color-stop(0.35, #333),color-stop(0.50, #888),color-stop(0.65, #333),color-stop(1, #000));
-    background: -moz-linear-gradient(#000 0%,#333 35%, #888 50%,#333 65%,#000 100%);
-    background: -ms-linear-gradient(#000 0%,#333 35%, #888 50%,#333 65%,#000 100%);
-    background: -o-linear-gradient(#000 0%,#333 35%, #888 50%,#333 65%,#000 100%);
-}
-.dww {
-    margin: 0 2px;
-    overflow: hidden;
-    position: relative;
-    /*top: -30px;*/
-}
-.dwsc .dww {
-    color: #fff;
-    background: #444;
-    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #000),color-stop(0.45, #444),color-stop(0.55, #444),color-stop(1, #000));
-    background: -moz-linear-gradient(#000 0%,#444 45%, #444 55%, #000 100%);
-    background: -ms-linear-gradient(#000 0%,#444 45%, #444 55%, #000 100%);
-    background: -o-linear-gradient(#000 0%,#444 45%, #444 55%, #000 100%);
-}
-.dww ul {
-    list-style: none;
-    margin: 0;
-    padding: 0;
-    /*display: block;
-    width: 100%;*/
-    position: relative;
-    z-index: 2;
-}
-.dww li {
-    list-style: none;
-    margin: 0;
-    padding: 0 5px;
-    display: block;
-    text-align: center;
-    line-height: 40px;
-    font-size: 26px;
-    white-space: nowrap;
-    text-shadow: 0 1px 1px #000;
-    opacity: .3;
-    filter: Alpha(Opacity=30);
-}
-/* Valid entry */
-.dww li.dw-v {
-    opacity: 1;
-    filter: Alpha(Opacity=100);
-}
-/* Hidden entry */
-.dww li.dw-h {
-    visibility: hidden;
-}
-/* Wheel +/- buttons */
-.dwwb {
-    position: absolute;
-    z-index: 4;
-    left: 0;
-    cursor: pointer;
-    width: 100%;
-    height: 40px;
-    text-align: center;
-}
-.dwwbp {
-    top: 0;
-    -webkit-border-radius: 3px 3px 0 0;
-    -moz-border-radius: 3px 3px 0 0;
-    border-radius: 3px 3px 0 0;
-    font-size: 40px;
-}
-.dwwbm {
-    bottom: 0;
-    -webkit-border-radius: 0 0 3px 3px;
-    -moz-border-radius: 0 0 3px 3px;
-    border-radius: 0 0 3px 3px;
-    font-size: 32px;
-    font-weight: bold;
-}
-.dwpm .dwwc {
-    background: transparent;
-}
-.dwpm .dww {
-    margin: -1px;
-}
-.dwpm .dww li {
-    text-shadow: none;
-}
-.dwpm .dwwol {
-    display: none;
-}
-/* Datewheel wheel overlay */
-.dwwo {
-    position: absolute;
-    z-index: 3;
-    top: 0;
-    left: 0;
-    width: 100%;
-    height: 100%;
-    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #000),color-stop(0.52, rgba(44,44,44,0)),color-stop(0.48, rgba(44,44,44,0)),color-stop(1, #000));
-    background: -moz-linear-gradient(#000 0%,rgba(44,44,44,0) 52%, rgba(44,44,44,0) 48%, #000 100%);
-    background: -ms-linear-gradient(#000 0%,rgba(44,44,44,0) 52%, rgba(44,44,44,0) 48%, #000 100%);
-    background: -o-linear-gradient(#000 0%,rgba(44,44,44,0) 52%, rgba(44,44,44,0) 48%, #000 100%);
-}
-/* Background line */
-.dwwol {
-    position: absolute;
-    z-index: 1;
-    top: 50%;
-    left: 0;
-    width: 100%;
-    height: 0;
-    margin-top: -1px;
-    border-top: 1px solid #333;
-    border-bottom: 1px solid #555;
-}
-/* Datewheel button */
-.dwbg .dwb {
-    display: block;
-    height: 40px;
-    line-height: 40px;
-    padding: 0 15px;
-    margin: 0 2px;
-    font-size: 14px;
-    font-weight: bold;
-    text-decoration: none;
-    text-shadow:0 -1px 1px #000;
-    border-radius: 5px;
-    -moz-border-radius: 5px;
-    -webkit-border-radius:5px;
-    box-shadow:0 1px 3px rgba(0,0,0,0.5);
-    -moz-box-shadow:0 1px 3px rgba(0,0,0,0.5);
-    -webkit-box-shadow:0 1px 3px rgba(0,0,0,0.5);
-    color: #fff;
-    background:#000;
-    background:-webkit-gradient(linear,left bottom,left top,color-stop(0.5, #000),color-stop(0.5, #6e6e6e));
-    background:-moz-linear-gradient(#6e6e6e 50%,#000 50%);
-    background:-ms-linear-gradient(#6e6e6e 50%,#000 50%);
-    background:-o-linear-gradient(#6e6e6e 50%,#000 50%);
-}
-/* Datewheel button container */
-.dwbc {
-    /*margin-top: 5px;*/
-    padding: 5px 0;
-    text-align: center;
-    clear: both;
-}
-/* Datewheel button wrapper */
-.dwbw {
-    display: inline-block;
-    width: 50%;
-}
-/* Hidden label */
-.dwhl {
-    padding-top: 10px;
-}
-.dwhl .dwl {
-    display: none;
-}
-/* Backgrounds */
-.dwbg {
-    background: #fff;
-    border-radius: 3px;
-    -webkit-border-radius: 3px;
-    -moz-border-radius: 3px;
-}
-.dwbg .dwpm .dww {
-    color: #000;
-    background: #fff;
-    border: 1px solid #AAA;
-}
-.dwbg .dwwb {
-    background: #ccc;
-    color: #888;
-    text-shadow: 0 -1px 1px #333;
-    box-shadow: 0 0 5px #333;
-    -webkit-box-shadow: 0 0 5px #333;
-    -moz-box-shadow: 0 0 5px #333;
-}
-.dwbg .dwwbp {
-    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #bdbdbd),color-stop(1, #f7f7f7));
-    background: -moz-linear-gradient(#f7f7f7,#bdbdbd);
-    background: -ms-linear-gradient(#f7f7f7,#bdbdbd);
-    background: -o-linear-gradient(#f7f7f7,#bdbdbd);
-}
-.dwbg .dwwbm {
-    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #f7f7f7),color-stop(1, #bdbdbd));
-    background: -moz-linear-gradient(#bdbdbd,#f7f7f7);
-    background: -ms-linear-gradient(#bdbdbd,#f7f7f7);
-    background: -o-linear-gradient(#bdbdbd,#f7f7f7);
-}
-.dwbg .dwb-a {
-    background:#3c7500;
-    background:-webkit-gradient(linear,left bottom,left top,color-stop(0.5, #3c7500),color-stop(0.5, #94c840));
-    background:-moz-linear-gradient(#94c840 50%,#3c7500 50%);
-    background:-ms-linear-gradient(#94c840 50%,#3c7500 50%);
-    background:-o-linear-gradient(#94c840 50%,#3c7500 50%);
-}
-.dwbg .dwwl .dwb-a {
-    background:#3c7500;
-    background:-webkit-gradient(linear,left bottom,left top,color-stop(0, #3c7500),color-stop(1, #94c840));
-    background:-moz-linear-gradient(#94c840,#3c7500);
-    background:-ms-linear-gradient(#94c840,#3c7500);
-    background:-o-linear-gradient(#94c840,#3c7500);
-}
+/* Datewheel overlay */
+.dw {
+    min-width:170px;
+    padding: 0 10px;
+    position: absolute;
+    top: 5%;
+    left: 0;
+    z-index: 1001;
+    color: #000;
+    font-family: arial, verdana, sans-serif;
+    font-size: 12px;
+    text-shadow: none;
+}
+.dwi {
+    position: static;
+    margin: 5px;
+    display: inline-block;
+}
+.dwwr {
+    zoom: 1;
+}
+/* Datewheel overlay background */
+.dwo {
+    width: 100%;
+    background: #000;
+    position: absolute;
+    top: 0;
+    left: 0;
+    z-index: 1000;
+    opacity: .7;
+    filter:Alpha(Opacity=70);
+}
+/* Datewheel wheel container wrapper */
+.dwc {
+    float: left;
+    margin: 0 2px 5px 2px;
+    padding-top: 30px;
+}
+.dwcc {
+    clear: both;
+}
+/* Datewheel label */
+.dwl {
+    /*margin: 0 2px;*/
+    text-align: center;
+    line-height: 30px;
+    height: 30px;
+    white-space: nowrap;
+    position: absolute;
+    top: -30px;
+    width: 100%;
+}
+/* Datewheel value */
+.dwv {
+    padding: 10px 0;
+    border-bottom: 1px solid #000;
+}
+/* Datewheel wheel container */
+.dwrc {
+    -webkit-border-radius: 3px;
+    -moz-border-radius: 3px;
+    border-radius: 3px;
+}
+.dwwc {
+    margin: 0;
+    padding: 0 2px;
+    position: relative;
+    background: #000;
+    zoom:1;
+}
+/* Datewheel wheels */
+.dwwl {
+    margin: 4px 2px;
+    position: relative;
+    background: #888;
+    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #000),color-stop(0.35, #333),color-stop(0.50, #888),color-stop(0.65, #333),color-stop(1, #000));
+    background: -moz-linear-gradient(#000 0%,#333 35%, #888 50%,#333 65%,#000 100%);
+    background: -ms-linear-gradient(#000 0%,#333 35%, #888 50%,#333 65%,#000 100%);
+    background: -o-linear-gradient(#000 0%,#333 35%, #888 50%,#333 65%,#000 100%);
+}
+.dww {
+    margin: 0 2px;
+    overflow: hidden;
+    position: relative;
+    /*top: -30px;*/
+}
+.dwsc .dww {
+    color: #fff;
+    background: #444;
+    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #000),color-stop(0.45, #444),color-stop(0.55, #444),color-stop(1, #000));
+    background: -moz-linear-gradient(#000 0%,#444 45%, #444 55%, #000 100%);
+    background: -ms-linear-gradient(#000 0%,#444 45%, #444 55%, #000 100%);
+    background: -o-linear-gradient(#000 0%,#444 45%, #444 55%, #000 100%);
+}
+.dww ul {
+    list-style: none;
+    margin: 0;
+    padding: 0;
+    /*display: block;
+    width: 100%;*/
+    position: relative;
+    z-index: 2;
+}
+.dww li {
+    list-style: none;
+    margin: 0;
+    padding: 0 5px;
+    display: block;
+    text-align: center;
+    line-height: 40px;
+    font-size: 26px;
+    white-space: nowrap;
+    text-shadow: 0 1px 1px #000;
+    opacity: .3;
+    filter: Alpha(Opacity=30);
+}
+/* Valid entry */
+.dww li.dw-v {
+    opacity: 1;
+    filter: Alpha(Opacity=100);
+}
+/* Hidden entry */
+.dww li.dw-h {
+    visibility: hidden;
+}
+/* Wheel +/- buttons */
+.dwwb {
+    position: absolute;
+    z-index: 4;
+    left: 0;
+    cursor: pointer;
+    width: 100%;
+    height: 40px;
+    text-align: center;
+}
+.dwwbp {
+    top: 0;
+    -webkit-border-radius: 3px 3px 0 0;
+    -moz-border-radius: 3px 3px 0 0;
+    border-radius: 3px 3px 0 0;
+    font-size: 40px;
+}
+.dwwbm {
+    bottom: 0;
+    -webkit-border-radius: 0 0 3px 3px;
+    -moz-border-radius: 0 0 3px 3px;
+    border-radius: 0 0 3px 3px;
+    font-size: 32px;
+    font-weight: bold;
+}
+.dwpm .dwwc {
+    background: transparent;
+}
+.dwpm .dww {
+    margin: -1px;
+}
+.dwpm .dww li {
+    text-shadow: none;
+}
+.dwpm .dwwol {
+    display: none;
+}
+/* Datewheel wheel overlay */
+.dwwo {
+    position: absolute;
+    z-index: 3;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 100%;
+    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #000),color-stop(0.52, rgba(44,44,44,0)),color-stop(0.48, rgba(44,44,44,0)),color-stop(1, #000));
+    background: -moz-linear-gradient(#000 0%,rgba(44,44,44,0) 52%, rgba(44,44,44,0) 48%, #000 100%);
+    background: -ms-linear-gradient(#000 0%,rgba(44,44,44,0) 52%, rgba(44,44,44,0) 48%, #000 100%);
+    background: -o-linear-gradient(#000 0%,rgba(44,44,44,0) 52%, rgba(44,44,44,0) 48%, #000 100%);
+}
+/* Background line */
+.dwwol {
+    position: absolute;
+    z-index: 1;
+    top: 50%;
+    left: 0;
+    width: 100%;
+    height: 0;
+    margin-top: -1px;
+    border-top: 1px solid #333;
+    border-bottom: 1px solid #555;
+}
+/* Datewheel button */
+.dwbg .dwb {
+    display: block;
+    height: 40px;
+    line-height: 40px;
+    padding: 0 15px;
+    margin: 0 2px;
+    font-size: 14px;
+    font-weight: bold;
+    text-decoration: none;
+    text-shadow:0 -1px 1px #000;
+    border-radius: 5px;
+    -moz-border-radius: 5px;
+    -webkit-border-radius:5px;
+    box-shadow:0 1px 3px rgba(0,0,0,0.5);
+    -moz-box-shadow:0 1px 3px rgba(0,0,0,0.5);
+    -webkit-box-shadow:0 1px 3px rgba(0,0,0,0.5);
+    color: #fff;
+    background:#000;
+    background:-webkit-gradient(linear,left bottom,left top,color-stop(0.5, #000),color-stop(0.5, #6e6e6e));
+    background:-moz-linear-gradient(#6e6e6e 50%,#000 50%);
+    background:-ms-linear-gradient(#6e6e6e 50%,#000 50%);
+    background:-o-linear-gradient(#6e6e6e 50%,#000 50%);
+}
+/* Datewheel button container */
+.dwbc {
+    /*margin-top: 5px;*/
+    padding: 5px 0;
+    text-align: center;
+    clear: both;
+}
+/* Datewheel button wrapper */
+.dwbw {
+    display: inline-block;
+    width: 50%;
+}
+/* Hidden label */
+.dwhl {
+    padding-top: 10px;
+}
+.dwhl .dwl {
+    display: none;
+}
+/* Backgrounds */
+.dwbg {
+    background: #fff;
+    border-radius: 3px;
+    -webkit-border-radius: 3px;
+    -moz-border-radius: 3px;
+}
+.dwbg .dwpm .dww {
+    color: #000;
+    background: #fff;
+    border: 1px solid #AAA;
+}
+.dwbg .dwwb {
+    background: #ccc;
+    color: #888;
+    text-shadow: 0 -1px 1px #333;
+    box-shadow: 0 0 5px #333;
+    -webkit-box-shadow: 0 0 5px #333;
+    -moz-box-shadow: 0 0 5px #333;
+}
+.dwbg .dwwbp {
+    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #bdbdbd),color-stop(1, #f7f7f7));
+    background: -moz-linear-gradient(#f7f7f7,#bdbdbd);
+    background: -ms-linear-gradient(#f7f7f7,#bdbdbd);
+    background: -o-linear-gradient(#f7f7f7,#bdbdbd);
+}
+.dwbg .dwwbm {
+    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #f7f7f7),color-stop(1, #bdbdbd));
+    background: -moz-linear-gradient(#bdbdbd,#f7f7f7);
+    background: -ms-linear-gradient(#bdbdbd,#f7f7f7);
+    background: -o-linear-gradient(#bdbdbd,#f7f7f7);
+}
+.dwbg .dwb-a {
+    background:#3c7500;
+    background:-webkit-gradient(linear,left bottom,left top,color-stop(0.5, #3c7500),color-stop(0.5, #94c840));
+    background:-moz-linear-gradient(#94c840 50%,#3c7500 50%);
+    background:-ms-linear-gradient(#94c840 50%,#3c7500 50%);
+    background:-o-linear-gradient(#94c840 50%,#3c7500 50%);
+}
+.dwbg .dwwl .dwb-a {
+    background:#3c7500;
+    background:-webkit-gradient(linear,left bottom,left top,color-stop(0, #3c7500),color-stop(1, #94c840));
+    background:-moz-linear-gradient(#94c840,#3c7500);
+    background:-ms-linear-gradient(#94c840,#3c7500);
+    background:-o-linear-gradient(#94c840,#3c7500);
+}

+ 47 - 47
miaomiao/plugins/jpush-phonegap-plugin/example/css/mobiscroll.jqm-2.0.1.css

xqd
@@ -1,47 +1,47 @@
-/* jQuery Mobile Theme */
-.jqm .dwo {
-    background: none;
-}
-.jqm .dw {
-    padding: 6px;
-    z-index: 1003;
-}
-.jqm .dwv {
-    position: static;
-    width: auto;
-    padding: .7em 15px .7em 15px;
-    border: 0;
-}
-.jqm .dwwr {
-    border: 0;
-}
-.jqm .dwpm .dwwo {
-    background: none;
-}
-.jqm .dwc {
-    margin: 0;
-    padding: 30px 5px 5px 5px;
- }
-.jqm .dwhl {
-    padding: 5px;
-}
-.jqm .dwwb {
-    margin: 0;
-    border: 0;
-}
-.jqm .dwwb span {
-    padding: 0;
-}
-.jqm .dwwbp .ui-btn-inner {
-    -webkit-border-radius: 3px 3px 0 0;
-    -moz-border-radius: 3px 3px 0 0;
-    border-radius: 3px 3px 0 0;
-}
-.jqm .dwwbm .ui-btn-inner {
-    -webkit-border-radius: 0 0 3px 3px;
-    -moz-border-radius: 0 0 3px 3px;
-    border-radius: 0 0 3px 3px;
-}
-.jqm .dwwbp span {
-    font-weight: normal;
-}
+/* jQuery Mobile Theme */
+.jqm .dwo {
+    background: none;
+}
+.jqm .dw {
+    padding: 6px;
+    z-index: 1003;
+}
+.jqm .dwv {
+    position: static;
+    width: auto;
+    padding: .7em 15px .7em 15px;
+    border: 0;
+}
+.jqm .dwwr {
+    border: 0;
+}
+.jqm .dwpm .dwwo {
+    background: none;
+}
+.jqm .dwc {
+    margin: 0;
+    padding: 30px 5px 5px 5px;
+ }
+.jqm .dwhl {
+    padding: 5px;
+}
+.jqm .dwwb {
+    margin: 0;
+    border: 0;
+}
+.jqm .dwwb span {
+    padding: 0;
+}
+.jqm .dwwbp .ui-btn-inner {
+    -webkit-border-radius: 3px 3px 0 0;
+    -moz-border-radius: 3px 3px 0 0;
+    border-radius: 3px 3px 0 0;
+}
+.jqm .dwwbm .ui-btn-inner {
+    -webkit-border-radius: 0 0 3px 3px;
+    -moz-border-radius: 0 0 3px 3px;
+    border-radius: 0 0 3px 3px;
+}
+.jqm .dwwbp span {
+    font-weight: normal;
+}

+ 0 - 0
miaomiao/plugins/jpush-phonegap-plugin/example/js/jquery.js


+ 0 - 0
miaomiao/plugins/jpush-phonegap-plugin/example/js/jquery.mobile-1.1.1.js


+ 16 - 16
miaomiao/plugins/jpush-phonegap-plugin/src/ios/Plugins/AppDelegate+JPush.h

xqd
@@ -1,16 +1,16 @@
-//
-//  AppDelegate+JPush.h
-//  delegateExtention
-//
-//  Created by 张庆贺 on 15/8/3.
-//  Copyright (c) 2015年 JPush. All rights reserved.
-//
-
-#import "AppDelegate.h"
-#import <UserNotifications/UserNotifications.h>
-#import "JPUSHService.h"
-
-@interface AppDelegate (JPush) <JPUSHRegisterDelegate>
--(void)registerForRemoteNotification;
--(void)startJPushSDK;
-@end
+//
+//  AppDelegate+JPush.h
+//  delegateExtention
+//
+//  Created by 张庆贺 on 15/8/3.
+//  Copyright (c) 2015年 JPush. All rights reserved.
+//
+
+#import "AppDelegate.h"
+#import <UserNotifications/UserNotifications.h>
+#import "JPUSHService.h"
+
+@interface AppDelegate (JPush) <JPUSHRegisterDelegate>
+-(void)registerForRemoteNotification;
+-(void)startJPushSDK;
+@end

+ 156 - 156
miaomiao/plugins/jpush-phonegap-plugin/src/ios/Plugins/AppDelegate+JPush.m

xqd
@@ -1,156 +1,156 @@
-//
-//  AppDelegate+JPush.m
-//  delegateExtention
-//
-//  Created by 张庆贺 on 15/8/3.
-//  Copyright (c) 2015年 JPush. All rights reserved.
-//
-
-#import "AppDelegate+JPush.h"
-#import "JPushPlugin.h"
-#import <objc/runtime.h>
-#import <AdSupport/AdSupport.h>
-#import <UserNotifications/UserNotifications.h>
-#import "JPushDefine.h"
-
-@implementation AppDelegate (JPush)
-
-+(void)load{
-    Method origin1;
-    Method swizzle1;
-    origin1  = class_getInstanceMethod([self class],@selector(init));
-    swizzle1 = class_getInstanceMethod([self class], @selector(init_plus));
-    method_exchangeImplementations(origin1, swizzle1);
-}
-
--(instancetype)init_plus{
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidLaunch:) name:UIApplicationDidFinishLaunchingNotification object:nil];
-    return [self init_plus];
-}
-
--(void)fireOpenNotification:(NSTimer*)timer{
-    if (SharedJPushPlugin) {
-        [JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[timer.userInfo toJsonString]];
-        [timer invalidate];
-    }
-}
-
-NSDictionary *_launchOptions;
--(void)applicationDidLaunch:(NSNotification *)notification{
-
-
-    if (notification) {
-        if (notification.userInfo) {
-            NSDictionary *userInfo1 = [notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
-            if (userInfo1.count > 0) {
-                [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:userInfo1 repeats:YES];
-            }
-
-            NSDictionary *userInfo2 = [notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey];
-            if (userInfo2.count > 0) {
-                [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:userInfo2 repeats:YES];
-            }
-        }
-        [JPUSHService setDebugMode];
-
-        NSString *plistPath = [[NSBundle mainBundle] pathForResource:JPushConfig_FileName ofType:@"plist"];
-        NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
-        NSNumber *delay       = [plistData valueForKey:JPushConfig_Delay];
-
-        _launchOptions = notification.userInfo;
-
-        if (![delay boolValue]) {
-            [self startJPushSDK];
-        }
-    }
-}
-
--(void)startJPushSDK{
-    [self registerForRemoteNotification];
-    [JPushPlugin setupJPushSDK:_launchOptions];
-}
-
--(void)registerForRemoteNotification{
-    if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
-#ifdef NSFoundationVersionNumber_iOS_9_x_Max
-        JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];
-        entity.types = UNAuthorizationOptionAlert|UNAuthorizationOptionBadge|UNAuthorizationOptionSound;
-        [JPUSHService registerForRemoteNotificationConfig:entity delegate:self];
-#endif
-    }else if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
-        //可以添加自定义categories
-        [JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
-                                                          UIUserNotificationTypeSound |
-                                                          UIUserNotificationTypeAlert)
-                                              categories:nil];
-    } else if([[UIDevice currentDevice].systemVersion floatValue] < 8.0){
-        //categories 必须为nil
-        [JPUSHService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
-                                                          UIRemoteNotificationTypeSound |
-                                                          UIRemoteNotificationTypeAlert)
-                                              categories:nil];
-    }
-}
-
-- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
-    [JPUSHService registerDeviceToken:deviceToken];
-}
-
--(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
-    [JPUSHService handleRemoteNotification:userInfo];
-
-    [JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]];
-}
-
--(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
-    [JPUSHService handleRemoteNotification:userInfo];
-    NSString *eventName;
-    switch ([UIApplication sharedApplication].applicationState) {
-        case UIApplicationStateInactive:
-            eventName = JPushDocumentEvent_OpenNotification;
-            break;
-        case UIApplicationStateActive:
-            eventName = JPushDocumentEvent_ReceiveNotification;
-            break;
-        case UIApplicationStateBackground:
-            eventName = JPushDocumentEvent_BackgroundNotification;
-            break;
-        default:
-            break;
-    }
-    [JPushPlugin fireDocumentEvent:eventName jsString:[userInfo toJsonString]];
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(30 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-      completionHandler(UIBackgroundFetchResultNewData);
-    });
-}
-
--(void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler{
-    NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:notification.request.content.userInfo];
-    [JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]];
-    completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
-}
-
--(void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler{
-    NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:response.notification.request.content.userInfo];
-    @try {
-        [userInfo setValue:[response valueForKey:@"userText"] forKey:@"userText"];
-    } @catch (NSException *exception) { }
-    [userInfo setValue:response.actionIdentifier forKey:@"actionIdentifier"];
-    [JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[userInfo toJsonString]];
-    completionHandler();
-}
-
-- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
-    [[NSNotificationCenter defaultCenter] postNotificationName:JPushDocumentEvent_ReceiveLocalNotification object:notification.userInfo];
-}
-
-- (void)applicationWillEnterForeground:(UIApplication *)application {
-    //  [application setApplicationIconBadgeNumber:0];
-    //  [application cancelAllLocalNotifications];
-}
-
-- (void)applicationDidEnterBackground:(UIApplication *)application {
-    //  [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
-}
-
-@end
+//
+//  AppDelegate+JPush.m
+//  delegateExtention
+//
+//  Created by 张庆贺 on 15/8/3.
+//  Copyright (c) 2015年 JPush. All rights reserved.
+//
+
+#import "AppDelegate+JPush.h"
+#import "JPushPlugin.h"
+#import <objc/runtime.h>
+#import <AdSupport/AdSupport.h>
+#import <UserNotifications/UserNotifications.h>
+#import "JPushDefine.h"
+
+@implementation AppDelegate (JPush)
+
++(void)load{
+    Method origin1;
+    Method swizzle1;
+    origin1  = class_getInstanceMethod([self class],@selector(init));
+    swizzle1 = class_getInstanceMethod([self class], @selector(init_plus));
+    method_exchangeImplementations(origin1, swizzle1);
+}
+
+-(instancetype)init_plus{
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidLaunch:) name:UIApplicationDidFinishLaunchingNotification object:nil];
+    return [self init_plus];
+}
+
+-(void)fireOpenNotification:(NSTimer*)timer{
+    if (SharedJPushPlugin) {
+        [JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[timer.userInfo toJsonString]];
+        [timer invalidate];
+    }
+}
+
+NSDictionary *_launchOptions;
+-(void)applicationDidLaunch:(NSNotification *)notification{
+
+
+    if (notification) {
+        if (notification.userInfo) {
+            NSDictionary *userInfo1 = [notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
+            if (userInfo1.count > 0) {
+                [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:userInfo1 repeats:YES];
+            }
+
+            NSDictionary *userInfo2 = [notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey];
+            if (userInfo2.count > 0) {
+                [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:userInfo2 repeats:YES];
+            }
+        }
+        [JPUSHService setDebugMode];
+
+        NSString *plistPath = [[NSBundle mainBundle] pathForResource:JPushConfig_FileName ofType:@"plist"];
+        NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
+        NSNumber *delay       = [plistData valueForKey:JPushConfig_Delay];
+
+        _launchOptions = notification.userInfo;
+
+        if (![delay boolValue]) {
+            [self startJPushSDK];
+        }
+    }
+}
+
+-(void)startJPushSDK{
+    [self registerForRemoteNotification];
+    [JPushPlugin setupJPushSDK:_launchOptions];
+}
+
+-(void)registerForRemoteNotification{
+    if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
+#ifdef NSFoundationVersionNumber_iOS_9_x_Max
+        JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];
+        entity.types = UNAuthorizationOptionAlert|UNAuthorizationOptionBadge|UNAuthorizationOptionSound;
+        [JPUSHService registerForRemoteNotificationConfig:entity delegate:self];
+#endif
+    }else if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
+        //可以添加自定义categories
+        [JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
+                                                          UIUserNotificationTypeSound |
+                                                          UIUserNotificationTypeAlert)
+                                              categories:nil];
+    } else if([[UIDevice currentDevice].systemVersion floatValue] < 8.0){
+        //categories 必须为nil
+        [JPUSHService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
+                                                          UIRemoteNotificationTypeSound |
+                                                          UIRemoteNotificationTypeAlert)
+                                              categories:nil];
+    }
+}
+
+- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
+    [JPUSHService registerDeviceToken:deviceToken];
+}
+
+-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
+    [JPUSHService handleRemoteNotification:userInfo];
+
+    [JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]];
+}
+
+-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
+    [JPUSHService handleRemoteNotification:userInfo];
+    NSString *eventName;
+    switch ([UIApplication sharedApplication].applicationState) {
+        case UIApplicationStateInactive:
+            eventName = JPushDocumentEvent_OpenNotification;
+            break;
+        case UIApplicationStateActive:
+            eventName = JPushDocumentEvent_ReceiveNotification;
+            break;
+        case UIApplicationStateBackground:
+            eventName = JPushDocumentEvent_BackgroundNotification;
+            break;
+        default:
+            break;
+    }
+    [JPushPlugin fireDocumentEvent:eventName jsString:[userInfo toJsonString]];
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(30 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+      completionHandler(UIBackgroundFetchResultNewData);
+    });
+}
+
+-(void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler{
+    NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:notification.request.content.userInfo];
+    [JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]];
+    completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
+}
+
+-(void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler{
+    NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:response.notification.request.content.userInfo];
+    @try {
+        [userInfo setValue:[response valueForKey:@"userText"] forKey:@"userText"];
+    } @catch (NSException *exception) { }
+    [userInfo setValue:response.actionIdentifier forKey:@"actionIdentifier"];
+    [JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[userInfo toJsonString]];
+    completionHandler();
+}
+
+- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
+    [[NSNotificationCenter defaultCenter] postNotificationName:JPushDocumentEvent_ReceiveLocalNotification object:notification.userInfo];
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+    //  [application setApplicationIconBadgeNumber:0];
+    //  [application cancelAllLocalNotifications];
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+    //  [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
+}
+
+@end

+ 94 - 94
miaomiao/plugins/jpush-phonegap-plugin/src/ios/Plugins/JPushPlugin.h

xqd
@@ -1,94 +1,94 @@
-//
-//  PushTalkPlugin.h
-//  PushTalk
-//
-//  Created by zhangqinghe on 13-12-13.
-//
-//
-
-#import <Cordova/CDV.h>
-
-@interface JPushPlugin : CDVPlugin{
-
-}
-
-//注册通知服务并启动 SDK
--(void)startJPushSDK:(CDVInvokedUrlCommand*)command;
-
-//以下为js中可调用接口
-//设置标签、别名
--(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command;
--(void)setTags:(CDVInvokedUrlCommand*)command;
--(void)setAlias:(CDVInvokedUrlCommand*)command;
-
-//获取 RegistrationID
--(void)getRegistrationID:(CDVInvokedUrlCommand*)command;
-
-//页面统计
--(void)startLogPageView:(CDVInvokedUrlCommand*)command;
--(void)stopLogPageView:(CDVInvokedUrlCommand*)command;
--(void)beginLogPageView:(CDVInvokedUrlCommand*)command;
-
-//设置角标到服务器,服务器下一次发消息时,会设置成这个值
-//本接口不会改变应用本地的角标值.
--(void)setBadge:(CDVInvokedUrlCommand*)command;
-//相当于 [setBadge:0]
--(void)resetBadge:(CDVInvokedUrlCommand*)command;
-
-//应用本地的角标值设置/获取
--(void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
--(void)getApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
-
-//停止与恢复推送
--(void)stopPush:(CDVInvokedUrlCommand*)command;
--(void)resumePush:(CDVInvokedUrlCommand*)command;
--(void)isPushStopped:(CDVInvokedUrlCommand*)command;
-
-//开关日志
--(void)setDebugModeFromIos:(CDVInvokedUrlCommand*)command;
--(void)setLogOFF:(CDVInvokedUrlCommand*)command;
--(void)crashLogON:(CDVInvokedUrlCommand*)command;
-
-//本地推送
--(void)setLocalNotification:(CDVInvokedUrlCommand*)command;
--(void)deleteLocalNotificationWithIdentifierKey:(CDVInvokedUrlCommand*)command;
--(void)clearAllLocalNotifications:(CDVInvokedUrlCommand*)command;
-
-//地理位置上报 [latitude,longitude]
--(void)setLocation:(CDVInvokedUrlCommand*)command;
-
-//检查用户的推送设置情况
--(void)getUserNotificationSettings:(CDVInvokedUrlCommand*)command;
-
-//ios 10 APIs
--(void)addDismissActions:(CDVInvokedUrlCommand*)command;
--(void)addNotificationActions:(CDVInvokedUrlCommand*)command;
-
-/*
- *  以下为js中可监听到的事件
- *  jpush.openNotification      点击推送消息启动或唤醒app
- *  jpush.setTagsWithAlias      设置标签、别名完成
- *  jpush.receiveMessage        收到自定义消息
- *  jpush.receiveNotification   前台收到推送
- *  jpush.backgroundNotification 后台收到推送
- */
-
-# pragma mark - private
-
-+(void)fireDocumentEvent:(NSString*)eventName jsString:(NSString*)jsString;
-
-+(void)setupJPushSDK:(NSDictionary*)userInfo;
-
-@end
-
-JPushPlugin *SharedJPushPlugin;
-
-@interface NSDictionary (JPush)
--(NSString*)toJsonString;
-@end
-
-@interface NSString (JPush)
--(NSDictionary*)toDictionary;
-@end
-
-
+//
+//  PushTalkPlugin.h
+//  PushTalk
+//
+//  Created by zhangqinghe on 13-12-13.
+//
+//
+
+#import <Cordova/CDV.h>
+
+@interface JPushPlugin : CDVPlugin{
+
+}
+
+//注册通知服务并启动 SDK
+-(void)startJPushSDK:(CDVInvokedUrlCommand*)command;
+
+//以下为js中可调用接口
+//设置标签、别名
+-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command;
+-(void)setTags:(CDVInvokedUrlCommand*)command;
+-(void)setAlias:(CDVInvokedUrlCommand*)command;
+
+//获取 RegistrationID
+-(void)getRegistrationID:(CDVInvokedUrlCommand*)command;
+
+//页面统计
+-(void)startLogPageView:(CDVInvokedUrlCommand*)command;
+-(void)stopLogPageView:(CDVInvokedUrlCommand*)command;
+-(void)beginLogPageView:(CDVInvokedUrlCommand*)command;
+
+//设置角标到服务器,服务器下一次发消息时,会设置成这个值
+//本接口不会改变应用本地的角标值.
+-(void)setBadge:(CDVInvokedUrlCommand*)command;
+//相当于 [setBadge:0]
+-(void)resetBadge:(CDVInvokedUrlCommand*)command;
+
+//应用本地的角标值设置/获取
+-(void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
+-(void)getApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command;
+
+//停止与恢复推送
+-(void)stopPush:(CDVInvokedUrlCommand*)command;
+-(void)resumePush:(CDVInvokedUrlCommand*)command;
+-(void)isPushStopped:(CDVInvokedUrlCommand*)command;
+
+//开关日志
+-(void)setDebugModeFromIos:(CDVInvokedUrlCommand*)command;
+-(void)setLogOFF:(CDVInvokedUrlCommand*)command;
+-(void)crashLogON:(CDVInvokedUrlCommand*)command;
+
+//本地推送
+-(void)setLocalNotification:(CDVInvokedUrlCommand*)command;
+-(void)deleteLocalNotificationWithIdentifierKey:(CDVInvokedUrlCommand*)command;
+-(void)clearAllLocalNotifications:(CDVInvokedUrlCommand*)command;
+
+//地理位置上报 [latitude,longitude]
+-(void)setLocation:(CDVInvokedUrlCommand*)command;
+
+//检查用户的推送设置情况
+-(void)getUserNotificationSettings:(CDVInvokedUrlCommand*)command;
+
+//ios 10 APIs
+-(void)addDismissActions:(CDVInvokedUrlCommand*)command;
+-(void)addNotificationActions:(CDVInvokedUrlCommand*)command;
+
+/*
+ *  以下为js中可监听到的事件
+ *  jpush.openNotification      点击推送消息启动或唤醒app
+ *  jpush.setTagsWithAlias      设置标签、别名完成
+ *  jpush.receiveMessage        收到自定义消息
+ *  jpush.receiveNotification   前台收到推送
+ *  jpush.backgroundNotification 后台收到推送
+ */
+
+# pragma mark - private
+
++(void)fireDocumentEvent:(NSString*)eventName jsString:(NSString*)jsString;
+
++(void)setupJPushSDK:(NSDictionary*)userInfo;
+
+@end
+
+JPushPlugin *SharedJPushPlugin;
+
+@interface NSDictionary (JPush)
+-(NSString*)toJsonString;
+@end
+
+@interface NSString (JPush)
+-(NSDictionary*)toDictionary;
+@end
+
+

+ 365 - 365
miaomiao/plugins/jpush-phonegap-plugin/src/ios/Plugins/JPushPlugin.m

xqd
@@ -1,365 +1,365 @@
-
-//
-//  PushTalkPlugin.m
-//  PushTalk
-//
-//  Created by zhangqinghe on 13-12-13.
-//
-//
-
-#import "JPushPlugin.h"
-#import "JPUSHService.h"
-#import <UIKit/UIKit.h>
-#import <AdSupport/AdSupport.h>
-#import <UserNotifications/UserNotifications.h>
-#import "AppDelegate+JPush.h"
-#import "JPushDefine.h"
-
-@implementation NSDictionary (JPush)
--(NSString*)toJsonString{
-    NSError  *error;
-    NSData   *data       = [NSJSONSerialization dataWithJSONObject:self options:0 error:&error];
-    NSString *jsonString = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
-    return jsonString;
-}
-@end
-
-@implementation NSString (JPush)
--(NSDictionary*)toDictionary{
-    NSError      *error;
-    NSData       *jsonData = [self dataUsingEncoding:NSUTF8StringEncoding];
-    NSDictionary *dict     = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
-    return dict;
-}
-@end
-
-@interface JPushPlugin()
-
-@end
-
-@implementation JPushPlugin
-
--(void)startJPushSDK:(CDVInvokedUrlCommand*)command{
-    [(AppDelegate*)[UIApplication sharedApplication].delegate startJPushSDK];
-}
-
-#pragma mark- 外部接口
--(void)stopPush:(CDVInvokedUrlCommand*)command{
-    [[UIApplication sharedApplication]unregisterForRemoteNotifications];
-}
-
--(void)resumePush:(CDVInvokedUrlCommand*)command{
-    [(AppDelegate*)[UIApplication sharedApplication].delegate registerForRemoteNotification];
-}
-
--(void)isPushStopped:(CDVInvokedUrlCommand*)command{
-    NSNumber *result = [[UIApplication sharedApplication] isRegisteredForRemoteNotifications] ? @(0) : @(1);
-    [self handleResultWithValue:result command:command];
-}
-
--(void)initial:(CDVInvokedUrlCommand*)command{
-    //do nithng,because Cordova plugin use lazy load mode.
-}
-
-#ifdef __CORDOVA_4_0_0
-
-- (void)pluginInitialize {
-    NSLog(@"### pluginInitialize ");
-    [self initPlugin];
-}
-
-#else
-
-- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView{
-    NSLog(@"### initWithWebView ");
-    if (self=[super initWithWebView:theWebView]) {
-    }
-    [self initPlugin];
-    return self;
-}
-
-#endif
-
--(void)initPlugin{
-    if (!SharedJPushPlugin) {
-        SharedJPushPlugin = self;
-    }
-    [[NSNotificationCenter defaultCenter] addObserver:self
-                                             selector:@selector(networkDidReceiveMessage:)
-                                                 name:kJPFNetworkDidReceiveMessageNotification
-                                               object:nil];
-}
-
-+(void)fireDocumentEvent:(NSString*)eventName jsString:(NSString*)jsString{
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [SharedJPushPlugin.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.%@',%@)", eventName, jsString]];
-    });
-}
-
--(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command{
-    NSString *alias = [command argumentAtIndex:0];
-    NSArray  *tags  = [command argumentAtIndex:1];
-
-    [JPUSHService setTags:[NSSet setWithArray:tags]
-                    alias:alias
-    fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) {
-        CDVPluginResult *result;
-        if (iResCode == 0) {
-            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil];
-        } else {
-            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil];
-        }
-        [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
-    }];
-}
-
--(void)setTags:(CDVInvokedUrlCommand*)command{
-    NSArray *tags = command.arguments;
-    [JPUSHService setTags:[NSSet setWithArray:tags]
-                    alias:nil
-    fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) {
-        CDVPluginResult *result;
-        if (iResCode == 0) {
-            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil];
-        } else {
-            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil];
-        }
-        [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
-    }];
-}
-
--(void)setAlias:(CDVInvokedUrlCommand*)command{
-    NSString *alias = [command argumentAtIndex:0];
-    [JPUSHService setTags:nil
-                    alias:alias
-    fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) {
-        CDVPluginResult *result;
-        if (iResCode == 0) {
-            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil];
-        } else {
-            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil];
-        }
-        [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
-    }];
-}
-
--(void)getRegistrationID:(CDVInvokedUrlCommand*)command{
-    NSString* registrationID = [JPUSHService registrationID];
-    [self handleResultWithValue:registrationID command:command];
-}
-
--(void)startLogPageView:(CDVInvokedUrlCommand*)command{
-    NSString * pageName = [command argumentAtIndex:0];
-    [JPUSHService startLogPageView:pageName];
-}
-
--(void)stopLogPageView:(CDVInvokedUrlCommand*)command{
-    NSString * pageName = [command argumentAtIndex:0];
-    [JPUSHService stopLogPageView:pageName];
-}
-
--(void)beginLogPageView:(CDVInvokedUrlCommand*)command{
-    NSString *pageName = [command argumentAtIndex:0];
-    NSNumber *duration = [command argumentAtIndex:1];
-    [JPUSHService beginLogPageView:pageName duration:duration.intValue];
-}
-
--(void)setBadge:(CDVInvokedUrlCommand*)command{
-    NSNumber *badge = [command argumentAtIndex:0];
-    [JPUSHService setBadge:badge.intValue];
-}
-
--(void)resetBadge:(CDVInvokedUrlCommand*)command{
-    [JPUSHService resetBadge];
-}
-
--(void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command{
-    NSNumber *badge = [command argumentAtIndex:0];
-    [UIApplication sharedApplication].applicationIconBadgeNumber = badge.intValue;
-}
-
--(void)getApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command {
-    NSInteger num = [UIApplication sharedApplication].applicationIconBadgeNumber;
-    NSNumber *number = [NSNumber numberWithInteger:num];
-    [self handleResultWithValue:number command:command];
-}
-
--(void)setDebugModeFromIos:(CDVInvokedUrlCommand*)command{
-    [JPUSHService setDebugMode];
-}
-
--(void)setLogOFF:(CDVInvokedUrlCommand*)command{
-    [JPUSHService setLogOFF];
-}
-
--(void)crashLogON:(CDVInvokedUrlCommand*)command{
-    [JPUSHService crashLogON];
-}
-
--(void)setLocalNotification:(CDVInvokedUrlCommand*)command{
-    NSLog(@"ios 10 after please use UNNotificationRequest to set local notification, see apple doc to learn more");
-
-    NSDate       *date  = [NSDate dateWithTimeIntervalSinceNow:[[command argumentAtIndex:0] intValue]];
-    NSString     *alert = [command argumentAtIndex:1];
-    NSNumber     *badge = [command argumentAtIndex:2];
-    NSString     *idKey = [command argumentAtIndex:3];
-    NSDictionary *dict  = [command argumentAtIndex:4];
-    [JPUSHService setLocalNotification:date alertBody:alert badge:badge.intValue alertAction:nil identifierKey:idKey userInfo:dict soundName:nil];
-}
-
--(void)deleteLocalNotificationWithIdentifierKey:(CDVInvokedUrlCommand*)command{
-    NSString *identifier = [command argumentAtIndex:0];
-    JPushNotificationIdentifier *jpid = [JPushNotificationIdentifier new];
-    jpid.identifiers = @[identifier];
-    [JPUSHService removeNotification:jpid];
-}
-
--(void)clearAllLocalNotifications:(CDVInvokedUrlCommand*)command{
-    [JPUSHService removeNotification:nil];
-}
-
--(void)setLocation:(CDVInvokedUrlCommand*)command{
-    NSNumber *latitude  = [command argumentAtIndex:0];
-    NSNumber *longitude = [command argumentAtIndex:1];
-    [JPUSHService setLatitude:latitude.doubleValue longitude:longitude.doubleValue];
-}
-
--(void)getUserNotificationSettings:(CDVInvokedUrlCommand*)command{
-    if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
-        UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
-        WEAK_SELF(weakSelf);
-        [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
-            NSMutableDictionary *dict = [NSMutableDictionary dictionary];
-            dict[@"authorizationStatus"]       = @(settings.authorizationStatus);
-            dict[@"soundSetting"]              = @(settings.soundSetting);
-            dict[@"badgeSetting"]              = @(settings.badgeSetting);
-            dict[@"alertSetting"]              = @(settings.alertSetting);
-            dict[@"notificationCenterSetting"] = @(settings.notificationCenterSetting);
-            dict[@"lockScreenSetting"]         = @(settings.lockScreenSetting);
-            dict[@"carPlaySetting"]            = @(settings.carPlaySetting);
-            dict[@"alertStyle"]                = @(settings.alertStyle);
-            [weakSelf handleResultWithValue:dict command:command];
-        }];
-    }else if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
-        UIUserNotificationSettings *settings = [[UIApplication sharedApplication] currentUserNotificationSettings];
-        UIUserNotificationType type = settings.types;
-        NSNumber *number = [NSNumber numberWithInteger:type];
-        [self handleResultWithValue:number command:command];
-    }else{
-        UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
-        NSNumber *number = [NSNumber numberWithInteger:type];
-        [self handleResultWithValue:number command:command];
-    }
-}
-
-#pragma mark - ios 10 APIs
-
--(void)addDismissActions:(CDVInvokedUrlCommand*)command{
-    [self addActions:command dismiss:YES];
-}
-
--(void)addNotificationActions:(CDVInvokedUrlCommand*)command{
-    [self addActions:command dismiss:NO];
-}
-
--(void)addActions:(CDVInvokedUrlCommand*)command dismiss:(BOOL)dimiss{
-    NSArray *actionsData     = [command argumentAtIndex:0];
-    NSString *categoryId     = [command argumentAtIndex:1];
-    NSMutableArray *actions  = [NSMutableArray array];
-    for (NSDictionary *dict in actionsData) {
-        NSString *title      = dict[@"title"];
-        NSString *identifier = dict[@"identifier"];
-        NSString *option     = dict[@"option"];
-        NSString *type       = dict[@"type"];
-        if ([type isEqualToString:@"textInput"]) {
-            NSString *textInputButtonTitle = dict[@"textInputButtonTitle"];
-            NSString *textInputPlaceholder = dict[@"textInputPlaceholder"];
-            UNTextInputNotificationAction *inputAction = [UNTextInputNotificationAction actionWithIdentifier:identifier title:title options:option.integerValue textInputButtonTitle:textInputButtonTitle textInputPlaceholder:textInputPlaceholder];
-            [actions addObject:inputAction];
-        } else {
-            UNNotificationAction *action = [UNNotificationAction actionWithIdentifier:title title:title options:option.integerValue];
-            [actions addObject:action];
-        }
-    }
-    UNNotificationCategory *category;
-    if (dimiss) {
-        category = [UNNotificationCategory categoryWithIdentifier:categoryId
-                                                          actions:actions
-                                                intentIdentifiers:@[]
-                                                          options:UNNotificationCategoryOptionCustomDismissAction];
-    } else {
-        category = [UNNotificationCategory categoryWithIdentifier:categoryId
-                                                          actions:actions
-                                                intentIdentifiers:@[]
-                                                          options:UNNotificationCategoryOptionNone];
-    }
-    [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObject:category]];
-}
-
-#pragma mark - 内部方法
-
-+(void)setupJPushSDK:(NSDictionary*)userInfo{
-    NSString *plistPath = [[NSBundle mainBundle] pathForResource:JPushConfig_FileName ofType:@"plist"];
-    if (plistPath == nil) {
-        NSLog(@"error: PushConfig.plist not found");
-        assert(0);
-    }
-
-    NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
-    NSString *appkey       = [plistData valueForKey:JPushConfig_Appkey];
-    NSString *channel      = [plistData valueForKey:JPushConfig_Channel];
-    NSNumber *isProduction = [plistData valueForKey:JPushConfig_IsProduction];
-    NSNumber *isIDFA       = [plistData valueForKey:JPushConfig_IsIDFA];
-
-    NSString *advertisingId = nil;
-    if(isIDFA.boolValue) {
-        advertisingId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
-    }
-    [JPUSHService setupWithOption:userInfo
-                           appKey:appkey
-                          channel:channel
-                 apsForProduction:[isProduction boolValue]
-            advertisingIdentifier:advertisingId];
-}
-
-#pragma mark 将参数返回给js
--(void)handleResultWithValue:(id)value command:(CDVInvokedUrlCommand*)command {
-    CDVPluginResult *result = nil;
-    CDVCommandStatus status = CDVCommandStatus_OK;
-
-    if ([value isKindOfClass:[NSString class]]) {
-        value = [value stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-    } else if ([value isKindOfClass:[NSNull class]]) {
-        value = nil;
-    }
-
-    if ([value isKindOfClass:[NSObject class]]) {
-        result = [CDVPluginResult resultWithStatus:status messageAsString:value];//NSObject 类型都可以
-    } else {
-        NSLog(@"Cordova callback block returned unrecognized type: %@", NSStringFromClass([value class]));
-        result = nil;
-    }
-
-    if (!result) {
-        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
-    }
-    [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
-}
-
-#pragma mark 设置标签及别名回调
--(void)tagsWithAliasCallback:(int)resultCode tags:(NSSet *)tags alias:(NSString *)alias {
-    if (resultCode == 0) {  // Success
-
-    } else {
-
-    }
-}
-
-- (void)networkDidReceiveMessage:(NSNotification *)notification {
-    if (notification && notification.userInfo) {
-        [JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveMessage
-                              jsString:[notification.userInfo toJsonString]];
-    }
-}
-
-@end
+
+//
+//  PushTalkPlugin.m
+//  PushTalk
+//
+//  Created by zhangqinghe on 13-12-13.
+//
+//
+
+#import "JPushPlugin.h"
+#import "JPUSHService.h"
+#import <UIKit/UIKit.h>
+#import <AdSupport/AdSupport.h>
+#import <UserNotifications/UserNotifications.h>
+#import "AppDelegate+JPush.h"
+#import "JPushDefine.h"
+
+@implementation NSDictionary (JPush)
+-(NSString*)toJsonString{
+    NSError  *error;
+    NSData   *data       = [NSJSONSerialization dataWithJSONObject:self options:0 error:&error];
+    NSString *jsonString = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
+    return jsonString;
+}
+@end
+
+@implementation NSString (JPush)
+-(NSDictionary*)toDictionary{
+    NSError      *error;
+    NSData       *jsonData = [self dataUsingEncoding:NSUTF8StringEncoding];
+    NSDictionary *dict     = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
+    return dict;
+}
+@end
+
+@interface JPushPlugin()
+
+@end
+
+@implementation JPushPlugin
+
+-(void)startJPushSDK:(CDVInvokedUrlCommand*)command{
+    [(AppDelegate*)[UIApplication sharedApplication].delegate startJPushSDK];
+}
+
+#pragma mark- 外部接口
+-(void)stopPush:(CDVInvokedUrlCommand*)command{
+    [[UIApplication sharedApplication]unregisterForRemoteNotifications];
+}
+
+-(void)resumePush:(CDVInvokedUrlCommand*)command{
+    [(AppDelegate*)[UIApplication sharedApplication].delegate registerForRemoteNotification];
+}
+
+-(void)isPushStopped:(CDVInvokedUrlCommand*)command{
+    NSNumber *result = [[UIApplication sharedApplication] isRegisteredForRemoteNotifications] ? @(0) : @(1);
+    [self handleResultWithValue:result command:command];
+}
+
+-(void)initial:(CDVInvokedUrlCommand*)command{
+    //do nithng,because Cordova plugin use lazy load mode.
+}
+
+#ifdef __CORDOVA_4_0_0
+
+- (void)pluginInitialize {
+    NSLog(@"### pluginInitialize ");
+    [self initPlugin];
+}
+
+#else
+
+- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView{
+    NSLog(@"### initWithWebView ");
+    if (self=[super initWithWebView:theWebView]) {
+    }
+    [self initPlugin];
+    return self;
+}
+
+#endif
+
+-(void)initPlugin{
+    if (!SharedJPushPlugin) {
+        SharedJPushPlugin = self;
+    }
+    [[NSNotificationCenter defaultCenter] addObserver:self
+                                             selector:@selector(networkDidReceiveMessage:)
+                                                 name:kJPFNetworkDidReceiveMessageNotification
+                                               object:nil];
+}
+
++(void)fireDocumentEvent:(NSString*)eventName jsString:(NSString*)jsString{
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [SharedJPushPlugin.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireDocumentEvent('jpush.%@',%@)", eventName, jsString]];
+    });
+}
+
+-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command{
+    NSString *alias = [command argumentAtIndex:0];
+    NSArray  *tags  = [command argumentAtIndex:1];
+
+    [JPUSHService setTags:[NSSet setWithArray:tags]
+                    alias:alias
+    fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) {
+        CDVPluginResult *result;
+        if (iResCode == 0) {
+            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil];
+        } else {
+            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil];
+        }
+        [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
+    }];
+}
+
+-(void)setTags:(CDVInvokedUrlCommand*)command{
+    NSArray *tags = command.arguments;
+    [JPUSHService setTags:[NSSet setWithArray:tags]
+                    alias:nil
+    fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) {
+        CDVPluginResult *result;
+        if (iResCode == 0) {
+            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil];
+        } else {
+            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil];
+        }
+        [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
+    }];
+}
+
+-(void)setAlias:(CDVInvokedUrlCommand*)command{
+    NSString *alias = [command argumentAtIndex:0];
+    [JPUSHService setTags:nil
+                    alias:alias
+    fetchCompletionHandle:^(int iResCode, NSSet *iTags, NSString *iAlias) {
+        CDVPluginResult *result;
+        if (iResCode == 0) {
+            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil];
+        } else {
+            result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:nil];
+        }
+        [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
+    }];
+}
+
+-(void)getRegistrationID:(CDVInvokedUrlCommand*)command{
+    NSString* registrationID = [JPUSHService registrationID];
+    [self handleResultWithValue:registrationID command:command];
+}
+
+-(void)startLogPageView:(CDVInvokedUrlCommand*)command{
+    NSString * pageName = [command argumentAtIndex:0];
+    [JPUSHService startLogPageView:pageName];
+}
+
+-(void)stopLogPageView:(CDVInvokedUrlCommand*)command{
+    NSString * pageName = [command argumentAtIndex:0];
+    [JPUSHService stopLogPageView:pageName];
+}
+
+-(void)beginLogPageView:(CDVInvokedUrlCommand*)command{
+    NSString *pageName = [command argumentAtIndex:0];
+    NSNumber *duration = [command argumentAtIndex:1];
+    [JPUSHService beginLogPageView:pageName duration:duration.intValue];
+}
+
+-(void)setBadge:(CDVInvokedUrlCommand*)command{
+    NSNumber *badge = [command argumentAtIndex:0];
+    [JPUSHService setBadge:badge.intValue];
+}
+
+-(void)resetBadge:(CDVInvokedUrlCommand*)command{
+    [JPUSHService resetBadge];
+}
+
+-(void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command{
+    NSNumber *badge = [command argumentAtIndex:0];
+    [UIApplication sharedApplication].applicationIconBadgeNumber = badge.intValue;
+}
+
+-(void)getApplicationIconBadgeNumber:(CDVInvokedUrlCommand*)command {
+    NSInteger num = [UIApplication sharedApplication].applicationIconBadgeNumber;
+    NSNumber *number = [NSNumber numberWithInteger:num];
+    [self handleResultWithValue:number command:command];
+}
+
+-(void)setDebugModeFromIos:(CDVInvokedUrlCommand*)command{
+    [JPUSHService setDebugMode];
+}
+
+-(void)setLogOFF:(CDVInvokedUrlCommand*)command{
+    [JPUSHService setLogOFF];
+}
+
+-(void)crashLogON:(CDVInvokedUrlCommand*)command{
+    [JPUSHService crashLogON];
+}
+
+-(void)setLocalNotification:(CDVInvokedUrlCommand*)command{
+    NSLog(@"ios 10 after please use UNNotificationRequest to set local notification, see apple doc to learn more");
+
+    NSDate       *date  = [NSDate dateWithTimeIntervalSinceNow:[[command argumentAtIndex:0] intValue]];
+    NSString     *alert = [command argumentAtIndex:1];
+    NSNumber     *badge = [command argumentAtIndex:2];
+    NSString     *idKey = [command argumentAtIndex:3];
+    NSDictionary *dict  = [command argumentAtIndex:4];
+    [JPUSHService setLocalNotification:date alertBody:alert badge:badge.intValue alertAction:nil identifierKey:idKey userInfo:dict soundName:nil];
+}
+
+-(void)deleteLocalNotificationWithIdentifierKey:(CDVInvokedUrlCommand*)command{
+    NSString *identifier = [command argumentAtIndex:0];
+    JPushNotificationIdentifier *jpid = [JPushNotificationIdentifier new];
+    jpid.identifiers = @[identifier];
+    [JPUSHService removeNotification:jpid];
+}
+
+-(void)clearAllLocalNotifications:(CDVInvokedUrlCommand*)command{
+    [JPUSHService removeNotification:nil];
+}
+
+-(void)setLocation:(CDVInvokedUrlCommand*)command{
+    NSNumber *latitude  = [command argumentAtIndex:0];
+    NSNumber *longitude = [command argumentAtIndex:1];
+    [JPUSHService setLatitude:latitude.doubleValue longitude:longitude.doubleValue];
+}
+
+-(void)getUserNotificationSettings:(CDVInvokedUrlCommand*)command{
+    if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
+        UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
+        WEAK_SELF(weakSelf);
+        [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
+            NSMutableDictionary *dict = [NSMutableDictionary dictionary];
+            dict[@"authorizationStatus"]       = @(settings.authorizationStatus);
+            dict[@"soundSetting"]              = @(settings.soundSetting);
+            dict[@"badgeSetting"]              = @(settings.badgeSetting);
+            dict[@"alertSetting"]              = @(settings.alertSetting);
+            dict[@"notificationCenterSetting"] = @(settings.notificationCenterSetting);
+            dict[@"lockScreenSetting"]         = @(settings.lockScreenSetting);
+            dict[@"carPlaySetting"]            = @(settings.carPlaySetting);
+            dict[@"alertStyle"]                = @(settings.alertStyle);
+            [weakSelf handleResultWithValue:dict command:command];
+        }];
+    }else if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
+        UIUserNotificationSettings *settings = [[UIApplication sharedApplication] currentUserNotificationSettings];
+        UIUserNotificationType type = settings.types;
+        NSNumber *number = [NSNumber numberWithInteger:type];
+        [self handleResultWithValue:number command:command];
+    }else{
+        UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
+        NSNumber *number = [NSNumber numberWithInteger:type];
+        [self handleResultWithValue:number command:command];
+    }
+}
+
+#pragma mark - ios 10 APIs
+
+-(void)addDismissActions:(CDVInvokedUrlCommand*)command{
+    [self addActions:command dismiss:YES];
+}
+
+-(void)addNotificationActions:(CDVInvokedUrlCommand*)command{
+    [self addActions:command dismiss:NO];
+}
+
+-(void)addActions:(CDVInvokedUrlCommand*)command dismiss:(BOOL)dimiss{
+    NSArray *actionsData     = [command argumentAtIndex:0];
+    NSString *categoryId     = [command argumentAtIndex:1];
+    NSMutableArray *actions  = [NSMutableArray array];
+    for (NSDictionary *dict in actionsData) {
+        NSString *title      = dict[@"title"];
+        NSString *identifier = dict[@"identifier"];
+        NSString *option     = dict[@"option"];
+        NSString *type       = dict[@"type"];
+        if ([type isEqualToString:@"textInput"]) {
+            NSString *textInputButtonTitle = dict[@"textInputButtonTitle"];
+            NSString *textInputPlaceholder = dict[@"textInputPlaceholder"];
+            UNTextInputNotificationAction *inputAction = [UNTextInputNotificationAction actionWithIdentifier:identifier title:title options:option.integerValue textInputButtonTitle:textInputButtonTitle textInputPlaceholder:textInputPlaceholder];
+            [actions addObject:inputAction];
+        } else {
+            UNNotificationAction *action = [UNNotificationAction actionWithIdentifier:title title:title options:option.integerValue];
+            [actions addObject:action];
+        }
+    }
+    UNNotificationCategory *category;
+    if (dimiss) {
+        category = [UNNotificationCategory categoryWithIdentifier:categoryId
+                                                          actions:actions
+                                                intentIdentifiers:@[]
+                                                          options:UNNotificationCategoryOptionCustomDismissAction];
+    } else {
+        category = [UNNotificationCategory categoryWithIdentifier:categoryId
+                                                          actions:actions
+                                                intentIdentifiers:@[]
+                                                          options:UNNotificationCategoryOptionNone];
+    }
+    [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObject:category]];
+}
+
+#pragma mark - 内部方法
+
++(void)setupJPushSDK:(NSDictionary*)userInfo{
+    NSString *plistPath = [[NSBundle mainBundle] pathForResource:JPushConfig_FileName ofType:@"plist"];
+    if (plistPath == nil) {
+        NSLog(@"error: PushConfig.plist not found");
+        assert(0);
+    }
+
+    NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
+    NSString *appkey       = [plistData valueForKey:JPushConfig_Appkey];
+    NSString *channel      = [plistData valueForKey:JPushConfig_Channel];
+    NSNumber *isProduction = [plistData valueForKey:JPushConfig_IsProduction];
+    NSNumber *isIDFA       = [plistData valueForKey:JPushConfig_IsIDFA];
+
+    NSString *advertisingId = nil;
+    if(isIDFA.boolValue) {
+        advertisingId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
+    }
+    [JPUSHService setupWithOption:userInfo
+                           appKey:appkey
+                          channel:channel
+                 apsForProduction:[isProduction boolValue]
+            advertisingIdentifier:advertisingId];
+}
+
+#pragma mark 将参数返回给js
+-(void)handleResultWithValue:(id)value command:(CDVInvokedUrlCommand*)command {
+    CDVPluginResult *result = nil;
+    CDVCommandStatus status = CDVCommandStatus_OK;
+
+    if ([value isKindOfClass:[NSString class]]) {
+        value = [value stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+    } else if ([value isKindOfClass:[NSNull class]]) {
+        value = nil;
+    }
+
+    if ([value isKindOfClass:[NSObject class]]) {
+        result = [CDVPluginResult resultWithStatus:status messageAsString:value];//NSObject 类型都可以
+    } else {
+        NSLog(@"Cordova callback block returned unrecognized type: %@", NSStringFromClass([value class]));
+        result = nil;
+    }
+
+    if (!result) {
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
+    }
+    [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
+}
+
+#pragma mark 设置标签及别名回调
+-(void)tagsWithAliasCallback:(int)resultCode tags:(NSSet *)tags alias:(NSString *)alias {
+    if (resultCode == 0) {  // Success
+
+    } else {
+
+    }
+}
+
+- (void)networkDidReceiveMessage:(NSNotification *)notification {
+    if (notification && notification.userInfo) {
+        [JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveMessage
+                              jsString:[notification.userInfo toJsonString]];
+    }
+}
+
+@end

+ 0 - 0
miaomiao/plugins/jpush-phonegap-plugin/src/ios/lib/jpush-ios-3.0.6.a