Advertisement
Guest User

Untitled

a guest
May 3rd, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.13 KB | None | 0 0
  1. #js {:handler #object[NotificationsComponent [object Object]], :onRegister false, :onError false, :onNotification false, :onRemoteFetch false, :isLoaded true, :hasPoppedInitialNotification true, :isPermissionsRequestPending false, :permissions #js {:alert true, :badge true, :sound true}, :callNative #object[Function "function (name, params) {
  2. if (typeof this.handler[name] === 'function') {
  3. var _handler;
  4.  
  5. if (typeof params !== 'array' && typeof params !== 'object') {
  6. params = [];
  7. }
  8.  
  9. return (_handler = this.handler)[name].apply(_handler, babelHelpers.toConsumableArray(params));
  10. } else {
  11. return null;
  12. }
  13. }"], :configure #object[Function "function (options) {
  14. if (typeof options.onRegister !== 'undefined') {
  15. this.onRegister = options.onRegister;
  16. }
  17.  
  18. if (typeof options.onError !== 'undefined') {
  19. this.onError = options.onError;
  20. }
  21.  
  22. if (typeof options.onNotification !== 'undefined') {
  23. this.onNotification = options.onNotification;
  24. }
  25.  
  26. if (typeof options.permissions !== 'undefined') {
  27. this.permissions = options.permissions;
  28. }
  29.  
  30. if (typeof options.senderID !== 'undefined') {
  31. this.senderID = options.senderID;
  32. }
  33.  
  34. if (typeof options.onRemoteFetch !== 'undefined') {
  35. this.onRemoteFetch = options.onRemoteFetch;
  36. }
  37.  
  38. if (this.isLoaded === false) {
  39. this._onRegister = this._onRegister.bind(this);
  40. this._onNotification = this._onNotification.bind(this);
  41. this._onRemoteFetch = this._onRemoteFetch.bind(this);
  42. this.callNative('addEventListener', ['register', this._onRegister]);
  43. this.callNative('addEventListener', ['notification', this._onNotification]);
  44. this.callNative('addEventListener', ['localNotification', this._onNotification]);
  45. Platform.OS === 'android' ? this.callNative('addEventListener', ['remoteFetch', this._onRemoteFetch]) : null;
  46.  
  47. this.isLoaded = true;
  48. }
  49.  
  50. if (this.hasPoppedInitialNotification === false && (options.popInitialNotification === undefined || options.popInitialNotification === true)) {
  51. this.popInitialNotification(function (firstNotification) {
  52. if (firstNotification !== null) {
  53. this._onNotification(firstNotification, true);
  54. }
  55. }.bind(this));
  56. this.hasPoppedInitialNotification = true;
  57. }
  58.  
  59. if (options.requestPermissions !== false) {
  60. this._requestPermissions();
  61. }
  62. }"], :unregister #object[Function "function () {
  63. this.callNative('removeEventListener', ['register', this._onRegister]);
  64. this.callNative('removeEventListener', ['notification', this._onNotification]);
  65. this.callNative('removeEventListener', ['localNotification', this._onNotification]);
  66. Platform.OS === 'android' ? this.callNative('removeEventListener', ['remoteFetch', this._onRemoteFetch]) : null;
  67. this.isLoaded = false;
  68. }"], :localNotification #object[Function "function (details) {
  69. if (Platform.OS === 'ios') {
  70.  
  71. var soundName = details.soundName ? details.soundName : 'default';
  72.  
  73. if (details.hasOwnProperty('playSound') && !details.playSound) {
  74. soundName = '';
  75. }
  76.  
  77. this.handler.presentLocalNotification({
  78. alertTitle: details.title,
  79. alertBody: details.message,
  80. alertAction: details.alertAction,
  81. category: details.category,
  82. soundName: soundName,
  83. applicationIconBadgeNumber: details.number,
  84. userInfo: details.userInfo
  85. });
  86. } else {
  87. this.handler.presentLocalNotification(details);
  88. }
  89. }"], :localNotificationSchedule #object[Function "function (details) {
  90. if (Platform.OS === 'ios') {
  91. this.handler.scheduleLocalNotification({
  92. fireDate: details.date.toISOString(),
  93. alertBody: details.message,
  94. userInfo: details.userInfo
  95. });
  96. } else {
  97. details.fireDate = details.date.getTime();
  98. delete details.date;
  99. this.handler.scheduleLocalNotification(details);
  100. }
  101. }"], :_onRegister #object[bound "function () { [native code] }"], :_onRemoteFetch #object[bound "function () { [native code] }"], :_onNotification #object[bound "function () { [native code] }"], :_onPermissionResult #object[Function "function () {
  102. this.isPermissionsRequestPending = false;
  103. }"], :_requestPermissions #object[Function "function () {
  104. if (Platform.OS === 'ios') {
  105. if (this.isPermissionsRequestPending === false) {
  106. this.isPermissionsRequestPending = true;
  107. return this.callNative('requestPermissions', [this.permissions]).then(this._onPermissionResult.bind(this)).catch(this._onPermissionResult.bind(this));
  108. }
  109. } else if (typeof this.senderID !== 'undefined') {
  110. return this.callNative('requestPermissions', [this.senderID]);
  111. }
  112. }"], :requestPermissions #object[Function "function () {
  113. if (Platform.OS === 'ios') {
  114. return this.callNative('requestPermissions', [this.permissions]);
  115. } else if (typeof this.senderID !== 'undefined') {
  116. return this.callNative('requestPermissions', [this.senderID]);
  117. }
  118. }"], :presentLocalNotification #object[Function "function () {
  119. return this.callNative('presentLocalNotification', arguments);
  120. }"], :scheduleLocalNotification #object[Function "function () {
  121. return this.callNative('scheduleLocalNotification', arguments);
  122. }"], :cancelLocalNotifications #object[Function "function () {
  123. return this.callNative('cancelLocalNotifications', arguments);
  124. }"], :cancelAllLocalNotifications #object[Function "function () {
  125. return this.callNative('cancelAllLocalNotifications', arguments);
  126. }"], :setApplicationIconBadgeNumber #object[Function "function () {
  127. return this.callNative('setApplicationIconBadgeNumber', arguments);
  128. }"], :getApplicationIconBadgeNumber #object[Function "function () {
  129. return this.callNative('getApplicationIconBadgeNumber', arguments);
  130. }"], :popInitialNotification #object[Function "function (handler) {
  131. this.callNative('getInitialNotification').then(function (result) {
  132. handler(result);
  133. });
  134. }"], :abandonPermissions #object[Function "function () {
  135. return this.callNative('abandonPermissions', arguments);
  136. }"], :checkPermissions #object[Function "function () {
  137. return this.callNative('checkPermissions', arguments);
  138. }"], :registerNotificationActions #object[Function "function () {
  139. return this.callNative('registerNotificationActions', arguments);
  140. }"], :clearAllNotifications #object[Function "function () {
  141. return this.callNative('clearAllNotifications', arguments);
  142. }"]}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement