Page processing method, apparatus and device
By constructing a second binder and a lifecycle callback unit to obtain mobile application page element data, the problems of low page collection efficiency and insufficient security in existing technologies are solved, and efficient and secure page data collection and overlay are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU ALIBABA INT INTERNET IND CO LTD
- Filing Date
- 2022-10-19
- Publication Date
- 2026-06-16
AI Technical Summary
In existing technologies, mobile application page content collection is inefficient, has low coverage, and lacks online user data security, especially in the offline testing phase where it is impossible to obtain page content after real user operations.
By determining the page data collection configuration information of the mobile application, a second binder that inherits from the first binder is constructed. The first and second lifecycle callback units are used to obtain page element data of the mobile operating system and mobile UI framework. Only allowed page element content is collected to avoid leakage of user privacy. The opening and closing of all pages are monitored under page lifecycle management.
It improved the efficiency of page data collection, ensured the security of online user data and page coverage, avoided frequent collection of the same page content, saved system resources, and improved user experience.
Smart Images

Figure CN115659090B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of mobile application page processing technology, specifically to page processing methods and apparatus, as well as electronic devices. Background Technology
[0002] With the increasing prevalence of mobile smart devices (such as smartphones and tablets), more and more mobile terminal applications, or simply mobile applications (APPs), have emerged. The page content of mobile applications is a crucial type of data, and many processing methods require access to it. For example, international e-commerce apps need to detect untranslated content on the page. Currently, a typical method for obtaining mobile application page content is to capture screenshots and then manually or using text recognition algorithms to extract the various textual information from the screenshots.
[0003] However, the above solutions have at least the following problems: 1) Whether the text is identified manually or by algorithms, the efficiency of page data collection is low; 2) Page screenshots include the complete content of the page, which may involve user privacy information, so they are only suitable for offline testing of mobile applications, and not for processing already launched mobile applications; 3) The pages displayed in the offline testing phase are not the pages displayed after real user operations, so there are some pages that cannot be accessed, and therefore it is impossible to obtain screenshots of these pages, and thus impossible to perform processes such as missed page detection on these pages. Summary of the Invention
[0004] This application provides a page processing method to address the problems of low page data collection efficiency, low page coverage, and low online user data security in existing technologies. This application also provides a page processing apparatus and an electronic device.
[0005] This application provides a page processing method, including:
[0006] The page data collection configuration information of the mobile application is determined. The native page of the mobile application includes a first page element of the mobile operating system and a view component of the mobile UI framework. The view component includes a second page element of the mobile UI framework. The page lifecycle callback unit of the native page is a first lifecycle callback unit. The mobile UI framework includes a mobile UI framework engine, a component framework, and a first binder for binding the component framework and the mobile UI framework engine. The first binder includes a page lifecycle callback unit, and the page lifecycle callback unit of the first binder is a second lifecycle callback unit.
[0007] Construct a second binder that inherits from the first binder, wherein the second lifecycle callback unit in the second binder includes program code for collecting data of the second page elements;
[0008] When processing the target native page, the first lifecycle callback unit obtains the data of the first page elements included in the target native page according to the configuration information; when processing the view components of the mobile UI framework included in the target native page, the first lifecycle callback unit obtains the data of the second page elements included in the target native page by calling the second lifecycle callback unit according to the root element reference of the second page element tree and the configuration information.
[0009] Process the data of the first page element and the data of the second page element.
[0010] Optionally, the configuration information includes: an identifier for at least one native page;
[0011] If the identifier of the at least one native page includes the identifier of the target native page, then the page data of the target native page is obtained.
[0012] Optionally, the configuration information may also include: an identifier for at least one page element;
[0013] The step of obtaining the page data of the target native page includes:
[0014] Based on the identifier of the at least one page element, obtain the data of the at least one page element included in the target native page.
[0015] Optionally, the configuration information may further include: page element type information; the page element type includes: a first page element type and / or a second page element type;
[0016] The step of obtaining data of the at least one page element included in the target native page based on the identifier of the at least one page element includes:
[0017] Based on the identifier of the at least one page element and the corresponding page element type, obtain the data of the first page element and the data of the second page element included in the target native page.
[0018] Optionally, the configuration information includes: switch information for performing page data acquisition and processing;
[0019] If the switch information is on, then the page data of the target native page is obtained.
[0020] Optionally, the configuration information includes: page data collection frequency;
[0021] Based on the page data collection frequency, obtain the page data of the target native page.
[0022] Optional, also includes:
[0023] When the target native page is opened, the configuration information is obtained through the first lifecycle callback unit;
[0024] When leaving the target native page, the data of the first page element is obtained through the first lifecycle callback unit according to the configuration information; the data of the second page element is obtained by calling the second lifecycle callback unit according to the root element reference and the configuration information.
[0025] Optional, also includes:
[0026] Based on the first lifecycle callback unit, a first software development kit is generated, wherein the first page element data acquisition program code included in the first lifecycle callback unit is written in the native language of the mobile operating system;
[0027] Based on the second binder, a second software development kit is generated, and the second page element data acquisition program code included in the second lifecycle callback unit is written in the language of a mobile UI framework;
[0028] Deploy the first software development kit and the second software development kit to the target mobile application.
[0029] Optional, also includes:
[0030] Determine the path and location of page elements;
[0031] The processing of the data of the first page element and the data of the second page element includes:
[0032] Based on the path location, process the data of the first page element and the data of the second page element.
[0033] Optionally, processing the data of the first page element and the data of the second page element includes:
[0034] Based on the data of the first page element and the data of the second page element, obtain the untranslated data included in the target native page.
[0035] This application also provides a page processing method, including:
[0036] Determine the page data collection configuration information of the mobile application. The native page of the mobile application includes the first page element of the mobile operating system and the view component of the mobile UI framework. The view component includes the second page element of the mobile UI framework.
[0037] Based on the configuration information, page data of the target native page of the mobile application is collected, and the page data includes data of the first page element and data of the second page element;
[0038] Process the page data of the target native page.
[0039] This application also provides a page processing apparatus, including:
[0040] A configuration information determination unit is used to determine the page data collection configuration information of a mobile application. The native page of the mobile application includes a first page element of the mobile operating system and a view component of the mobile UI framework. The view component includes a second page element of the mobile UI framework. The page lifecycle callback unit of the native page is a first lifecycle callback unit. The mobile UI framework includes a mobile UI framework engine, a component framework, and a first binder for binding the component framework and the mobile UI framework engine. The first binder includes a page lifecycle callback unit, and the page lifecycle callback unit of the first binder is a second lifecycle callback unit.
[0041] The second binder construction unit is used to construct a second binder that inherits from the first binder. The second lifecycle callback unit in the second binder includes program code for collecting data of the second page elements.
[0042] The first page element data acquisition unit is used to acquire the data of the first page elements included in the target native page through the first lifecycle callback unit according to the configuration information when processing the target native page;
[0043] The second page element data acquisition unit is used by the first lifecycle callback unit to obtain the data of the second page elements included in the target native page by calling the second lifecycle callback unit, based on the root element reference of the second page element tree and the configuration information;
[0044] The page data processing unit is used to process the data of the first page element and the data of the second page element.
[0045] This application also provides a page processing apparatus, including:
[0046] The configuration information determination unit is used to determine the page data collection configuration information of the mobile application. The native page of the mobile application includes the first page element of the mobile operating system and the view component of the mobile UI framework. The view component includes the second page element of the mobile UI framework.
[0047] The page data acquisition unit is used to acquire page data of the target native page of the mobile application according to the configuration information. The page data includes data of the first page element and data of the second page element.
[0048] The page data processing unit is used to process the page data of the target native page.
[0049] This application also provides an electronic device, including:
[0050] Processor and memory;
[0051] A memory for storing a program that implements any of the page processing methods described above, wherein the device is powered on and the program of the method is executed by the processor.
[0052] This application also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the various methods described above.
[0053] This application also provides a computer program product including instructions that, when run on a computer, cause the computer to perform the various methods described above.
[0054] Compared with the prior art, this application has the following advantages:
[0055] The page processing method provided in this application involves: determining the page data collection configuration information of a mobile application; constructing a second binder that inherits from a first binder, wherein the second lifecycle callback unit in the second binder includes program code for collecting second page element data; when processing a target native page, obtaining the first page element data of the mobile operating system included in the target native page according to the configuration information through the first lifecycle callback unit of the native page; when processing the view components of the mobile UI framework, the first lifecycle callback unit obtains the second page element data of the target native page by calling the second lifecycle callback unit according to the root element reference of the second page element tree of the mobile UI framework and the configuration information; and processing the data of the first page elements and the data of the second page elements. This processing method enables the collection of page content from an online APP based on configuration information. Since the configuration information includes page element collection restriction information, only page element content that is allowed to be collected will be collected, thus avoiding the leakage of user privacy and effectively improving the security of online user data. Meanwhile, because the page lifecycle management unit collects page element data based on configuration information, and the first lifecycle callback unit is a necessary step for all native pages, while the second lifecycle callback unit is a necessary step for all view layer logic of the mobile UI framework and holds a reference to the root view, the page lifecycle management unit can monitor the opening and closing of all pages, thus reaching all pages of the mobile application and avoiding the situation of only collecting a portion of native pages specified by test users. Therefore, it can effectively improve page coverage. Furthermore, because page content is read through page elements, avoiding the need to identify page content from page screenshots, it can effectively improve the efficiency of page data collection.
[0056] The page processing method provided in this application determines the page data collection configuration information of a mobile application; collects page data of a target native page according to the configuration information; and processes the page data of the target native page. This processing method allows for the collection of page content from an online app based on configuration information. Since the configuration information includes page element collection restrictions, only allowed page element content is collected, thus avoiding the leakage of user privacy and effectively improving the security of online user data. Furthermore, because page element data is collected based on the configuration information through a page lifecycle management unit, and this unit can monitor the opening and closing of all pages, all pages of the mobile application can be reached, avoiding the collection of only a portion of the native pages specified by the test user, thus effectively improving page coverage. Moreover, because page content is read through page elements, avoiding the need to identify page content from page screenshots, the efficiency of page data collection is effectively improved. Attached Figure Description
[0057] Figure 1 This application provides a flowchart illustrating the page processing method.
[0058] Figure 2 This application provides a schematic diagram illustrating the application scenarios of the page processing method.
[0059] Figure 3 This application provides a schematic diagram of the page processing apparatus. Detailed Implementation
[0060] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0061] This application provides page processing methods and apparatus, as well as electronic devices. The various solutions are described in detail in the following embodiments.
[0062] First Embodiment
[0063] Please refer to Figure 1 This is a flowchart illustrating an embodiment of the page processing method of this application. In this embodiment, the method may include the following steps:
[0064] Step S101: Determine the page data collection configuration information of the mobile application. The native page of the mobile application includes the first page element of the mobile operating system and the view component (view container) of the mobile UI (User Interface) framework. The view container includes the second page element of the mobile UI framework.
[0065] The method provided in this application embodiment can collect and process page content for the native pages of online mobile applications. Mobile applications run on mobile internet devices (mobile terminals), which are terminal devices that access the internet via wireless network technology.
[0066] The native page of the mobile application includes a first page element of the mobile operating system and a view container of the mobile UI framework. The view container includes a second page element of the mobile UI framework. The first page element is developed using the native language of the mobile operating system, while the second page element is developed using the language of the mobile UI framework. The mobile UI framework includes: a mobile UI framework engine, a component framework, and a first binder for binding the component framework and the mobile UI framework engine. The first binder includes a page lifecycle scheduling unit.
[0067] like Figure 2As shown, in this embodiment, the mobile UI framework is the Flutter framework, where the Flutter engine is the UI framework engine used to render Flutter pages, the Flutter framework is the component framework, and WidgetsFlutterBinding is the first binder between the Flutter framework and the Flutter engine. The interface displayed to the user by the mobile application is a native page. Native pages under different mobile terminal operating systems use different programming languages; for example, Android systems use Java to develop native pages, while iOS systems use Objective-C. The native page displays page content generated based on Flutter page code through a native Flutter view container. The Flutter page code can be a programming language such as Dart.
[0068] The configuration information includes processing information for collecting page content from the native pages of the mobile application, and can be applied to all pages of the mobile application. The configuration information includes, but is not limited to: identifiers of at least one native page that is allowed to collect page data, identifiers of at least one page element within the native page that is allowed to collect element data, page element type information, on / off information for performing page data collection processing, and page data collection frequency. The page element type can be a first page element (native page element of the mobile operating system) type and / or a second page element (native page element of the mobile UI framework, such as a Flutter element) type.
[0069] Mobile applications typically include multiple native pages. The configuration information may include identifiers of at least one native page that is allowed to collect page data (referred to as a page whitelist), or identifiers of at least one native page that is not allowed to collect page data (referred to as a page blacklist).
[0070] In one example, the configuration information includes the identifier of at least one native page that is allowed to collect page data; correspondingly, if the identifier of the at least one native page includes the identifier of a target native page, then the page data of the target native page is collected. This approach allows for the specification of one or more native pages in the mobile application that require page data collection, avoiding the collection of page content from other native pages; therefore, it effectively improves the security of page content collection.
[0071] A native page typically includes multiple page elements. The configuration information may include the identifier of at least one page element in the native page that is allowed to collect element data (referred to as the element whitelist), or the identifier of at least one page element that is not allowed to collect element data (referred to as the element blacklist).
[0072] In one example, the configuration information includes: an identifier for at least one page element in the native page whose data is allowed to be collected; accordingly, based on the identifier of the at least one page element, data of at least one page element included in the target native page is collected. This processing method allows for the specification of page elements in the native page whose content can be obtained, such as plain text elements, rich text elements, and input boxes, avoiding the collection of data from other page elements (such as password input boxes); therefore, it can effectively improve the security of page content collection.
[0073] Native web pages typically include two types of page elements: first page elements of the mobile operating system and second page elements of the mobile UI framework. In one example, the configuration information includes: page element type information; the page element types include: first page element and second page element; correspondingly, the step of collecting data of at least one page element included in the target native page based on the identifier of the at least one page element can be implemented as follows: based on the identifier of the at least one page element and the corresponding page element type, collect data of the first page element and the second page element included in the target native page. This processing method distinguishes between the first page element and the second page element, and even if the first page element and the second page element have the same name, resulting in a name conflict, the data of the first page element and the second page element can still be accurately collected; therefore, it can effectively improve the accuracy of page content collection.
[0074] In one example, the configuration information includes: switch information for performing page data collection processing; correspondingly, if the switch information is on, page data of the target native page is collected; if the switch information is off, page data of the target native page is not collected. The switch information refers to information on whether the page data collection processing function of the mobile application is enabled. If the switch information is on, data can be collected from any native page of the mobile application using the method provided in this application embodiment; if the switch information is off, data is not collected from the native pages of the mobile application. This processing method eliminates the need to release a new version of the mobile application during gray-scale disaster recovery processing, thus not affecting user experience; therefore, it can effectively improve the user experience.
[0075] In one example, the configuration information includes: page data collection frequency; accordingly, page data of the target native page is collected according to the page data collection frequency. The page data collection frequency includes, but is not limited to: for the same native page, the number of page openings between the last collected page data and the current collected page data reaches a threshold. The threshold can be determined according to application requirements. For example, setting the threshold to 1000 means that the content of the same page will only be collected once every 1000 times opened by the same user, or the content of the same page will only be collected once every 1000 times opened by multiple users. This approach avoids frequent collection of the same page's content, effectively saving system resources on the mobile terminal.
[0076] In one example, configuration information can be set via the client and uploaded to the server for storage. Different mobile devices can retrieve this configuration information from the server, eliminating the need for local storage on the mobile devices. For instance, a user opens the mobile application's data collection configuration page through their client (such as a PC, tablet, or laptop), specifies the target mobile application, and configures the aforementioned settings. The client then sends a configuration information setting request for the target mobile application to the server. The server extracts the user's configuration information from this request and saves it. This approach ensures that when the configuration information changes, only the server-stored configuration information needs to be maintained, without requiring updates to the configuration information on each mobile device; thus, it effectively improves the maintainability of the configuration information.
[0077] Step S103: Collect page data of the target native page according to the configuration information.
[0078] The page data includes data from the first page element and data from the second page element. Based on the configuration information, data from the first page element and data from the second page element of the target native page can be collected respectively.
[0079] In one example, step S103 may include the following sub-steps:
[0080] Step S1031: When the target native page is opened, obtain the configuration information.
[0081] In practice, the configuration information can be obtained from the local storage of the mobile device or requested from the server.
[0082] Step S1033: When leaving the target native page, obtain the page data of the target native page according to the configuration information.
[0083] In practice, the configuration information can be obtained when the target native page is opened, and the page data of the target native page can be obtained based on the configuration information when leaving the target native page. Taking a Flutter page as an example, the lifecycle can be monitored using Flutter Boost, or it can be monitored using the first binder (WidgetsFlutterBinding).
[0084] In practice, after obtaining the configuration information, the configuration information for the target native page can be retrieved from the configuration information based on the identifier of the target native page, so as to obtain the page data of the target native page based on the configuration information for the target native page.
[0085] The method provided in this application determines the timing of page data collection to be when the page is closed, so that page content is read only when leaving the page. This does not block page opening or the main thread; therefore, it can effectively ensure page opening performance and thus ensure a good user experience.
[0086] In one example, the method may further include the following steps: constructing a second binder that inherits from the first binder, wherein a second lifecycle callback unit in the second binder includes program code for collecting data of second page elements.
[0087] The first binder can be a class, and the second lifecycle callback unit is a method within that class. Developers can rewrite the code for this method when building the second binder. For example, if the mobile UI framework is Flutter, the first binder is the `WidgetsFlutterBinding` class, and a second binder inheriting from `WidgetsFlutterBinding` is built, then the code for the page's lifecycle callback unit is rewritten.
[0088] The program code includes, but is not limited to: code for obtaining the root element reference of the element tree (second page element tree) of the target native page; and code for obtaining page data of the target native page based on the root element reference and the configuration information of the target native page. Furthermore, the program code may also include: code for obtaining the configuration information; code for obtaining the configuration information of the target native page based on its identifier; and code for sending the collected page data to the server.
[0089] When a second binder is constructed, step S103 can be implemented as follows: the first lifecycle callback unit of the native page obtains the data of the first page elements included in the target native page according to the configuration information; when the first lifecycle callback unit processes the view components of the mobile UI framework included in the native page, it obtains the data of the second page elements included in the target native page by calling the second lifecycle callback unit according to the root element reference of the second page element tree and the configuration information.
[0090] The first lifecycle callback unit is for the native page, while the second lifecycle callback unit is for the page built into a mobile UI framework (such as a Flutter page). The first lifecycle callback unit iterates through the elements of the native page, which include the first page elements and the view container of the mobile UI framework. When it iterates to the first page element, the first lifecycle callback unit retrieves the data of the first page element according to the configuration information; when it iterates to the view container, it calls the second lifecycle callback unit. The second lifecycle callback unit can obtain a reference to the root element of the second element tree and traverses the second page elements based on this reference. When it iterates to the second page element, the second lifecycle callback unit retrieves the data of the second page element according to the configuration information.
[0091] In practice, the identifier of the currently opened target native page can be obtained through the page open event response unit included in the binder; the identifier of the currently closed target native page can be obtained through the page close event response unit included in the binder.
[0092] The method provided in this application constructs a second binder and uses a first lifecycle callback unit and a second lifecycle callback unit to read page content during page processing. Since the first lifecycle callback unit is a necessary step for all native pages, and the second lifecycle callback unit is a necessary step for all view layer logic of the mobile UI framework and holds a reference to the root view, this processing method can collect page content from all native pages of the mobile application, thereby effectively improving page coverage.
[0093] In one example, the method may further include the following steps: generating a first software development kit (SDK) based on the first lifecycle callback unit, wherein the first page element data acquisition program code included in the first lifecycle callback unit is written in the native language of the mobile operating system; generating a second SSD based on the second binder, wherein the second page element data acquisition program code included in the second lifecycle callback unit is written in the language of the mobile UI framework; and deploying the first SSD and the second SSD to the target mobile application. Because the second binder uses aspect-oriented programming (AOP) technology, it can isolate different parts of the application logic, thereby reducing the coupling between different parts of the application logic and achieving program instrumentation; therefore, it can effectively improve the reusability of the second binder, thereby improving development efficiency and scalability.
[0094] Step S105: Process the page data of the target native page.
[0095] In practice, various processing methods can be used to process the page data of the target native page, such as missing translation detection or other page content repair processing. Missing translation detection refers to identifying untranslated content in the target native page based on collected page data during mobile application localization. Mobile application localization refers to the process of translating the mobile application's user interface and auxiliary documentation from its country of origin into another language to adapt it to a foreign language and culture.
[0096] In one example, the method may further include the following steps: determining the path position of a page element; correspondingly, step S105 may be implemented as follows: processing the page data of the target native page based on the path position. The path position includes all ancestor elements on the path pointing to the target element, and the target element can be returned based on the path position. This processing method allows for accurate location of the page position of the collected page data; therefore, it can effectively improve the accuracy of page processing.
[0097] As can be seen from the above embodiments, the page processing method provided in this application determines the page data collection configuration information of a mobile application; collects page data of a target native page according to the configuration information; and processes the page data of the target native page. This processing method allows for the collection of page content from an online app based on configuration information. Since the configuration information includes page element collection restrictions, only allowed page element content is collected, thus avoiding the leakage of user privacy and effectively improving the security of online user data. Furthermore, because page element data is collected based on configuration information through a page lifecycle management unit, and the page lifecycle management unit can monitor the opening and closing of all pages, all pages of the mobile application can be reached, avoiding the collection of only a portion of the native pages specified by the test user, thus effectively improving page coverage. Moreover, because page content is read through page elements, avoiding the identification of page content from page screenshots, page data collection efficiency is effectively improved.
[0098] Second Embodiment
[0099] In the above embodiments, a page processing method is provided. Correspondingly, this application also provides a page processing apparatus. This apparatus corresponds to the embodiments of the above method. The parts of this embodiment that are the same as those in the first embodiment will not be repeated; please refer to the corresponding parts in Embodiment 1.
[0100] This application provides a page processing device comprising: a configuration information determination unit, a page data acquisition unit, and a page data processing unit.
[0101] A configuration information determination unit is used to determine the page data collection configuration information of a mobile application. The native page of the mobile application includes a first page element of the mobile operating system and a view component of the mobile UI framework. The view component includes a second page element of the mobile UI framework. A page data collection unit is used to collect page data of the target native page of the mobile application according to the configuration information. The page data includes data of the first page element and data of the second page element. A page data processing unit is used to process the page data of the target native page.
[0102] In one example, the configuration information includes: an identifier of at least one native page; if the identifier of the at least one native page includes the identifier of the target native page, then the page data of the target native page is obtained.
[0103] In one example, the configuration information further includes: an identifier of at least one page element; obtaining the page data of the target native page includes: obtaining the data of the at least one page element included in the target native page based on the identifier of the at least one page element.
[0104] In one example, the configuration information further includes: page element type information; the page element type includes: a first page element type and / or a second page element type; the step of obtaining the data of the at least one page element included in the target native page according to the identifier of the at least one page element includes: obtaining the data of the first page element and the data of the second page element included in the target native page according to the identifier of the at least one page element and the corresponding page element type.
[0105] In one example, the configuration information includes: switch information for performing page data collection processing; if the switch information is on, then the page data of the target native page is obtained.
[0106] In one example, the configuration information includes: page data collection frequency; and obtaining page data of the target native page according to the page data collection frequency.
[0107] In one example, the page data acquisition unit is specifically used to obtain the configuration information when opening the target native page; and to obtain the page data of the target native page according to the configuration information when leaving the target native page.
[0108] In one example, the apparatus further includes: a second binder building unit for building a second binder that inherits from the first binder, wherein a second lifecycle callback unit in the second binder includes program code for collecting data of second page elements; the page data collection unit is specifically used to obtain data of the first page elements included in the target native page according to the configuration information through the first lifecycle callback unit of the native page; when the first lifecycle callback unit processes the view components of the mobile UI framework included in the native page, it obtains data of the second page elements included in the target native page by calling the second lifecycle callback unit according to the root element reference of the second page element tree and the configuration information.
[0109] In one example, the apparatus further includes: a packaging unit and a deployment unit. The packaging unit is configured to generate a first software development kit (SDK) based on the first lifecycle callback unit, wherein the first page element data acquisition program code included in the first lifecycle callback unit is written in the native language of the mobile operating system; and to generate a second SSD based on the second binder, wherein the second page element data acquisition program code included in the second lifecycle callback unit is written in the language of a mobile UI framework; the deployment unit is configured to deploy the first SSD and the second SSD to the target mobile application.
[0110] In one example, the apparatus further includes: a path location determination unit for determining the path location of a page element; and a page data processing unit specifically configured to process the data of the first page element and the data of the second page element based on the path location.
[0111] In one example, the page data processing unit is specifically used to obtain the untranslated data included in the target native page based on the data of the first page element and the data of the second page element.
[0112] Third Embodiment
[0113] In the above embodiments, a page processing method is provided. Correspondingly, this application also provides a page processing method. This method corresponds to the embodiments of the above methods. The parts of this embodiment that are the same as those in the first embodiment will not be repeated; please refer to the corresponding parts in Embodiment 1.
[0114] Please refer to Figure 3 This is a flowchart illustrating an embodiment of the page processing method of this application. In this embodiment, the method may include the following steps:
[0115] Step S301: Determine the page data collection configuration information for the mobile application.
[0116] The native page of the mobile application includes a first page element of the mobile operating system and a view component of the mobile UI framework. The view component includes a second page element of the mobile UI framework. The first page element is developed using the native language of the mobile operating system, while the second page element is developed using the language of the mobile UI framework. The mobile UI framework includes a mobile UI framework engine, a component framework, and a first binder for binding the component framework and the mobile UI framework engine. The first binder includes a page lifecycle scheduling unit. For ease of description, this embodiment refers to the page lifecycle callback unit of the native page as the first lifecycle callback unit, and the page lifecycle callback unit of the first binder as the second lifecycle callback unit.
[0117] like Figure 2As shown, in this embodiment, the mobile UI framework is the Flutter framework, where the Flutter engine is the UI framework engine used to render Flutter pages, the Flutter component framework is the Flutterframework, and WidgetsFlutterBinding is the first binder between the Flutter framework and the Flutter engine. The interface displayed to the user by the mobile application is a native page. Native pages on different mobile terminal operating systems use different programming languages; for example, Android systems use Java to develop native pages, while iOS systems use Objective-C. The native page displays page content generated based on Flutter page code through native Flutter view components (also known as view containers). The Flutter page code can be in programming languages such as Dart. Figure 2 The process involves collecting content from native English web pages and then performing translation error detection based on the collected content.
[0118] The configuration information includes processing information for collecting page content from the native pages of the mobile application, and can be applied to all pages of the mobile application. The configuration information in this embodiment is the same as the configuration information in Embodiment 1 above; relevant explanations can be found in Part 1 of the embodiment, and will not be repeated here.
[0119] Step S303: Construct a second binder that inherits from the first binder. The second lifecycle callback unit in the second binder includes program code for collecting data of the second page elements.
[0120] The first binder can be a class, and the second lifecycle callback unit is a method within that class. Developers can rewrite the code for this method when building the second binder. For example... Figure 2 As shown, the mobile UI framework is the Flutter framework, the first binder is the WidgetsFlutterBinding class, a second binder that inherits from the WidgetsFlutterBinding class is constructed, and the program code of the second lifecycle callback unit is rewritten.
[0121] The program code includes, but is not limited to: code for obtaining a reference to the root element of the second page element tree of the target native page; and code for obtaining the second page element data of the target native page based on the root element reference and the configuration information of the target native page. Furthermore, the program code may also include: code for obtaining the configuration information; code for obtaining the configuration information of the target native page based on its identifier; and code for sending the collected page data to the server.
[0122] In one example, the method may further include the following steps: generating a first software development kit (SDK) based on the first lifecycle callback unit, wherein the first page element data acquisition program code included in the first lifecycle callback unit is written in the native language of the mobile operating system; generating a second SSD based on the second binder, wherein the second page element data acquisition program code included in the second lifecycle callback unit is written in the language of the mobile UI framework; and deploying the first SSD and the second SSD to the target mobile application. Because the second binder uses aspect-oriented programming (AOP) technology, it can isolate different parts of the application logic, thereby reducing the coupling between different parts of the application logic and achieving program instrumentation; therefore, it can effectively improve the reusability of the second binder, thereby improving development efficiency and scalability.
[0123] Step S305: When processing the target native page, the data of the first page elements included in the target native page is obtained through the first lifecycle callback unit according to the configuration information.
[0124] Step S307: When the first lifecycle callback unit processes the view components of the mobile UI framework included in the target native page, it calls the second lifecycle callback unit to obtain the data of the second page elements included in the target native page based on the root element reference of the second page element tree and the configuration information.
[0125] The first lifecycle callback unit is for native pages, while the second lifecycle callback unit is for pages within a mobile UI framework (such as Flutter pages). The first lifecycle callback unit iterates through the elements of the native page, which include the first page elements and view components of the mobile UI framework. When it iterates to a first page element, the first lifecycle callback unit retrieves the data of that element based on the configuration information. When it iterates to a view component, it invokes the second lifecycle callback unit. The second lifecycle callback unit obtains a reference to the root element of the second page element tree and iterates through the second page elements based on this reference. When it iterates to a second page element, the second lifecycle callback unit retrieves the data of that element based on the configuration information.
[0126] In one example, the method may further include the following steps: when opening the target native page, obtaining the configuration information through the first lifecycle callback unit; correspondingly, when leaving the target native page, executing the above steps S303 and S305. Specifically, the identifier of the currently opened target native page can be obtained through the page open event response unit included in the binder; the identifier of the currently closed target native page can be obtained through the page close event response unit included in the binder. This processing method ensures that the timing for collecting page data is determined to be when the page is closed, and that page content is only read when leaving the page through the first and second lifecycle callback units. This avoids blocking page opening and the main thread; therefore, it effectively ensures page opening performance, thereby ensuring a good user experience.
[0127] Step S309: Process the data of the first page element and the data of the second page element.
[0128] In practice, various processing methods can be used to handle the page data of the target native page, such as untranslated content detection or other page content repair. Untranslated content detection refers to identifying untranslated content in the target native page based on the collected page data during the localization process of the mobile application. Figure 2 As shown, mobile application localization refers to the process of translating the user interface and supporting documentation of a mobile application from its country of origin into another language to adapt it to a foreign language and culture.
[0129] As can be seen from the above embodiments, the page processing method provided in this application determines the page data collection configuration information of the mobile application; constructs a second binder that inherits from the first binder, and the second lifecycle callback unit in the second binder includes program code for collecting second page element data; when processing the target native page, the first lifecycle callback unit of the native page obtains the first page element data of the mobile operating system included in the target native page according to the configuration information; when processing the view components of the mobile UI framework, the first lifecycle callback unit obtains the second page element data of the target native page by calling the second lifecycle callback unit according to the root element reference of the second page element tree of the mobile UI framework and the configuration information; and processes the page data of the target native page. This processing method can improve page data collection efficiency, page coverage, and user data security.
[0130] Fourth embodiment
[0131] In the above embodiments, a page processing method is provided. Correspondingly, this application also provides a page processing apparatus. This apparatus corresponds to the embodiments of the above method. The parts of this embodiment that are the same as those in the first embodiment will not be repeated; please refer to the corresponding parts in Embodiment 1.
[0132] This application provides a page processing apparatus comprising: a configuration information determination unit, a second binder construction unit, a first page element data acquisition unit, a second page element data acquisition unit, and a page data processing unit.
[0133] A configuration information determination unit is used to determine the page data collection configuration information of the mobile application. The native page of the mobile application includes a first page element of the mobile operating system and a view component of the mobile UI framework. The view component includes a second page element of the mobile UI framework. The page lifecycle callback unit of the native page is a first lifecycle callback unit. The mobile UI framework includes: a mobile UI framework engine, a component framework, and a first binder for binding the component framework and the mobile UI framework engine. The first binder includes a page lifecycle callback unit, and the page lifecycle callback unit of the first binder is a second lifecycle callback unit. A second binder construction unit is used to construct a second binder that inherits from the first binder. The second lifecycle callback unit includes program code for collecting data of second page elements; a first page element data acquisition unit, used to acquire data of the first page elements included in the target native page through the first lifecycle callback unit according to the configuration information when processing the target native page; a second page element data acquisition unit, used by the first lifecycle callback unit to acquire data of the second page elements included in the target native page by calling the second lifecycle callback unit according to the root element reference of the second page element tree and the configuration information when processing the view components of the mobile UI framework included in the target native page; and a page data processing unit, used to process the data of the first page elements and the data of the second page elements.
[0134] In one example, the configuration information includes: an identifier of at least one native page; if the identifier of the at least one native page includes the identifier of the target native page, then the page data of the target native page is obtained.
[0135] In one example, the configuration information further includes: an identifier of at least one page element; obtaining the page data of the target native page includes: obtaining the data of the at least one page element included in the target native page based on the identifier of the at least one page element.
[0136] In one example, the configuration information further includes: page element type information; the page element type includes: a first page element type and / or a second page element type; the step of obtaining the data of the at least one page element included in the target native page according to the identifier of the at least one page element includes: obtaining the data of the first page element and the data of the second page element included in the target native page according to the identifier of the at least one page element and the corresponding page element type.
[0137] In one example, the configuration information includes: switch information for performing page data collection processing; if the switch information is on, then the page data of the target native page is obtained.
[0138] In one example, the configuration information includes: page data collection frequency; and obtaining page data of the target native page according to the page data collection frequency.
[0139] In one example, the device further includes: a configuration information acquisition unit, configured to acquire the configuration information through the first lifecycle callback unit when the target native page is opened; and to activate the first page element data acquisition unit and the second page element data acquisition unit when the target native page is left.
[0140] In one example, the apparatus further includes: a packaging unit and a deployment unit. The packaging unit is configured to generate a first software development kit (SDK) based on the first lifecycle callback unit, wherein the first page element data acquisition program code included in the first lifecycle callback unit is written in the native language of the mobile operating system; and to generate a second SSD based on the second binder, wherein the second page element data acquisition program code included in the second lifecycle callback unit is written in the language of a mobile UI framework; the deployment unit is configured to deploy the first SSD and the second SSD to the target mobile application.
[0141] In one example, the apparatus further includes: a path location determination unit for determining the path location of a page element; and a page data processing unit specifically configured to process the data of the first page element and the data of the second page element based on the path location.
[0142] In one example, the page data processing unit is specifically used to obtain the untranslated data included in the target native page based on the data of the first page element and the data of the second page element.
[0143] Fifth embodiment
[0144] This application also provides an electronic device. Since the device embodiments are substantially similar to the method embodiments, the description is relatively simple; relevant details can be found in the description of the method embodiments. The device embodiments described below are merely illustrative.
[0145] This embodiment provides an electronic device, which includes a processor and a memory; the memory is used to store a program that implements a page processing method, and the device is powered on and runs the program of the method through the processor.
[0146] Although this application discloses preferred embodiments as described above, it is not intended to limit this application. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of this application. Therefore, the scope of protection of this application should be determined by the scope defined in the claims of this application.
[0147] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0148] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0149] 1. Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include non-transitory computer-readable media, such as modulated data signals and carrier waves.
[0150] 2. Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
Claims
1. A page processing method, characterized in that, include: Determine the page data collection configuration information of the mobile application. The native page of the mobile application includes the first page element of the mobile operating system and the view component of the mobile UI framework. The view component includes the second page element of the mobile UI framework. The page lifecycle callback unit of the native page is the first lifecycle callback unit; The mobile UI framework includes: a mobile UI framework engine, a component framework, and a first binder for binding the component framework and the mobile UI framework engine. The first binder includes a page lifecycle callback unit, and the page lifecycle callback unit of the first binder is a second lifecycle callback unit. A second binder inheriting from the first binder is constructed, and the program code of the second lifecycle callback unit in the second binder is rewritten; the second lifecycle callback unit in the second binder includes program code for collecting second page element data; the program code includes at least: code for obtaining the root element reference of the element tree of the target native page; code for obtaining the page data of the target native page according to the root element reference and the configuration information of the target native page; code for obtaining the configuration information; code for obtaining the configuration information of the target native page according to the identifier of the target native page; and code for sending the collected page data to the server. When processing the target native page, the first lifecycle callback unit obtains the data of the first page elements included in the target native page according to the configuration information; when processing the view components of the mobile UI framework included in the target native page, the first lifecycle callback unit obtains the data of the second page elements included in the target native page by calling the second lifecycle callback unit according to the root element reference of the second page element tree and the configuration information. Process the data of the first page element and the data of the second page element.
2. The method according to claim 1, characterized in that, The configuration information includes: the identifier of at least one native page; If the identifier of the at least one native page includes the identifier of the target native page, then the page data of the target native page is obtained.
3. The method according to claim 2, characterized in that, The configuration information also includes: the identifier of at least one page element; The step of obtaining the page data of the target native page includes: Based on the identifier of the at least one page element, obtain the data of the at least one page element included in the target native page.
4. The method according to claim 3, characterized in that, The configuration information also includes: page element type information; the page element type includes: a first page element type and / or a second page element type; The step of obtaining data of the at least one page element included in the target native page based on the identifier of the at least one page element includes: Based on the identifier of the at least one page element and the corresponding page element type, obtain the data of the first page element and the data of the second page element included in the target native page.
5. The method according to any one of claims 1 to 4, characterized in that, The configuration information includes: switch information for performing page data collection and processing; If the switch information is on, then the page data of the target native page is obtained.
6. The method according to claim 1, characterized in that, The configuration information includes: page data collection frequency; Based on the page data collection frequency, obtain the page data of the target native page.
7. The method according to claim 1, characterized in that, Also includes: When the target native page is opened, the configuration information is obtained through the first lifecycle callback unit; When leaving the target native page, the data of the first page element is obtained through the first lifecycle callback unit according to the configuration information; the data of the second page element is obtained by calling the second lifecycle callback unit according to the root element reference and the configuration information.
8. The method according to claim 1, characterized in that, Also includes: Based on the first lifecycle callback unit, a first software development kit is generated, wherein the first page element data acquisition program code included in the first lifecycle callback unit is written in the native language of the mobile operating system; Based on the second binder, a second software development kit is generated, and the second page element data acquisition program code included in the second lifecycle callback unit is written in the language of a mobile UI framework; Deploy the first software development kit and the second software development kit to the target mobile application.
9. The method according to claim 1, characterized in that, Also includes: Determine the path and location of page elements; The processing of the data of the first page element and the data of the second page element includes: Based on the path location, process the data of the first page element and the data of the second page element.
10. The method according to claim 1, characterized in that, The processing of the data of the first page element and the data of the second page element includes: Based on the data of the first page element and the data of the second page element, obtain the untranslated data included in the target native page.
11. A page processing method, characterized in that, include: Determine the page data collection configuration information of the mobile application. The native page of the mobile application includes the first page element of the mobile operating system and the view component of the mobile UI framework. The view component includes the second page element of the mobile UI framework. Based on the configuration information, page data of the target native page of the mobile application is collected, the page data including data of a first page element and data of a second page element; the data of the first page element and the data of the second page element are obtained using the method described in claim 1; Process the page data of the target native page.
12. A page processing apparatus, characterized in that, include: The configuration information determination unit is used to determine the page data collection configuration information of the mobile application. The native page of the mobile application includes the first page element of the mobile operating system and the view component of the mobile UI framework. The view component includes the second page element of the mobile UI framework. The page lifecycle callback unit of the native page is the first lifecycle callback unit; The mobile UI framework includes: a mobile UI framework engine, a component framework, and a first binder for binding the component framework and the mobile UI framework engine. The first binder includes a page lifecycle callback unit, and the page lifecycle callback unit of the first binder is a second lifecycle callback unit. The second binder construction unit is used to construct a second binder that inherits from the first binder and rewrite the program code of the second lifecycle callback unit in the second binder; the second lifecycle callback unit in the second binder includes program code for collecting second page element data; the program code includes at least: code for obtaining the root element reference of the element tree of the target native page; code for obtaining page data of the target native page according to the root element reference and the configuration information of the target native page; code for obtaining the configuration information; code for obtaining the configuration information of the target native page according to the identifier of the target native page; and code for sending the collected page data to the server. The first page element data acquisition unit is used to acquire the data of the first page elements included in the target native page through the first lifecycle callback unit according to the configuration information when processing the target native page; The second page element data acquisition unit is used by the first lifecycle callback unit to obtain the data of the second page elements included in the target native page by calling the second lifecycle callback unit, based on the root element reference of the second page element tree and the configuration information; The page data processing unit is used to process the data of the first page element and the data of the second page element.
13. A page processing apparatus, characterized in that, include: The configuration information determination unit is used to determine the page data collection configuration information of the mobile application. The native page of the mobile application includes the first page element of the mobile operating system and the view component of the mobile UI framework. The view component includes the second page element of the mobile UI framework. A page data acquisition unit is configured to acquire page data of the target native page of the mobile application according to the configuration information, wherein the page data includes data of a first page element and data of a second page element; the data of the first page element and the data of the second page element are acquired using the method described in claim 1. The page data processing unit is used to process the page data of the target native page.
14. An electronic device, characterized in that, include: Processor and memory; A memory for storing a program implementing the page processing method according to any one of claims 1-11, wherein the device is powered on and the program of the method is executed by the processor.