def send_ping(cls, client):
     if client.client_type == ClientType.OS_ANDROID:
         notification = PingNotification()
         notification.send({client.client_type: [client.messaging_id]})
     else:
         # Send iOS/web/webhooks ping via TBANS
         return TBANSHelper.ping(client)
 def send_ping(cls, client):
     if client.client_type == ClientType.OS_ANDROID:
         notification = PingNotification()
         notification.send({client.client_type: [client.messaging_id]})
     else:
         # Send iOS/web/webhooks ping via TBANS
         return TBANSHelper.ping(client)
Пример #3
0
    def post(self):
        self._require_login()
        self._require_registration()

        # Check to make sure that they aren't trying to edit another user
        current_user_account_id = self.user_bundle.account.key.id()
        target_account_id = self.request.get('account_id')
        if target_account_id == current_user_account_id:
            client_id = self.request.get('client_id')
            client = MobileClient.get_by_id(int(client_id),
                                            parent=ndb.Key(
                                                Account,
                                                current_user_account_id))
            if client is not None:
                # This makes sure that the client actually exists and that this user owns it
                if client.client_type == ClientType.WEBHOOK:
                    keys = {
                        client.client_type:
                        [(client.messaging_id, client.secret)]
                    }
                else:
                    keys = {client.client_type: [client.messaging_id]}
                notification = PingNotification()
                notification.send(keys)
            self.redirect('/account')
        else:
            self.redirect('/')
    def send_ping(cls, client):
        if client.client_type == ClientType.WEBHOOK:
            keys = {client.client_type: [(client.messaging_id, client.secret)]}
        else:
            keys = {client.client_type: [client.messaging_id]}

        notification = PingNotification()
        notification.send(keys)
    def post(self):
        self._require_registration()

        # Check to make sure that they aren't trying to edit another user
        current_user_account_id = self.user_bundle.account.key.id()
        target_account_id = self.request.get('account_id')
        if target_account_id == current_user_account_id:
            client_id = self.request.get('client_id')
            client = MobileClient.get_by_id(int(client_id), parent=ndb.Key(Account, current_user_account_id))
            if client is not None:
                # This makes sure that the client actually exists and that this user owns it
                if client.client_type == ClientType.WEBHOOK:
                    keys = {client.client_type: [(client.messaging_id, client.secret)]}
                else:
                    keys = {client.client_type: [client.messaging_id]}
                notification = PingNotification()
                notification.send(keys)
            self.redirect('/account')
        else:
            self.redirect('/')