def _push(self, notification, alert, extra_metadata={}, badge=None):
     recipient = notification.recipient
     models.push_notification(notification.action,
                              alert,
                              recipient=recipient,
                              extra_metadata=extra_metadata,
                              badge=badge)
    def _push(self, notification, alert, extra_metadata={}, badge=None):
        language_code = notification.recipient.kv.last_language_code.get() or 'en'
        translation.activate(language_code)
        localized_alert = force_text(alert)
        translation.deactivate()

        recipient = notification.recipient
        models.push_notification(notification.action, localized_alert,
                                 recipient=recipient, extra_metadata=extra_metadata, badge=badge)
Esempio n. 3
0
    def _publish_quest_of_the_day(self):
        signals.current_quest_changed.send(ScheduledQuest, instance=self)

        RealtimeChannel('qotd', 1).publish({'quest_id': self.quest_id})

        push_notification('quest_of_the_day',
                          _(u"Today's Quest: %(quest_title)s" % {'quest_title': self.quest.title}),
                          extra_metadata={'quest_id': self.quest.id},
                          badge=1)
Esempio n. 4
0
def new_color_alert(message, color_packs_header, colors_header):
    version = int(redis.incr('color_alert_version'))

    push_notification('new_color_alert', message,
                      extra_metadata={'color_alert_version': version})

    activity_item = NewColorAlertActivity.with_message(message, version)

    @bgwork.defer
    def broadcast_to_activity_streams():
        for user in User.objects.all():
            user.redis.activity_stream.push(activity_item)
            user.redis.iphone_activity_stream.push(activity_item)
Esempio n. 5
0
def new_color_alert(message, color_packs_header, colors_header):
    version = int(redis.incr('color_alert_version'))

    push_notification('new_color_alert',
                      message,
                      extra_metadata={'color_alert_version': version})

    activity_item = NewColorAlertActivity.with_message(message, version)

    @bgwork.defer
    def broadcast_to_activity_streams():
        for user in User.objects.all():
            user.redis.activity_stream.push(activity_item)
            user.redis.iphone_activity_stream.push(activity_item)
 def _push(self, notification, alert, extra_metadata={}, badge=None):
     recipient = notification.recipient
     models.push_notification(notification.action, alert,
                              recipient=recipient, extra_metadata=extra_metadata, badge=badge)