Page generation method, apparatus, device, and medium
By receiving and processing the element unit configuration information from the server through the terminal, the element units of the feed stream page are dynamically generated, which solves the problem of long update cycles for content service applications and achieves efficient page generation and a user-friendly update experience.
Patent Information
- Application Number
- CN202110063111.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-18
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2041-01-18
AI Technical Summary
In existing technologies, content service applications need to be redeveloped and updated by users when updating the feed page layout, resulting in long development cycles and poor user experience.
The terminal receives element unit configuration information from the server, associates and saves new type element unit identification information and layout data, responds to page generation operations to obtain target page configuration information, generates target element units based on layout data and builds the page, and dynamically adjusts the layout.
New types of element units can be generated without updating the application, improving page generation efficiency, saving development costs, and enhancing user experience.
Smart Images

Figure CN113608737B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, in particular to the technical field of cloud, and provides a page generation method and device, equipment and a medium. BACKGROUND
[0002] Most content service applications display various types of content in the form of feed stream pages. At present, when developing a content service application, the layout of a feed stream page is compiled. When the content service application is running, the layout of the corresponding feed stream page can be loaded.
[0003] However, with the continuous development of media technology, new layouts may appear at irregular times. If a new layout needs to be displayed in a feed stream page, the developer is required to update the content service application according to the development cycle, and the updated content service application can load and display the new feed stream layout. However, this method requires the content service application to be updated and released, the development cycle is long, and the user needs to update the content service application in time to display the new layout of the feed stream page, which results in low efficiency of page generation. SUMMARY
[0004] Embodiments of the present application provide a page generation method, device, equipment and medium, which are used to improve the efficiency of generating a page.
[0005] In one aspect, a page generation method is provided, which is applied to a terminal, and an application program is installed in the terminal, and the method comprises the following steps.
[0006] After receiving new element unit configuration information issued by a server, the identification information and layout data of a new type of element unit contained in the new element unit configuration information are associated and saved, and the element unit is a basic unit for generating a page;
[0007] In response to a page generation operation triggered on the application program, target page configuration information is obtained, wherein the target page configuration information comprises target identification information of a target element unit for generating a target page, and information content associated with the target element unit, and the target element unit comprises at least one of the new type of element unit;
[0008] Based on the target identification information, layout data corresponding to the target element unit is obtained;
[0009] Based on the layout data and information content of the target element unit, the target element unit is generated;
[0010] Based on the target element unit, the target page is generated.
[0011] In one aspect, a page generation apparatus is provided, the apparatus being arranged in a terminal in which an application is installed, the apparatus comprising:
[0012] a layout data registration module configured to, upon receiving new element unit configuration information issued by a server, save identification information of a new type of element unit and layout data of the new type of element unit contained in the new element unit configuration information in association;
[0013] a page configuration information obtaining module configured to, in response to a page generation operation triggered on the application, obtain corresponding target page configuration information, wherein the target page configuration information comprises target identification information of a target element unit used to generate a target page and information content associated with the target element unit, and the target element unit comprises at least one of the new type of element unit;
[0014] a page generation module configured to, based on the target identification information, acquire layout data corresponding to the target element unit, generate the target element unit based on the layout data and the information content of the target element unit, and generate the target page based on the target element unit.
[0015] In one possible implementation, the page configuration information obtaining module is specifically configured to:
[0016] in response to the page generation operation, send a page generation request to a server;
[0017] if new page configuration information fed back by the server is received, use the new page configuration information as the target page configuration information, and replace historical page configuration information recorded in a local cache based on the new page configuration information;
[0018] if no new page configuration information fed back by the server is received, use historical page configuration information recorded in the local cache as the target page configuration information.
[0019] In one possible implementation, the new element unit configuration information contains a plurality of layout data associated with the new type of element unit and a layout data identifier corresponding to each layout data, and the target page configuration information further comprises a target layout data identifier corresponding to the target element unit; the page configuration information obtaining module is specifically configured to:
[0020] based on the target identification information and the target layout data identifier, obtain layout data corresponding to the target element unit.
[0021] In a possible embodiment, the layout data corresponding to the target element unit comprises a target view class corresponding to the target element unit, the target view class defines a page element category supported by the target element unit for display, and the information content comprises page element data corresponding to each page element in the target element unit; and the page generation module is specifically configured to:
[0022] determine the number of each page element category in the target element unit according to the information content;
[0023] input the number of each page element category in the target element unit into the target view class, and create a corresponding number of page elements respectively;
[0024] configure the page element data corresponding to each created page element in the information content into the corresponding page element respectively.
[0025] In a possible embodiment, the layout data corresponding to the target element unit further comprises a data model for determining the size of the target element unit, and the information content further comprises presentation area information of each page element in the target page; and the page generation module is further configured to:
[0026] input the presentation area information of each page element in the target page into the data model to obtain the size of the target element unit.
[0027] In a possible embodiment, the layout data corresponding to the target element unit further comprises a data model for determining the size of the target element unit, an extension interface for calculating the layout size of a text element in a page is provided in the application program, each page element in the target element unit comprises a text element, the information content further comprises presentation area information of other page elements in each page element except the text element in the target page, and the information content further comprises text content and font parameters corresponding to the text element; and the page generation module is specifically configured to:
[0028] input the text content and the font parameters into the extension interface to determine the presentation area information of the text content in the target page;
[0029] input the presentation area information of other page elements in each page element except the text element in the target page and the presentation area information in the target page into the data model to determine the size of the target element unit.
[0030] In a possible embodiment, if the number of the target element units is a plurality, the content information further comprises an arrangement order of the plurality of target element units; and the page generation module is specifically configured to:
[0031] The target page is generated based on the target element unit, including:
[0032] The target page is generated based on the target element unit, including:
[0033] In a possible embodiment, the page configuration information obtaining module is further configured to, after the target page is generated based on the target element unit, obtain updated page configuration information in response to a page refresh operation triggered for the target page;
[0034] The page generation module is further configured to, if there is change identifier information and change information content of a changed element unit in the updated page configuration information compared with the target page configuration information, determine corresponding layout data based on the change identifier information, generate the changed element unit according to the layout data of the changed element unit and the change information content, and generate a refreshed target page according to the target element unit and the changed element unit.
[0035] The embodiments of the present application provide a computer device, including:
[0036] at least one processor, and
[0037] a memory connected with the at least one processor in communication;
[0038] The memory stores instructions executable by the at least one processor, and the at least one processor implements the method according to any one of the aspects by executing the instructions stored in the memory.
[0039] The embodiments of the present application provide a computer storage medium, which stores computer instructions, and when the computer instructions run on a computer, the computer executes the method according to any one of the aspects.
[0040] The embodiments of the present application have at least the following technical effects:
[0041] In this embodiment, the terminal can directly obtain the element unit configuration information of the new type of element unit from the server. Subsequently, when a page needs to be generated, the terminal can generate the corresponding element unit based on the obtained configuration information, thereby generating the page. This eliminates the need to re-release the application and improves page generation efficiency. Furthermore, since a new application release is not required, it saves development manpower and reduces page generation costs. For users, the new type of element unit can be viewed promptly without application updates, improving user efficiency. Attached Figure Description
[0042] Figure 1 An example of a page provided for embodiments of this application. Figure 1 ;
[0043] Figure 2A This is a schematic diagram illustrating an application scenario of a page generation method provided in an embodiment of this application;
[0044] Figure 2B Provided for the embodiments of this application Figure 2A Schematic diagram of the equipment in the middle;
[0045] Figure 3 A flowchart illustrating a page generation method provided in an embodiment of this application;
[0046] Figure 4A Figure 2 shows an example page provided in an embodiment of this application;
[0047] Figure 4B An example diagram of a generated target page provided in an embodiment of this application;
[0048] Figure 5 An example diagram of target page configuration information provided in an embodiment of this application;
[0049] Figure 6 An example diagram illustrating the process of generating a target element unit provided in this application embodiment;
[0050] Figure 7 An example diagram illustrating the calculation of the size of a target element unit, provided as an embodiment of this application;
[0051] Figure 8 Provided for the embodiments of this application Figure 4B The page displayed after the target page is refreshed;
[0052] Figure 9 Provided for the embodiments of this application Figure 2A A schematic diagram illustrating the interaction process between various devices in the system;
[0053] Figure 10 A flowchart of a page generation method provided by an embodiment of the present application is shown in FIG. 1.
[0054] Figure 11 A structural diagram of a page generation apparatus provided by an embodiment of the present application is shown in FIG. 2.
[0055] Figure 12 A structural diagram of a computer device provided by an embodiment of the present application is shown in FIG. 3. DETAILED DESCRIPTION
[0056] In order to better understand the technical solutions provided by the embodiments of the present application, the following will be described in detail in combination with the accompanying drawings and specific embodiments.
[0057] In order to facilitate those skilled in the art to better understand the technical solutions of the present application, the following will introduce the terms involved in the present application.
[0058] User Interface (UI) and page: the overall design of the man-machine interaction, operation logic, and interface aesthetics of software. A better UI design not only makes the software have personality and taste, but also makes the operation of the application program comfortable, simple, and free, fully embodies the positioning and characteristics of the software. The page involved in the embodiments of the present application belongs to a kind of user interface, and the page in the embodiments of the present application can be an interface presented by an application program running in a terminal.
[0059] Feed flow page: a kind of page, which is a page implemented by feed. Feed is a content aggregator formed by combining a plurality of message sources actively subscribed by a user, and helps the user to continuously obtain the latest subscribed source content. Feed can be further understood as a data form for continuously providing content to the user, and is a resource aggregator composed of a plurality of content providing sources, which is actively subscribed by the user and provides content to the user.
[0060] UITableViewCell: a view class under the UIKit framework, which is a carrier for list display, and can customize different styles of list content based on UITableView, and can be applied to generate a feed flow page.
[0061] Method swizzling: a technique that can be applied in Objective-C or other languages to support dynamic method dispatch. Method swizzling allows a method's implementation to be replaced with another method's implementation at runtime by changing the mapping between a particular method and its actual implementation. Further understanding is that this technique can allow an application to hook during runtime, that is, dynamically generate classes and objects during the running of the application. Method swizzling can be applied to different operating systems, such as the IOS system.
[0062] Element unit: refers to the constituent unit of a page, for example, can be the basic constituent unit of a page, and can be further understood as a unit for carrying page elements. The element unit in a page generated by a UITableViewCell can be a cell. A page can be composed of one or more element units, and each element unit contains one or more page elements, such as one or more of a single picture element, a multiple picture element, a text element, a video element, an audio element, a button element, and a live interface element. Element units can be divided into multiple types, for example, they can be classified by the types of page elements they support to display, that is, if two element units do not completely support the same or completely different types of page elements to display, they can be considered to belong to different types. For example, one element unit supports to display picture elements and text elements, and another element unit supports to display picture elements and audio elements, so these two element units can be considered to be different types of element units. Different element units can contain the same types of page elements, or some of the same types of page elements, or completely different types of page elements. It should be noted that the page elements supported by an element unit to display means that the element unit can carry the corresponding page elements, but this does not mean that all element units in this type of element unit must contain all the supported page elements to display. For example, a class A element unit supports text elements and video elements, and in a certain page, an element unit belonging to the class A element unit can only contain video elements.
[0063] To more clearly illustrate the relationship between the page and the element unit, the following will take the page shown in Figure 1 as an example for introduction: please refer to Figure 1 , the page 100 displays video-related content, and the page 100 includes multiple element units 110, such as Figure 1 the first element unit 111 and the second element unit 112 shown in Figure 1 The page elements of the first element unit 111 include
[0064] Layout: refers to the specific presentation of an element unit. A page can contain an element unit of one type of layout, or include element units of multiple types of layout. If the layouts of the element units included by two pages are different, then the layouts of the two pages can be considered to be different. The layout types of element units can be divided in various ways. For example, the layout types of element units can be divided according to the types of page elements that the element units can support loading. For example, one element unit can support loading pictures, and another element unit can support loading text, so the two element units can be considered to be different element units. For another example, the layout types of element units are divided according to the types of page elements included by the element units, that is, the types of loaded page elements are different, so they are considered to be element units of different layouts. For example, one element unit includes a single picture, and another element unit includes multiple pictures, so the two element units can be considered to be different layouts. For another example, one element unit includes a picture and text, and another element unit includes a picture and a button, so the two element units are considered to be element units of different layouts.
[0065] Style: can be understood as the specific presentation of a page element. Each page element in an element unit can be arranged and displayed in multiple styles. Multiple page elements in an element unit can also be arranged and displayed in multiple styles. Taking text as an example, different fonts of text can be considered to be different styles. For another example, text superimposed on a picture, and a picture covering text can be considered to be two styles.
[0066] Element unit configuration information: includes identification information of an element unit and layout data of the element unit. The identification information is used to identify different types of element units, that is, the identification information of different types of element units is different. It should be noted that one type of element unit can have one or more ways of generating a layout, so one type of element can correspond to one or more layout data. In order to facilitate distinction, each layout data can be associated with a corresponding layout data identifier. The layout data identifier can be represented by the name of the layout data.
[0067] Layout data: used to describe the layout generation method of an element unit. The layout data includes the view class of the element unit, and the view class defines the types of page elements that the element unit can support displaying. The view class is represented by, for example, cellClassName. The layout data can also include a data model, and the data model defines the way to generate the size of the element unit. The data model is represented by, for example, modelClass. The size of the element unit includes the height of the element unit, and can also include the width of the element unit. When the element unit is displayed in three dimensions or more than three dimensions, the size of the element unit also includes the size in other dimensions in addition to the width and the height. Continuing to take Figure 1 as an example, the height of the element unit is specifically Figure 1In the formula, H represents the width of the element unit, which can be specifically expressed as Figure 1 In the formula, W represents the width of the element unit.
[0068] Page element and page element data: a type of element used to describe a page display, such as a picture, a video, text, an emoticon, or a live interface. Page element data is used to describe the specific content that needs to be presented in the page element in the page. The page element data can be expressed in specific content, such as text C. The page element data can also be expressed in the resource identifier of specific content, such as a uniform resource locator (URL) of a picture.
[0069] Page configuration information: can be understood as a set of data required for presenting a page. The page configuration information includes information content for presenting the page, and identification information of the element units that constitute the page. The information content is used to describe the data related to the page element presented in each element unit in the page, including page element data, and can also include the presentation area information of each page element in the page. The page configuration information can be expressed in a tree-like collection model, and the page configuration information can be implemented in a property list (Plist). The page element configuration information can also include the total number of element units that constitute the page, so as to facilitate subsequent verification of the integrity of the page configuration information. The page element configuration information can also include the version number of the information, so as to facilitate subsequent determination of whether the page configuration information is updated.
[0070] The contents of the new page configuration information and the historical page configuration information in the embodiments of the present application can refer to the definition of the page configuration information. The difference between the new page configuration information and the historical page configuration information is the timing at which the application program obtains the page configuration information. If the application program obtains the page configuration information from the background at the current time, it is considered as new page configuration information. If the application program obtains the page configuration information from the background before the current time, it is considered as historical page configuration information.
[0071] Plist: a file format similar to xml, doc, or json, etc. Plist can store corresponding data in the form of key-value pairs, and can be used to store user settings or bundled information. Plist can store various abstract data, so each plist can include data in multiple formats.
[0072] Presentation area information: used to describe the area size occupied by each page element in the page and the position of the page element in the page. According to the presentation area information, the area occupied by the page element in the page can be determined, which can be referred to as a presentation area. Taking a picture as an example, the presentation area information of the picture is, for example, the reference coordinate point of the picture and the height and width of the picture, the reference coordinate point is, for example, the center coordinate point of the picture or the starting coordinate point of the picture in the page, and the presentation area information of the picture can be represented as (x, y, W, H), (x, y) respectively represent the starting coordinate point of the picture in the page, W represents the width of the picture in the page, and H represents the height of the picture in the page. The presentation area information can also be represented by four boundary coordinate points of the picture. The specific expression of the presentation area information is not limited in the present application.
[0073] TMFFeedMapper: a class that can provide an element unit layout registration method (registerLayout) to the outside. Registration can be understood as determining a layout method for generating an element unit, for example, registration can be implemented by associating and saving the identification information and layout data of the element unit. The class can be used in an application program to implement the layout registration process of the element unit.
[0074] It should be noted that "multiple" in the embodiments of the present application means two or more, and "at least one" means one or more.
[0075] The related art is introduced as follows:
[0076] In the related art, a developer develops a page with a new layout according to a requirement, writes development code into an application program, and publishes a new version of the application program. After a user downloads the new version of the application program, the application program can support displaying the page with the new layout. However, in this way, the developer needs to consider the compatibility between the code segment corresponding to the new layout and the code of the original application program, and the like, so the development difficulty is high and the development period is long. Moreover, the developer needs to develop a new version of the application program for different operating systems, which further leads to high development difficulty. Moreover, for the user, the application program also needs to be updated to display the updated page, which leads to low efficiency of page control.
[0077] In view of this, the embodiment of the present application provides a page generation scheme, in which an application can parse element unit configuration information issued by a server to obtain a layout generation method of a new type of element unit, and can dynamically parse page configuration information issued by the server to generate corresponding element units according to the obtained layout generation method of the element unit, so as to construct a page and realize dynamic adjustment of the layout of the page, or dynamic addition of the layout of the page. In specific implementation, a registration interface is pre-set in the application, when there is a new type of element unit, the application in the terminal can directly obtain element unit configuration information of the element unit from the server, and call the registration interface based on the element unit configuration information, so as to obtain the layout generation method of the new type of element unit. When a page needs to be displayed, the application can obtain corresponding page configuration information, directly find element unit configuration information corresponding to element units in the page configuration information from the obtained element unit configuration information, and generate corresponding element units in real time according to the obtained layout generation method of the element unit, and then generate a page. That is, in the scheme, the server can issue corresponding updated element units to the application at any time, without the need to update the application, so as to realize generation of a new type of element unit, and then realize update of the layout of the page, thereby improving the efficiency of page generation in the application.
[0078] Based on the above design idea, the application scenario of the page generation method of the embodiment of the present application is introduced below.
[0079] Please refer to Figure 2A , the application scenario diagram of the page generation method provided by the embodiment of the present application, Figure 2A or can be understood as a structure example diagram of the page control system in the embodiment of the present application. The scenario diagram includes a terminal 210, a server 220 and a database 230.
[0080] The terminal 210 runs an application 211, which is a pre-installed application in the terminal 210. The application can be any type of application, such as a content service application, a social instant messaging application or an instant messaging application, etc., which is not limited by the present application.
[0081] The terminal 210 and the server 220 can be directly or indirectly connected through a communication network, such as a local area network, a wide area network or the Internet, etc., which is not limited by the present application. The server 220 can be an application server, a network tool or a dedicated server device, etc.
[0082] The server 220 can perform corresponding read and write operations on the database 230, for example, when responding to a corresponding request of the application, the server 220 can obtain corresponding data from the database 230.
[0083] The database 230 can be deployed in the server 220, or can be deployed on another device independent of the server 220. The database 230 can store various data, such as page element data corresponding to each of the plurality of pages, for example, the database 230 can store video, picture or text content displayed on the page. In addition, the database 230 can also store user portraits of each user, so as to subsequently recommend page element data of interest to the user. The database 230 can store various data in a fixed form. The database 230 can store various data in a key-value manner, for example. The database 230 can directly write various data, or can write a resource address of various data, so as to reduce the storage amount.
[0084] The various data can be obtained by the server 220 from a network resource and stored in the database 230, can be obtained by the server 220 from another terminal and stored in the database 230, or can be obtained by the server 220 from a remote content server and stored in the database 230. The remote content server is a data source server corresponding to the data, and the server 220 can request the data from the remote content server.
[0085] For example, each user forwards the content created by the user to the server 220 through the terminal, and forwards the content to the terminal corresponding to the other user through the server 220. The server 220 can also store the content in the database 230. For example, user A publishes article F through the application program, and the server 220 can share the article F to the terminal of the other user through the network. The server 220 can also write the article F into the database 230.
[0086] Specifically, the terminal 210 can be used to display a corresponding page in response to various operations performed by the user on the application program 211. For example, the user can perform a page request operation on the application program 211, and the application program 211 generates a page generation request to request corresponding page configuration information from the server 220 in response to the page generation operation.
[0087] After obtaining the page generation request, the server 220 obtains corresponding page content from the database 230 according to the page request of the application program 211. The server 220 can also obtain a user portrait from the database 230 according to the page request, and obtain page content recommended for the user from the database 230 based on the user portrait. Then, the server 220 converts the obtained page content into fixed form configuration information, and feeds back the configuration information to the application program 211.
[0088] After the application 211 obtains the configuration information, the configuration information is parsed to display the corresponding page content in the form of a page. Details of the specific content related to page presentation will be described below.
[0089] Further, when the user performs a corresponding operation on the presented page, such as a click operation, a forwarding operation, or a collection operation on a certain page content in the page, the terminal 211 can generate content operation information in response to the operation. The content operation information includes the operation type performed by the user and the page content corresponding to the operation.
[0090] The terminal 211 can send the content operation information to the server 220. The server 220 can update the user portrait according to the operation information and store the updated user portrait in the database 230.
[0091] In a possible specific application scenario, the server 220 can execute a plurality of modules to respond to a request sent by the application. Please refer to Figure 2B The server 220 includes a content feedback module 221 and a content recommendation module 222. The content feedback module 221 and the content recommendation module 222 can be deployed on the same server or on different servers. The content feedback module 221 and the content recommendation module 222 can be implemented by a process or a service.
[0092] The content feedback module 221 is used to interact with the terminal 210, and the content recommendation module 222 is used to determine the page content displayed for the user. For example, the content feedback module 221 can receive a page request from the terminal 210 and feed back the page request to the content recommendation module 222. After receiving the page request, the content recommendation module 222 determines the page content recommended for the user from the database 230 according to the page request and the user portrait.
[0093] After the content recommendation module 222 determines the page content recommended for the user, the content feedback module 221 feeds back the page content to the terminal 210, and the terminal loads the corresponding page content to display the corresponding page.
[0094] Further, the terminal 210 can generate corresponding content operation information according to the operation performed by the user on the page content in the displayed page, such as a click operation, a forwarding operation, or a collection operation. The content operation information can refer to the content described above, and details are not described herein.
[0095] It should be noted that if the user accesses a specific page, the server 220 does not need to recommend page content.
[0096] In a possible example, the terminal 210 can also obtain updated personal information in response to a corresponding operation, such as an update operation, an addition operation, or the like, performed on the personal information of the user, and feed the updated personal information to the content feedback module 221, so as to write the updated personal information into the database 230 by the content feedback module 221. The server 220 can also update the user portrait according to the updated personal information, and write the updated user portrait into the database 230.
[0097] The terminal 210 in the above description can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a game device, a smart television, a smart bracelet, and the like, but is not limited thereto. The server 220 can be a stand-alone physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and basic cloud computing services such as big data and artificial intelligence platforms. When the database 230 is deployed on another device independent of the server 220, the other device can also be implemented through various cloud servers.
[0098] In a possible embodiment, the server 220 in the above description can be implemented through cloud technology. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, and the like applied based on a cloud computing business model, can form a resource pool, and can be used on demand and flexibly and conveniently. Cloud computing technology will become an important support. The background service of a technical network system needs a large amount of computing and storage resources, such as video websites, picture websites, and more portals. With the high development and application of the Internet industry, in the future, each item can have its own identification mark and needs to be transmitted to the background system for logical processing. Different levels of data will be processed separately, and various types of industry data need strong system support. These can be implemented through cloud computing.
[0099] On the basis of the application scenarios discussed above, the following takes the page generation method executed by the terminal in Figure 2A-2B as an example to introduce the page generation method involved in the embodiments of the present application.
[0100] Please refer to Figure 3 , which is a flowchart of a page generation method provided by the embodiments of the present application. The specific implementation process of the method is as follows.
[0101] S31, the terminal associates and stores the identification information and layout data of the new type of element unit contained in the new element unit configuration information sent by the server.
[0102] The terminal has an application installed, and after the application is started, the terminal can request element unit configuration information from the server. If the server detects that there is no new type of element unit configuration information to be sent, the server can send element unit configuration information to the terminal. The server can also detect that the application in the terminal is started, and detect that there is no new element unit configuration information to be sent, and can actively send new element unit configuration information to the terminal.
[0103] After the terminal obtains the element unit configuration information, the terminal can parse the element unit configuration information to obtain the identification information and layout data of the new type of element unit, and associate the identification information and layout data of the new type of element unit. Of course, the element unit configuration information can include the identification information and layout data of one new type of element unit, or the identification information and layout data of multiple new types of element units. Correspondingly, the terminal can associate and store the identification information and layout data of each new type of element unit. The specific meaning of the element unit configuration information can be referred to the foregoing description, and will not be repeated here. After the terminal associates and stores the identification information and layout data of the new type of element unit, the terminal obtains the layout method for generating the new type of element unit. Similarly, the terminal can obtain the element unit identification information corresponding to various types of element units, and the layout data corresponding to the element units.
[0104] It should be noted that S31 can be executed after each application is started, executed in real time, or executed periodically, and the present application does not limit this.
[0105] S32, the terminal obtains the corresponding target page configuration information in response to a page generation operation triggered on the application.
[0106] After the application is opened, the user can perform a page generation operation on the application, for example, a sliding operation performed by the user on the application, and for example, a clicking operation performed by the user on a preset function control in the application. The terminal can obtain corresponding new page configuration information according to the page generation operation. The target page configuration information includes target identification information of a target element unit used to generate a target page, and information content associated with the target element unit. The target identification information can refer to the meaning of the identification information described above, and the information content can refer to the content described above, which will not be repeated here. The target element unit can include one target element unit or multiple target element units. If the target element unit in the target page configuration information includes multiple target element units, the target page configuration information specifically includes identification information of each target element unit and information content corresponding to each target element unit.
[0107] For example, please refer to the page of the application shown in Figure 4A When the user clicks the "car" control in the page, it is equivalent to performing a page generation operation.
[0108] S33, the terminal obtains layout data corresponding to the target element unit based on the target identification information.
[0109] The terminal searches for layout data corresponding to the target identification information from the identification information and layout data of the new type of element unit associated and saved by the terminal. If there are multiple target element units, there are also multiple target identification information, and then multiple layout data can be searched.
[0110] S34, the terminal generates a target element unit based on the layout data and information content of the target element unit.
[0111] After obtaining the layout data and information content of the target element unit, the terminal can generate a corresponding target element unit according to the layout data and information content. Of course, if there are multiple target element units, the terminal can generate multiple target element units according to the layout data and information content of each target element unit.
[0112] S35, the terminal generates a target page based on the target element unit.
[0113] After generating the target element unit, if there are multiple target element units, the terminal can arrange the multiple target element units, thereby generating a target page. As an embodiment, the page can further include some basic page elements which are basically unchanged when the page of the application is updated. In order to simplify the data transmission amount between the terminal and the server, the terminal can pre-store the basic page elements. After generating the target element unit, the terminal can arrange the target element unit and the basic page elements, thereby generating a target page.
[0114] Continuing to use Figure 4A the example shown in FIG. 6, after the user clicks the "car" control in Figure 4A , the terminal can generate and display the target page shown in Figure 4B .
[0115] In an embodiment of the present application, the terminal can request the element unit configuration information corresponding to the new type of element unit from the server in real time, thereby obtaining the layout method for generating the new type of element unit in advance. When a page needs to be generated, the terminal can obtain the corresponding page configuration information from the server, thereby searching for the element unit configuration information of the corresponding element unit in the page configuration information according to the page configuration information, and further generating the corresponding element unit. In this way, the terminal can support the generation of the new type of element unit without updating the application, thereby improving the efficiency of page generation. Moreover, the situation that the old version of the application cannot be compatible with the layout of the new version of the element unit is avoided, thereby improving the reliability of the application running.
[0116] As an embodiment, the application can be pre-provided with a TMFFeedMapper class, and provide a registerLayout method outside, the corresponding parameters of the registerLayout method being a layout data identifier, a page configuration information class name and an element unit class name, and a tool class of a configuration class (config) outside. After obtaining the new element unit configuration information, the application can obtain the layout data identifier, the page configuration information class name and the element unit class name according to the new element unit configuration information, and input the obtained layout data identifier, page configuration information class name and element unit class name into the registerLayout method, thereby completing the registration of the element unit.
[0117] After obtaining the new element unit configuration information, the terminal can call the initialization function (setup) in the config, parse the identifier information of the element unit and the corresponding layout data in the element unit configuration information according to the element unit configuration information, and create the relationship between the identifier information and the corresponding layout data, thereby completing the registration process of the new type of element unit.
[0118] Further, in order to reduce the delay in the subsequent page loading process, after the application is started, the terminal directly requests the new element unit configuration information from the server to complete the registration process of the new type of element unit in advance.
[0119] For example, refer to the following Table 1 for the association between the identification information of the element unit and the layout data:
[0120] Table 1
[0121]
[0122] Referring to Table 1, the identification information of the first type of element unit in Table 1 is "Out_text", and the layout data specifically includes description information of the first view class TMFFeedTitleCell and description information of the data model TMFFeed; the identification information of the first type of element unit in Table 1 is "Out_text_image_1", and the layout data specifically includes description information of the second view class TMFFeedTitleImageLightCell and description information of the data model TMFFeed; the identification information of the third type of element unit in Table 1 is "Out_text_image_3", and the layout data specifically includes description information of the third view class TMFFeedTripleImageLightCell and description information of the data model TMFTripleImageFeed. It should be noted that the description information corresponding to the view class in Table 1 can be understood as the way to generate the corresponding view according to the view class, and the description information corresponding to the data model can be understood as the way to generate the size of the element unit according to the corresponding data model. The specific form of the description information is, for example, code.
[0123] As an embodiment, since one type of element unit can correspond to multiple layout data, in order to facilitate subsequent accurate search for the corresponding layout data, the terminal can associate the identification information, the layout data, and the layout data identifier corresponding to the layout data when associating the identification information and the layout data.
[0124] After the user performs the page generation operation, the terminal determines that the page needs to be loaded, so the terminal can obtain the corresponding target configuration information. The following illustrates the way to obtain the target configuration information in S32:
[0125] Example 1: The terminal can obtain the new page configuration information from the server, and use the new page configuration information as the target page configuration information.
[0126] Specifically, the terminal can generate a page generation request in response to the page generation operation, the page generation request being used to request a page, and the page generation request can carry a user identifier in the application. The user identifier can be generated according to a logged-in account in the application, can be generated according to a device identifier of the terminal, or can be a unique identifier directly assigned to the user by the server. After the server receives the page generation request, the server determines that corresponding page configuration information needs to be generated for the user.
[0127] In a possible embodiment, the server can obtain the page configuration information of the target page from a database.
[0128] In a specific implementation, the database can store page configuration information of various pages or partial pages, and the database can further store a page tag corresponding to each page configuration information, the page tag being used to indicate main content of the page. After the server obtains the page generation request, the server can obtain corresponding page configuration information from the database.
[0129] For example, the page generation request can further carry an operation tag, the operation tag being used to indicate a page generation operation performed by the user. The server can match the page configuration information of the fixed page from the database according to the operation tag carried in the page generation request, and feed back the page configuration information as new page configuration information to the terminal.
[0130] In another possible embodiment, the server can determine page element data matched with the user according to the page generation request, and generate new page configuration information according to the matched page element data.
[0131] For example, the server can configure corresponding page element data for the user from the database. For example, the server can match page element data of interest to the user according to a user portrait of the user in the database. Further, the server can generate page configuration information according to the determined page element data. For example, the server can prestore a page configuration information template, the configuration information template defining data items required for generating page configuration information, and the server can load the determined page element data into the corresponding data items, thereby generating page configuration information. The server can also input the determined page element data into a preset code to generate new page configuration information, the preset code being a code used to generate page configuration information.
[0132] In a possible implementation, the terminal can first load historical page configuration information as backup data, and then overwrite the historical page configuration information with new page configuration information obtained from the server. The meaning of the historical page configuration information can refer to the content discussed above, and will not be repeated here.
[0133] As an embodiment, in the above example one, after the terminal obtains the new page configuration information from the server, the terminal can update the new page configuration information in the local cache, and the new page configuration information is regarded as the historical page configuration information for the next page generation process
[0134] Example two: the terminal can record the historical page configuration information in the local cache as the target page configuration information.
[0135] The terminal can record the historical page configuration information in the local cache, which can be the configuration information corresponding to the default page in the application in the terminal. If the historical page configuration information is the page configuration information corresponding to the default page, the historical page configuration information will not change over time. The historical page configuration information can also be the historical page configuration information displayed by the terminal before the current time. The present application does not limit this. In this case, the terminal can adaptively update the historical page configuration information in the local cache according to the currently displayed page. Since the communication between the terminal and the server can be uncertain due to the location of the terminal and the like, the terminal or the server can be abnormal in communication. In this case, the terminal can not be able to successfully send the page generation request to the server. It can also be that the server cannot successfully send the new page configuration information to the terminal after receiving the page generation request. Therefore, in the embodiment of the present application, after the terminal determines that the new page configuration information obtained from the server fails, the terminal can obtain the historical page configuration information from the local cache, and then use the historical page configuration information as the target page configuration information.
[0136] This involves how the terminal specifically determines that the new page configuration information obtained from the server fails. For example, the terminal can start timing when sending the page generation request to the server, and determine that the new page configuration information obtained from the server fails after determining that the preset time period is reached without obtaining the new page configuration information from the server. The terminal can also resend the page generation request to the server multiple times, and determine that the new page configuration information obtained from the server fails after resending the page generation request to the server reaches a preset number of times without obtaining the new page configuration information from the server. In this way, the terminal can avoid waiting for the feedback of the server all the time, so that the terminal cannot be normally displayed. In the embodiment of the present application, even if the terminal does not obtain the new page configuration information from the server, the terminal can also display based on the historical page configuration information in the future, so as to avoid displaying blank and improve user experience.
[0137] The following Figure 5 The target page configuration information is exemplarily introduced as follows by taking the example of the target page configuration information shown in the following
[0138] The target page configuration information is in the form of key-value pair, and the Figure 5The middle target page configuration information takes an information property list as an example, which records that the layout version of the list is 1.2.1, and records 3 element units, specifically the first element unit 510, the second element unit 520, and the third element unit 530 in the middle target page configuration information. Figure 5 The information property list also records the identification information of each element unit, and the identification information of the first element unit 510, the second element unit 520, and the third element unit 530 is out_text, out_text_image_1, and out_text_image_3 respectively.
[0139] The information property list also records the information content included in each element unit, which will be introduced below:
[0140] The page element types of the first element unit 510 include picture elements and text elements, and the picture elements are specifically the first picture 511 and the second picture 512 in the middle target page configuration information. Figure 5 The text elements are specifically the text 513 in the middle target page configuration information. Figure 5 The information property list records the respective URLs of the first picture 511 and the second picture 512, and also records that the text 513 is "titleName". In addition, the information property list also records the presentation area information of the first picture 511 and the second picture 512, specifically (20, 10, 60, 60) shown in the middle target page configuration information. Figure 5 Figure 5 The information property list takes an example that the presentation area information of the first picture 511 and the second picture 512 is the same, and actually does not limit the presentation area information of each picture.
[0141] The information property list also records that the page element types of the second element unit 520 include picture elements, and records the URL of the picture and the presentation area information of the picture. In addition, the information property list also records that the page element included in the third element unit is a label, and records the presentation area information of the label.
[0142] In addition, the information property list also records the layout data identification corresponding to each element unit, for example, the layout data identification corresponding to the first element unit 510 is specifically TMFFeedTitleCell and TMFFeed, the layout data identification of the second element unit 520 is specifically TMFFeedTitleImageLightCell and TMFFeed, and the layout data identification of the third element unit 530 is specifically TMFFeedTripleImageLightCell and TMFTripleImageFeed.
[0143] After obtaining the target page configuration information, the terminal can perform S33, and the implementation of S33 is described as follows:
[0144] In a first manner, the terminal searches the associated saved identification information and layout data for layout data matching the target identification information in the target page configuration information.
[0145] The target page configuration information includes target identification information of a target element unit constituting a target page. The terminal can parse the target page configuration information, obtain corresponding target identification information from the target page configuration information, and determine layout data matching the target identification information from the associated saved identification information and layout data.
[0146] For example, taking the identification information as the name of an element unit and the element unit as a cell as an example, after obtaining the name of the element unit in the target page configuration information, the terminal can search the TMFFeedMapper for a registered element unit, thereby obtaining layout data corresponding to the name of the element unit.
[0147] In a second manner, the terminal searches the associated saved identification information and layout data for layout data matching the target identification information and target layout data identification in the target page configuration information.
[0148] As described above, since there can be multiple layout data corresponding to some element units, in the embodiment of the present application, the target page configuration information further includes target data identification of a target element unit. After the terminal parses the target page configuration information, the terminal can obtain the target data identification and the target identification information, and then the terminal can search for layout data matching both the target data identification and the target identification information according to the target data identification and the target identification information.
[0149] As an embodiment, if the number of target element units in the target page configuration information is multiple, the terminal can use the above-mentioned first manner or second manner to determine the layout data corresponding to each target element unit.
[0150] Please continue to refer to Figure 5 The terminal parses the identification information of the target element unit in the target page configuration information as Out_text, and obtains the layout data identification of the target element unit as TMFFeedTitleCell and TMFFeed. The association between the identification information and the layout data saved by the terminal can refer to Table 1 in the foregoing description. The terminal determines the layout data of the target element unit according to Out_text, TMFFeedTitleCell, and TMFFeed.
[0151] After obtaining the target page configuration information and the layout data corresponding to the target element unit in the target page configuration information, the terminal can perform S34. The specific implementation of S34 is described below.
[0152] In some cases, there can be multiple target element units, and the terminal generates each target element unit in the same way. The generation of one target element unit is described below as an example.
[0153] The terminal generates the target element unit according to the number of each type of page element in the target element unit and the view class in the layout data of the target element unit.
[0154] Specifically, the terminal can parse the information content in the target page configuration information to determine the number of each type of page element included in the target element unit. Of course, the target element unit can include one type of page element or multiple types of page elements. The specific meaning of the page element can refer to the method described above, which is not repeated here. After obtaining the number of each type of page element, the number of each type of page element can be input into the target view class. For example, the number of each type of page element can be arranged in an array according to a preset arrangement order of each type of page element, and input into the target view class in the form of an array, so that the corresponding page element can be created through the target view class.
[0155] In a specific implementation, after obtaining the target view class of the target element unit, the terminal can call each method under the target view class to create the corresponding page element, and then generate the target element unit. Different page elements correspond to different methods under the target view class. In addition, it should be noted that one page element can correspond to one or more methods under the target view class, which is not limited by the embodiments of the present application.
[0156] After obtaining each page element, the terminal can configure the page element data corresponding to each page element into the corresponding page element to obtain the target element unit. The terminal can determine the presentation area of the created page element according to the presentation area information of each page element in the target configuration information when creating the page element, and then only need to configure the page element data into the corresponding page element. The terminal can also determine the presentation area of each page element after configuring the page element data into the page element to generate the target element unit.
[0157] For example, the target element unit includes one video and two texts, so that an array is constructed as (1, 2), and the array is input into the target view class, and then a method for generating a video element is called, a picture element is created, for example, a method for implementing video playing can be called, and a method for playing an advertisement in playing can also be called, and a method for pausing advertisement playing can also be called, and the like, to generate a complete video element, and a method for generating a text element is also called to create a text.
[0158] In order to improve the efficiency of generating the target element unit next time, in the embodiment of the application, after the corresponding method of the target view class is called, the target view class and the called methods can be associated with the target identification information of the target element unit, so that if the target element unit needs to be generated again subsequently, the methods can be directly obtained according to the target identification information, so as to call the methods to generate corresponding page elements.
[0159] As an embodiment, the application program can configure a basic TMFFeedTableViewCell class which inherits from UITableViewCell, and the TMFFeedTableViewCell class includes a data configuration (configWithData) method and an initialization element unit (initItems) method, both of which belong to the view class, the configWithData method is used to configure page element data for each element unit, and the initItems method is used to initialize the view, that is, to determine the view elements supported by the target element unit to be displayed.
[0160] When the terminal generates the target element unit, the initItems method can be called to initialize the view. Initializing the view specifically includes loading the page elements supported by the target element unit to be displayed and the memory size occupied by the array composed of the quantities of various page elements. The terminal inputs the array composed of various page elements into the initItems method, and adds a category to the TMFFeedTableViewCell class in the target element unit according to the array, where the category can be understood as adding methods for generating various page elements, and the corresponding page elements are generated through these methods.
[0161] After the corresponding page elements are generated, the layout data corresponding to the target element unit can be called through the objc_setAssociatedObject function, and the configWithData method is called to configure the corresponding page element data for each page element.
[0162] Further, the terminal associates the layout data including the called methods with the target identification information of the corresponding target element unit through an object association setting (objc_setAssociatedObject) function, and can subsequently directly call the corresponding layout data including the called methods according to the target identification information. It should be noted that the layout data herein not only includes the target view class, but also includes each method under the called target view class, and can also include a target data model.
[0163] For example, refer to Figure 6 For an example diagram of the process of generating a target element unit, the terminal determines that the target element page includes one text element, one multi-text and image element, and two label elements, and thus creates a text element 601, a multi-text and image element 602, and a first label element 603 as shown in (1) of FIG. 6. Figure 6 (1) of FIG. 6 takes each presentation area corresponding to each page element as an example, but in fact, the terminal is not limited to determining the timing of the presentation area of each page element. The terminal configures the page element data corresponding to each page element into the page elements as shown in (1) of FIG. 6, thereby generating a target element unit as shown in (2) of FIG. 6. Figure 6 (1) of FIG. 6 takes each presentation area corresponding to each page element as an example, but in fact, the terminal is not limited to determining the timing of the presentation area of each page element. The terminal configures the page element data corresponding to each page element into the page elements as shown in (1) of FIG. 6, thereby generating a target element unit as shown in (2) of FIG. 6. Figure 6 (1) of FIG. 6 takes each presentation area corresponding to each page element as an example, but in fact, the terminal is not limited to determining the timing of the presentation area of each page element. The terminal configures the page element data corresponding to each page element into the page elements as shown in (1) of FIG. 6, thereby generating a target element unit as shown in (2) of FIG. 6. Figure 6 (1) of FIG. 6 takes each presentation area corresponding to each page element as an example, but in fact, the terminal is not limited to determining the timing of the presentation area of each page element. The terminal configures the page element data corresponding to each page element into the page elements as shown in (1) of FIG. 6, thereby generating a target element unit as shown in (2) of FIG. 6.
[0164] In generating the target element unit, in addition to configuring the corresponding page element data, the size of the target element unit also needs to be considered, wherein the size of the target element unit can be fixed, but since the size of each page element in each target element unit is not fixed, in order to optimize the presentation effect of each target element unit, the terminal can also calculate the size of the target element unit in the embodiment of the present application, so that the presentation effect of each page element in the target element unit is better.
[0165] Specifically, the layout data corresponding to the target element unit can also include a data model, and the terminal can determine the data model corresponding to the target element unit from the data model corresponding to the layout data according to the layout data identifier in the target page configuration information, and after obtaining the data model, the presentation area information of each page element in the target page configuration information can be parsed and input into the data model, thereby calculating the size of the target element unit. There are various ways for the data model to calculate the size of the target element unit, which will be described below:
[0166] The data model can determine the presentation area corresponding to each page element according to the presentation area information of each page element, and further determine the height required by the target element unit, and the width of the target element unit can be fixed or determined by the terminal according to the presentation area corresponding to each page element.
[0167] For example, please refer to Figure 7 For an example of calculating the height of the target element unit, the terminal determines that the target element unit includes text 701 and three pictures 702, and determines that the height of the text 701 is H1, the starting coordinate point is shown as point A, the height of the three pictures 702 is H2, and the starting coordinate point is shown as point B. The terminal determines the difference in the vertical coordinate between points A and B, and thus can determine the height of the target element unit as (H1+H2+H3) according to the difference and H3.
[0168] However, in actual application, the presentation area of some page elements may change according to the related parameters of the page elements. For example, if one or both of the font and the font size of the text change, the presentation area corresponding to the text will change. In this case, the presentation area corresponding to the page element needs to be dynamically calculated, and then the size of the target element unit is determined.
[0169] Specifically, when the target page configuration information includes the text content of the text element and the font parameter, the font parameter includes one or both of the font and the font size. When calculating the presentation area corresponding to the text element, the terminal can call an extension interface to pass the text content and the font parameter through the extension interface to obtain the presentation area information of the text element. For example, the extension interface can be text size calculation (caculateSizeWithText) for the text element. It should be noted that the extension interface can be understood as an interface set in the application program for accessing the outside, and the extension interface can be associated with the data model in advance by the terminal.
[0170] After the presentation area information of the dynamically changed page element is calculated, the terminal determines the size of the target element unit based on the presentation area information of the page element and the presentation area information of other page elements. The way of determining the size of the target element unit through the data model can refer to the content discussed above, which will not be repeated here.
[0171] It should be noted that if the target page configuration information does not include the font parameter of the text, but includes the presentation area information of the text, the terminal can directly calculate the size of the target element unit according to the presentation area information in this case.
[0172] It should be noted that if the target element unit includes multiple target element units, the terminal can generate each target element unit according to any of the above methods. The way of generating each target element unit is the same, which will not be repeated here.
[0173] After obtaining the target element unit, the terminal can perform S35, and the execution process of S35 is described below.
[0174] If the target element unit is only one, then after generating the target element unit, the target page is obtained. As discussed above, some basic page elements can also be pre-stored in the terminal, and the terminal arranges the target element unit and the basic page elements to generate the target page.
[0175] If the target element unit includes multiple, then after the terminal generates multiple target elements, the target page can be generated by arranging the target elements in sequence according to the arrangement order of the multiple target elements in the target page configuration information. The arrangement order of the multiple target elements can be included in the target page configuration information separately, or the order of the identification information of the target element units in the target page configuration information is the arrangement order of the multiple target element units. Further, if the terminal stores basic page elements, the basic page elements can be arranged with the target element units to generate the target page elements.
[0176] Continuing with the target page configuration information shown in FIG. 5, the arrangement order in the target page configuration information is the first element unit 510, the second page element unit 520, and the third page element unit 530 in sequence from front to back. After the terminal generates the three element units, the target page is generated by arranging the first element unit 510, the second page element unit 520, and the third page element unit 530. Figure 5
[0177] After the terminal generates the target page, the terminal can further display the target page to timely show the target page to the user.
[0178] After the terminal displays the target page, the user can perform an interactive operation on the target element unit, such as a click operation or a forwarding operation, and the terminal responds to the interactive operation to execute corresponding business logic. For example, the terminal can generate a forwarding request according to the forwarding operation of the terminal, so that the server forwards the content of the target page to other devices according to the forwarding request. The server can also generate interactive information corresponding to the user's interactive operation at this time to update the target page. The server can update the user portrait of the user stored in the database according to the interactive information, so as to facilitate subsequent recommendation of corresponding page element data to the user based on the latest user portrait.
[0179] After the terminal displays the target page, the user can also perform a page refresh operation on the target page, such as a user's up-slip operation, down-slip operation, trigger operation on a refresh control in the target page, zoom-out operation on the target page, or zoom-in operation on the target page. The terminal responds to the page refresh operation to update the target page.
[0180] The terminal can send a page refresh request to the server. After receiving the page refresh request, the server can generate updated page configuration information according to the page refresh request, and feed back the updated page configuration information to the terminal. The content of the server generating the updated page configuration information can refer to the content of generating the new page configuration information discussed above, and will not be repeated here.
[0181] The terminal can repeat the above process according to the updated page configuration information to generate the refreshed target page.
[0182] As an embodiment, in order to simplify the process of the terminal refreshing the page, after obtaining the updated page configuration information, the terminal can compare the updated page configuration information with the previous target page configuration information to determine the change identifier information and change information content of the change element unit that changes compared with the target page configuration information. The terminal can obtain the layout data corresponding to the change identifier information according to the change identifier information according to the method discussed above, and generate the change element unit according to the layout data and the change information content, and then generate the refreshed target page according to the change element unit and the target element unit. The changes in the updated page configuration information compared with the target page configuration information can be in many specific cases, which are described as follows:
[0183] I. The updated page configuration information adds a change element unit compared with the target page configuration information:
[0184] In this case, the terminal can obtain the identifier information and information content of the added change element unit from the updated page configuration information, and generate the added change element unit to add the change element unit to the target element unit in the target page to obtain the refreshed target page. At the same time, the terminal can reduce the size of the element unit in proportion to ensure that the target element unit and the change element unit can be displayed normally.
[0185] II. The updated page configuration information reduces the target element unit compared with the target page configuration information:
[0186] In this case, the terminal can determine the reduced change element unit, delete the reduced change element unit from the target page, and thus obtain the refreshed target page. At the same time, the terminal can enlarge the size of each element unit in proportion to ensure that the refreshed target page can display the remaining target element unit.
[0187] III. The updated page configuration information adds a change element unit and reduces a target element unit compared with the target page configuration information:
[0188] In this case, the terminal can generate the added change element unit and delete the reduced target element unit from the target element unit according to the method discussed above, and generate the refreshed target page according to the added change element unit and the remaining target element unit. In this case, the number of the added change element unit and the reduced target element unit can be the same, and in this case, the terminal can be normally displayed according to the size of each element unit in the updated page configuration information.
[0189] As an embodiment, as discussed above, the terminal associates the layout data including the called method with the target identification information of the corresponding target element unit through the objc_setAssociatedObject function. In order to simplify the page generation process of the terminal, in the embodiment of the present application, when generating a new page, if it is necessary to generate a target element unit that has been generated before, the terminal dynamically takes out the layout data corresponding to the target element unit through the objc_getAssociatedObject function to quickly generate the corresponding target element unit.
[0190] For example, please continue to refer to the example shown in Figure 4B When the user performs an up-slip operation on the target page shown in Figure 4B , the terminal can perform a refresh operation on the target page, and further generate the refreshed target page shown in Figure 8 , which is less than the first element unit in the target page, and adds the third element unit 800 shown in Figure 8 .
[0191] In order to more clearly illustrate the page generation method in the embodiment of the present application, please refer to Figure 9 , which is an interaction process diagram between the terminal and the server in the embodiment of the present application. The interaction process specifically includes: Figure 2A S901, the terminal obtains the element unit configuration information issued by the server.
[0192] The meaning of the element unit configuration information and the timing of the terminal obtaining the element unit configuration information can refer to the content discussed above, which will not be repeated here.
[0193] S902, the terminal associates and saves the identification information and the layout data in the element unit configuration information.
[0194] The meaning of the identification information and the layout data, and the way of associating and saving the identification information and the layout data can refer to the content discussed above, which will not be repeated here.
[0195] The meaning of the identification information and the layout data, and the way of associating and saving the identification information and the layout data can refer to the content discussed above, which will not be repeated here.
[0196] S903, the terminal generates a page generation request based on the page generation operation.
[0197] The meanings of page generation operations and page generation requests can be found in the previous discussion, and will not be repeated here.
[0198] S904, the terminal sends a page generation request to the server.
[0199] S905, the terminal receives the target page configuration information sent by the server.
[0200] The meaning of the target page configuration information and the method of generating the target page configuration information can be referred to the content discussed above, and will not be repeated here.
[0201] S906, the terminal obtains the corresponding layout data based on the target identifier information in the target page configuration information.
[0202] The methods for obtaining layout data can be referred to the previous discussion, and will not be repeated here.
[0203] S907, the terminal generates the target element unit based on the layout data and information content.
[0204] The method for generating target element units can be referred to the previous discussion, and will not be repeated here.
[0205] S908, the terminal generates the target page based on the target element unit.
[0206] The method for generating the target page can be referred to the previous discussion, and will not be repeated here.
[0207] S909, the terminal displays the target page.
[0208] exist Figure 9 In the described embodiment, the terminal can directly obtain the element unit configuration information of the new type of element unit from the server. Based on this configuration information, it associates the identification information and layout data of the new type of element unit. Subsequently, when a page needs to be loaded, the terminal can directly look up the layout data corresponding to the element unit on the page, and generate the corresponding element unit based on the layout data. This allows the new type of element unit to be loaded and displayed without updating the application on the terminal, improving page generation efficiency. Since no application release is required, it saves development manpower and improves development efficiency.
[0209] To more clearly illustrate the page generation method involved in the embodiments of this application, the following example uses a terminal executing the page generation method, with cell elements, to generate a feed stream page. Figure 10The flowchart of the page generation method is shown, and the page generation method in the embodiment of the present application is exemplarily introduced:
[0210] S1001, starting an application program.
[0211] S1002, the terminal loads cell configuration information of a cell.
[0212] After starting the application program, the terminal can load the cell configuration information obtained previously.
[0213] S1003, the terminal obtains new cell configuration information from a server, and associates and saves identification information and layout data of a new type of cell.
[0214] The new cell configuration information and the associated saving mode can refer to the content discussed above, and will not be repeated here.
[0215] S1004, the terminal generates a cell according to the corresponding layout data and information content.
[0216] The terminal can obtain target page configuration information, obtain corresponding layout data from the associated saved layout data according to the target page configuration information, and further generate a cell. The specific method of generating a cell can refer to the content of generating an element unit above, and will not be repeated here.
[0217] For example, the terminal can generate a cell by Method swizzling after obtaining the corresponding layout data. The specific method of generating a cell can refer to the content of generating an element unit above, and will not be repeated here.
[0218] S1005, the terminal displays a feed stream page.
[0219] In the embodiment shown, Figure 10 In the embodiment shown, the terminal can obtain the layout data of the new type of cell in the feed stream page from the server in advance, and when loading the feed stream page, directly obtain the corresponding layout data according to the page configuration file, so as to generate the corresponding cell according to the layout data, and further generate the target page. In this way, the terminal does not need to update the application program, and can display the new type of feed stream page, so as to improve the efficiency of generating the feed stream page.
[0220] Based on the same inventive concept as the above page generation method, the embodiment of the present application provides a page generation device, which is arranged in a terminal in which an application program is installed. Please refer to Figure 11 The device comprises:
[0221] The layout data registration module 1101 is configured to, in response to receiving new element unit configuration information issued by the server, save the identification information and layout data of a new type of element unit contained in the new element unit configuration information in association with each other, the element unit being a basic unit for generating a page;
[0222] The page configuration information obtaining module 1102 is configured to, in response to a page generation operation triggered on the application, obtain corresponding target page configuration information, wherein the target page configuration information includes target identification information of a target element unit for generating a target page, and information content associated with the target element unit, and the target element unit includes at least one of the new type of element unit.
[0223] The page generation module 1103 is configured to, based on the target identification information, acquire layout data corresponding to the target element unit; based on the layout data and the information content of the target element unit, generate the target element unit; and based on the target element unit, generate the target page.
[0224] In a possible implementation, the page configuration information obtaining module 1102 is specifically configured to:
[0225] In response to the page generation operation, send a page generation request to the server;
[0226] If new page configuration information fed back by the server is received, the new page configuration information is taken as the target page configuration information, and historical page configuration information recorded in the local cache is replaced based on the new page configuration information;
[0227] If no new page configuration information fed back by the server is received, the historical page configuration information recorded in the local cache is taken as the target page configuration information.
[0228] In a possible implementation, the new element unit configuration information contains a plurality of layout data associated with the new type of element unit, and each layout data corresponds to a layout data identifier, and the target page configuration information further includes a target layout data identifier corresponding to the target element unit; the page configuration information obtaining module 1102 is specifically configured to:
[0229] Based on the target identification information and the target layout data identifier, obtain the layout data corresponding to the target element unit.
[0230] In a possible implementation, the layout data corresponding to the target element unit includes a target view class corresponding to the target element unit, the target view class defining a type of page element supported by the target element unit for display, and the information content includes page element data corresponding to each page element in the target element unit; the page generation module 1103 is specifically configured to:
[0231] According to the information content, determine the number of each type of page element in the target element unit;
[0232] Input the number of each type of page element in the target element unit into the target view class, and create a corresponding number of page elements respectively;
[0233] Configure the page element data corresponding to each created page element in the information content into the corresponding page element respectively.
[0234] In a possible embodiment, the layout data corresponding to the target element unit further includes a data model for determining the size of the target element unit, and the information content further includes the presentation area information of each page element in the target page; the page generation module 1103 is further configured to:
[0235] Input the presentation area information of each page element in the target page into the data model to obtain the size of the target element unit.
[0236] In a possible embodiment, the layout data corresponding to the target element unit further includes a data model for determining the size of the target element unit, and the application program is provided with an extended interface for calculating the layout size of a text element in a page, each page element in the target element unit includes a text element, the information content further includes the presentation area information of other page elements in each page element except the text element, and the information content further includes text content corresponding to the text element and font parameters; the page generation module 1103 is specifically configured to:
[0237] Input the text content and the font parameters into the extended interface to determine the presentation area information of the text content in the target page;
[0238] Input the presentation area information of other page elements in each page element except the text element and the presentation area information in the target page into the data model to determine the size of the target element unit.
[0239] In a possible embodiment, if the number of target element units is a plurality, the content information further includes the arrangement order of the plurality of target element units; the page generation module 1103 is specifically configured to:
[0240] Generate the target page based on the target element unit, including:
[0241] Arrange the plurality of target element units in sequence according to the arrangement order to generate the target page.
[0242] In a possible embodiment, the page configuration information obtaining module 1102 is further configured to, after generating the target page based on the target element unit, obtain updated page configuration information in response to a page refresh operation triggered for the target page.
[0243] The page generation module 1103 is further configured to: if, compared with the target page configuration information, the updated page configuration information contains change identifier information and change information content of the changed element unit, determine the corresponding layout data based on the change identifier information; generate the changed element unit based on the layout data and change information content of the changed element unit; and generate the refreshed target page based on the target element unit and the changed element unit.
[0244] It should be noted that, Figure 11 The device in the document can be used to implement any of the page generation methods discussed above, which will not be elaborated here.
[0245] Based on the same inventive concept as the page generation method described above, this application provides a computer device, please refer to... Figure 12 The computer device includes a processor 1201 and a memory 1202.
[0246] The processor 1201 can be a central processing unit (CPU), or a digital processing unit, etc. This application embodiment does not limit the specific connection medium between the memory 1202 and the processor 1201. This application embodiment... Figure 12 The memory 1202 and the processor 1201 are connected via a bus 1203, and the bus 1203 is in Figure 12 The connections between other components are shown in thick lines only and are not intended to be limiting. Bus 1203 can be divided into address bus, data bus, control bus, etc. For ease of illustration, Figure 12 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0247] Memory 1202 may be volatile memory, such as random-access memory (RAM); memory 1202 may also be non-volatile memory, such as read-only memory, flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 1202 may be any other medium capable of carrying or storing desired program code having the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 1202 may be a combination of the above-described memories.
[0248] The processor 1201 is configured to execute any of the page generation methods discussed above when invoking the computer program stored in the memory 1202. The processor 1201 can also be configured to implement the functions of the terminal discussed above, or to implement the functions of the apparatus discussed above. Figure 11 The processor 1201 is configured to execute any of the page generation methods discussed above when invoking the computer program stored in the memory 1202. The processor 1201 can also be configured to implement the functions of the terminal discussed above, or to implement the functions of the apparatus discussed above.
[0249] Based on the same inventive concept, the embodiment of the present application provides a computer storage medium, which stores computer instructions. When the computer instructions are run on a computer, the computer executes any of the page generation methods discussed above.
[0250] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can 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-ROMs, optical storage devices, etc.) containing computer-usable program code.
[0251] Based on the same inventive concept, the embodiment of the present application provides a computer program product, which includes computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the page generation method discussed above.
[0252] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction-related hardware, and the foregoing program can be stored in a computer readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed. The foregoing storage medium includes mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks or optical disks, and various media that can store program codes.
[0253] Alternatively, the above-mentioned integrated units of the present application, if realized in the form of software function modules and sold or used as independent products, can also be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the methods described in the embodiments of the present application. The aforementioned storage medium includes: mobile storage devices, ROM, RAM, magnetic disks or optical disks, and various media that can store program codes.
[0254] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application belong to the scope of the claims of the present application and their equivalents, the present application also intends to include these modifications and variations.
Claims
1. A page generation method characterized by, Applied to a terminal, the terminal is installed with an application program, comprising: Parsing and processing the new element unit configuration information received from the server, obtaining the identification information and layout data of the new type of element unit contained in the new element unit configuration information, and associating and saving the identification information and corresponding layout data of the new type of element unit, the element unit being a basic unit for generating a page; the new element unit configuration information is issued by the server after detecting that there is no new type of element unit configuration information issued; In response to a page generation operation triggered on the application program, obtaining corresponding target page configuration information; wherein the target page configuration information includes target identification information of a target element unit for generating a target page, and information content associated with the target element unit; the target element unit includes at least one of the new type of element unit; the information content includes page element data corresponding to each page element in the target element unit, and presentation area information of the page element in the target page; Based on the target identification information, the layout data corresponding to the target element unit is obtained from the associated saved identification information and layout data; wherein the layout data includes a data model for determining the size of the target element unit, and a target view class corresponding to the target element unit, which defines the types of page elements supported by the target element unit for display; According to the information content, the number of each type of page element in the target element unit is determined, and the number of each type of page element in the target element unit is arranged in an array according to the preset composition order of each type of page element, and the array is input into the target view class to create a corresponding number of page elements, and the page element data corresponding to each created page element in the information content is configured into the corresponding page element; and the presentation area information of each page element in the target page is input into the data model to obtain the size of the target element unit; Based on the page elements in the target element unit and the size of the target element unit, the target page is generated.
2. The method of claim 1, wherein, The target page configuration information is obtained in response to the page generation operation triggered on the application program, comprising: In response to the page generation operation, a page generation request is sent to the server; If the new page configuration information fed back by the server is received, the new page configuration information is taken as the target page configuration information, and the historical page configuration information recorded in the local cache is replaced based on the new page configuration information; If the new page configuration information fed back by the server is not received, the historical page configuration information recorded in the local cache is taken as the target page configuration information.
3. The method of claim 1, wherein, The new element unit configuration information contains multiple layout data associated with the new type of element unit, and the layout data identifier corresponding to each layout data, and the target page configuration information further includes the target layout data identifier corresponding to the target element unit; The layout data corresponding to the target element unit is obtained based on the target identification information. The layout data corresponding to the target element unit is obtained based on the target identification information and the target layout data identification.
4. The method of claim 1, wherein, The layout data corresponding to the target element unit further includes a data model for determining the size of the target element unit, the application program is provided with an extension interface for calculating the layout size of a text element in a page, each page element in the target element unit includes a text element, the information content further includes presentation area information of other page elements in the target page except the text element, and the information content further includes text content and font parameters corresponding to the text element; The target element unit is generated based on the layout data and the information content of the target element unit, including: The text content and the font parameters are input into the extension interface to determine the presentation area information of the text content in the target page. The presentation area information of other page elements in the target page except the text element and the presentation area information in the target page are input into the data model to determine the size of the target element unit.
5. The method according to any one of claims 1 to 4, wherein If the number of the target element units is multiple, the information content further includes an arrangement order of the multiple target element units. The target page is generated based on the target element unit, including: The multiple target element units are arranged in sequence according to the arrangement order to generate the target page.
6. The method according to any one of claims 1 to 4, wherein After the target page is generated based on the target element unit, the method further includes: In response to a page refresh operation triggered for the target page, updated page configuration information is obtained; If there is changed identification information of a changed element unit and changed information content in the updated page configuration information compared with the target page configuration information, corresponding layout data is determined based on the changed identification information; The changed element unit is generated according to the layout data of the changed element unit and the changed information content; A refreshed target page is generated according to the target element unit and the changed element unit.
7. A page generation apparatus characterized by comprising: The device is arranged in a terminal, and the terminal is installed with an application program, and the device includes: A layout data registration module is configured to analyze and process received new element unit configuration information issued by a server, obtain identification information and layout data of a new type of element unit contained in the new element unit configuration information, and save the identification information and corresponding layout data of the new type of element unit in association, the element unit being a basic unit for generating a page, and the new element unit configuration information being issued by the server after detecting that new type of element unit configuration information has not been issued. The page configuration information obtaining module is configured to obtain target page configuration information corresponding to a page generation operation triggered on the application program, wherein the target page configuration information comprises target identification information of a target element unit used to generate a target page and information content associated with the target element unit, the target element unit comprises at least one of the new type of element units, and the information content comprises page element data corresponding to each page element in the target element unit and presentation area information of the page element in the target page. The page generation module is configured to obtain layout data corresponding to the target element unit from the associated saved identification information and layout data based on the target identification information, wherein the layout data comprises a data model used to determine the size of the target element unit and a target view class corresponding to the target element unit, and the target view class defines a type of page element supported by the target element unit for display. According to the information content, the number of each type of page element in the target element unit is determined, the number of each type of page element in the target element unit is arranged in a preset order of composition of each type of page element to form an array, the array is input into the target view class, a corresponding number of page elements are created, page element data corresponding to each created page element in the information content is configured into the corresponding page element, and the presentation area information of each page element in the target page is input into the data model to obtain the size of the target element unit. The target page is generated based on the page elements in the target element unit and the size of the target element unit.
8. A computer device, comprising: The method comprises the following steps: at least one processor, and a memory connected in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements the method according to any one of claims 1-6 by executing the instructions stored in the memory.
9. A computer storage medium, characterized in that The computer storage medium stores computer instructions, and when the computer instructions run on a computer, the computer executes the method according to any one of claims 1-6.
Citation Information
Patent Citations
Method and apparatus used for dynamic layout of interface elements of mobile application
CN108509526A