Method, device and equipment for customizing interface based on event bus and medium
Through the event bus-based method, decoupling the interface and service logic, users can flexibly edit the interface and generate customized view files, solving the inflexible and compatibility problems of interface customization in the existing technology, and realizing the highly customized interface and service logic of the interface confidentiality.
Patent Information
- Application Number
- CN202411239665.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-13
AI Technical Summary
The existing interface customization method is inflexible, cannot be highly customized according to the user's brand or needs, and the complexity of service processing logic leads to compatibility issues.
Using a custom interface method based on the event bus, a customized view file is generated by obtaining the page parameter information edited by the user, including event publishing code, the event processing center triggers the service processing logic, decoupling the interface and service logic, and users can flexibly edit the interface without paying attention to the service. Logical content and reduce interface customization complexity and compatibility issues by simplifying events.
It realizes flexible interface customization and confidentiality of service logic, reduces the complexity and compatibility of interface customization development, and improves the scalability of the system.
Smart Images

Figure CN119127192A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and medium for customizing an event bus interface. Background Art
[0002] With the rapid development of digitalization today, service providers such as banks, transportation, and securities companies have put forward highly customized interface requirements for facial recognition technology, hoping to combine the design of facial recognition interface with their own brand or other needs.
[0003] Therefore, how to provide a method for interface customization is a technical problem that needs to be solved urgently. Summary of the invention
[0004] The embodiments of the present specification provide a method, apparatus, device and medium for customizing an interface based on an event bus to solve the inflexibility problem of existing interface customization methods.
[0005] To solve the above technical problems, the embodiments of this specification are implemented as follows:
[0006] The embodiment of this specification provides a method for customizing an interface based on an event bus, including:
[0007] Get the page parameter information edited by the user;
[0008] Based on the page parameter information, a custom view View layer file is generated for rendering and displaying a custom interface corresponding to the page parameter information; the custom view View layer file contains an event publishing code for publishing an event; the code is used to publish an event based on a user's preset operation on the custom interface; the event is used by an event processing center to trigger a service processing logic corresponding to the event;
[0009] The customized view View layer file and the SDK file containing the event processing center and the service processing logic are loaded into the terminal, so that the terminal can display the customized interface based on the customized view View layer file and can call the service processing logic based on the event processing center to respond to events triggered by the customized interface.
[0010] An embodiment of the present specification provides a device for customizing an interface based on an event bus, comprising:
[0011] Parameter editing module, used to obtain the page parameter information edited by the user;
[0012] A file generation module is used to generate a custom view View layer file for rendering and displaying a custom interface corresponding to the page parameter information based on the page parameter information; the custom view View layer file contains an event publishing code for publishing an event; the code is used to publish an event based on a preset operation of the user on the custom interface; the event is used by the event processing center to trigger the service processing logic corresponding to the event;
[0013] A file loading module is used to load the customized view View layer file and the SDK file containing the event processing center and the service processing logic to the terminal, so that the terminal can display the customized interface based on the customized view View layer file and can call the service processing logic based on the event processing center to respond to events triggered by the customized interface.
[0014] An embodiment of the present specification provides a device based on an event bus customized interface, including:
[0015] at least one processor; and,
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0018] Get the page parameter information edited by the user;
[0019] Based on the page parameter information, a custom view View layer file is generated for rendering and displaying a custom interface corresponding to the page parameter information; the custom view View layer file contains an event publishing code for publishing an event; the event is used by the event processing center to trigger the service processing logic corresponding to the event;
[0020] The customized view View layer file and the SDK file containing the event processing center and the service processing logic are loaded into the terminal, so that the terminal can display the customized interface based on the customized view View layer file and can call the service processing logic based on the event processing center to respond to events triggered by the customized interface.
[0021] An embodiment of the present specification provides a computer-readable medium on which computer-readable instructions are stored. The computer-readable instructions can be executed by a processor to implement a method for customizing an interface based on an event bus.
[0022] An embodiment of this specification can achieve the following beneficial effects:
[0023] In the embodiment of this specification, a customized view layer file of a customized interface is generated based on the parameter information of the page edited by the user, and the file contains code for publishing events. The event processing center can trigger the service processing logic corresponding to the event. The terminal equipped with the customized view layer file and the SDK file containing the event processing center and the service processing logic can display the customized interface based on the customized view layer file, and can also call the service processing logic based on the event processing center to respond to the event triggered by the customized interface. Among them, by introducing the event processing mechanism, the interface and service processing logic are decoupled, and the user can edit the page parameter information according to the needs without paying attention to the specific content of the service processing logic, and can customize the interface more flexibly.
[0024] On the other hand, the SDK file containing the event processing center and the service processing logic and the customized view View layer file can be separate files. Users can edit the View layer file, and the content in the SDK file is obfuscated to the user, thereby ensuring the confidentiality of the core technology of the service processing logic.
[0025] On the other hand, the custom view View layer file contains code for publishing events, which simplifies the interface-related services into the form of publishing events. Through simplified events, the complexity of interface customization development can be further reduced, and compatibility issues caused by changes in service processing logic can also be reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0027] Figure 1 A flowchart of a method for customizing an interface based on an event bus provided in an embodiment of this specification;
[0028] Figure 2 An architectural diagram of a display customization interface provided in an embodiment of this specification;
[0029] Figure 3 A schematic diagram of the structure of a device for customizing an event bus interface provided in an embodiment of this specification;
[0030] Figure 4 A schematic diagram of the structure of a device based on an event bus customized interface provided in an embodiment of this specification. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solutions and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of one or more embodiments of this specification.
[0032] In order to more clearly illustrate the method provided in this specification, the terms involved in one or more embodiments of this specification are first explained.
[0033] MVVM (Model-View-ViewModel) is a software architecture pattern used to separate the data model (Model), user interface (View), and presentation logic (ViewModel) in an application. Model represents the data and business logic of the application, View is the user interaction interface, and ViewModel acts as an intermediary between View and Model, managing the state and behavior of the view and synchronizing the View and Model, so that the view and model remain decoupled for independent development and testing.
[0034] An event bus is a messaging system that allows decoupled communication between different software components or objects. Components can publish events through the event bus, and other components can subscribe to these events. When an event is published, all components that have subscribed to the event will be notified. This approach achieves loose coupling between components, making the system easier to expand and maintain.
[0035] Publisher, in the event bus system, is an object or component that can publish events. When a specific event occurs, the publisher will publish the event to the event bus for subscribers to receive and process.
[0036] A subscriber is a component or object that registers to receive specific events. In an event bus system, a subscriber registers itself as a receiver of specific events through the event bus and responds when these events occur.
[0037] Interface customization refers to providing customized user interface capabilities to customers who access the SDK (Software Development Kit). For the face recognition interface, during this process, customers do not need to modify the source code of the face recognition SDK or recompile it. Instead, customers can dynamically customize the user interface based on the provided interface templates. This customization allows for adjustments to layout, themes, and control states based on specific conditions, such as the company's brand image, application scenario characteristics, cultural and geographical differences, etc.
[0038] In the related technologies of interface customization, usually only the size, color, etc. of some controls in the page are allowed to be adjusted, and the user cannot change the interface layout, and the interface customization is not flexible.
[0039] In some related technologies, the service processing logic providers provide a rich set of API interfaces and development toolkits SDK containing service logic. Users can customize the interface by calling the API interface and SDK, which requires users to have a deep understanding of how to use the API interface and has high requirements for users. In addition, dependence on the API will lead to compatibility issues in the future. For example, if the API is updated or changed, users need to adjust the API parameters accordingly and rewrite the code of the display interface to correctly call the service logic.
[0040] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.
[0041] Figure 1 A flow chart of a method for customizing an interface based on an event bus provided in an embodiment of this specification. From a program perspective, the execution subject of the process can be a program or application client installed on an application server. From a hardware perspective, the execution subject of the process can be a terminal device for editing a customized interface, such as a computer, an operating platform, etc.
[0042] like Figure 1 As shown, the process may include the following steps.
[0043] Step 102: Obtain the page parameter information edited by the user.
[0044] The page parameter information may be parameter information of each component displayed in the customized interface, such as button color information, position information, page layout information, etc.
[0045] Step 104: Based on the page parameter information, generate a customized view layer file for rendering and displaying a customized interface corresponding to the page parameter information.
[0046] Among them, the custom view View layer file contains event publishing code for publishing events; the event is used by the event processing center to trigger the service processing logic corresponding to the event.
[0047] The event processing center can receive the time published in the custom view layer file as an event subscriber and trigger the corresponding service processing logic. The service processing logic can be the processing logic required for processing the business represented by the custom interface. For example, if the custom interface is an interface for biometric identification, the corresponding service processing logic may include service logic for starting information collection components such as cameras to collect biometric images, service logic for identifying collected images, and so on. Biometric features may include features such as face, fingerprint, voiceprint, fingerprint, and palmprint.
[0048] The custom view layer file may contain configuration information of each display component in the custom page, such as position information, color information, size information, display form information, etc.
[0049] The code contained in the custom view layer file is related to the interface display, which can be understood as the code executed in the View layer in the MVVM architecture. During the entire life cycle of the interface display and user interaction, the View layer plays the role of an event publisher, publishing defined event types to the event bus.
[0050] Step 106: Load the customized view layer file and the SDK file including the event processing center and the service processing logic into the terminal.
[0051] The terminal can display the customized interface based on the customized view layer file and can call the service processing logic based on the event processing center to respond to the event triggered by the customized interface.
[0052] The terminal may be a device including a display screen for displaying a customized page, or a control device or platform for controlling a display device to display a customized interface. The terminal may be one device or multiple related devices.
[0053] For example, some service agencies may set up one or more operation terminals with display screens, such as self-service cash registers, self-service teller machines, banking terminals, etc. An operation terminal can be used as a terminal, deployed with a custom view layer file and an SDK file containing an event processing center and service processing logic.
[0054] For another example, multiple display terminals can also be controlled by one control device. The control device here can be used as a terminal, and a customized view View layer file and an SDK file containing an event processing center and service processing logic are deployed. Or the control device and the display terminal are multiple devices as terminals. The control device can be deployed with a customized view View layer file and an SDK file containing an event processing center and service processing logic. The display terminal displays a customized page based on the control of the control device. Alternatively, the control device is deployed with an SDK file containing an event processing center and service processing logic, and the display terminal is deployed with a customized view View layer file. The display terminal can display a customized page or send an event. The event processing center in the control device can obtain the event and trigger the corresponding service processing logic. The specific file deployment method can be set according to actual needs and is not specifically limited here.
[0055] The specific service logic contained in the SDK file is confidential to the user who edits the page parameter information. For example, the user does not have the authority to view the specific content in the file, or the content in the SDK file is obfuscated and the user cannot distinguish the specific content, making the specific service processing logic confidential to the user. The terminal system or the terminal application used in the terminal can identify the content in the SDK file and execute the corresponding program flow.
[0056] The SDK file can contain the code of the event processing center and the code of each service processing logic. The event processing center is a module that is pre-built according to actual business needs to manage pages and corresponding service processing logic. It is responsible for the unified scheduling of different service modules. As a subscriber, the event processing center registers on the event bus and is ready to receive events of the specified type at any time. For example, once it listens to the initialization event of the face recognition interface, it activates services such as permission verification.
[0057] It should be understood that the order of some steps in the methods described in one or more embodiments of this specification can be interchanged according to actual needs, or some steps can be omitted or deleted.
[0058] For example, in actual applications, the terminal used to display the customized interface can also be a terminal device for users to edit page parameter information. The execution subject in the embodiments of this specification can be a terminal used to display customized pages. In this case, there is no need to send the customized view View layer file and the SDK file to the terminal in step 206, and the terminal can directly run the loaded file. The user can edit the page parameter information in the terminal, and the customized view View layer file can be generated in the terminal. The SDK file containing the event processing center and the service processing logic can also be obtained from the service logic provider, and then the customized page can be displayed. In actual applications, the customized view View layer file and the SDK file containing the event processing center and the service processing logic can be independent files, or they can be the same file. For example, the same file can contain multiple sub-files, and the customized view View layer file can be a sub-file therein. There is no specific limitation on the specific file format here.
[0059] Figure 1 The method in introduces an event processing mechanism and uses the event processing center to decouple the interface and service processing logic. Users can edit page parameter information as needed without paying attention to the specific content of the service processing logic, and can customize the interface more flexibly.
[0060] At the same time, the SDK file containing the event processing center and service processing logic and the customized view View layer file can be independent or separate files. Users can edit the View layer file to ensure the confidentiality of the core technology of the service processing logic.
[0061] In addition, the custom view View layer file contains code for publishing events, which simplifies the interface-related services into the form of publishing events. Through simplified events, the complexity of interface customization development can be further reduced, and compatibility issues caused by changes in service processing logic can also be reduced.
[0062] based on Figure 1 The method, the examples of this specification also provide some specific implementation plans of the method, which are described below.
[0063] In this specification, the page parameter information edited by the user may be edited based on the interface template. Optionally, the above-mentioned acquisition of the page parameter information edited by the user may specifically include:
[0064] Obtaining an initial view View layer file; the file code of the initial view View layer file includes an editable view parameter code;
[0065] Based on the user's editing operation on the editable view parameter code, the page parameter information edited by the user is obtained.
[0066] The initial view layer file contains editable view parameter codes, which can specifically include the attribute names of view components. Users can edit the parameter values corresponding to view components, which can also be understood as attribute values. Parameter values or attribute values are used to determine the presentation form of view components in the customized page, such as page layout, component display position, presentation form of prompt information, etc.
[0067] In actual applications, the initial view View layer file may also include the default parameter value information of the view component. The user can modify the default parameter value to obtain the edited page parameter information. The view parameter code given in the initial view View layer file may also be added or deleted. The above editing operation may include at least one of a deletion operation, an addition operation, and a modification operation.
[0068] In the embodiments of the present specification, the page parameter information may include information representing at least one display parameter of the display position, display form, display color, display order, and display content of the page components; wherein the page components may include at least one of a title bar, an operation control, a progress bar, an image acquisition box, and prompt information.
[0069] The title bar can be a horizontal bar at the top of an interface or application, which contains the name of the application or the title of the currently open file, the interface title, etc. The title bar may also include some commonly used operation buttons, such as minimize, maximize / restore, and close buttons. The title bar can also display information related to the system status, such as whether face recognition is running, the system version, or the currently logged-in user information. By setting the title bar, the recognition and professionalism of the user interface can be improved. For example, use the title() function to set the window title, or customize the icon, background, and font color, etc. to enhance the user experience and the aesthetics of the interface.
[0070] Controls are interface elements in user interface (UI) design that users can interact with directly. These controls allow users to control the behavior of software applications or operating systems through mouse clicks, touch, keyboard input, etc. Controls enable users to intuitively operate software and implement specific functions without having to deeply understand the underlying technical details.
[0071] Specific types of operation controls may include: buttons, which are usually used to perform a specific action, such as "Save", "Cancel", "OK", etc.; text boxes, which allow users to enter text information; check boxes, which are used to select one or more of multiple options; radio buttons, which can only select one from a group of radio buttons; list boxes, which display a series of options for users to choose from; combo boxes, which combine the functions of list boxes and text boxes, and users can select items in the list or enter them manually; sliders, which allow users to adjust values or settings by dragging; labels, which are used to display static text to inform users of the functions of other controls; menus, which provide a group of related options, usually presented in the form of a drop-down list; tabs, which are used to switch between different content areas in the same window, and so on.
[0072] The progress bar can be used to show the completion status of an operation. For example, the progress of face recognition. The progress bar can be a horizontal bar graph, or a circular or other shaped image. It can be used to show the percentage of a task from start to completion, helping users understand the progress of the operation and the estimated remaining time. The progress bar can be updated in real time. As the task progresses, the progress bar will gradually fill up until it is completely full, indicating that the task is completed.
[0073] The image acquisition frame can be a bounding rectangle or a circle or other shaped boundary for locating and capturing the area of the acquired image. This frame is used to delimit the part of the image or video frame containing the object to be acquired, such as the part of the face to be acquired, to facilitate subsequent image processing, such as face detection, feature extraction and recognition processes.
[0074] Prompt information can be displayed during the entire life cycle of the page display or presented in other ways, such as information broadcast by voice, information displayed in the form of text, animation or arrows to indicate direction, etc.
[0075] The various components to be displayed in the interface and the display form of the components can be set according to actual needs, and are not specifically limited here.
[0076] For example, the initial view View layer file contains code for setting prompt information, as follows:
[0077]
[0078] Among them, Text(this.livenessInfo.showSuggestMsg) indicates that the component is used to display the suggestion information of liveness recognition, and its text content comes from the this.livenessInfo.showSuggestMsg file. In actual applications, this file can also be a user-editable file, and is also used to set the suggestion information of liveness recognition, such as "Please blink" and other information. This code also sets the parameter information of fontSize font size, fontColor color, width width, margin top margin, and maxLines maximum number of display lines. The component also has an alignRules attribute, which defines the alignment of the component relative to other components or container edges, ensuring the correct layout of the component on the interface. Among them, this component is given the ID of zeta_top_tip, and top:{anchor:"zeta_divider",align:VerticalAlign.Bottom} indicates that the component is located below the divider with ID zeta_divider.
[0079] Users can edit the corresponding attribute values of components, such as changing the font size from 18 to 20, changing the width from 100% to 80%, etc. They can also edit the display position information of components. For example, if the component was originally located below the divider with ID zeta_divider, the display position of the component can be changed to below the component with ID zeta_title. The component with ID zeta_title is also an editable component included in the initial view layer file.
[0080] Users do not need to edit the property names corresponding to the components. For example, the codes representing the properties such as id('zeta_top_tip'), .fontSize(), .fontColor(), .width(), .margin({top:}), and .maxLines() in the above example do not need to be edited. Users can edit the property values corresponding to each property, which can also be called parameter values.
[0081] It can be understood that the above is only an explanation of the display style of editing prompt information. In actual applications, the parameters of other components in the page can be edited according to actual needs to meet actual business needs.
[0082] In the embodiments of this specification, a corresponding component ID can be set for each page component so that it can be referenced in other places. For example, the relative position relationship can be set according to the component ID as mentioned above, and the corresponding component can also be displayed according to the preset execution steps through the component ID.
[0083] In actual applications, the displayed page components may also include information in the form of pictures, voices, etc. The corresponding pictures, voices, etc. information may be called by the names or storage locations or other identifiers of the pictures, voices, etc., and such information is also editable information.
[0084] For example, Image($r("app.media.zeta_ball_success")) loads an image from the resource bundle through the $r function. The actual user can also set the information of the displayed image according to actual needs.
[0085] The editable initial view View layer file provided to the user in the embodiments of this specification may include code for publishing events, and the user may obtain a customized view View layer file by editing the initial view View layer file. Optionally, the above-mentioned generation of a customized view View layer file for rendering and displaying a customized interface corresponding to the page parameter information based on the page parameter information may specifically include:
[0086] Utilize the page parameter information to update the editable view parameter code in the initial view View layer file to obtain the customized view View layer file. The initial view View layer file may represent a view template file, which may contain information about various components used to render the view interface. The user may obtain a customized view View layer file by editing the page parameter information. The above update may represent replacing the original parameter information with the user's newly edited page parameter information. In actual applications, the user may first delete the original page parameter information and then enter new parameter information, or may first enter new parameter information and then delete the original parameter information. After editing is completed, the user may save the edited page parameter information through the Save or Save As operation to obtain a customized view View layer file.
[0087] The editable view parameter code may include a code representing at least one display parameter of the display position, display form, display color, display order, and display content of the page component. The user may edit the specific parameter value according to actual needs.
[0088] The initial view View layer file can also contain code for publishing events. When a preset operation occurs in the display interface or page, the corresponding event can be published so that the event processing center can call the corresponding service processing flow. In this way, after the user edits the initial view View layer file, he can obtain a customized view View layer file containing code for publishing events.
[0089] For example, the view layer file can contain the following code for publishing events:
[0090]
[0091] Among them, aboutToAppear() represents the event triggered when the page is about to appear. It publishes the zeta_event_on_face_page_liveness_appear event through ZetaEventBusManager and passes livenessInfo as a parameter. onBackPress() represents the event triggered when the user presses the back key. If the current number of attempts is less than the maximum number of retries, or this is the first display, the zeta_event_on_face_page_back event is published and a Boolean value is passed to indicate whether the retry limit has been reached. This method returns true, which usually indicates that the event has been processed, preventing the default return behavior.
[0092] When editing page parameters, users do not need to edit the code used to publish events. In actual applications, the initial view layer file can be provided to users by the administrator or developer of the service logic. Users can represent service demanders. For example, the administrator of the face recognition algorithm provides the processing logic of the algorithm to an institution or organization that needs face recognition, but the institution or organization cannot view the specific service logic content and can use the service logic for face recognition.
[0093] In actual applications, users who edit page parameters may be users with preliminary coding skills, who may understand which contents in the initial view layer file are editable and which do not need to be edited. The service logic manager or developer may also provide the user with a user manual file corresponding to the initial view layer file. The user manual file may include explanation information for the code in the initial view layer file, and may also include indication information for indicating editable content or content that does not need to be edited. Users may edit the editable code in the initial view layer file according to the user manual file to obtain a customized view layer file.
[0094] In actual applications, the editable view parameter codes and the codes that do not need to be edited in the initial view layer file can be displayed in different styles, such as in different font colors, so that users can better distinguish between the editable codes and the codes that do not need to be edited. The codes that do not need to be edited in the initial view layer file can also be displayed to the user in a locked state, so that the user cannot edit them, which can also prevent users from editing the code content that does not need to be edited, and can also improve the success rate of page customization.
[0095] It is understandable that the user mentioned in the embodiments of this specification can be a person who demands customized pages or a person who provides service logic. For example, the person who demands customized pages can edit page parameters or entrust the service logic provider to customize the page and edit the page parameters. The specific identity of the user is not specifically limited here, as long as the user can edit the View layer file.
[0096] The initial view View layer file in the embodiment of the present specification may include View layer codes representing the view layout and used to trigger events, and may also include state variable information representing variables that can be presented in the page. For example, the prompt is edited from text to voice broadcast, which reduces the amount of code and can also improve the efficiency of page customization.
[0097] In order to further improve the decoupling of the interface and the service logic, the method for customizing the interface provided in the embodiments of this specification can be implemented based on the MVVM architecture. Optionally, the SDK file can also include a view data ViewModel layer file; the view data ViewModel layer file is used to save the state variables related to the customized interface; the variable value of the state variable can be updated according to the processing result data of the service processing logic.
[0098] Among them, the view data ViewModel layer file contains state variable information involved in the interface display process, such as whether the face in the recognition box is blocked, whether it is aligned, whether it meets the requirements of the prompt, and information indicating image quality, etc. The View layer file may contain attribute parameters corresponding to the state variables, and the view data ViewModel layer code contained in the view data ViewModel layer file may provide parameter values to the View layer so that the View layer can display the corresponding page components or page effects.
[0099] In actual applications, the View layer will publish events with the state variables in the ViewModel as parameters. After receiving these parameters, the event processing center saves the state variables so that the state variables can be modified accordingly according to the business logic in the future. The specific parameter values of the state variables in the ViewModel will also be modified accordingly according to the business logic. The specific state variable transmission process can be found in the MVVM architecture-related technologies, which will not be described in detail here.
[0100] The custom view View layer file or the initial view View layer file contains the identification information of the view data ViewModel layer, which can monitor the changes of the state variables in the ViewModel layer and display the corresponding page effects according to the state variables. The identification information and the relevant code for obtaining the state variables based on the identification information can be the code that does not need to be changed, and the user does not need to modify the used functions, parameter attributes, etc. when editing the page parameters.
[0101] For example, the @Watch function can be used to monitor changes in state variables in the ViewModel layer, such as the following statement: @Watch('onInfoUpdated') livenessInfo:ZetaLiveness=new ZetaLiveness(). Among them, livenessInfo represents the identification information of the ViewModel layer, and onInfoUpdated is a callback function. When any attribute value in livenessInfo changes, the parameter value in the View layer can be updated through the callback function, and the View layer can control the terminal to display the corresponding page according to the updated parameter value. The state variable can be a pre-defined variable related to the interface display. For example, if a face is detected, the variable indicating the face status can be updated to a parameter value indicating the presence of a face. The View layer can change the prompt from "no face detected" to "blink" according to the parameter value.
[0102] In the embodiments of this specification, the terminal for displaying a customized interface may be equipped with the Hongmeng system, and the code in the customized view layer file may be executed based on the routing mechanism of the Hongmeng system to display the customized interface. Optionally, the customized view layer file includes a page routing identifier; the terminal is equipped with the Hongmeng system; the method further includes:
[0103] The terminal determines to execute the customized view layer file to display the customized interface based on the routing mechanism of the Hongmeng system and the page routing identifier.
[0104] The page route identifier can be a string that complies with the routing mechanism of the Hongmeng system and can be recognized by the Hongmeng system. For example, @Entry({routeName:'zeta_liveness_face_verify_open'}), where zeta_liveness_face_verify_open can represent the page route identifier. In actual applications, the specific content of the identifier can be set according to actual needs, and is not limited here.
[0105] In actual applications, the files loaded into the terminal may also include the view layer files used to display the default page. If the user does not edit the custom view layer files, the terminal may also display the default page. The terminal can use the routing mechanism of Hongmeng OS to enable the customized interface to be loaded and displayed first; if the customer does not customize it, the system will return to the default view interface built into the SDK.
[0106] It is understandable that the terminal may also use other operating systems as long as they can recognize the codes in the custom view layer file and the SDK file. For example, an operating system that can recognize the contents of the custom view layer file and the SDK file may be built based on the contents of the custom view layer file and the SDK file, and the built operating system may also be used to display the custom interface.
[0107] In the embodiment of this specification, the event bus mechanism can be used to process the entire life cycle of the page. The events that can be published in the above-mentioned custom view View layer file may include at least one of the following: interface creation event, interface background event, interface foreground event, interface destruction event, and interaction event of controls in the interface.
[0108] The event processing center contains service processing logic that should be triggered and executed according to the needs of each event, wherein the service processing logic includes the processing logic of at least one of the scheduled operation service, the terminal device authority verification service, the terminal device device setting service, and the business data processing service.
[0109] The interface creation event can represent an event triggered when an interface is first loaded or instantiated. This event can be accompanied by resource initialization and layout construction. The custom view View layer file can contain relevant code for resource initialization and layout construction. The terminal can publish the interface creation event by executing the custom view View layer file. The event processing center obtains the initialization state variable and can also change the state variable according to the processing result data of the service processing logic in the future.
[0110] The interface background event can be an event triggered when the interface loses focus or the application goes to the background. For example, the user switches to another application or the device screen is locked. After the event processing center obtains the event, it can trigger the execution of related programs to suspend services, such as pausing video playback, saving user status, etc., to save system resources.
[0111] The interface foregrounding event can represent an event triggered when the interface regains focus or returns to the foreground from the background. This means that the user starts to interact with the interface again, and the event processing center can trigger the resumption of previously suspended services, such as restarting video playback, updating data display, etc.
[0112] The interface destruction event can represent an event triggered when the interface is no longer needed and is about to be recycled by the system, such as when the user exits the interface. The event processing center can trigger the service logic of releasing occupied resources, such as canceling all registered listeners to avoid memory leaks and other potential problems.
[0113] The interactive events of controls in the interface can represent events triggered when users interact with controls on the interface. For example, events triggered by clicks, touches, slides, or other types of user input. Through the event bus, the event processing center can send signals to other components or logic layers to notify them of user interactions and execute corresponding service logic.
[0114] The timing operation service can represent timing logic, such as starting countdown, counting up, etc.
[0115] The permission verification service of the terminal device can represent the logic of verifying whether the terminal device has enabled the required permissions, such as whether the terminal allows the application to use camera permissions, location acquisition permissions, memory access permissions, etc.
[0116] The device setting service of the terminal device may represent logic for setting device parameters of the terminal device, for example, setting the screen brightness, volume level, etc. of the terminal device.
[0117] The business data processing service may represent logic for processing an object to be processed obtained through a custom interface, such as face recognition algorithm logic for recognizing a face image obtained through a custom interface, and the like.
[0118] As an implementation method, the customized interface in the embodiment of this specification can be an interface for face recognition. The interface can display a face recognition box, a recognition progress bar, prompts or arrows prompting the user to adjust the direction of the face, and other identification information. It can also include controls for users to start the face recognition process, controls for returning to the previous page or exiting the current page, etc. It can also include identification information of the party demanding face recognition, such as logos, names, and other information.
[0119] Optionally, the permission verification service of the above-mentioned terminal device may include a permission verification service for verifying camera permissions; the setting service of the terminal device may include a service for adjusting the terminal screen brightness; the business data processing service may include a service for calling a face verification algorithm to verify the collected face image.
[0120] In the embodiments of this specification, the event processing center is responsible for the unified scheduling of different service modules. As a subscriber, the event processing center registers on the event bus and is ready to receive events of specified types at any time. For example, once it listens to the initialization event of the face recognition interface, it activates services such as permission verification. During the entire life cycle and user interaction of the face recognition interface, the View layer plays the role of an event publisher. It publishes defined event types to the event bus, such as interface creation, backgroundization, foregroundization, destruction, and control interaction events. For interface creation events, the View layer can publish events with the state variables in the ViewModel as parameters. After receiving these parameters, the event processing center saves the state variables so that the corresponding state variables can be modified in the future according to the processing of business logic.
[0121] Optionally, the above event in the embodiment of this specification may include an interface creation event; the method in the embodiment of this specification may also include:
[0122] After the terminal obtains the interface creation instruction, the terminal executes the event publishing code and uses the state variable of the view data ViewModel layer file as a parameter to publish an interface creation event;
[0123] The event processing center receives the interface creation event, triggering the execution of the service processing logic corresponding to the interface creation event;
[0124] Update the state variable according to the processing result information of the service processing logic corresponding to the interface creation event to obtain an updated state variable;
[0125] The view data ViewModel layer file triggers the custom view View layer file to display the corresponding page information according to the updated state variable.
[0126] Among them, when creating a page, through system callback, such as using aboutToAppear function to perform system callback, a page creation event is issued. This event can have a predefined event ID, such as eta_event_on_face_page_liveness_appear. This event can also contain a ViewModel object, which is passed to the event processing center for subsequent modification. The ViewModel object can be understood as a state variable managed by the ViewModel layer. After the service processing logic processes each frame of the image, it will update and modify the state variables in the ViewModel.
[0127] For example, the ViewModel layer could contain the following code:
[0128]
[0129]
[0130] It can be seen that the ViewModel layer can contain multiple state variables. It is understandable that the above is only an example.
[0131] In actual applications, the state variables contained in the ViewModel layer can be set according to actual needs and are not specifically limited here.
[0132] In actual applications, after the service processing logic processes the results, the service processing logic or the event processing center can update the state variables in the ViewModel layer according to the processing results, and then the View layer can display them accordingly.
[0133] In actual applications, users who customize the interface do not need to modify the content in the ViewModel layer, and the content in the ViewModel layer can be kept confidential to users.
[0134] The model layer in the MVVM architecture refers to the data model, which generally refers to various business logic processing and data manipulation performed by the backend. The service processing logic triggered by the event processing center in the embodiment of this specification is equivalent to the model layer. In the embodiment of this specification, the interface can be customized based on the MVVM architecture and event bus under Hongmeng OS (operating system). The above-mentioned SDK file and customized view View layer file can be SDK (Software Development Kit, software development kit) files. The terminal can execute the program after obtaining the SDK file, display the customized interface, and use the customized interface to perform corresponding business processing, such as face recognition.
[0135] To more clearly illustrate the method for customizing an interface based on an event bus provided in the embodiments of this specification, the following takes the face recognition interface as an example. Figure 2 The architecture diagram shown is used for explanation. Figure 2 An architectural diagram of a display customization interface provided in an embodiment of this specification.
[0136] like Figure 2As shown, the view layer 202 can represent the code program included in the custom view layer file; the event processing center 204 can represent the code program representing the event processing center in the SDK file; the service processing logic 206 can represent the code program used to execute the corresponding service processing logic in the SDK file, which can also be called the model layer; the ViewModel layer 208 can represent the code program included in the view data ViewModel layer file. In actual applications, if the state variables managed by the ViewModel layer are not related to the device setting service, the permission verification service, and the timed operation service, the model layer can also be the code program for the data processing service.
[0137] Assume that the customized interface is a face recognition interface, and the service processing logic is the service processing logic for face recognition. After the page demander obtains the initial view View layer file, it edits the page parameters according to actual needs; then the edited customized view View layer file, ViewModel layer code file, and code files containing the event processing center and various service logics are recorded in the terminal device, for example, the terminal device can be a terminal for handling business. The terminal can determine the customized view View layer file that needs to be executed based on the routing function of the Hongmeng system.
[0138] An application for processing business can be run in the terminal device. The application can be connected to the structure involved in the embodiments of this specification through API calls and other methods. If the application needs to start the face recognition function, for example, the user clicks on the control in the application for starting face recognition, a face recognition interface needs to be created. The View layer can publish a page creation event in the system callback method. This event can have a pre-defined event ID, such as zeta_event_on_face_page_liveness_appear. The event can contain a ViewModel object, which is passed to the event processing center for subsequent modification.
[0139] After the event processing center obtains the page creation event ID, it can trigger the permission verification service according to the correspondence between the pre-established event and the corresponding service processing logic. The permission verification service can determine whether the terminal is authorized to use the camera and obtain the permission verification result; this permission verification result can be sent to the event processing center, which can also be understood as the event processing center can detect the permission verification result, and then the event processing center triggers the corresponding service according to the permission verification result. Specifically, if the permission verification result is that the camera permission has been enabled, the ViewModel object can be modified, which contains a state variable of whether the camera permission is available. The ViewModel layer can synchronize the state variable to the View layer, and then the View layer can display the face scanning component according to the state of the camera permission of the ViewModel object, such as a small round box in the page, indicating the area where the face is collected, and the event processing center can also start the timed operation service, such as starting the countdown, and can also start the device setting service, such as adjusting the screen brightness, and adjusting the screen brightness to the preset value. If the camera permission is not enabled, the event processing center can trigger a pop-up window to prompt the user whether to open or leave the interface.
[0140] After starting the camera to capture images, the event processing center can also trigger data processing services, such as calling face algorithms to determine the quality of the captured faces, or to determine whether the captured faces match the business.
[0141] If the data processing service detects that the face is not centered, the event processing center will modify the ViewModel object sent when the page is created. Based on this result, the ViewModel layer will determine whether the user needs to turn left, right, up, or down, and feedback to the View layer. This will trigger the View layer to display the text or voice "Please keep your face centered" or other prompt information.
[0142] When the user adjusts his posture according to the prompt, the camera can continuously collect user image data and process it using the data processing service. After the data processing service detects the face status, it can also modify the score of the face facing the screen in the ViewModel object sent when the page is created, and then feedback to the View layer, so that the progress is displayed accordingly in the interface. When it is completely facing, the progress can be displayed as 100%. If the face recognition succeeds or fails within the preset time period, the View layer can also display a prompt message indicating the success or failure of the recognition. The modification of the state variables in the ViewModel layer can be performed by the event processing center or by the service processing logic, such as the data processing service, which is not specifically limited here.
[0143] If the user identification is completed or the user does not want to continue identification and clicks the return control on the page, the View layer can publish a page return event, such as "zeta_event_on_face_page_back". After the event processing center obtains the event, it can create a retention pop-up window to prompt the user whether to try again.
[0144] If the user performs operations such as swiping up or swiping down in the terminal to indicate that the page will be put into the background, the View layer can publish a background event, such as "zeta_event_on_face_page_hide". After the event processing center receives this background event, it can suspend calling services, such as pausing timing, pausing data processing services, etc.
[0145] If the user displays the background page on the front-end page, the View layer can publish a page foregrounding event. After the event processing center obtains the event, it can resume services, such as resuming timing, resuming data processing services, etc.
[0146] If the user recognition operation is completed and the face recognition interface is exited, the View layer can obtain information indicating that the interface is to be destroyed through the system callback, and can publish a page destruction event. After the event processing center obtains the event, it can release the held resources, for example, close the timing service, algorithm processing service, cancel the event monitoring process, and so on.
[0147] In the present description, the decoupling of the face recognition interface and the service module is achieved by introducing the mechanism of the event bus and the event processing center. This design makes the communication between the interface and the service more flexible, reduces the complexity of the interface, and improves the scalability of the system. On the other hand, by providing a View layer code that only contains view layout, state variables, and event triggering timing, the customization demander is allowed to flexibly customize the interface layout and control details according to its own needs, while protecting the confidentiality of the core technology of face recognition. On the other hand, when customizing the interface, the customization demander does not need to understand the complex internal processing mechanism, but only needs to focus on the interface appearance design, state management, and event sending. Simplified event definitions, such as interface creation, activation, transfer to the background, destruction, and control interaction, further reduce the complexity of interface customization development, and significantly reduce compatibility issues caused by service API changes.
[0148] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method. Figure 3 The following is a schematic diagram of a device for customizing an event bus interface according to an embodiment of the present specification. Figure 3 As shown, the device may include:
[0149] The parameter editing module 302 is used to obtain the page parameter information edited by the user.
[0150] The file generation module 304 is used to generate a customized view layer file for rendering and displaying a customized interface corresponding to the page parameter information based on the page parameter information.
[0151] The custom view View layer file contains an event publishing code for publishing an event; the event is used by the event processing center to trigger the service processing logic corresponding to the event.
[0152] The file loading module 306 is used to load the customized view View layer file and the SDK file containing the event processing center and the service processing logic to the terminal, so that the terminal can display the customized interface based on the customized view View layer file and can call the service processing logic based on the event processing center to respond to the event triggered by the customized interface.
[0153] based on Figure 3 The present specification also provides some specific implementation schemes of the device, which are described below.
[0154] Optionally, the parameter editing module may include:
[0155] An initial file acquisition unit, used to acquire an initial view View layer file; the file code of the initial view View layer file includes an editable view parameter code;
[0156] The code editing unit is used to obtain the page parameter information edited by the user based on the user's editing operation on the editable view parameter code.
[0157] Optionally, the initial view layer file includes the code for publishing events; the file generation module can be specifically used for:
[0158] The page parameter information is used to update the editable view parameter code in the initial view View layer file to obtain the customized view View layer file.
[0159] Optionally, the SDK file also includes a view data ViewModel layer file; the view data ViewModel layer file is used to save state variables related to the customized interface; the variable value of the state variable can be updated according to the processing result data of the service processing logic.
[0160] Optionally, the page parameter information includes information representing at least one display parameter of the display position, display form, display color, display order, and display content of the page components; the page components include at least one of a title bar, an operation control, a progress bar, an image acquisition box, and prompt information.
[0161] Optionally, the customized view View layer file includes a page routing identifier; the terminal is equipped with the HarmonyOS system; the terminal can also determine to execute the customized view View layer file to display the customized interface based on the routing mechanism of the HarmonyOS system and the page routing identifier.
[0162] Optionally, the event includes at least one of an interface creation event, an interface background event, an interface foreground event, an interface destruction event, and an interactive event of controls in the interface;
[0163] And / or, the service processing logic includes processing logic for at least one of a scheduled operation service, a terminal device authority verification service, a terminal device device setting service, and a business data processing service.
[0164] Optionally, the permission verification service of the terminal device includes a permission verification service for verifying camera permissions; the setting service of the terminal device includes a service for adjusting the terminal screen brightness; and the business data processing service includes a service for calling a face verification algorithm to verify the collected face image.
[0165] Optionally, the event includes an interface creation event; after acquiring the interface creation instruction, the terminal may also execute the event publishing code and use the state variable of the view data ViewModel layer file as a parameter to publish the interface creation event;
[0166] The event processing center receives the interface creation event, triggering the execution of the service processing logic corresponding to the interface creation event;
[0167] Update the state variable according to the processing result information of the service processing logic corresponding to the interface creation event to obtain an updated state variable;
[0168] The view data ViewModel layer file triggers the custom view View layer file to display the corresponding page information according to the updated state variable.
[0169] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method.
[0170] Figure 4 This is a schematic diagram of a device based on an event bus customized interface provided in an embodiment of this specification. Figure 4 As shown, the device 400 may include:
[0171] at least one processor 410; and,
[0172] A memory 430 is communicatively connected to the at least one processor; wherein,
[0173] The memory 430 stores instructions 420 executable by the at least one processor 410. The instructions are executed by the at least one processor 410 to enable the at least one processor 410 to:
[0174] Get the page parameter information edited by the user;
[0175] Based on the page parameter information, a custom view View layer file is generated for rendering and displaying a custom interface corresponding to the page parameter information; the custom view View layer file contains an event publishing code for publishing an event; the event is used by the event processing center to trigger the service processing logic corresponding to the event;
[0176] The customized view View layer file and the SDK file containing the event processing center and the service processing logic are loaded into the terminal, so that the terminal can display the customized interface based on the customized view View layer file and can call the service processing logic based on the event processing center to respond to events triggered by the customized interface.
[0177] Based on the same idea, the embodiment of this specification also provides a computer-readable medium corresponding to the above method. The computer-readable medium stores computer-readable instructions, which can be executed by a processor to implement the above method for customizing an interface based on an event bus.
[0178] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. Figure 4 As for the device shown, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0179] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0180] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0181] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0182] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0183] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0184] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0185] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0186] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0187] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0188] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0189] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0190] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0191] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0192] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0193] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for customizing an interface based on an event bus, comprising: Get the page parameter information edited by the user; Based on the page parameter information, a custom view View layer file is generated for rendering and displaying a custom interface corresponding to the page parameter information; the custom view View layer file includes an event publishing code for publishing an event; The code is used to publish an event based on the user's preset operation on the customized interface; the event is used by the event processing center to trigger the service processing logic corresponding to the event; The customized view View layer file and the SDK file containing the event processing center and the service processing logic are loaded into the terminal, so that the terminal can display the customized interface based on the customized view View layer file and can call the service processing logic based on the event processing center to respond to events triggered by the customized interface.
2. According to the method of claim 1, the step of obtaining the page parameter information edited by the user comprises: Get the initial view layer file; The file code of the initial view View layer file includes editable view parameter code; Based on the user's editing operation on the editable view parameter code, the page parameter information edited by the user is obtained.
3. According to the method of claim 2, the initial view View layer file includes the code for publishing events; the generating of the customized view View layer file for rendering and displaying the customized interface corresponding to the page parameter information based on the page parameter information specifically includes: The page parameter information is used to update the editable view parameter code in the initial view View layer file to obtain the customized view View layer file.
4. According to the method described in claim 1, the SDK file also includes a view data ViewModel layer file; the view data ViewModel layer file is used to save the state variables related to the customized interface; the variable value of the state variable can be updated according to the processing result data of the service processing logic.
5. The method according to claim 1, wherein the page parameter information includes information indicating at least one display parameter of the page component: display position, display form, display color, display order, and display content; The page components include at least one of a title bar, an operation control, a progress bar, an image acquisition box, and prompt information.
6. According to the method of claim 1, the custom view View layer file includes a page routing identifier; the terminal is equipped with Hongmeng system; the method further includes: The terminal is based on the routing mechanism of the Hongmeng system and determines to execute the customized view layer file to display the customized interface according to the page routing identifier.
7. The method according to claim 1, wherein the event comprises at least one of an interface creation event, an interface background event, an interface foreground event, an interface destruction event, and an interactive event of controls in the interface; And / or, the service processing logic includes processing logic for at least one of a scheduled operation service, a terminal device authority verification service, a terminal device device setting service, and a business data processing service.
8. According to the method described in claim 7, the permission verification service of the terminal device includes a permission verification service for verifying camera permissions; the setting service of the terminal device includes a service for adjusting the brightness of the terminal screen; and the business data processing service includes a service for calling a face verification algorithm to verify the collected face image.
9. The method according to claim 4, wherein the event comprises an interface creation event; The method further comprises: After the terminal obtains the interface creation instruction, the terminal executes the event publishing code and uses the state variable of the view data ViewModel layer file as a parameter to publish an interface creation event; The event processing center receives the interface creation event, triggering the execution of the service processing logic corresponding to the interface creation event; Update the state variable according to the processing result information of the service processing logic corresponding to the interface creation event to obtain an updated state variable; The view data ViewModel layer file triggers the custom view View layer file to display the corresponding page information according to the updated state variable.
10. A device for customizing an interface based on an event bus, comprising: Parameter editing module, used to obtain the page parameter information edited by the user; A file generation module, used to generate a customized view layer file for rendering and displaying a customized interface corresponding to the page parameter information based on the page parameter information; the customized view layer file includes an event publishing code for publishing an event; The code is used to publish an event based on the user's preset operation on the customized interface; the event is used by the event processing center to trigger the service processing logic corresponding to the event; A file loading module is used to load the customized view View layer file and the SDK file containing the event processing center and the service processing logic to the terminal, so that the terminal can display the customized interface based on the customized view View layer file and can call the service processing logic based on the event processing center to respond to events triggered by the customized interface.
11. A device for customizing an interface based on an event bus, comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Get the page parameter information edited by the user; Based on the page parameter information, a custom view View layer file is generated for rendering and displaying a custom interface corresponding to the page parameter information; the custom view View layer file contains an event publishing code for publishing an event; the event is used by the event processing center to trigger the service processing logic corresponding to the event; The customized view View layer file and the SDK file containing the event processing center and the service processing logic are loaded into the terminal, so that the terminal can display the customized interface based on the customized view View layer file and can call the service processing logic based on the event processing center to respond to events triggered by the customized interface.
12. A computer-readable medium having computer-readable instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the method for customizing an interface based on an event bus according to any one of claims 1 to 9.
