EIP712 Filtering count checking
This commit is contained in:
@@ -503,6 +503,24 @@ e_eip712_filtering_mode ui_712_get_filtering_mode(void) {
|
||||
return ui_ctx->filtering_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of filters this message should process
|
||||
*
|
||||
* @param[in] count number of filters
|
||||
*/
|
||||
void ui_712_set_filters_count(uint8_t count) {
|
||||
ui_ctx->filters_to_process = count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of filters left to process
|
||||
*
|
||||
* @return number of filters
|
||||
*/
|
||||
uint8_t ui_712_remaining_filters(void) {
|
||||
return ui_ctx->filters_to_process;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all the UI struct field flags
|
||||
*/
|
||||
@@ -521,4 +539,21 @@ void ui_712_queue_struct_to_review(void) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify of a filter change from a path advance
|
||||
*
|
||||
* This function figures out by itself if there is anything to do
|
||||
*/
|
||||
void ui_712_notify_filter_change(void) {
|
||||
if (path_get_root_type() == ROOT_MESSAGE) {
|
||||
if (ui_ctx->filtering_mode == EIP712_FILTERING_FULL) {
|
||||
if (ui_ctx->filters_to_process > 0) {
|
||||
if (ui_ctx->field_flags & UI_712_FIELD_SHOWN) {
|
||||
ui_ctx->filters_to_process -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAVE_EIP712_FULL_SUPPORT
|
||||
|
||||
Reference in New Issue
Block a user