diff --git a/common/protob/messages-common.proto b/common/protob/messages-common.proto index 8e3ed56a13..dbdbc0171b 100644 --- a/common/protob/messages-common.proto +++ b/common/protob/messages-common.proto @@ -47,11 +47,6 @@ message Failure { message ButtonRequest { optional ButtonRequestType code = 1; // enum identifier of the screen optional uint32 pages = 2; // if the screen is paginated, number of pages - optional uint32 page_number = 3; // if the screen is paginated, current page (1-based) - /* Rationale: both fields are optional, and neither field can have 0 as a valid - value. So both testing `if pages` and `if page_number` do the right thing. - Also the following is always true: `page_is_last = (page_number == pages)` */ - /** * Type of button request */ diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 7b5816a3c5..20b58a45e2 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## 2.4.1 [14th July 2021] ### Added -- ButtonRequest is sent also after every screen of a multi-page view. [#1671] +- ButtonRequest for multi-page views contains number of pages. [#1671] ### Changed - Converted altcoin apps to common layout code. [#1538] diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index d4834a4c95..6b03796a61 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -283,14 +283,12 @@ if TYPE_CHECKING: class ButtonRequest(protobuf.MessageType): code: ButtonRequestType | None pages: int | None - page_number: int | None def __init__( self, *, code: ButtonRequestType | None = None, pages: int | None = None, - page_number: int | None = None, ) -> None: pass diff --git a/core/src/trezor/ui/components/tt/scroll.py b/core/src/trezor/ui/components/tt/scroll.py index 2d0c12dbe0..a262a88206 100644 --- a/core/src/trezor/ui/components/tt/scroll.py +++ b/core/src/trezor/ui/components/tt/scroll.py @@ -111,12 +111,9 @@ class Paginated(ui.Layout): code: ButtonRequestType = ButtonRequestType.Other, ) -> Any: workflow.close_others() + await ctx.call(ButtonRequest(code=code, pages=len(self.pages)), ButtonAck) result = WAS_PAGED while result is WAS_PAGED: - br = ButtonRequest( - code=code, pages=len(self.pages), page_number=self.page + 1 - ) - await ctx.call(br, ButtonAck) result = await self return result diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index 89196d1575..106a1f35a2 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -701,7 +701,6 @@ class ButtonRequest(protobuf.MessageType): FIELDS = { 1: protobuf.Field("code", ButtonRequestType, repeated=False, required=False), 2: protobuf.Field("pages", "uint32", repeated=False, required=False), - 3: protobuf.Field("page_number", "uint32", repeated=False, required=False), } def __init__( @@ -709,11 +708,9 @@ class ButtonRequest(protobuf.MessageType): *, code: Optional[ButtonRequestType] = None, pages: Optional[int] = None, - page_number: Optional[int] = None, ) -> None: self.code = code self.pages = pages - self.page_number = page_number class ButtonAck(protobuf.MessageType):