Prepare content for notification index
 @api private

 @param [Object] target Notification target instance
 @param [Array<Notificaion>] notification_index Array notification index
 @param [Hash] params Option parameter to send render_notification
1697
def prepare_content_for(target, notification_index, params)
        content_for :notification_index do
          @target = target
          begin
            render_notification notification_index, params
          rescue ActionView::MissingTemplate
            params.delete(:target)
            render_notification notification_index, params
          end
        end
      end
466639
def notify(self, state, notifications):
        '''
        
        '''

        def do_append(desc, notifications):
            for notification in notifications:
                if not isinstance(notification, PendingNotification):
                    raise ValueError("Expected notify() params to be a list "
                                     "of PendingNotification instance, got %r."
                                     % notification)
                key = str(notification.recipient.key)
                if key not in desc.pending_notifications:
                    desc.pending_notifications[key] = list()
                desc.pending_notifications[key].append(notification)

        return state.agent.update_descriptor(do_append, notifications)
85727
def notify
      if reports.any?
        @notifiers.each do |notifier, options|
          # .dup is NOT reliable
          options_copy = Marshal.load(Marshal.dump(options))
          notifier.new(options_copy).notify(self)
        end
      end
    end
1103083
function show() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'success';

  return _extends({
    type: _const.RNS_SHOW_NOTIFICATION
  }, opts, {
    uid: opts.uid || Date.now(),
    level: level
  });
}
1046182
def preview
      notifications = Correspondent::Notification.for_subscriber(params[:subscriber_type], params[:subscriber_id])

      if stale?(notifications)
        render(
          json: {
            count: notifications.count,
            notification: notifications.limit(1).first
          }
        )
      end
    end
26496
private function prepareApnsHeaders(Notification $notification)
    {
        if (!empty($notification->getId())) {
            $this->headers[self::HEADER_APNS_ID] =  $notification->getId();
        }

        if ($notification->getExpirationAt() instanceof \DateTime) {
            $this->headers[self::HEADER_APNS_EXPIRATION] = $notification->getExpirationAt()->getTimestamp();
        }

        if (is_int($notification->getPriority())) {
            $this->headers[self::HEADER_APNS_PRIORITY] =  $notification->getPriority();
        }

        if (!empty($notification->getCollapseId())) {
            $this->headers[self::HEADER_APNS_COLLAPSE_ID ] = $notification->getCollapseId();
        }
    }
286533
def nosound_notification(text, options = {})
      base = {
        aps: {
          alert: {
            title: nil,
            subtitle: nil,
            body: text
          },
          badge: 1,
          'mutable-content': 1,
          'content-available': 1
        }
      }
      base.merge(options)
    end
1263947
def create(notification_options)
      response = @connection.post PARCELNOTIFICATION_URL, body: notification_options.to_json.to_ascii, headers: { 'Content-Type' => 'application/json' }
      RecursiveOpenStruct.new(response.parsed, recurse_over_arrays: true)
    end
415095
def prepare_dispatches(cls, message, recipients=None):
        
        return Dispatch.create(message, recipients or cls.get_subscribers())
1067579
def set_email_notification(self, hit_type, email, event_types=None):
        
        return self._set_notification(hit_type, 'Email', email, event_types)
21310
@SuppressLint("SetTextI18n")
	public void setNotifications(Integer notifications) {

		if ((notifications != null) && (notifications > 0)) {
			setVisibility(VISIBLE);
			if (notifications > maximum) {
				this.setText(maximum + "+");
			} else {
				this.setText(notifications.toString());
			}
		} else {
			setVisibility(GONE);
		}
	}
1161031
def notifications_view(request):
    
    page_name = "Your Notifications"
    # Copy the notifications so that they are still unread when we render the page
    notifications = list(request.user.notifications.all())
    request.user.notifications.mark_all_as_read()
    return render_to_response("list_notifications.html", {
        "page_name": page_name,
        "notifications": notifications,
        }, context_instance=RequestContext(request))
980463
def push_notifications
      pending = find_pending
      to_send = pending.map do |notification|
        notification_type.new notification.destinations, notification.data
      end
      pusher = build_pusher
      pusher.push to_send
      pending.each_with_index do |p, i|
        p.update_attributes! results: to_send[i].results
      end
    end
829231
def new
      @announcement = Announcement.new
  
      respond_to do |format|
        format.html # new.html.erb
        format.json { render json: @announcement }
      end
    end
139315
public static function make($notifiable, Notification $notification, $targeting): array
    {
        $payload = $notification->toOneSignal($notifiable)->toArray();

        if (static::isTargetingEmail($targeting)) {
            $payload['filters'] = collect([['field' => 'email', 'value' => $targeting['email']]]);
        } elseif (static::isTargetingTags($targeting)) {
            $array = $targeting['tags'];
            $res = count($array) == count($array, COUNT_RECURSIVE);
            if ($res) {
                $payload['tags'] = collect([$targeting['tags']]);
            } else {
                $payload['tags'] = collect($targeting['tags']);
            }
        } elseif (static::isTargetingIncludedSegments($targeting)) {
            $payload['included_segments'] = collect($targeting['included_segments']);
        } elseif (static::isTargetingExcludedSegments($targeting)) {
            $payload['excluded_segments'] = collect($targeting['excluded_segments']);
        } elseif (static::isTargetingExternalUserIds($targeting)) {
            $payload['include_external_user_ids'] = collect($targeting['include_external_user_ids']);
        } else {
            $payload['include_player_ids'] = collect($targeting);
        }

        return $payload;
    }
103200
def handle(self, *args, **options):
        
        # retrieve layers
        notifications = self.retrieve_old_notifications()
        count = len(notifications)

        if count > 0:
            self.output('found %d notifications to purge...' % count)
            notifications.delete()
            self.output('%d notifications deleted successfully.' % count)
        else:
            self.output('there are no old notifications to purge')
973991
public function markNotificationAsRead($notification_id)
    {
        $notification = $this->notifications()
            ->where('id', $notification_id)
            ->whereNull('read_at');

        if ($notification->exists()) {
            $notification->first()->markAsRead();
        }
    }