Exemplo n.º 1
0
def pre_remove_subscription(sender, **kwargs):
    subscriber = kwargs.get('instance')
    sub_manager = SubscriberManager()
    subscriptions = sub_manager.get_device_subscriptions(subscriber.device_id)

    logger.info("Delete subscriber ({0} - {1}) signal ".format(subscriber.name, subscriber.sub_type))

    for channel_name in subscriptions:
        unsubscribe_channel(channel, subscriber.device_id)
Exemplo n.º 2
0
def pre_remove_subscription(sender, **kwargs):
    subscriber = kwargs.get('instance')
    sub_manager = SubscriberManager()
    subscriptions = sub_manager.get_device_subscriptions(subscriber.device_id)

    logger.info("Delete subscriber ({0} - {1}) signal ".format(
        subscriber.name, subscriber.sub_type))

    for channel_name in subscriptions:
        unsubscribe_channel(channel, subscriber.device_id)
Exemplo n.º 3
0
    def delete(self, request, deviceToken=None, websitePushID=None):
        logger.info("DELETE deviceToken={0} auth={1}".format(deviceToken, request.META['HTTP_AUTHORIZATION']))
        # Rimozione della subscription (a tendere valutare logical delete)
        # Subscriber.objects.filter(token=deviceToken).delete()
        subscribed_channels = get_device_subscriptions(deviceToken)

        for channel in [c.channel for c in subscribed_channels]:
            unsubscribe_channel(channel, deviceToken)

        return HttpResponse(status=200)
Exemplo n.º 4
0
def pre_remove_channel(sender, **kwargs):
    channel = kwargs.get('instance')
    sub_manager = SubscriberManager()
    sub_tokens = sub_manager.get_all_subscribers(channel.name)
    devices = Subscriber.objects.filter(token__in=sub_tokens)

    logger.info("Delete channel ({0}) signal ".format(channel.name))

    for dev in devices.all():
        logger.info("\t removing subscriber {0}".format(dev.device_id))
        unsubscribe_channel(channel, dev.device_id)
Exemplo n.º 5
0
def pre_remove_channel(sender, **kwargs):
    channel = kwargs.get('instance')
    sub_manager = SubscriberManager()
    sub_tokens = sub_manager.get_all_subscribers(channel.name)
    devices = Subscriber.objects.filter(token__in=sub_tokens)

    logger.info("Delete channel ({0}) signal ".format(channel.name))

    for dev in devices.all():
        logger.info("\t removing subscriber {0}".format(dev.device_id))
        unsubscribe_channel(channel, dev.device_id)
Exemplo n.º 6
0
    def delete(self, request, deviceToken=None, websitePushID=None):
        logger.info("DELETE deviceToken={0} auth={1}".format(
            deviceToken, request.META['HTTP_AUTHORIZATION']))
        # Rimozione della subscription (a tendere valutare logical delete)
        # Subscriber.objects.filter(token=deviceToken).delete()
        subscribed_channels = get_device_subscriptions(deviceToken)

        for channel in [c.channel for c in subscribed_channels]:
            unsubscribe_channel(channel, deviceToken)

        return HttpResponse(status=200)