Content page and native controller interaction method, device, equipment and medium
By using a shared bridge to parse business requests in the application, identify the target native controller, and establish a corresponding relationship, the problem of information confusion when React pages interact with native controllers is solved, and accurate information transmission and processing result callbacks are achieved.
Patent Information
- Application Number
- CN202411433575.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-10-15
AI Technical Summary
In an application, when React pages interact with native controllers, the existing bridge cannot accurately locate the corresponding native controller, resulting in incorrect sending of interaction information.
The shared bridge receives business requests from target content pages, parses the requests to determine the target native controller, and provides an interaction channel between multiple content pages and multiple native controllers. This ensures that the target content pages and target native controllers have a pre-defined correspondence, enabling accurate transmission of business requests and callback of processing results.
This solution resolves the issue of miscommunication when interacting with multiple content pages and native controllers, ensuring the accuracy and efficiency of interactive information.
Smart Images

Figure CN118964067B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technologies, and in particular to a method, device, equipment and medium for interaction between a content page and a native controller. Background Art
[0002] When an application uses a complex hybrid development such as H5 (HyperText Markup Language 5) container, ReactNative, and native, since the application is not entirely written in ReactNative, there are a large number of events that the React page needs to interact with the native. Currently, ReactNative provides a bridge interaction mechanism to achieve communication between native and ReactNative, such as Figure 1 As shown, for example, the React page 3 is currently displayed at the front end, but the React page 2 running in the background sends an event. The bridge cannot find which of the native controllers 1, 2 and 3 corresponds to the native controller of React page 2, which may cause confusion in sending. Summary of the invention
[0003] The present invention provides a method, device, equipment and medium for interaction between a content page and a native controller, so as to ensure accurate transmission of interaction information between the content page and the native controller.
[0004] According to one aspect of the present invention, a method for interacting between a content page and a native controller is provided, the method comprising:
[0005] Receiving a business request sent by a target content page through a shared bridge;
[0006] Parsing the service request using the shared bridge to determine a target native controller that matches the target content page, the shared bridge being used to provide an interactive channel between multiple content pages and multiple native controllers, the target content page and the target native controller having a preset corresponding relationship;
[0007] The business request is sent to the target native controller to call the business function of the target native page, and the processing result of the business request by the business function of the target native page is called back to the target content page.
[0008] According to another aspect of the present invention, a device for interacting between a content page and a native controller is provided, the device comprising:
[0009] A business request acquisition module, used for receiving a business request sent by a target content page through a shared bridge;
[0010] a target native controller determination module, configured to parse the service request using the shared bridge to determine a target native controller that matches the target content page, wherein the shared bridge is configured to provide an interaction channel between multiple content pages and multiple native controllers, and the target content page and the target native controller have a preset corresponding relationship;
[0011] The processing result callback module is used to send the business request to the target native controller to call the business function of the target native page, and call back the processing result of the business request by the business function of the target native page to the target content page.
[0012] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0013] A processor; and a memory communicatively connected to the processor; wherein the memory stores a computer program executable by the processor, and the computer program is executed by the processor so that the processor can execute the method for interacting between the content page and the native controller described in any embodiment of the present invention.
[0014] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for interacting between a content page and a native controller described in any embodiment of the present invention when executed.
[0015] The technical solution of the embodiment of the present invention is to receive a business request sent by a target content page through a shared bridge; use the shared bridge to parse the business request to determine a target native controller that matches the target content page, and the shared bridge is used to provide an interaction channel between multiple content pages and multiple native controllers, and the target content page and the target native controller have a preset correspondence; send the business request to the target native controller to call the business function of the target native page, and call back the processing result of the business function of the target native page on the business request to the target content page, and adopt a technical means of establishing a correspondence between the content page and the native controller, thereby solving the problem of disordered sending of interactive information when multiple content pages and multiple native controllers interact through a shared bridge in the prior art, and ensuring the accurate sending of interactive information.
[0016] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 A schematic diagram of a shared bridge for implementing interaction in the prior art;
[0019] Figure 2 A flowchart of a method for interaction between a content page and a native controller provided by an embodiment of the present invention;
[0020] Figure 3 A schematic diagram of establishing multiple bridges to achieve interaction in a prior art;
[0021] Figure 4 A schematic diagram of the relationship between a native controller, a native page, and a React page provided in this embodiment;
[0022] Figure 5 A flowchart of another method for interaction between a content page and a native controller provided in this embodiment;
[0023] Figure 6 A complete schematic diagram of a method for interacting between a content page and a native controller provided in this embodiment;
[0024] Figure 7 A schematic diagram of the structure of a device for interacting between a content page and a native controller provided by an embodiment of the present invention;
[0025] Figure 8 It is a structural schematic diagram of an electronic device that implements the method for interacting between a content page and a native controller according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or apparatus.
[0028] Before introducing the solutions of the present invention, relevant terms involved in the embodiments of the present invention are first explained.
[0029] ReactNative: It is an improved version of the react language for mobile applications. React was originally a language for developing web applications. After the modification, react can be run on applications.
[0030] Figure 2 This is a flowchart of a method for interacting between a content page and a native controller provided by an embodiment of the present invention. This embodiment is applicable to the case where multiple content pages and multiple native controllers in an application program interact with each other through a shared bridge. The method can be executed by an interactive device for a content page and a native controller. The interactive device for a content page and a native controller can be implemented in the form of hardware and / or software. The interactive device for a content page and a native controller can be configured in a smart device that can install an application program. Figure 2 As shown, the method includes:
[0031] S110: Receive a service request sent by a target content page through a shared bridge.
[0032] Among them, the target content page may refer to one or some of the multiple content pages in the application. The content page and the target content page may refer to a user business interface that is not written in the native coding language of the smart device operating system. For example, the target content page may refer to a React page, that is, a page written in the React language. The business request may refer to a request by the target content page for the business function of the native page, and the native page may refer to a page written in the native coding language of the smart device operating system, such as an album, a gallery, and a navigation bar. Correspondingly, the business request may be, for example, a request to call an album, control a native navigation bar (such as settings such as title, back button, and background color).
[0033] In an application, there can be interactions between multiple content pages and multiple native controllers, such as the registration page, login page, and login success page of a website. In the page, you need to upload some photos and call the album or gallery. Figure 3As shown, if a content page in an application uses a bridge to communicate with a native controller, once a large number of content pages are opened, the memory of the application will surge, which will cause serious challenges to the performance of the application. In order to solve this problem, a shared bridge mechanism can be used.
[0034] Optionally, before receiving the service request sent by the target content page through the shared bridge, the method may also include: creating a shared bridge during the target application startup process; and creating a target native controller and a page carrier of the target content page in response to an access request for the target content page.
[0035] The access request to the target content page may be initiated by the user through the client. The target native controller may be a controller for controlling the target native page and the target content page. The target native page may access the native controller based on the native coding language of the smart device operating system, and the target content page may access the native controller based on its writing language (such as React language). Figure 4 A schematic diagram of the relationship between a native controller, a native page, and a React page is provided for this embodiment. A page carrier may refer to a rendering container of a target content page.
[0036] In this embodiment, during the startup process of the target application, a shared bridge can be initialized and created. When the target application receives an access request for a target content page, it can determine which page the user needs to access based on the request parameters carried in the access request, that is, determine the identities of the target content page and the target native page, thereby creating a controller for controlling the target content page and the target native page, and creating a page carrier for the target content page (for example, creating a RootView for a React page).
[0037] Optionally, after creating the target native controller, the process may further include: creating a target native page, and adding the target native page to the target native controller.
[0038] This setting can pre-bind the target native controller and the target native page.
[0039] Optionally, after creating the page carrier of the target content page, the process may further include: creating tag information using the page carrier, and passing the tag information as identity information of the page carrier to the target content page; and using the identity information of the page carrier as a target parameter value to generate a service request.
[0040] The tag information may be unique identification information of the page carrier. The target parameter value may be a parameter value in the business request, such as props.
[0041] For example, when the React language initializes the component, the React page can be rendered, and the rootTag (that is, the tag information of the page carrier) can be obtained through props, and the rootTag can be sent to the shared bridge as a parameter value in the business request.
[0042] S120. Analyze the business request using a shared bridge to determine a target native controller that matches the target content page. The shared bridge is used to provide an interaction channel between multiple content pages and multiple native controllers. The target content page and the target native controller have a preset corresponding relationship.
[0043] In this embodiment, the shared bridge on the native controller side may be used to parse the service request sent by the target content page to determine the target native controller corresponding to the target content page.
[0044] In an optional implementation, using a shared bridge to parse a business request to determine a target native controller that matches a target content page may include: using a shared bridge to parse a business request to obtain a target parameter value; and determining a target native controller that matches the target content page based on the target parameter value.
[0045] Exemplarily, the shared bridge on the native controller side can be used to parse the service request to obtain the rootTag, so that the target native controller can be reversely determined based on the rootTag and through a management list of the preset correspondence between the target content page and the target native controller.
[0046] Optionally, determining a target native controller that matches a target content page according to a parameter value of a target parameter may include: determining identity information of a page carrier corresponding to the target content page according to the parameter value of the target parameter; and determining the target native controller according to the identity information of the page carrier.
[0047] In this embodiment, when creating a page carrier (RootView), each RootView will have a rootTag, which is unique. Then, this RootView is added to the native controller. It can be understood that the target content page, the page carrier of the target content page, the tag information of the page carrier, and the target native controller are in a one-to-one correspondence.
[0048] Continuing with the previous example, we can determine the identity of RootView based on rootTag, and then find the target native controller based on RootView.
[0049] S130: Send the business request to the target native controller to call the business function of the target native page, and call back the processing result of the business request by the business function of the target native page to the target content page.
[0050] Optionally, a business request can be sent to a target native controller to instruct the target native controller to call a transaction processor corresponding to the business function of the target native page to process the business request; obtain the processing result fed back by the transaction processor; if the processing result is successful, pass the processing result to the target content page through the resolver closure block method callback of the shared bridge; if the processing result is failed, pass the processing result to the target content page through the rejecter closure block method callback of the shared bridge.
[0051] It can be understood that the processing result can be returned to the React page through the corresponding resolver closure block method (processing result is successful) or rejecter closure block method (processing result is failure) callback.
[0052] The technical solution of the embodiment of the present invention is to receive a business request sent by a target content page through a shared bridge; use the shared bridge to parse the business request to determine a target native controller that matches the target content page, and the shared bridge is used to provide an interaction channel between multiple content pages and multiple native controllers, and the target content page and the target native controller have a preset correspondence; send the business request to the target native controller to call the business function of the target native page, and call back the processing result of the business function of the target native page on the business request to the target content page, and adopt a technical means of establishing a correspondence between the content page and the native controller, thereby solving the problem of disordered sending of interactive information when multiple content pages and multiple native controllers interact through a shared bridge in the prior art, and ensuring the accurate sending of interactive information.
[0053] Figure 5 A flowchart of another method for interaction between a page and a native application provided in this embodiment.
[0054] S2001. Create a shared bridge during the target application startup process.
[0055] S2002: Create a target native controller and a page carrier of the target content page according to an access request for the target content page.
[0056] S2003. Create a target native page, and add the target native page to the target native controller.
[0057] S2004: Create tag information using the page carrier, and pass the tag information as identity information of the page carrier to the target content page.
[0058] S2005. Use the identity information of the page carrier as a target parameter value to generate a service request.
[0059] S2006: Receive a service request sent by the target content page through the shared bridge.
[0060] S2007. Utilize the shared bridge to parse the service request and obtain the target parameter value.
[0061] S2008. Determine the identity information of the page carrier corresponding to the target content page according to the parameter value of the target parameter.
[0062] S2009. Determine the target native controller according to the identity information of the page carrier, and the shared bridge is used to provide an interaction channel between the multiple content pages and the multiple native controllers.
[0063] S2010. Send the business request to the target native controller to instruct the target native controller to call the transaction processor corresponding to the business function of the target native page to process the business request.
[0064] S2011. Obtain the processing result fed back by the transaction processor.
[0065] S2012: When the processing result is successful, the processing result is passed to the target content page through the resolver closure block callback of the shared bridge.
[0066] S2013. When the processing result is a processing failure, the processing result is passed to the target content page via a rejecter closure block callback of the shared bridge.
[0067] In order to enable those skilled in the art to better understand the content of this application and the interaction method with the native controller. Figure 6 Taking modifying the navigation bar title as an example, this embodiment provides a complete schematic diagram of a method for interacting between a content page and a native controller.
[0068] Start the APP application (equivalent to the target application), create a singleton bridge object, and open a new page window (equivalent to the target native controller); create a native navigation bar (equivalent to the target native page) in the newly opened page window, and add the navigation bar to the native controller; obtain the instance bridge object (equivalent to the shared bridge), create a container third-party ReactNative framework that hosts the React page, and pass the bridge to the React page container, generate a unique roottag tag (equivalent to tag information) for the created Rootview, and bind the rootview to the shared bridge; use the react page container to render the front-end page (equivalent to the target content page), and pass the roottag as a parameter, so that the react front-end page can obtain the roottag when it is initialized, and then add the rootview to the native controller.
[0069] After the shared bridge, native controller, native navigation bar, and react front-end page are created, the react front-end page can send events (equivalent to the business request sent by the target content page) to call native capabilities (equivalent to the business functions of the target native page), such as modifying the navigation bar title, and passing the roottag as a parameter; the event is encapsulated through the react page container (while providing a callback channel) and sent to the bridge, the bridge parses the event to obtain the roottag, and determines the rootview page object (i.e. react page) corresponding to the event based on the roottag to the react page container, and determines the native controller it depends on based on the rootview page object; thereby passing the event to the native controller, allowing the event distributor to process the corresponding function, and the native controller calls the corresponding native navigation bar to process the title modification event, and then feeds back the event processing result to the react page container through the bridge, and the react page container calls back the success or failure result to the react front-end page based on the event processing result.
[0070] Figure 7 A schematic diagram of a structure of a device for interacting between a content page and a native controller provided by an embodiment of the present invention. Figure 7 As shown, the device includes: a service request acquisition module 310, a target native controller determination module 320 and a processing result callback module 330. Among them:
[0071] A business request acquisition module 310 is used to receive a business request sent by a target content page through a shared bridge;
[0072] A target native controller determination module 320, configured to parse the service request using the shared bridge to determine a target native controller that matches the target content page, wherein the shared bridge is configured to provide an interaction channel between multiple content pages and multiple native controllers, and the target content page and the target native controller have a preset corresponding relationship;
[0073] The processing result callback module 330 is used to send the business request to the target native controller to call the business function of the target native page, and call back the processing result of the business request by the business function of the target native page to the target content page.
[0074] The technical solution of the embodiment of the present invention is to receive a business request sent by a target content page through a shared bridge; use the shared bridge to parse the business request to determine a target native controller that matches the target content page, the shared bridge is used to provide an interaction channel between multiple content pages and multiple native controllers, and the target content page and the target native controller have a preset correspondence; send the business request to the target native controller to call the business function of the target native page, and call back the processing result of the business function of the target native page on the business request to the target content page, and adopt a technical means of establishing a correspondence between the content page and the native controller, thereby solving the problem of disordered sending of interactive information when multiple content pages and multiple native controllers interact through a shared bridge in the prior art, and ensuring the accurate sending of interactive information.
[0075] Optionally, the content page and native controller interaction device further includes a creation module, which is used for, before receiving a service request sent by the target content page through the shared bridge:
[0076] Creating the shared bridge during the target application startup process;
[0077] In response to an access request for a target content page, the target native controller and a page bearer of the target content page are created.
[0078] Optionally, the content page and native controller interaction device further includes a native page adding module, which is used to: after creating the target native controller:
[0079] A target native page is created, and the target native page is added to the target native controller.
[0080] Optionally, the content page and native controller interaction device further includes a service request generation module, which is used to: after creating the page carrier of the target content page:
[0081] Creating tag information using the page bearer, and passing the tag information as identity information of the page bearer to the target content page;
[0082] The identity information of the page bearer is used as a target parameter value to generate the service request.
[0083] Optionally, the target native controller determination module 320 may be specifically used for:
[0084] Utilizing the shared bridge to parse the service request and obtain a target parameter value;
[0085] Determining the identity information of the page carrier corresponding to the target content page according to the parameter value of the target parameter;
[0086] The target native controller is determined according to the identity information of the page carrier.
[0087] Optionally, the processing result callback module 330 may be specifically used for:
[0088] The business request is sent to the target native controller to instruct the target native controller to call a transaction processor corresponding to the business function of the target native page to process the business request.
[0089] Optionally, the processing result callback module 330 may be further used for:
[0090] Obtaining a processing result fed back by the transaction processor;
[0091] When the processing result is successful, the processing result is passed to the target content page through the resolver closure block callback of the shared bridge;
[0092] When the processing result is a processing failure, the processing result is passed to the target content page via a rejecter closure block callback of the shared bridge.
[0093] The content page and native controller interaction device provided in the embodiment of the present invention can execute the content page and native controller interaction method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0094] Figure 8 A schematic diagram of an electronic device 400 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers or various forms of mobile devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0095] like Figure 8 As shown, the electronic device 400 includes a processor 401, and a memory connected to the processor 401 in communication, such as a read-only memory (ROM) 402, a random access memory (RAM) 403, etc., wherein the memory stores a computer program that can be executed by the processor, and the processor 401 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 402 or the computer program loaded from the storage unit 408 to the random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 can also be stored. The processor 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0096] Multiple components in the electronic device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the electronic device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0097] Processor 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of processor 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. Processor 401 executes the various methods and processes described above, such as the method of interacting between a page and a native application.
[0098] In some embodiments, the method for interacting between a page and a native application may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the processor 401, one or more steps of the method for interacting between a page and a native application described above may be performed. Alternatively, in other embodiments, the processor 401 may be configured to execute the method for interacting between a page and a native application in any other appropriate manner (e.g., by means of firmware).
[0099] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0100] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0101] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0102] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0103] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0104] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0105] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0106] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for interaction between a content page and a native controller, characterized in that: include: Creating a shared bridge during the start-up of a target application, and in response to an access request for a target content page, creating a target native controller and a page bearer of the target content page, wherein the page bearer is a RootView; After creating the target native controller, creating a target native page, and adding the target native page to the target native controller; Using the page bearer to create tag information, and passing the tag information as the identity information of the page bearer to the target content page, and using the identity information of the page bearer as the target parameter value to generate a service request; Receiving the service request sent by the target content page through the shared bridge; Utilizing the shared bridge to parse the service request and obtain the target parameter value, determining the identity information of the page carrier corresponding to the target content page according to the parameter value of the target parameter, and determining the target native controller according to the identity information of the page carrier, wherein the shared bridge is used to provide an interactive channel between multiple content pages and multiple native controllers, and the target content page and the target native controller have a preset corresponding relationship; The business request is sent to the target native controller to instruct the target native controller to call the transaction processor corresponding to the business function of the target native page to process the business request, and obtain the processing result fed back by the transaction processor; if the processing result is successful, the processing result is passed to the target content page through the resolver closure block method callback of the shared bridge; if the processing result is failed, the processing result is passed to the target content page through the rejecter closure block method callback of the shared bridge.
2. An interactive device between a content page and a native controller, characterized in that: include: A creation module, used to create a shared bridge during the startup of a target application, and in response to an access request for a target content page, create a target native controller and a page bearer of the target content page, wherein the page bearer is a RootView; A native page adding module, used for creating a target native page after creating the target native controller, and adding the target native page to the target native controller; A service request generation module, used to create tag information using the page carrier, and pass the tag information as the identity information of the page carrier to the target content page, and use the identity information of the page carrier as the target parameter value to generate a service request; A service request acquisition module, configured to receive the service request sent by the target content page through the shared bridge; a target native controller determination module, configured to parse the service request using the shared bridge to obtain the target parameter value, determine the identity information of the page carrier corresponding to the target content page according to the parameter value of the target parameter, and determine the target native controller according to the identity information of the page carrier, wherein the shared bridge is configured to provide an interaction channel between multiple content pages and multiple native controllers, and the target content page and the target native controller have a preset corresponding relationship; A processing result callback module is used to send the business request to the target native controller to instruct the target native controller to call the transaction processor corresponding to the business function of the target native page to process the business request, and obtain the processing result fed back by the transaction processor; when the processing result is successful, the processing result is passed to the target content page through the resolver closure block method of the shared bridge; when the processing result is a processing failure, the processing result is passed to the target content page through the rejecter closure block method of the shared bridge.
3. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for interacting between a content page and a native controller as claimed in claim 1.
4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for interacting between a content page and a native controller as claimed in claim 1 when the processor executes the instructions.
Citation Information
Patent Citations
Page display method and device and electronic equipment
CN110442286A
Communication system and method for expansion development of mobile terminal
CN113741862A