View element exposure detection method, device, electronic device and storage medium
By configuring element identification for view elements of Flutter page and monitoring life cycle status updates, the problem of inaccurate judgment of view elements on Flutter page view elements is solved, and accurate judgment and performance optimization of view elements are achieved.
Patent Information
- Application Number
- CN202111112536.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-18
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2041-09-18
AI Technical Summary
When using Flutter technology, the method of judging the exposure status of view elements is inaccurate and consumes a lot of performance, especially in the case of Flutter page rendering mechanism multiplexing and multi-view element list scrolling, resulting in serious application performance loss.
By configuring element identifiers for multiple view elements of the Flutter page applied to the target, when monitoring the component's lifecycle state update, compare the view element identifiers before and after the lifecycle state update to determine whether exposure and reporting are required, so as to accurately judge the view element's Exposure status.
It realizes accurate judgment of the exposure status of Flutter page view elements, avoids application performance losses, and ensures page fluency.
Smart Images

Figure CN113791963B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for detecting exposure of a view element. Background Art
[0002] Flutter is a cross-platform user interface (UI) framework launched by Google. It can implement a set of codes and reuse them on multiple terminals, making it easy for developers to efficiently build multi-platform applications through a set of codes.
[0003] When using Flutter to meet some business needs, you often encounter situations where you need to count the exposure status of view elements in the application page to determine whether the view elements in the application page are exposed, that is, whether the view elements in the application page are visible to the user. In Android and iOS, the solution for determining whether the view elements in the application page are exposed is already very mature, but Flutter technology has not been promoted for a long time, and there is no mature solution for processing view element exposure. In addition, Flutter's page rendering mechanism is quite different from Android and iOS, so there is an urgent need for a simple and available solution for processing view element exposure.
[0004] Currently, for Flutter, there are two main strategies for determining whether the view elements in the Flutter page of the application are exposed: 1. If the component (the component corresponds to the code level) executes the initial state life cycle, it can be determined that the view element corresponding to the component is in the user-visible state (that is, the element is exposed); 2. By calculating the upper and lower boundary offsets of the view element and comparing them with the screen coordinates, it is determined whether the view element is in the user-visible state.
[0005] For strategy 1, Flutter's page rendering mechanism reuses components. Although the user sees new content, the component does not execute the initial state lifecycle and does not report exposure, so the exposure judgment is inaccurate. For strategy 2, the solution for calculating the offset of the view element boundary is relatively complex, and for an element list including multiple view elements, the offset of each view element needs to be calculated frequently, which will cause the list scrolling to be stuck and seriously affect the application performance.
[0006] It can be seen that in the prior art, when judging the exposure status of view elements in the Flutter page of the application, there are problems such as inaccurate judgment or relatively complex judgment strategy, which may easily cause serious loss of application performance. Summary of the invention
[0007] The embodiments of the present invention provide a method, device, electronic device and storage medium for detecting exposure of a view element, so as to solve the problem in the prior art that, when judging the exposure status of a view element in a Flutter page of an application, the judgment is inaccurate or the judgment strategy is relatively complex, which may cause serious loss of application performance.
[0008] In a first aspect, an embodiment of the present invention provides a method for detecting exposure of a view element, comprising:
[0009] Configure element identifiers corresponding to multiple view elements, respectively, where the multiple view elements are elements corresponding to the Flutter page of the target application, and the multiple view elements correspond to at least one component, and the at least one component is a component corresponding to the target application;
[0010] In the case where a state update occurs in the life cycle of a target component, determining a first view element and a second view element respectively corresponding to the target component before and after the life cycle state update, the first view element is in an exposed state and the exposure status has been reported to the server, and the target component is one of the at least one component;
[0011] According to a first element identifier corresponding to the first view element and a second element identifier corresponding to the second view element, it is determined whether the second view element is an updated view element that needs to be exposed and reported.
[0012] In a second aspect, an embodiment of the present invention provides a device for detecting exposure of a view element, comprising:
[0013] A configuration module, used to configure element identifiers corresponding to a plurality of view elements, respectively, where the plurality of view elements are elements corresponding to a Flutter page of a target application, and the plurality of view elements correspond to at least one component, and the at least one component is a component corresponding to the target application;
[0014] A first determination module is used to determine, when monitoring that a state update occurs in the life cycle of a target component, a first view element and a second view element respectively corresponding to the target component before and after the life cycle state update, wherein the first view element is in an exposed state and the exposure status has been reported to the server, and the target component is one of the at least one component;
[0015] The second determining module is used to determine whether the second view element is an updated view element that needs to be exposed and reported according to a first element identifier corresponding to the first view element and a second element identifier corresponding to the second view element.
[0016] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the above-mentioned method for detecting exposure of view elements when executed by the processor.
[0017] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned view element exposure detection method are implemented.
[0018] The technical solution of the embodiment of the present invention configures element identifiers for multiple view elements corresponding to the Flutter page of the target application respectively, and when monitoring the life cycle of the target component of at least one component corresponding to the multiple view elements, determines the first view element and the second view element corresponding to the target component before and after the life cycle state update respectively, and determines whether the second view element is the updated view element that needs to be exposed and reported according to the first element identifier corresponding to the first view element and the second element identifier corresponding to the second view element. The situation of the view element exposed by the Flutter page can be accurately judged based on the element identifier, and at the same time, the performance of the application can be guaranteed, and the jamming of the Flutter page can be avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 Schematic diagram showing a method for detecting exposure of a view element provided by an embodiment of the present invention
[0020] Figure 2 A flowchart showing a specific implementation of a method for detecting exposure of a view element provided by an embodiment of the present invention;
[0021] Figure 3 A schematic diagram showing a device for detecting exposure of a view element provided by an embodiment of the present invention;
[0022] Figure 4 A schematic diagram of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present invention. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0025] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0026] In view of the problem that in the prior art, when judging the exposure of view elements in the Flutter page of an application, the judgment is inaccurate or the judgment strategy is relatively complex, which may cause serious loss of application performance, the embodiment of the present invention provides a method for detecting exposure of view elements, see Figure 1 As shown, the method includes:
[0027] Step 101: configure element identifiers corresponding to multiple view elements, where the multiple view elements are elements corresponding to the Flutter page of the target application, and the multiple view elements correspond to at least one component, and the at least one component is a component corresponding to the target application.
[0028] The target application in the embodiment of the present invention is an application developed based on Flutter technology, and the Flutter page is an application page rendered based on Flutter technology. The target application may correspond to at least one Flutter page, and the Flutter page of the target application corresponds to multiple view elements. For multiple view elements, multiple view elements correspond to at least one component, and at least one component is a component corresponding to the target application. The component corresponds to the code level, and a component may correspond to different view elements at different times.
[0029] For multiple view elements corresponding to the Flutter page of the target application, you can configure element identifiers corresponding to each view element. The element identifiers here can be used as identity identifiers of the view elements to distinguish the view elements.
[0030] Step 102: When a life cycle status update of a target component is monitored, determine the first view element and the second view element that respectively correspond to the target component before and after the life cycle status update, the first view element is in an exposed state and the exposure status has been reported to the server, and the target component is one of the at least one components.
[0031] After configuring element identifiers for multiple view elements corresponding to the Flutter page of the target application, the life cycle of each component can be monitored. In the case of monitoring that the life cycle of the target component has a state update, the first view element and the second view element corresponding to the life cycle state before and after the update can be determined for the target component. The target component is one of the at least one components corresponding to the Flutter page of the target application. Among them, the first view element corresponding to the target component is the view element corresponding to the target component before the life cycle state is updated, and the second view element corresponding to the target component is the view element corresponding to the life cycle state of the target component after the update. The first view element is in an exposed state, and the exposure status corresponding to the first view element in the exposed state has been reported to the server. The server determines that the first view element is visible to the user on the Flutter page according to the exposed state of the first view element, and the user can browse it. The server here is the server corresponding to the target application.
[0032] Step 103: Determine whether the second view element is an updated view element that needs to be exposed and reported, according to the first element identifier corresponding to the first view element and the second element identifier corresponding to the second view element.
[0033] After determining the first view element and the second view element corresponding to the target component before and after its lifecycle status is updated, the first element identifier corresponding to the first view element and the second element identifier corresponding to the second view element can be obtained, and then based on the first element identifier and the second element identifier, it is detected whether the second view element is an updated view element that needs to be exposed and reported, and based on the detection result, it is determined whether the second view element is a new view element and whether it needs to be exposed and reported.
[0034] In the above implementation process, by respectively configuring element identifiers for multiple view elements corresponding to the Flutter page of the target application, when monitoring that the life cycle of the target component in at least one component corresponding to the multiple view elements has a state update, the first view element and the second view element corresponding to the target component before and after the life cycle state update are determined, and according to the first element identifier corresponding to the first view element and the second element identifier corresponding to the second view element, it is determined whether the second view element is the updated view element that needs to be exposed and reported. The situation of the view elements exposed by the Flutter page can be accurately judged based on the element identifier, and at the same time, the performance of the application can be guaranteed to avoid the jamming of the Flutter page.
[0035] Wherein, step 103 determines whether the second view element is an updated view element that needs to be reported for exposure according to the first element identifier corresponding to the first view element and the second element identifier corresponding to the second view element, including:
[0036] Detect whether the first element identifier and the second element identifier are the same element identifier;
[0037] When the first element identifier and the second element identifier are the same element identifier, determining that the second view element is a view element that does not need to be exposed and reported;
[0038] In a case where the first element identifier and the second element identifier are different element identifiers, it is determined that the second view element is an updated view element that needs to be exposed and reported.
[0039] When determining whether the second view element is an updated view element that needs to be exposed and reported based on the first element identifier corresponding to the first view element and the second element identifier corresponding to the second view element, it can be detected whether the first element identifier and the second element identifier are the same element identifier. If the first element identifier and the second element identifier are the same element identifier, it can be determined that the second view element is the same view element as the first view element, the second view element does not belong to a new view element, and the view element corresponding to the target component before and after the life cycle state is updated has not changed. Since the first view element is in an exposed state, the second view element does not need to be exposed and reported. If the first element identifier and the second element identifier do not belong to the same element identifier, it can be determined that the second view element is a different view element from the first view element. At this time, it is determined that the second view element is a new view element and needs to be exposed and reported.
[0040] The above implementation process compares the element identifiers of the two view elements corresponding to the target component before and after the life cycle status is updated, and determines whether the view element is updated based on whether the element identifiers are the same. This can accurately identify whether the view element corresponding to the target component after the life cycle status is updated needs to be exposed and reported, so as to achieve fast and effective exposure reporting identification based on element identifiers.
[0041] In an optional embodiment of the present invention, the method further comprises the following steps:
[0042] When monitoring that the target component executes the initial state life cycle, determining that the first view element corresponding to the target component is in an exposed state;
[0043] When it is determined that the first view element corresponding to the target component is in an exposed state, the exposure status of the first view element is reported to the server.
[0044] When the target component is monitored to execute the initial state life cycle, it indicates that the target component is inserted into the view tree, so the current view element corresponding to the target component (the first view element of the target component) is in a user-visible state, that is, the first view element of the target component is in an exposed state. When it is determined that the first view element of the target component is in an exposed state, the exposure status of the first view element can be reported to the server. The server can determine that the first view element is in a user-visible state on the Flutter page based on the exposure status of the first view element, and the user can browse it.
[0045] The above process can determine that the first view element corresponding to the target component is in a user-visible state when the target component executes the initial state life cycle. The present invention can also determine whether the second view element is an updated view element that needs to be exposed and reported when the state is updated in the life cycle of the target component, thereby achieving comprehensive and accurate judgment of the exposure status of the view elements corresponding to the Flutter page, including the first exposure and the exposure when the view elements are updated. At the same time, the performance of the application can be guaranteed without causing page freezes.
[0046] Among them, in this embodiment, the exposure judgment logic can be encapsulated through code design, and the reusability of the code can be improved through encapsulation, so that the developer does not need to care about the exposure logic. After the view element is exposed, the exposure status of the view element can be reported to the server, so that the server can determine which view elements are visible to the user on the Flutter page based on the exposure status of the view element, and then obtain the user's behavior information to determine the user's behavior preference.
[0047] Optionally, after determining that the second view element is an updated view element that needs to be exposed and reported, the method further includes:
[0048] Reporting the exposure status of the second view element in the exposed state to the server;
[0049] Wherein, in a state of reporting the exposure status of the second view element to the server, the second view element is a view element obtained after updating the first view element.
[0050] When it is determined that the second view element is different from the first view element, it can be determined that the second view is a view element obtained after the first view element is updated. Since the second view element is different from the first view element, it can be determined that the second view element is a view element that needs to be reported for exposure. At this time, the exposure status corresponding to the second view element (in an exposed state) can be reported to the server, and the server determines that the second view element is visible to the user on the Flutter page based on the received exposure status.
[0051] In the above process, when a view element is updated, the exposure status of the view element obtained after the update is reported to the server, so that the exposure status of the view element can be collected and uploaded to the server, so that the server can determine which view elements are visible to the user on the Flutter page, and then obtain the user's behavior information based on the exposure status of the view element.
[0052] Optionally, when configuring element identifiers corresponding to multiple view elements, include:
[0053] For multiple view elements corresponding to the Flutter page of the target application, configure element identifiers corresponding to the multiple view elements based on the component association relationship;
[0054] The component association relationship includes the association relationship between components and the association relationship between different view elements corresponding to each component.
[0055] When configuring corresponding element identifiers for multiple view elements corresponding to the Flutter page of the target application, a first association relationship between components in at least one component corresponding to the target application and a second association relationship between different view elements corresponding to the same component can be determined, and a component association relationship is generated according to the first association relationship and the second association relationship. Configuring element identifiers for multiple view elements based on the component association relationship can associate element identifiers of view elements corresponding to different components with association relationships, and associate element identifiers of different view elements of the same component.
[0056] For example, the Flutter page of the target application corresponds to three components, namely component 1, component 2 and component 3. The three view elements corresponding to component 1 are view element 1, view element 2 and view element 3, respectively. The three view elements corresponding to component 2 are view element 4, view element 5 and view element 6, respectively. The three view elements corresponding to component 3 are view element 7, view element 8 and view element 9, respectively. Component 1 corresponds to the first area of the Flutter page, component 2 corresponds to the second area of the Flutter page, and component 3 corresponds to the third area of the Flutter page. The first area is adjacent to the second area, and the second area is adjacent to the third area. Component 1 forms a first association relationship with component 2, which is equivalent to forming a first association relationship between the first area and the second area. Component 2 forms a first association relationship with component 3, which is equivalent to forming a first association relationship between the second area and the third area. View element 1, view element 2 and view element 3 form a second association relationship, view element 4, view element 5 and view element 6 form a second association relationship, and view element 7, view element 8 and view element 9 form a third association relationship. When configuring element identifiers, you can configure view element 1 to correspond to element identifier 1, view element 2 to correspond to element identifier 2, view element 3 to correspond to element identifier 3, view element 4 to correspond to element identifier 11, view element 5 to correspond to element identifier 12, view element 6 to correspond to element identifier 13, view element 7 to correspond to element identifier 21, view element 8 to correspond to element identifier 22, and view element 9 to correspond to element identifier 23. So far, the serial numbers of the element identifiers of the view elements corresponding to the same component are arranged in ascending order, and the units digits of the serial numbers of the view elements in the same arrangement position corresponding to different components are the same.
[0057] In the above implementation process, by configuring element identifiers based on component association relationships, associations between element identifiers can be formed based on relationships between components and associations between different view elements of the same component.
[0058] The following is an introduction to the reuse of components through a specific example. Component 1 corresponds to view element 1 and view element 2. When component 1 executes the initial state life cycle, it determines that the first view element (view element 1) corresponding to component 1 is in an exposed state, and reports the exposure status of the first view element to the server. When the state of component 1 is updated during its life cycle, view element 1 is updated to view element 2, and view element 2 reuses component 1. Although component 1 does not execute the initial state life cycle again, the element identifier corresponding to view element 2 is different from the element identifier corresponding to view element 1. Therefore, it is necessary to report the exposure of view element 2, which can ensure the accuracy of the exposure report judgment.
[0059] The following is an introduction to the method for detecting exposure of a view element provided by an embodiment of the present invention through a specific example. Figure 2 As shown, the following steps are included:
[0060] Step 201: For multiple view elements corresponding to the Flutter page of the target application, configure corresponding element identifiers, where the multiple view elements correspond to at least one component, and the at least one component is a component corresponding to the target application.
[0061] Step 202: when monitoring the target component to execute the initial state life cycle, determine that the first view element corresponding to the target component is in an exposed state, report the exposure status of the first view element to the server, and the target component is one of the at least one components.
[0062] Step 203: When a state update of the target component's life cycle is detected, determine the first view element and the second view element that respectively correspond to the target component before and after the life cycle state update, and the first view element is in an exposed state and the exposure status has been reported to the server.
[0063] Step 204: Obtain a first element identifier corresponding to the first view element and a second element identifier corresponding to the second view element.
[0064] Step 205 , detect whether the first element identifier and the second element identifier are the same element identifier, if so, execute step 206 , otherwise, execute step 207 .
[0065] Step 206: When the first element identifier and the second element identifier are the same element identifier, determine that the second view element is a view element that does not need to be exposed and reported.
[0066] Step 207: When the first element identifier and the second element identifier are different element identifiers, determine that the second view element is an updated view element that needs to be exposed and reported.
[0067] The above implementation process, by configuring the element identifier corresponding to the view element, can accurately judge the situation of the view element exposed by the Flutter page based on the element identifier, and can also realize comprehensive and accurate judgment of the exposure situation of the view element corresponding to the Flutter page, including the first exposure and the exposure when the view element is updated. At the same time, it can ensure the performance of the application and avoid the jamming of the Flutter page.
[0068] The above is the implementation process of the method for detecting exposure of view elements provided in an embodiment of the present invention. By respectively configuring element identifiers for multiple view elements corresponding to the Flutter page of the target application, when monitoring that the life cycle of the target component in at least one component corresponding to the multiple view elements has a state update, the first view element and the second view element corresponding to the target component before and after the life cycle state update are determined. According to the first element identifier corresponding to the first view element and the second element identifier corresponding to the second view element, it is determined whether the second view element is the updated view element that needs to be exposed and reported. The situation of the view element exposed by the Flutter page can be accurately judged based on the element identifier, and at the same time, the performance of the application can be guaranteed, and the jamming of the Flutter page can be avoided.
[0069] Furthermore, it is possible to comprehensively and accurately determine the exposure of the view elements corresponding to the Flutter page, including the first exposure and the exposure when the view elements are updated; by reporting the exposure of the view elements to the server, the server can determine which view elements are visible to the user on the Flutter page, and then obtain the user's behavior information to determine the user's behavior preferences; by configuring element identification based on component association relationships, associations between element identifications can be formed based on the relationships between components and the associations between different view elements corresponding to the same component.
[0070] The embodiment of the present invention also provides a device for detecting exposure of a view element, see Figure 3 As shown, including:
[0071] A configuration module 301 is used to configure element identifiers corresponding to multiple view elements, where the multiple view elements are elements corresponding to the Flutter page of the target application, and the multiple view elements correspond to at least one component, and the at least one component is a component corresponding to the target application;
[0072] A first determining module 302 is used to determine, when monitoring that a state update occurs in the life cycle of a target component, a first view element and a second view element respectively corresponding to the target component before and after the life cycle state update, the first view element is in an exposed state and the exposure status has been reported to the server, and the target component is one of the at least one component;
[0073] The second determining module 303 is configured to determine whether the second view element is an updated view element that needs to be exposed and reported according to a first element identifier corresponding to the first view element and a second element identifier corresponding to the second view element.
[0074] Optionally, the second determining module includes:
[0075] A detection submodule, used to detect whether the first element identifier and the second element identifier are the same element identifier;
[0076] a first determining submodule, configured to determine, when the first element identifier and the second element identifier are the same element identifier, that the second view element is a view element that does not require exposure reporting;
[0077] The second determining submodule is configured to determine, when the first element identifier and the second element identifier are different element identifiers, that the second view element is an updated view element that needs to be exposed and reported.
[0078] Optionally, the device further comprises:
[0079] A third determination module is used to determine that the first view element corresponding to the target component is in an exposed state when monitoring that the target component executes the initial state life cycle;
[0080] The first reporting module is used to report the exposure status of the first view element to the server when it is determined that the first view element corresponding to the target component is in an exposed state.
[0081] Optionally, the device further comprises:
[0082] A second reporting module, configured to report the exposure status of the second view element in an exposed state to the server after determining that the second view element is an updated view element that needs to be reported for exposure;
[0083] Wherein, in a state where the exposure status of the second view element is reported to the server, the second view element is a view element obtained after performing an element update on the first view element.
[0084] Optionally, the configuration module is further used to:
[0085] For the multiple view elements corresponding to the Flutter page of the target application, based on the component association relationship, configure element identifiers corresponding to the multiple view elements respectively;
[0086] The component association relationship includes the association relationship between the components and the association relationship between different view elements corresponding to each component.
[0087] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0088] On the other hand, an embodiment of the present invention further provides an electronic device, including a memory, a processor, a bus, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above-mentioned method for detecting exposure of view elements when executing the program.
[0089] For example, Figure 4 A schematic diagram of the physical structure of an electronic device is shown.
[0090] like Figure 4 As shown, the electronic device may include: a processor (processor) 410, a communication interface (Communications Interface) 420, a memory (memory) 430 and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 complete mutual communication through the communication bus 440. The processor 410 can call the logic instructions in the memory 430 to perform the following steps: configure the element identifiers corresponding to multiple view elements, the multiple view elements are elements corresponding to the Flutter page of the target application, and the multiple view elements correspond to at least one component, and the at least one component is the component corresponding to the target application; when the life cycle of the target component is monitored to have a state update, determine the first view element and the second view element corresponding to the target component before and after the life cycle state update, the first view element is in an exposed state and the exposure has been reported to the server, and the target component is one of the at least one component; according to the first element identifier corresponding to the first view element and the second element identifier corresponding to the second view element, determine whether the second view element is an updated view element that needs to be exposed and reported. The processor 410 can also implement other implementation processes of the detection method for view element exposure, which will not be repeated here.
[0091] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, 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 for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0092] On the other hand, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the method for detecting exposure of a view element provided in the above embodiments.
[0093] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0094] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting exposure of view elements, It is characterized in that include: Configure element identifiers corresponding to multiple view elements, respectively, where the multiple view elements are elements corresponding to the Flutter page of the target application, and the multiple view elements correspond to at least one component, and the at least one component is a component corresponding to the target application; In the case where a state update occurs in the life cycle of a target component, determining a first view element and a second view element respectively corresponding to the target component before and after the life cycle state update, the first view element is in an exposed state and the exposure status has been reported to the server, and the target component is one of the at least one component; Determining, according to a first element identifier corresponding to the first view element and a second element identifier corresponding to the second view element, whether the second view element is an updated view element that needs to be exposed and reported, includes: Detecting whether the first element identifier and the second element identifier are the same element identifier; When the first element identifier and the second element identifier are the same element identifier, determining that the second view element is a view element that does not need to be exposed and reported; In a case where the first element identifier and the second element identifier are different element identifiers, it is determined that the second view element is an updated view element that needs to be exposed and reported.
2. The method according to claim 1, It is characterized in that The method further comprises: In the case where it is monitored that the target component executes the initial state life cycle, determining that the first view element corresponding to the target component is in an exposed state; When it is determined that the first view element corresponding to the target component is in an exposed state, the exposure status of the first view element is reported to the server.
3. The method according to claim 1, It is characterized in that After determining that the second view element is an updated view element that needs to be exposed and reported, the method further includes: Reporting the exposure status of the second view element in an exposed state to the server; Wherein, in a state where the exposure status of the second view element is reported to the server, the second view element is a view element obtained after performing an element update on the first view element.
4. The method according to claim 1, It is characterized in that The configuration of element identifiers corresponding to the multiple view elements respectively includes: For the multiple view elements corresponding to the Flutter page of the target application, based on the component association relationship, configure element identifiers corresponding to the multiple view elements respectively; The component association relationship includes the association relationship between the components and the association relationship between different view elements corresponding to each component.
5. A device for detecting exposure of a view element, It is characterized in that include: A configuration module, used to configure element identifiers corresponding to a plurality of view elements, respectively, where the plurality of view elements are elements corresponding to a Flutter page of a target application, and the plurality of view elements correspond to at least one component, and the at least one component is a component corresponding to the target application; A first determination module is used to determine, when monitoring that a state update occurs in the life cycle of a target component, a first view element and a second view element respectively corresponding to the target component before and after the life cycle state update, wherein the first view element is in an exposed state and the exposure status has been reported to the server, and the target component is one of the at least one component; a second determining module, configured to determine, according to a first element identifier corresponding to the first view element and a second element identifier corresponding to the second view element, whether the second view element is an updated view element that needs to be exposed and reported; The second determining module comprises: A detection submodule, used to detect whether the first element identifier and the second element identifier are the same element identifier; a first determining submodule, configured to determine, when the first element identifier and the second element identifier are the same element identifier, that the second view element is a view element that does not require exposure reporting; The second determining submodule is configured to determine, when the first element identifier and the second element identifier are different element identifiers, that the second view element is an updated view element that needs to be exposed and reported.
6. The device according to claim 5, It is characterized in that The device also includes: A third determination module is used to determine that the first view element corresponding to the target component is in an exposed state when monitoring that the target component executes the initial state life cycle; The first reporting module is used to report the exposure status of the first view element to the server when it is determined that the first view element corresponding to the target component is in an exposed state.
7. An electronic device, It is characterized in that The method comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the method for detecting exposure of a view element according to any one of claims 1 to 4 are implemented.
8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for detecting exposure of a view element according to any one of claims 1 to 4 are implemented.
