Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for touchInputs (leaving session open) for display_render and list_display_render #244

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions flask_ask/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def standard_card(self, title=None, text=None, small_image_url=None, large_image
self._response['card'] = card
return self

def list_display_render(self, template=None, title=None, backButton='HIDDEN', token=None, background_image_url=None, image=None, listItems=None, hintText=None):
def list_display_render(self, template=None, title=None, backButton='HIDDEN', token=None, background_image_url=None, image=None, listItems=None, hintText=None, touchInput=None):
directive = [
{
'type': 'Display.RenderTemplate',
Expand Down Expand Up @@ -106,10 +106,15 @@ def list_display_render(self, template=None, title=None, backButton='HIDDEN', to
}
}
directive.append(hint)

#locate and remove shouldEndSession from response to allow for touch inputs on screened devices.
if (touchInput==True):
self._response.pop('shouldEndSession', True)

self._response['directives'] = directive
return self

def display_render(self, template=None, title=None, backButton='HIDDEN', token=None, background_image_url=None, image=None, text=None, hintText=None):
def display_render(self, template=None, title=None, backButton='HIDDEN', token=None, background_image_url=None, image=None, text=None, hintText=None, touchInput=None):
directive = [
{
'type': 'Display.RenderTemplate',
Expand Down Expand Up @@ -149,6 +154,10 @@ def display_render(self, template=None, title=None, backButton='HIDDEN', token=N
}
directive.append(hint)

#locate and remove shouldEndSession from response to allow for touch inputs on screened devices.
if (touchInput==True):
self._response.pop('shouldEndSession', True)

self._response['directives'] = directive
return self

Expand Down Expand Up @@ -200,7 +209,6 @@ def reprompt(self, reprompt):
self._response['reprompt'] = reprompt
return self


class buy(_Response):

def __init__(self, productId=None):
Expand Down