index.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = Object.setPrototypeOf ||
  3. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5. return function (d, b) {
  6. extendStatics(d, b);
  7. function __() { this.constructor = d; }
  8. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9. };
  10. })();
  11. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  12. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  13. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  14. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  15. return c > 3 && r && Object.defineProperty(target, key, r), r;
  16. };
  17. var __metadata = (this && this.__metadata) || function (k, v) {
  18. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  19. };
  20. import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
  21. import { Injectable } from '@angular/core';
  22. var JPush = (function (_super) {
  23. __extends(JPush, _super);
  24. function JPush() {
  25. return _super !== null && _super.apply(this, arguments) || this;
  26. }
  27. JPush.prototype.init = function () { return; };
  28. JPush.prototype.setDebugMode = function (enable) { return; };
  29. JPush.prototype.getRegistrationID = function () { return; };
  30. JPush.prototype.stopPush = function () { return; };
  31. JPush.prototype.resumePush = function () { return; };
  32. JPush.prototype.isPushStopped = function () { return; };
  33. JPush.prototype.setTags = function (params) { return; };
  34. JPush.prototype.addTags = function (params) { return; };
  35. JPush.prototype.deleteTags = function (params) { return; };
  36. JPush.prototype.cleanTags = function (params) { return; };
  37. JPush.prototype.getAllTags = function (params) { return; };
  38. /**
  39. * @param params { sequence: number, tag: string }
  40. */
  41. JPush.prototype.checkTagBindState = function (params) { return; };
  42. JPush.prototype.setAlias = function (params) { return; };
  43. JPush.prototype.deleteAlias = function (params) { return; };
  44. JPush.prototype.getAlias = function (params) { return; };
  45. /**
  46. * Determinate whether the application notification has been opened.
  47. *
  48. * iOS: 0: closed; >1: opened.
  49. * UIRemoteNotificationTypeNone = 0,
  50. * UIRemoteNotificationTypeBadge = 1 << 0,
  51. * UIRemoteNotificationTypeSound = 1 << 1,
  52. * UIRemoteNotificationTypeAlert = 1 << 2,
  53. * UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3
  54. *
  55. * Android: 0: closed; 1: opened.
  56. */
  57. JPush.prototype.getUserNotificationSettings = function () { return; };
  58. JPush.prototype.clearLocalNotifications = function () { return; };
  59. // iOS API - start
  60. JPush.prototype.setBadge = function (badge) { return; };
  61. JPush.prototype.resetBadge = function () { return; };
  62. JPush.prototype.setApplicationIconBadgeNumber = function (badge) { return; };
  63. JPush.prototype.getApplicationIconBadgeNumber = function () { return; };
  64. JPush.prototype.addLocalNotificationForIOS = function (delayTime, content, badge, identifierKey, extras) { return; };
  65. JPush.prototype.deleteLocalNotificationWithIdentifierKeyInIOS = function (identifierKey) { return; };
  66. JPush.prototype.addDismissActions = function (actions, categoryId) { return; };
  67. JPush.prototype.addNotificationActions = function (actions, categoryId) { return; };
  68. JPush.prototype.setLocation = function (latitude, longitude) { return; };
  69. JPush.prototype.startLogPageView = function (pageName) { return; };
  70. JPush.prototype.stopLogPageView = function (pageName) { return; };
  71. JPush.prototype.beginLogPageView = function (pageName, duration) { return; };
  72. // iOS API - end
  73. // Android API - start
  74. JPush.prototype.getConnectionState = function () { return; };
  75. JPush.prototype.setBasicPushNotificationBuilder = function () { return; };
  76. JPush.prototype.setCustomPushNotificationBuilder = function () { return; };
  77. JPush.prototype.clearAllNotification = function () { return; };
  78. JPush.prototype.clearNotificationById = function (id) { return; };
  79. JPush.prototype.setLatestNotificationNum = function (num) { return; };
  80. JPush.prototype.addLocalNotification = function (builderId, content, title, notificationId, broadcastTime, extras) { return; };
  81. JPush.prototype.removeLocalNotification = function (notificationId) { return; };
  82. JPush.prototype.reportNotificationOpened = function (msgId) { return; };
  83. JPush.prototype.requestPermission = function () { return; };
  84. JPush.prototype.setSilenceTime = function (startHour, startMinute, endHour, endMinute) { return; };
  85. JPush.prototype.setPushTime = function (weekdays, startHour, endHour) { return; };
  86. // Android API - end
  87. JPush.decorators = [
  88. { type: Injectable },
  89. ];
  90. /** @nocollapse */
  91. JPush.ctorParameters = function () { return []; };
  92. __decorate([
  93. Cordova(),
  94. __metadata("design:type", Function),
  95. __metadata("design:paramtypes", []),
  96. __metadata("design:returntype", Promise)
  97. ], JPush.prototype, "init", null);
  98. __decorate([
  99. Cordova(),
  100. __metadata("design:type", Function),
  101. __metadata("design:paramtypes", [Boolean]),
  102. __metadata("design:returntype", Promise)
  103. ], JPush.prototype, "setDebugMode", null);
  104. __decorate([
  105. Cordova(),
  106. __metadata("design:type", Function),
  107. __metadata("design:paramtypes", []),
  108. __metadata("design:returntype", Promise)
  109. ], JPush.prototype, "getRegistrationID", null);
  110. __decorate([
  111. Cordova(),
  112. __metadata("design:type", Function),
  113. __metadata("design:paramtypes", []),
  114. __metadata("design:returntype", Promise)
  115. ], JPush.prototype, "stopPush", null);
  116. __decorate([
  117. Cordova(),
  118. __metadata("design:type", Function),
  119. __metadata("design:paramtypes", []),
  120. __metadata("design:returntype", Promise)
  121. ], JPush.prototype, "resumePush", null);
  122. __decorate([
  123. Cordova(),
  124. __metadata("design:type", Function),
  125. __metadata("design:paramtypes", []),
  126. __metadata("design:returntype", Promise)
  127. ], JPush.prototype, "isPushStopped", null);
  128. __decorate([
  129. Cordova(),
  130. __metadata("design:type", Function),
  131. __metadata("design:paramtypes", [Object]),
  132. __metadata("design:returntype", Promise)
  133. ], JPush.prototype, "setTags", null);
  134. __decorate([
  135. Cordova(),
  136. __metadata("design:type", Function),
  137. __metadata("design:paramtypes", [Object]),
  138. __metadata("design:returntype", Promise)
  139. ], JPush.prototype, "addTags", null);
  140. __decorate([
  141. Cordova(),
  142. __metadata("design:type", Function),
  143. __metadata("design:paramtypes", [Object]),
  144. __metadata("design:returntype", Promise)
  145. ], JPush.prototype, "deleteTags", null);
  146. __decorate([
  147. Cordova(),
  148. __metadata("design:type", Function),
  149. __metadata("design:paramtypes", [Object]),
  150. __metadata("design:returntype", Promise)
  151. ], JPush.prototype, "cleanTags", null);
  152. __decorate([
  153. Cordova(),
  154. __metadata("design:type", Function),
  155. __metadata("design:paramtypes", [Object]),
  156. __metadata("design:returntype", Promise)
  157. ], JPush.prototype, "getAllTags", null);
  158. __decorate([
  159. Cordova(),
  160. __metadata("design:type", Function),
  161. __metadata("design:paramtypes", [Object]),
  162. __metadata("design:returntype", Promise)
  163. ], JPush.prototype, "checkTagBindState", null);
  164. __decorate([
  165. Cordova(),
  166. __metadata("design:type", Function),
  167. __metadata("design:paramtypes", [Object]),
  168. __metadata("design:returntype", Promise)
  169. ], JPush.prototype, "setAlias", null);
  170. __decorate([
  171. Cordova(),
  172. __metadata("design:type", Function),
  173. __metadata("design:paramtypes", [Object]),
  174. __metadata("design:returntype", Promise)
  175. ], JPush.prototype, "deleteAlias", null);
  176. __decorate([
  177. Cordova(),
  178. __metadata("design:type", Function),
  179. __metadata("design:paramtypes", [Object]),
  180. __metadata("design:returntype", Promise)
  181. ], JPush.prototype, "getAlias", null);
  182. __decorate([
  183. Cordova(),
  184. __metadata("design:type", Function),
  185. __metadata("design:paramtypes", []),
  186. __metadata("design:returntype", Promise)
  187. ], JPush.prototype, "getUserNotificationSettings", null);
  188. __decorate([
  189. Cordova(),
  190. __metadata("design:type", Function),
  191. __metadata("design:paramtypes", []),
  192. __metadata("design:returntype", Promise)
  193. ], JPush.prototype, "clearLocalNotifications", null);
  194. __decorate([
  195. Cordova(),
  196. __metadata("design:type", Function),
  197. __metadata("design:paramtypes", [Number]),
  198. __metadata("design:returntype", Promise)
  199. ], JPush.prototype, "setBadge", null);
  200. __decorate([
  201. Cordova(),
  202. __metadata("design:type", Function),
  203. __metadata("design:paramtypes", []),
  204. __metadata("design:returntype", Promise)
  205. ], JPush.prototype, "resetBadge", null);
  206. __decorate([
  207. Cordova(),
  208. __metadata("design:type", Function),
  209. __metadata("design:paramtypes", [Number]),
  210. __metadata("design:returntype", Promise)
  211. ], JPush.prototype, "setApplicationIconBadgeNumber", null);
  212. __decorate([
  213. Cordova(),
  214. __metadata("design:type", Function),
  215. __metadata("design:paramtypes", []),
  216. __metadata("design:returntype", Promise)
  217. ], JPush.prototype, "getApplicationIconBadgeNumber", null);
  218. __decorate([
  219. Cordova(),
  220. __metadata("design:type", Function),
  221. __metadata("design:paramtypes", [Number, String, Number, String, Object]),
  222. __metadata("design:returntype", Promise)
  223. ], JPush.prototype, "addLocalNotificationForIOS", null);
  224. __decorate([
  225. Cordova(),
  226. __metadata("design:type", Function),
  227. __metadata("design:paramtypes", [String]),
  228. __metadata("design:returntype", Promise)
  229. ], JPush.prototype, "deleteLocalNotificationWithIdentifierKeyInIOS", null);
  230. __decorate([
  231. Cordova(),
  232. __metadata("design:type", Function),
  233. __metadata("design:paramtypes", [Array, String]),
  234. __metadata("design:returntype", Promise)
  235. ], JPush.prototype, "addDismissActions", null);
  236. __decorate([
  237. Cordova(),
  238. __metadata("design:type", Function),
  239. __metadata("design:paramtypes", [Array, String]),
  240. __metadata("design:returntype", Promise)
  241. ], JPush.prototype, "addNotificationActions", null);
  242. __decorate([
  243. Cordova(),
  244. __metadata("design:type", Function),
  245. __metadata("design:paramtypes", [Number, Number]),
  246. __metadata("design:returntype", Promise)
  247. ], JPush.prototype, "setLocation", null);
  248. __decorate([
  249. Cordova(),
  250. __metadata("design:type", Function),
  251. __metadata("design:paramtypes", [String]),
  252. __metadata("design:returntype", Promise)
  253. ], JPush.prototype, "startLogPageView", null);
  254. __decorate([
  255. Cordova(),
  256. __metadata("design:type", Function),
  257. __metadata("design:paramtypes", [String]),
  258. __metadata("design:returntype", Promise)
  259. ], JPush.prototype, "stopLogPageView", null);
  260. __decorate([
  261. Cordova(),
  262. __metadata("design:type", Function),
  263. __metadata("design:paramtypes", [String, Number]),
  264. __metadata("design:returntype", Promise)
  265. ], JPush.prototype, "beginLogPageView", null);
  266. __decorate([
  267. Cordova(),
  268. __metadata("design:type", Function),
  269. __metadata("design:paramtypes", []),
  270. __metadata("design:returntype", Promise)
  271. ], JPush.prototype, "getConnectionState", null);
  272. __decorate([
  273. Cordova(),
  274. __metadata("design:type", Function),
  275. __metadata("design:paramtypes", []),
  276. __metadata("design:returntype", Promise)
  277. ], JPush.prototype, "setBasicPushNotificationBuilder", null);
  278. __decorate([
  279. Cordova(),
  280. __metadata("design:type", Function),
  281. __metadata("design:paramtypes", []),
  282. __metadata("design:returntype", Promise)
  283. ], JPush.prototype, "setCustomPushNotificationBuilder", null);
  284. __decorate([
  285. Cordova(),
  286. __metadata("design:type", Function),
  287. __metadata("design:paramtypes", []),
  288. __metadata("design:returntype", Promise)
  289. ], JPush.prototype, "clearAllNotification", null);
  290. __decorate([
  291. Cordova(),
  292. __metadata("design:type", Function),
  293. __metadata("design:paramtypes", [Number]),
  294. __metadata("design:returntype", Promise)
  295. ], JPush.prototype, "clearNotificationById", null);
  296. __decorate([
  297. Cordova(),
  298. __metadata("design:type", Function),
  299. __metadata("design:paramtypes", [Number]),
  300. __metadata("design:returntype", Promise)
  301. ], JPush.prototype, "setLatestNotificationNum", null);
  302. __decorate([
  303. Cordova(),
  304. __metadata("design:type", Function),
  305. __metadata("design:paramtypes", [Number, String, String, Number, Number, String]),
  306. __metadata("design:returntype", Promise)
  307. ], JPush.prototype, "addLocalNotification", null);
  308. __decorate([
  309. Cordova(),
  310. __metadata("design:type", Function),
  311. __metadata("design:paramtypes", [Number]),
  312. __metadata("design:returntype", Promise)
  313. ], JPush.prototype, "removeLocalNotification", null);
  314. __decorate([
  315. Cordova(),
  316. __metadata("design:type", Function),
  317. __metadata("design:paramtypes", [Number]),
  318. __metadata("design:returntype", Promise)
  319. ], JPush.prototype, "reportNotificationOpened", null);
  320. __decorate([
  321. Cordova(),
  322. __metadata("design:type", Function),
  323. __metadata("design:paramtypes", []),
  324. __metadata("design:returntype", Promise)
  325. ], JPush.prototype, "requestPermission", null);
  326. __decorate([
  327. Cordova(),
  328. __metadata("design:type", Function),
  329. __metadata("design:paramtypes", [Number, Number, Number, Number]),
  330. __metadata("design:returntype", Promise)
  331. ], JPush.prototype, "setSilenceTime", null);
  332. __decorate([
  333. Cordova(),
  334. __metadata("design:type", Function),
  335. __metadata("design:paramtypes", [Array, Number, Number]),
  336. __metadata("design:returntype", Promise)
  337. ], JPush.prototype, "setPushTime", null);
  338. JPush = __decorate([
  339. Plugin({
  340. pluginName: 'JPush',
  341. plugin: 'jpush-phonegap-plugin',
  342. pluginRef: 'plugins.jPushPlugin',
  343. repo: 'https://github.com/jpush/jpush-phonegap-plugin',
  344. install: 'ionic cordova plugin add jpush-phonegap-plugin --variable APP_KEY=your_app_key',
  345. installVariables: ['APP_KEY'],
  346. platforms: ['Android', 'iOS']
  347. })
  348. ], JPush);
  349. return JPush;
  350. }(IonicNativePlugin));
  351. export { JPush };
  352. //# sourceMappingURL=index.js.map